EvaluateExpression method

RuntimeObject? EvaluateExpression(
  1. Container exprContainer
)

Implementation

RuntimeObject? EvaluateExpression(Container exprContainer) {
  var startCallStackHeight = state.callStack.elements.length;

  state.callStack.push(PushPopType.Tunnel);

  _temporaryEvaluationContainer = exprContainer;

  state.goToStart();

  var evalStackHeight = state.evaluationStack.length;

  Continue();

  _temporaryEvaluationContainer = null;

  // Should have fallen off the end of the Container, which should
  // have auto-popped, but just in case we didn't for some reason,
  // manually pop to restore the state (including currentPath).
  if (state.callStack.elements.length > startCallStackHeight) {
    state.popCallstack();
  }

  var endStackHeight = state.evaluationStack.length;
  if (endStackHeight > evalStackHeight) {
    return state.popEvaluationStack();
  } else {
    return null;
  }
}