From ccdd9412952f06317b26531301c60321aab2e38e Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Fri, 15 Dec 2017 02:09:38 +0700 Subject: [PATCH] Refactor _getInputParams --- src/app/editor/contextualListener.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index ff1bae6f00..9893767724 100644 --- a/src/app/editor/contextualListener.js +++ b/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() + ')' } }