Java Node getArguments(Node functionCall)

PreviousNext

//package com.java2s;

import com.google.javascript.rhino.Node;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {
    static List<Node> getArguments(Node functionCall) {
        int childCount = functionCall.getChildCount();
        if (childCount == 1) {
            return Collections.emptyList();
        }/* w   ww  .  d  e   m   o2  s   . c  o  m  */
        List<Node> arguments = new ArrayList<>(childCount - 1);
        for (int i = 1; i < childCount; ++i) {
            arguments.add(functionCall.getChildAtIndex(i));
        }
        return arguments;
    }
}
PreviousNext

Related