eval method

dynamic eval(
  1. String expression
)

Evaluate an expression in the current context.

Requires a previous call to execute to establish the context. This is useful for REPL-style execution.

Implementation

dynamic eval(String expression) {
  if (!_hasExecutedOnce || _visitor == null || _globalEnvironment == null) {
    throw RuntimeD4rtException(
      'eval() requires an established execution context. Call execute() first.',
    );
  }

  // The expression needs to be parsed - but we don't have a parser here
  // This would need a parseSourceCallback or work with pre-parsed expressions
  throw UnsupportedError(
    'eval() is not supported in D4rtRunner. '
    'Use D4rt from tom_d4rt_exec for source code evaluation.',
  );
}