Examples of JIfStatement


Examples of com.google.gwt.dev.jjs.ast.JIfStatement

          JBinaryOperation compareOperation = new JBinaryOperation(program,
              x.getSourceInfo(), program.getTypePrimitiveBoolean(),
              JBinaryOperator.EQ, x.getExpr(), caseStatement.getExpr());
          JBlock block = new JBlock(program, x.getSourceInfo());
          block.statements.add(statement);
          JIfStatement ifStatement = new JIfStatement(program,
              x.getSourceInfo(), compareOperation, block, null);
          ctx.replaceMe(ifStatement);
        } else {
          // All we have is a default case; convert to a JBlock.
          JBlock block = new JBlock(program, x.getSourceInfo());
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JIfStatement

      JExpression expr = dispProcessExpression(x.condition);
      JStatement thenStmt = removeThen ? null
          : dispProcessStatement(x.thenStatement);
      JStatement elseStmt = removeElse ? null
          : dispProcessStatement(x.elseStatement);
      JIfStatement ifStmt = new JIfStatement(program, info, expr, thenStmt,
          elseStmt);
      return ifStmt;
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JIfStatement

        if (!block.statements.isEmpty()) {
          // Only bother adding the assignment if the block is non-empty
          block.statements.add(0, asg);
        }
        // nest the previous as an else for me
        cur = new JIfStatement(program, catchInfo, ifTest, block, cur);
      }

      newCatchBlock.statements.add(cur);
      x.getCatchArgs().clear();
      x.getCatchArgs().add(exRef);
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JIfStatement

        }
        JDeclarationStatement declaration =
            new JDeclarationStatement(catchInfo, arg, new JLocalRef(catchInfo, exceptionVariable));
        block.addStmt(0, declaration);
        // nest the previous as an else for me
        cur = new JIfStatement(catchInfo, ifTest, block, cur);
      }

      newCatchBlock.addStmt(cur);

      // Replace with a single catch block.
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JIfStatement

  private Result from(String decls, String expr, boolean b) throws UnableToCompleteException {
    JProgram program = compileSnippet("void", decls + "\n if(" + expr + ") return;");
    JMethod mainMethod = findMainMethod(program);
    JBlock block = ((JMethodBody) mainMethod.getBody()).getBlock();
    List<JStatement> statements = block.getStatements();
    JIfStatement ifStatement = (JIfStatement) statements.get(statements.size() - 1);

    Updater assumptions = new Updater(ConstantsAssumption.TOP);
    AssumptionDeducer.deduceAssumption(ifStatement.getIfExpr(),
        JBooleanLiteral.get(b), assumptions);
    return new Result(assumptions.unwrap());
  }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JIfStatement

    // no simplification made
    if (original != null) {
      return original;
    }
    return new JIfStatement(program, condExpr.getSourceInfo(), condExpr,
        thenStmt, elseStmt);
  }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JIfStatement

          JBinaryOperation compareOperation = new JBinaryOperation(program,
              x.getSourceInfo(), program.getTypePrimitiveBoolean(),
              JBinaryOperator.EQ, x.getExpr(), caseStatement.getExpr());
          JBlock block = new JBlock(program, x.getSourceInfo());
          block.statements.add(statement);
          JIfStatement ifStatement = new JIfStatement(program,
              x.getSourceInfo(), compareOperation, block, null);
          ctx.replaceMe(ifStatement);
        } else {
          // All we have is a default case; convert to a JBlock.
          JBlock block = new JBlock(program, x.getSourceInfo());
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JIfStatement

      try {
        SourceInfo info = makeSourceInfo(x);
        JStatement elseStatement = pop(x.elseStatement);
        JStatement thenStatement = pop(x.thenStatement);
        JExpression condition = pop(x.condition);
        push(new JIfStatement(info, condition, thenStatement, elseStatement));
      } catch (Throwable e) {
        throw translateException(x, e);
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JIfStatement

      }

      // if (exception != null) throw exception
      JExpression exceptionNotNull = new JBinaryOperation(info, JPrimitiveType.BOOLEAN,
          JBinaryOperator.NEQ, new JLocalRef(info, exceptionVar), JNullLiteral.INSTANCE);
      finallyBlock.addStmt(new JIfStatement(info, exceptionNotNull,
          new JThrowStatement(info, new JLocalRef(info, exceptionVar)), null));

      // Stitch all together into a inner try block
      innerBlock.addStmt(new JTryStatement(info, tryBlock, catchClauses,
            finallyBlock));
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JIfStatement

      }
      then.addStmt(new JThrowStatement(x.getSourceInfo(), call));

      JUnaryOperation notX =
          new JPrefixOperation(x.getSourceInfo(), JUnaryOperator.NOT, x.getTestExpr());
      JIfStatement cond =
          new JIfStatement(x.getSourceInfo(), notX, then, null);
      ctx.replaceMe(cond);
    }
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.