public Collection<JSDefinitionExpression> getDefinitions() { final PsiElement firstChild = getFirstChild(); if (firstChild instanceof JSDefinitionExpression) { return Collections.singletonList((JSDefinitionExpression) firstChild); } if (firstChild instanceof JSParenthesizedExpression) { final PsiElement commaExpression = PsiTreeUtil.findChildOfType(firstChild, JSCommaExpression.class); if (commaExpression != null) { return PsiTreeUtil.findChildrenOfType(commaExpression, JSDefinitionExpression.class); } } return Collections.emptyList(); }
public Collection<JSDefinitionExpression> getDefinitions() { final PsiElement firstChild = getFirstChild(); if (firstChild instanceof JSDefinitionExpression) { return Collections.singletonList((JSDefinitionExpression)firstChild); } else if (firstChild instanceof JSParenthesizedExpression) { final PsiElement commaExpression = PsiTreeUtil.findChildOfType(firstChild, JSCommaExpression.class); if (commaExpression != null) { return PsiTreeUtil.findChildrenOfType(commaExpression, JSDefinitionExpression.class); } } return Collections.emptyList(); }
@Override public void visitJSCommaExpression(JSCommaExpression node) { super.visitJSCommaExpression(node); if(node.getParent() instanceof JSCommaExpression) { return; } if(node.getParent() instanceof JSForStatement) { return; } registerError(node); }