Package com.google.gwt.dev.js.ast

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


      JsNameRef ctmRef = castableTypeMapName.makeRef(x.getSourceInfo());

      JsExpression castMapLit = generateCastableTypeMap(x);
      JsExpression ctmAsg = createAssignment(ctmRef,
          castMapLit);
      JsExprStmt ctmAsgStmt = ctmAsg.makeStmt();
      globalStmts.add(ctmAsgStmt);
      typeForStatMap.put(ctmAsgStmt, x);
    }
View Full Code Here


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

        // asg
        JsExpression asg = createAssignment(lhs, rhs);
        JsExprStmt stmt = asg.makeStmt();
        globalStmts.add(stmt);
        typeForStatMap.put(stmt, program.getTypeJavaLangObject());
      }
    }
View Full Code Here

    private void generateVTableAssignment(List<JsStatement> globalStmts, JMethod method,
        JsName lhsName, JsExpression rhs) {
      SourceInfo sourceInfo = method.getSourceInfo();
      JsNameRef lhs = lhsName.makeRef(sourceInfo);
      lhs.setQualifier(globalTemp.makeRef(sourceInfo));
      JsExprStmt polyAssignment = createAssignment(lhs, rhs).makeStmt();
      globalStmts.add(polyAssignment);
      vtableInitForMethodMap.put(polyAssignment, method);

      if (shouldEmitDisplayNames()) {
        JsExprStmt displayNameAssignment = outputDisplayName(lhs, method);
        globalStmts.add(displayNameAssignment);
        vtableInitForMethodMap.put(displayNameAssignment, method);
      }
    }
View Full Code Here

    private void createAndAddExportAssignment(JDeclaredType x, List<JsStatement> globalStmts,
        JsExpression exportRhs, Pair<String, String> exportNamespacePair) {
      JsNameRef leaf = new JsNameRef(x.getSourceInfo(), exportNamespacePair.getRight());
      leaf.setQualifier(getExportLhsQualifier(x, exportNamespacePair.getLeft()));
      JsExprStmt astStat = new JsExprStmt(x.getSourceInfo(),
           createAssignment(leaf,
               exportRhs));
      globalStmts.add(astStat);
    }
View Full Code Here

          provideCall.setQualifier(provideFuncRef);
          provideCall.getArguments().add(new JsStringLiteral(x.getSourceInfo(),
              exportNamespacePair.getLeft()));

          // _ = JCHSU.provide('foo.bar')
          JsExprStmt provideStat = createAssignment(globalTemp.makeRef(x.getSourceInfo()),
              provideCall).makeStmt();
          globalStmts.add(provideStat);
        } else if (jsInteropMode == OptionJsInteropMode.Mode.CLOSURE) {
          // goog.provide statements prepended by linker, so namespace already exists
          // but enclosing constructor exports may have overwritten them
View Full Code Here

   * 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

  private static JsExpression hoistedExpression(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

        boolean keepIt;
        JClassType vtableTypeAssigned = vtableTypeAssigned(stat);
        if (vtableTypeAssigned != null
            && livenessPredicate.isLive(vtableTypeAssigned)) {
          JsExprStmt result = extractPrototypeSetup(livenessPredicate,
              alreadyLoadedPredicate, stat, vtableTypeAssigned);
          if (result != null) {
            stat = result;
            keepIt = true;
          } else {
View Full Code Here

        toReturn.setArg1(lhs);
        stack.push(toReturn);
      }
    };
    c.accept(((JsExprStmt) stat).getExpression());
    JsExprStmt result = anyLiveCode[0] ? c.getExpression().makeStmt() : null;
    return result;
  }
View Full Code Here

   */
  private JClassType vtableTypeAssigned(JsStatement stat) {
    if (!(stat instanceof JsExprStmt)) {
      return null;
    }
    JsExprStmt expr = (JsExprStmt) stat;
    if (!(expr.getExpression() instanceof JsBinaryOperation)) {
      return null;
    }
    JsBinaryOperation binExpr = (JsBinaryOperation) expr.getExpression();
    if (binExpr.getOperator() != JsBinaryOperator.ASG) {
      return null;
    }
    if (!(binExpr.getArg1() instanceof JsNameRef)) {
      return null;
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.js.ast.JsExprStmt

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.