call method

  1. @override
Object? call(
  1. InterpreterVisitor visitor,
  2. List<Object?> positionalArguments, [
  3. Map<String, Object?> namedArguments = const {},
  4. List<RuntimeType>? typeArguments = const [],
])
override

Implementation

@override
Object? call(InterpreterVisitor visitor, List<Object?> positionalArguments,
    [Map<String, Object?> namedArguments = const {},
    List<RuntimeType>? typeArguments = const []]) {
  // Prepare the arguments for the actual call to the InterpretedExtensionMethod:
  // The first argument is ALWAYS the target instance.
  final actualPositionalArgs = [target, ...positionalArguments];

  Logger.debug(
      "[BoundExtensionMethodCallable] Calling extension method '${extensionMethod.declaration.name!.name}' bound to ${target?.runtimeType}");

  // Call the original extension method with the adjusted arguments.
  // It will handle ReturnException, etc.
  return extensionMethod.call(
      visitor, actualPositionalArgs, namedArguments, typeArguments);
}