Refactor _getInputParams

pull/1/head
ninabreznik 7 years ago
parent e45e416148
commit ccdd941295
  1. 23
      src/app/editor/contextualListener.js

@ -172,29 +172,22 @@ class ContextualListener {
}
_getInputParams (node) {
var params
var list = []
var params = []
for (var i in node.children) {
if (node.children[i].name === 'ParameterList') {
list.push(node.children[i])
var target = node.children[i]
break
}
}
debugger
for (var j in list) {
if (list[j].children.length) {
var children = list[j].children
for (var k in children) {
if (children[k].name === 'VariableDeclaration') {
params = children[k].attributes.type
break
}
if (target) {
var children = target.children
for (var j in children) {
if (children[j].name === 'VariableDeclaration') {
params.push(children[j].attributes.type.split(' ')[0])
}
} else {
params = ''
}
}
return '(' + params + ')'
return '(' + params.toString() + ')'
}
}

Loading…
Cancel
Save