Package com.google.caja.parser.js

Examples of com.google.caja.parser.js.FormalParam


  private ParseTreeNode getInvoke(JMethod m) {
    List<ParseTreeNode> formals = new ArrayList<ParseTreeNode>();
    List<ParseTreeNode> actuals = new ArrayList<ParseTreeNode>();
    for (int i = 0; i < m.getParameters().length; i++) {
      formals.add(new FormalParam(
          new Identifier(FilePosition.UNKNOWN, makeArgName(i))));
      actuals.add(new Reference(
          new Identifier(FilePosition.UNKNOWN, makeArgName(i))));
    }
    return QuasiBuilder.substV(""
View Full Code Here


    FilePosition unk = FilePosition.UNKNOWN;
    FunctionConstructor fc = new FunctionConstructor(
        unk,
        new Identifier(unk, "f"),
        Arrays.asList(
            new FormalParam(new Identifier(unk, "x")),
            new FormalParam(
                SyntheticNodes.s(new Identifier(unk, "y___")))),
        new Block(
            unk,
            Arrays.<Statement>asList(new ReturnStmt(
                unk,
View Full Code Here

         p = p.getParentContext()) {
      for (NameContext.VarInfo<String, ?> ni : p.vars()) {
        String rewrittenName = ni.newName;
        rewrittenNames.put(
            rewrittenName,
            new FormalParam(new Identifier(ni.declaredAt, rewrittenName)));
      }
    }
    for (String fixedExtern : fixedExterns) {
      rewrittenNames.put(
          fixedExtern,
          new FormalParam(new Identifier(FilePosition.UNKNOWN, fixedExtern)));
    }
    // If the input NameContext contains (foo => a, bar => b) then the program
    // looks like { (function (a, b) { @rewrittenExpression; }; }
    Block program = (Block) QuasiBuilder.substV(
        "{ (function (@formals*) { @f; }); }",
View Full Code Here

                  } catch (NameContext.RedeclarationException ex) {
                    // If it was previously declared then v wouldn't be null.
                    throw new SomethingWidgyHappenedError(ex);
                  }
                }
                FormalParam newP = new FormalParam(new Identifier(
                    p.getFilePosition(), v.newName));
                newFormals.add(newP);
              } else {
                newFormals.add(p);
              }
View Full Code Here

    return node;
  }

  protected void checkFormals(ParseTreeNode formals) {
    for (ParseTreeNode formal : formals.children()) {
      FormalParam f = (FormalParam) formal;
      if (!isSynthetic(f.getIdentifier())
          && f.getIdentifierName().endsWith("__")) {
        rewriter.mq.addMessage(
            RewriterMessageType.VARIABLES_CANNOT_END_IN_DOUBLE_UNDERSCORE,
            f.getFilePosition(), this, f);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.google.caja.parser.js.FormalParam

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.