Examples of ExpressionStmt


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

              // if (foo() && 0) { ... } else { baz(); }  =>  { foo(); baz(); }
            } else {
              optimizeConditional(s, c, i + 2, out);
            }
            List<Statement> stmts = Lists.newArrayList();
            stmts.add(new ExpressionStmt(sideEffect));
            if (out.node instanceof Block) {
              stmts.addAll(((Block) out.node).children());
            } else if (!(out.node instanceof Noop)) {
              stmts.add((Statement) out.node);
            }
View Full Code Here

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

        public ParseTreeNode fire(ParseTreeNode node, Scope scope) {
          if (node instanceof Expression && scope == null) {
            Expression e = (Expression) node;
            Block bl = new Block(
                e.getFilePosition(),
                Collections.singletonList(new ExpressionStmt(e)));
            scope = Scope.fromProgram(bl, AlphaRenamingRewriter.this);
            contexts.put(scope, rootContext);
            return expand(e, scope);
          }
          return NONE;
View Full Code Here

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

  public static Reference newReference(FilePosition pos, String name) {
    return new Reference(s(new Identifier(pos, name)));
  }

  protected static ExpressionStmt newExprStmt(Expression e) {
    return new ExpressionStmt(e.getFilePosition(), e);
  }
View Full Code Here

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

          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());
View Full Code Here

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

    ParseTreeNode result = null;
    // Code translated from another language should not be used as the module
    // result.
    if (isForSideEffect(node)) { return node; }
    if (node instanceof ExpressionStmt) {
      result = new ExpressionStmt(
          node.getFilePosition(),
          (Expression) QuasiBuilder.substV(
              "moduleResult___ = @result;",
              "result", ((ExpressionStmt) node).getExpression()));
    } else if (node instanceof ParseTreeNodeContainer) {
View Full Code Here

Examples of japa.parser.ast.stmt.ExpressionStmt

     *
     * @param block
     * @param stmt
     */
    public static void addStmt(BlockStmt block, Expression expr) {
        addStmt(block, new ExpressionStmt(expr));
    }
View Full Code Here

Examples of japa.parser.ast.stmt.ExpressionStmt

    public Boolean visit(EmptyStmt n1, Node arg) {
        return Boolean.TRUE;
    }

    public Boolean visit(ExpressionStmt n1, Node arg) {
        ExpressionStmt n2 = (ExpressionStmt) arg;

        if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
            return Boolean.FALSE;
        }

        return Boolean.TRUE;
    }
View Full Code Here

Examples of japa.parser.ast.stmt.ExpressionStmt

            typeDecl = ClassOrInterfaceDeclaration(modifier);
            ret = new TypeDeclarationStmt(typeDecl.getBeginLine(), typeDecl.getBeginColumn(), token.endLine, token.endColumn, typeDecl);
        } else if (jj_2_37(2147483647)) {
            expr = VariableDeclarationExpression();
            jj_consume_token(SEMICOLON);
            ret = new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr);
        } else {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                case ASSERT:
                case BOOLEAN:
                case BREAK:
View Full Code Here

Examples of japa.parser.ast.stmt.ExpressionStmt

                throw new ParseException();
        }
        jj_consume_token(SEMICOLON);
        {
            if (true) {
                return new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr);
            }
        }
        throw new Error("Missing return statement in function");
    }
View Full Code Here

Examples of japa.parser.ast.stmt.ExpressionStmt

     *
     * @param block
     * @param stmt
     */
    public static void addStmt(BlockStmt block, Expression expr) {
        addStmt(block, new ExpressionStmt(expr));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.