Package org.renjin.compiler.ir.tac.statements

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


    if(!(context instanceof LoopContext)) {
      throw new InvalidSyntaxException("`next` cannot be used outside of a loop");
    }
    LoopContext loopContext = (LoopContext)context;
    builder.addStatement( new GotoStatement(loopContext.getStartLabel()));
  }
View Full Code Here


    Expression ifTrueResult = builder.translateExpression(context, call.getArgument(1));
   
    // assign this result to our temp value
    builder.addStatement(new Assignment(ifResult, ifTrueResult));

    builder.addStatement(new GotoStatement(endLabel));
   
    builder.addLabel(falseTarget);
   
    // next evaluate "if false" expression
    // if the false clause is absent, it evaluates to
View Full Code Here

    // evaluate "if true" expression for side effects
    builder.addLabel(trueLabel);
    builder.translateStatements(context, call.getArgument(1));
   
    if(hasElse(call)) {
      builder.addStatement(new GotoStatement(endLabel));
      builder.addLabel(falseLabel);
      builder.translateStatements(context, call.getArgument(2));
    }   
   
    builder.addLabel(endLabel);
View Full Code Here

    IRLabel exitLabel = builder.newLabel();
   
    LoopContext loopContext = new LoopContext(beginLabel, exitLabel);
    builder.translateStatements(loopContext, call.getArgument(0));
   
    builder.addStatement(new GotoStatement(beginLabel));
    builder.addLabel(exitLabel);
  }
View Full Code Here

   
    // 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);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(false))));
    builder.addStatement(new GotoStatement(finishLabel));
   
    builder.addLabel(naLabel);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(LogicalVector.NA))));
   
    builder.addLabel(finishLabel);
View Full Code Here

   
    // 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);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(true))));
    builder.addStatement(new GotoStatement(finishLabel));
   
    builder.addLabel(naLabel);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(LogicalVector.NA))));
   
    builder.addLabel(finishLabel);
View Full Code Here

    factory.translateStatements(loopContext, body);
   
    // increment the counter
    factory.addLabel(nextLabel);
    factory.addStatement(new Assignment(counter, new Increment(counter)));
    factory.addStatement(new GotoStatement(counterLabel));

    factory.addLabel(exitLabel);
 
View Full Code Here

    if(!(context instanceof LoopContext)) {
      throw new InvalidSyntaxException("`break` cannot be used outside of a loop");
    }
    LoopContext loopContext = (LoopContext)context;
    builder.addStatement( new GotoStatement(loopContext.getExitLabel()));
  }
View Full Code Here

    LoopContext loopContext = new LoopContext(checkLabel, exitLabel);
    factory.translateStatements(loopContext, body);
   
    // increment the counter
    factory.addStatement(new GotoStatement(checkLabel));
   
    factory.addLabel(exitLabel);
  }
View Full Code Here

TOP

Related Classes of org.renjin.compiler.ir.tac.statements.GotoStatement

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.