Examples of JsExprStmt


Examples of com.google.gwt.dev.js.ast.JsExprStmt

    JsName name = scope.declareName("package-info", "package-info");
    List<JsStatement> statements = jsProgram.getFragment(0).getGlobalBlock().getStatements();
    final SourceOrigin sourceInfo = SourceOrigin.UNKNOWN;
    JsFunction function = new JsFunction(sourceInfo, scope, name);
    function.setBody(new JsBlock(sourceInfo));
    statements.add(new JsExprStmt(sourceInfo, function));

    // Function invocation statement.
    statements.add(new JsInvocation(sourceInfo, new JsNameRef(sourceInfo, name)).makeStmt());

    // Verify that the illegal "-" character is translated.
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsExprStmt

    program.setIndexedFunctions(functions("CoverageUtil.cover", "CoverageUtil.onBeforeUnload"));
    JsBlock globalBlock = program.getGlobalBlock();
    JsFunction function = new JsFunction(info, program.getScope());
    functionBody = new JsBlock(info);
    function.setBody(functionBody);
    globalBlock.getStatements().add(new JsExprStmt(info, function));
  }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsExprStmt

        // for non-statics, only setup an assignment if needed
        if (rhs != null) {
          JsNameRef fieldRef = name.makeRef();
          fieldRef.setQualifier(globalTemp.makeRef());
          JsExpression asg = createAssignment(fieldRef, rhs);
          push(new JsExprStmt(asg));
        } else {
          push(null);
        }
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsExprStmt

      // increments
      {
        JsExpression incrExpr = null;
        List<JsExprStmt> exprStmts = popList(x.getIncrements().size());
        for (int i = 0; i < exprStmts.size(); ++i) {
          JsExprStmt exprStmt = exprStmts.get(i);
          incrExpr = createCommaExpression(incrExpr, exprStmt.getExpression());
        }
        jsFor.setIncrExpr(incrExpr);
      }

      // condition
      if (x.getTestExpr() != null) {
        jsFor.setCondition((JsExpression) pop());
      }

      // initializers
      JsExpression initExpr = null;
      List<JsExprStmt> initStmts = popList(x.getInitializers().size());
      for (int i = 0; i < initStmts.size(); ++i) {
        JsExprStmt initStmt = initStmts.get(i);
        if (initStmt != null) {
          initExpr = createCommaExpression(initExpr, initStmt.getExpression());
        }
      }
      jsFor.setInitExpr(initExpr);

      push(jsFor);
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsExprStmt

        body.getStatements().add(jsReturn);
        rhs.setBody(body);

        // asg
        JsExpression asg = createAssignment(lhs, rhs);
        globalStmts.add(new JsExprStmt(asg));
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsExprStmt

        }
        JsNameRef fieldRef = typeIdName.makeRef();
        fieldRef.setQualifier(globalTemp.makeRef());
        JsNumberLiteral typeIdLit = jsProgram.getNumberLiteral(typeId);
        JsExpression asg = createAssignment(fieldRef, typeIdLit);
        globalStmts.add(new JsExprStmt(asg));
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsExprStmt

        return;
      }
      JsNameRef fieldRef = typeMarkerName.makeRef();
      fieldRef.setQualifier(globalTemp.makeRef());
      JsExpression asg = createAssignment(fieldRef, nullMethodName.makeRef());
      globalStmts.add(new JsExprStmt(asg));
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsExprStmt

        if (!method.isStatic() && !method.isAbstract()) {
          JsNameRef lhs = polymorphicNames.get(method).makeRef();
          lhs.setQualifier(globalTemp.makeRef());
          JsNameRef rhs = names.get(method).makeRef();
          JsExpression asg = createAssignment(lhs, rhs);
          globalStmts.add(new JsExprStmt(asg));
        }
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsExprStmt

   * If the statement is a JsExprStmt that declares a function with no other
   * side effects, returns that function; otherwise <code>null</code>.
   */
  protected static JsFunction isFunctionDecl(JsStatement stmt) {
    if (stmt instanceof JsExprStmt) {
      JsExprStmt exprStmt = (JsExprStmt) stmt;
      JsExpression expr = exprStmt.getExpression();
      if (expr instanceof JsFunction) {
        JsFunction func = (JsFunction) expr;
        if (func.getName() != null) {
          return func;
        }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsExprStmt

  private static JsExpression hoistedExpression(JsProgram program,
      JsStatement statement, List<JsName> localVariableNames) {
    JsExpression expression;
    if (statement instanceof JsExprStmt) {
      // Extract the expression
      JsExprStmt exprStmt = (JsExprStmt) statement;
      expression = exprStmt.getExpression();

    } else if (statement instanceof JsReturn) {
      // Extract the return value
      JsReturn ret = (JsReturn) statement;
      expression = ret.getExpr();
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.