visitThrowExpression method

  1. @override
Object? visitThrowExpression(
  1. ThrowExpression node
)
override

Implementation

@override
Object? visitThrowExpression(ThrowExpression node) {
  // 1. Evaluate the expression that is thrown
  final thrownValue = node.expression.accept<Object?>(this);

  // 2. Create and throw an InternalInterpreterException.
  final message = stringify(thrownValue); // Keep for debug log
  Logger.debug("[ThrowExpression] Throwing (original value): $message");
  // Throw the specific internal exception, wrapping the original value
  throw InternalInterpreterD4rtException(thrownValue);
  // We don't capture stack trace here, the 'catch' block does it.
}