Package com.google.caja.parser.js

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


          // and they do cause an assignment, they will always assign a numeric
          // value, so they do not need to be considered except for purposes of
          // uninitialized variable analysis.
        }
      } else if (use.parent.node instanceof Declaration) {
        Declaration d = (Declaration) use.parent.node;
        // If it's initialized as a result of some non-local value such as
        // a function call or thrown exception, assume it's not numeric.
        if (d instanceof FormalParam) { return false; }
        if (use.parent.parent.node instanceof CatchStmt) { return false; }
        // Otherwise the initializer had better not be a non-numeric value.
        if (d.getInitializer() != null) {
          Expression init = d.getInitializer();
          if (!isVisiblePropertyExpr(init, scopeTree, identifiersExpanding)) {
            return false;
          }
        } else if (isKeyReceiver(use)) {
          return false;
View Full Code Here


  public void addStartStatement(Statement s) {
    int pos = startStatements.size();
    // Group certain kinds of statements
    if (s.getClass() == Declaration.class) {
      Declaration d = (Declaration) s;
      if (d.getInitializer() == null) {
        int i = 0;
        if (i < pos && startStatements.get(i) instanceof DirectivePrologue) {
          ++i;
        }
        if (i < pos) {
View Full Code Here

          matches="/* synthetic */ var @v = @initial?;",
          substitutes="<expanded>")
      public ParseTreeNode fire(ParseTreeNode node, Scope scope) {
        Map<String, ParseTreeNode> bindings = this.match(node);
        if (bindings != null && isSynthetic((Identifier) bindings.get("v"))) {
          Declaration d = (Declaration) expandAll(node, scope);
          Statement s;
          if (d.getInitializer() == null) {
            s = new Noop(d.getFilePosition());
          } else {
            s = new ExpressionStmt(
                Operation.createInfix(
                    Operator.ASSIGN, new Reference(d.getIdentifier()),
                    d.getInitializer()));
            getRewriter().markTreeForSideEffect(s);
            d.removeChild(d.getInitializer());
          }
          scope.addStartOfScopeStatement(d);
          return s;
        }
        return NONE;
View Full Code Here

TOP

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

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.