Examples of IfStatement


Examples of org.lilystudio.javascript.statement.IfStatement

    case Token.EXPR_RESULT:
    case Token.EXPR_VOID:
      return new ExpressionStatement(node, root, scope);

    case Token.IFNE:
      return new IfStatement(node, root, scope);

    case Token.LOOP:
      return new LoopStatement(node, root, scope);

    case Token.LOCAL_BLOCK: {
View Full Code Here

Examples of org.mozilla.javascript.ast.IfStatement

    return loop;
  }

  @Override
  public AstNode ifStatement(AstNode condition, AstNode thenPart, AstNode elsePart) {
    IfStatement ifs = new IfStatement();
    ifs.setCondition(condition);
    ifs.setThenPart(thenPart);
    ifs.setElsePart(elsePart);
    return ifs;
  }
View Full Code Here

Examples of org.renjin.compiler.ir.tac.statements.IfStatement

   
    IRLabel trueTarget = builder.newLabel();
    IRLabel falseTarget = builder.newLabel();
    IRLabel endLabel = builder.newLabel();
   
    IfStatement jump = new IfStatement(condition, trueTarget, falseTarget);
    builder.addStatement(jump);
   
    // evaluate "if true" expression
    builder.addLabel(trueTarget);
    Expression ifTrueResult = builder.translateExpression(context, call.getArgument(1));
View Full Code Here

Examples of org.renjin.compiler.ir.tac.statements.IfStatement

      endLabel = builder.newLabel();
    } else {
      endLabel = falseLabel;
    }
   
    IfStatement jump = new IfStatement(condition, trueLabel, falseLabel);
    builder.addStatement(jump);
   
    // evaluate "if true" expression for side effects
    builder.addLabel(trueLabel);
    builder.translateStatements(context, call.getArgument(1));
View Full Code Here

Examples of org.renjin.compiler.ir.tac.statements.IfStatement

    IRLabel naLabel = builder.newLabel();
    IRLabel finishLabel = builder.newLabel();
   
    // check the first condition
    SimpleExpression condition1 = builder.translateSimpleExpression(context, call.getArgument(0));
    builder.addStatement(new IfStatement(condition1, firstTrue, falseLabel, firstNA));
   
    // first is true.
    // set the result to true and do the next test
    builder.addLabel(firstTrue);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(true))));
    builder.addStatement(new GotoStatement(test2Label));
   
    // first is NA
    // set the result to NA and do the next test
    builder.addLabel(firstNA);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(LogicalVector.NA))));
    builder.addStatement(new GotoStatement(test2Label));
   
    // check second condition
    builder.addLabel(test2Label);
    SimpleExpression condition2 = builder.translateSimpleExpression(context, call.getArgument(1));
    builder.addStatement(new IfStatement(condition2,
        finishLabel,  // if condition 2 is true, then the result is equal to condition2
        falseLabel, // if false, final result is false,
        naLabel));

    builder.addLabel(falseLabel);
View Full Code Here

Examples of org.renjin.compiler.ir.tac.statements.IfStatement

    IRLabel test2Label = builder.newLabel();
    IRLabel finishLabel = builder.newLabel();
   
    // check the first condition
    SimpleExpression condition1 = builder.translateSimpleExpression(context, call.getArgument(0));
    builder.addStatement(new IfStatement(condition1, test2Label, finishLabel, test2Label));
   
    // first condition is ok, check the second
    builder.addLabel(test2Label);
    builder.addStatement(new ExprStatement(builder.translateExpression(context, call.getArgument(1))));
   
View Full Code Here

Examples of org.renjin.compiler.ir.tac.statements.IfStatement

    IRLabel naLabel = builder.newLabel();
    IRLabel finishLabel = builder.newLabel();
   
    // check the first condition
    SimpleExpression condition1 = builder.translateSimpleExpression(context, call.getArgument(0));
    builder.addStatement(new IfStatement(condition1, trueLabel, firstFalse, firstNA));
   
    // first is true.
    // set the result to true and do the next test
    builder.addLabel(firstFalse);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(false))));
    builder.addStatement(new GotoStatement(test2Label));
   
    // first is NA
    // set the result to NA and do the next test
    builder.addLabel(firstNA);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(LogicalVector.NA))));
    builder.addStatement(new GotoStatement(test2Label));
   
    // check second condition
    builder.addLabel(test2Label);
    SimpleExpression condition2 = builder.translateSimpleExpression(context, call.getArgument(1));
    builder.addStatement(new IfStatement(condition2,
        trueLabel,
        finishLabel,  // if condition 2 is false, then the result is equal to condition1
        naLabel));

    builder.addLabel(trueLabel);
View Full Code Here

Examples of org.renjin.compiler.ir.tac.statements.IfStatement

    IRLabel test2Label = builder.newLabel();
    IRLabel finishLabel = builder.newLabel();
   
    // check the first condition
    SimpleExpression condition1 = builder.translateSimpleExpression(context, call.getArgument(0));
    builder.addStatement(new IfStatement(condition1, finishLabel, test2Label, test2Label));
   
    // first condition is ok, check the second
    builder.addLabel(test2Label);
    builder.addStatement(new ExprStatement(builder.translateExpression(context, call.getArgument(1))));
   
View Full Code Here

Examples of org.teiid.query.sql.proc.IfStatement

        critSelector.setElements(elements);
       
        HasCriteria hasSelector = new HasCriteria();
        hasSelector.setSelector(critSelector);
       
        IfStatement stmt = new IfStatement(hasSelector, ifBlock, elseBlock);
       
        Block block = new Block();       
        block.addStatement(declStmt);
        block.addStatement(stmt);
               
View Full Code Here

Examples of org.teiid.query.sql.proc.IfStatement

        }
        break;
            }
      case Statement.TYPE_IF:
            {
        IfStatement ifStmt = (IfStatement)statement;
        Program ifProgram = planBlock(parentProcCommand, ifStmt.getIfBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
        Program elseProgram = null;
        if(ifStmt.hasElseBlock()) {
          elseProgram = planBlock(parentProcCommand, ifStmt.getElseBlock(), metadata, debug, idGenerator, capFinder, analysisRecord, context);
        }
        instruction = new IfInstruction(ifStmt.getCondition(), ifProgram, elseProgram);
        if(debug) {
          analysisRecord.println("\tIF STATEMENT:\n" + statement); //$NON-NLS-1$
        }
        break;
            }
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.