// 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);