public boolean visit(CallExpression call) throws Exception { final FieldDeclaration constantDecl = ASTUtils.getConstantDeclaration(call); if (constantDecl != null) { // In case we are entering a nested element if (!declarations.empty() && declarations.peek() instanceof MethodDeclaration) { deferredDeclarations.add(constantDecl); return false; } visit(constantDecl); } else { int argsCount = 0; final CallArgumentsList args = call.getArgs(); if (args != null && args.getChilds() != null) { argsCount = args.getChilds().size(); } fRequestor.acceptMethodReference( call.getName(), argsCount, call.getCallName().sourceStart(), call.getCallName().sourceEnd()); } return true; }
@Override public boolean visitGeneral(ASTNode node) throws Exception { if (!ACTIVE) { return true; } if (node instanceof RubyRegexpExpression || node instanceof RubyDRegexpExpression) { handleRegexp(node); } else if (node instanceof RubySymbolReference) { requestor.addPosition(node.sourceStart(), node.sourceEnd(), HL_SYMBOL); } else if (node instanceof VariableReference) { handleVariableReference((VariableReference) node); } else if (node instanceof RubyDVarExpression) { requestor.addPosition(node.sourceStart(), node.sourceEnd(), HL_LOCAL_VARIABLE); } else if (node instanceof RubyDAssgnExpression) { ASTNode var = ((RubyDAssgnExpression) node).getLeft(); requestor.addPosition(var.sourceStart(), var.sourceEnd(), HL_LOCAL_VARIABLE); } else if (node instanceof StringLiteral) { if (isStringLiteralNeeded(node)) { requestor.addPosition(node.sourceStart(), node.sourceEnd(), HL_STRING); } } else if (node instanceof NumericLiteral || node instanceof FloatNumericLiteral || node instanceof BigNumericLiteral) { requestor.addPosition(node.sourceStart(), node.sourceEnd(), HL_NUMBER); } else if (node instanceof RubyEvaluatableStringExpression) { handleEvaluatableExpression(node); } else if (node instanceof CallExpression) { final CallExpression call = (CallExpression) node; if (!(RubySyntaxUtils.isRubyOperator(call.getName()) || call.getReceiver() == null && RubyCodeScanner.isPseudoKeyword(call.getName()))) { final SimpleReference callName = call.getCallName(); if (callName.sourceStart() >= 0 && callName.sourceEnd() > callName.sourceStart()) { requestor.addPosition(callName.sourceStart(), callName.sourceEnd(), HL_DEFAULT); } } } else if (node instanceof Declaration) { final Declaration declaration = (Declaration) node; requestor.addPosition(declaration.getNameStart(), declaration.getNameEnd(), HL_DEFAULT); } else if (node instanceof RubyConstantDeclaration) { final RubyConstantDeclaration declaration = (RubyConstantDeclaration) node; final SimpleReference name = declaration.getName(); requestor.addPosition(name.sourceStart(), name.sourceEnd(), HL_CONST); } stack.push(node); return true; }