Package org.mozilla.javascript.ast

Examples of org.mozilla.javascript.ast.FunctionCall


            _versionCompliance = versionCompliance;
        }

        public boolean visit(AstNode node) {
            if (node instanceof FunctionCall) {
                FunctionCall call = (FunctionCall) node;
                String functionName = call.getTarget().toSource();
               
                boolean arrayGet = false;
                if (call.getParent() != null && call.getParent() instanceof ElementGet) {
                    arrayGet = true;
                }
               
                // first try to find property of environment object with given name
                Iterator<TMLScriptMethod> methods = ReflectionManager.getInstance(_versionCompliance).getPublicMethods(_env, _envFlags).iterator();
                while (methods.hasNext()) {
                    TMLScriptMethod method = methods.next();
                    if (method.matchName(functionName) && method.getParameters().size() == call.getArguments().size()) {
                        if (method instanceof TMLScriptMethodExtension1) {
                            // compute type of parameters
                            List<String> paramTypes = new ArrayList<String>();
                            for (AstNode paramNode : call.getArguments()) {
                               
                                String currentEnvironmentObject = ReflectionManager.GLOBAL_SCOPE_CLASSNAME;
                                String[] values = splitVariableValue(paramNode.toSource(), false);
                                for (String value : values) {
                                    AstRoot valueAst = createParser().parse(value, "", 0);
View Full Code Here


    public boolean visit(final AstNode node) {
      int type = node.getType();

      switch (type) {
        case CALL: {
          FunctionCall call = (FunctionCall) node;
          String name = nameOf(call.getTarget());

          // if we can not determine the function name, skip
          if (name == null) {
            break;
          }

          if (name.equals("Ext.define")) {
            // complain if we found more than one class
            if (current != null) {
              log.warn("Found duplicate class definition in source: " + source);
            }
            processClassDef(call);
            return true; // process children
          }
          else if (name.equals("Ext.create")) {
            // complain if we have references to classes with Ext.create() and missing requires
            if (!call.getArguments().isEmpty() && call.getArguments().get(0) instanceof StringLiteral) {
              String className = nameOf(call.getArguments().get(0));
              maybeWarnMissingRequires(className, "Ext.create");
            }
            return false; // ignore children
          }
          break;
View Full Code Here

    return s;
  }

  @Override
  public AstNode functionCall(AstNode target, Iterable<AstNode> arguments) {
    FunctionCall fc = new FunctionCall();
    fc.setTarget(target);
    if (!Iterables.isEmpty(arguments)) {
      fc.setArguments(list(arguments));
    }
    return fc;
  }
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.ast.FunctionCall

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.