Search in sources :

Example 6 with IExpressionNode

use of org.apache.flex.compiler.tree.as.IExpressionNode in project vscode-nextgenas by BowlerHatLLC.

the class ActionScriptTextDocumentService method getFunctionCallNodeArgumentIndex.

private int getFunctionCallNodeArgumentIndex(IFunctionCallNode functionCallNode, IASNode offsetNode) {
    if (offsetNode == functionCallNode.getArgumentsNode() && offsetNode.getChildCount() == 0) {
        //there are no arguments yet
        return 0;
    }
    int indexToFind = offsetNode.getAbsoluteEnd();
    IExpressionNode[] argumentNodes = functionCallNode.getArgumentNodes();
    for (int i = argumentNodes.length - 1; i >= 0; i--) {
        IExpressionNode argumentNode = argumentNodes[i];
        if (indexToFind >= argumentNode.getAbsoluteStart()) {
            return i;
        }
    }
    return -1;
}
Also used : IExpressionNode(org.apache.flex.compiler.tree.as.IExpressionNode)

Aggregations

IExpressionNode (org.apache.flex.compiler.tree.as.IExpressionNode)6 IDefinition (org.apache.flex.compiler.definitions.IDefinition)4 IIdentifierNode (org.apache.flex.compiler.tree.as.IIdentifierNode)4 IMemberAccessExpressionNode (org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode)3 ITypeDefinition (org.apache.flex.compiler.definitions.ITypeDefinition)2 IASScope (org.apache.flex.compiler.scopes.IASScope)2 IASNode (org.apache.flex.compiler.tree.as.IASNode)2 IFunctionCallNode (org.apache.flex.compiler.tree.as.IFunctionCallNode)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 IClassDefinition (org.apache.flex.compiler.definitions.IClassDefinition)1 IEventDefinition (org.apache.flex.compiler.definitions.IEventDefinition)1 IFunctionDefinition (org.apache.flex.compiler.definitions.IFunctionDefinition)1 IParameterDefinition (org.apache.flex.compiler.definitions.IParameterDefinition)1 ASScope (org.apache.flex.compiler.internal.scopes.ASScope)1 TypeScope (org.apache.flex.compiler.internal.scopes.TypeScope)1 FullNameNode (org.apache.flex.compiler.internal.tree.as.FullNameNode)1 IMXMLTagAttributeData (org.apache.flex.compiler.mxml.IMXMLTagAttributeData)1 IMXMLTagData (org.apache.flex.compiler.mxml.IMXMLTagData)1 IBinaryOperatorNode (org.apache.flex.compiler.tree.as.IBinaryOperatorNode)1