runSubroutineErrorsOK method Null safety

Future<double> runSubroutineErrorsOK(
  1. double arg,
  2. Set<int> acceptableErrors
)

Implementation

Future<double> runSubroutineErrorsOK(
    double arg, Set<int> acceptableErrors) async {
  if (_subroutineStart == _subroutineNotStarted) {
    _subroutineStart = model.program.currentLine;
  } else {
    model.program.currentLine = _subroutineStart;
    pushPseudoReturn(model);
    assert(returnStackStartPos == model.program.returnStackPos);
  }
  model.setXYZT(Value.fromDouble(arg));
  await caller.runProgramLoop(acceptableErrors: acceptableErrors);
  assert(returnStackStartPos == model.program.returnStackPos + 1);
  if (model.getFlag(9)) {
    model.setFlag(9, false);
    if (model.xF > 0) {
      return double.infinity;
    } else {
      return double.negativeInfinity;
    }
  } else {
    return model.xF;
  }
}