Ejemplo n.º 1
0
  private int getMatchingCaseIndex(ActivationRecord record, ConstexprEvaluationContext context) {
    IValue controllerValue = null;
    if (controllerExprEval != null) {
      controllerValue = EvalUtil.getConditionExprValue(controllerExprEval, record, context);
    } else if (controllerDeclExec != null) {
      controllerValue = EvalUtil.getConditionDeclValue(controllerDeclExec, record, context);
    }

    for (int i = 0; i < bodyStmtExecutions.length; ++i) {
      if (isSatisfiedCaseStatement(bodyStmtExecutions[i], controllerValue, record, context)) {
        return i;
      }
    }
    return bodyStmtExecutions.length;
  }
Ejemplo n.º 2
0
 @Override
 public ICPPExecution executeForFunctionCall(
     ActivationRecord record, ConstexprEvaluationContext context) {
   final int caseIndex = getMatchingCaseIndex(record, context);
   for (int i = caseIndex; i < bodyStmtExecutions.length; ++i) {
     ICPPExecution stmtExec = bodyStmtExecutions[i];
     ICPPExecution result = EvalUtil.executeStatement(stmtExec, record, context);
     if (result instanceof ExecReturn || result instanceof ExecContinue) {
       return result;
     } else if (result instanceof ExecBreak) {
       break;
     }
   }
   return null;
 }