Examples of SwitchCase


Examples of org.eclipse.jdt.core.dom.SwitchCase

    jumpsStatements.add(currentslot);

    for (Iterator<Statement> iter = node.statements().iterator(); iter.hasNext();) {
      Statement statement = iter.next();
      if (statement instanceof SwitchCase) {
        SwitchCase switchCase = (SwitchCase) statement;
        if (switchCase.isDefault()) {
          jumpDefault = new Jump();
          push(jumpDefault);
          storeInstruction(); // jump
          statementsDefault = new ArrayList<Statement>();
        } else {
          if (switchCase.getExpression() instanceof StringLiteral) {
            push(new SendMessage(
                "equals", "(Ljava/lang/Object;)Z", 1, null, fCounter)); //$NON-NLS-1$ //$NON-NLS-2$
          } else {
            push(new EqualEqualOperator(Instruction.T_int,
                Instruction.T_int, true, fCounter));
          }
          push(new Dup());
          storeInstruction(); // dupe
          switchCase.getExpression().accept(this);
          storeInstruction(); // equal-equal
          ConditionalJump condJump = new ConditionalJump(true);
          push(condJump);
          storeInstruction(); // conditional jump
          if (currentslot.stmts != null) {
View Full Code Here

Examples of org.eclipse.jdt.core.dom.SwitchCase

   
    for(Object obj: node.statements()) {
      Statement stmt = (Statement) obj;
      if (stmt.getNodeType() == ASTNode.SWITCH_CASE) {
        CFGVertice caseVertice = graph.addNewVertice(stmt, "Switch case: " + stmt);
        SwitchCase aCase = (SwitchCase) stmt;
        if (aCase.isDefault()) {
          if (defaultTarget !=null)
            throw new MethodCFGBuilderException("Two defaults??");
          defaultTarget = caseVertice;
        } else
          cases.add(Pair.create(caseVertice, aCase.getExpression()));
        if (lastBlock !=null)
          acceptChildren(lastBlock, new ProcessingContext(previousVertice, caseVertice, context.returnDetails), true, switchBlock);
        lastBlock = new LinkedList<Statement>();
        previousVertice = caseVertice;
      } else {
View Full Code Here

Examples of org.mozilla.javascript.ast.SwitchCase

    return (T) node;
  }

  @Override
  public AstNode caseStatement(AstNode expression, Iterable<AstNode> statements) {
    SwitchCase s = new SwitchCase();
    s.setExpression(expression);
    for (AstNode stmt : statements) {
      if (stmt != null) {
        s.addStatement(stmt);
      }
    }
    return s;
  }
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.