call method

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

Implementation

@override
Object? call(
  InterpreterVisitor visitor,
  List<Object?> positionalArguments, [
  Map<String, Object?> namedArguments = const {},
  List<RuntimeType>? typeArguments,
]) {
  try {
    // Call the adapter, passing the stored native super object as the target
    return adapter(
      visitor,
      superObject,
      positionalArguments,
      namedArguments,
      typeArguments,
    );
  } on RangeError {
    // SCE74, third call path. Same defect as the two arms in `callable.dart`:
    // `RangeError extends ArgumentError`, so without this the clause below
    // swallows an SDK range failure raised by a bridged SUPERCLASS method
    // and reissues it as an uncatchable interpreter error. Narrowed, not
    // deleted, for the same reason — a plain `ArgumentError` here is still
    // an adapter's argument-shape complaint with no SDK counterpart.
    //
    // NO TEST REACHES THIS ARM, and that is a fact about a different gap
    // rather than about this fix. Measured 2026-09-21: a `super.` call
    // resolves only members the bridged superclass DECLARES, not ones it
    // inherits from its own bridged supertypes — `super.removeFirst()` on a
    // `ListQueue` subclass works and answers the SDK's `StateError`, while
    // `super.elementAt(0)` answers "Method 'elementAt' not found in bridged
    // superclass 'ListQueue'". Every member that raises a RangeError is an
    // inherited one, so no script can currently drive this path to one.
    //
    // The arm stays anyway: it is the same defect in the third of three
    // call paths, fixing two of three is the incompleteness this repo's
    // mirror rule exists to prevent, and rethrowing instead of rewrapping
    // cannot itself break anything. The resolution gap is filed separately.
    rethrow;
  } on ArgumentError catch (e) {
    throw RuntimeD4rtException(
      "Invalid arguments for bridged superclass method '$bridgedClassName.$methodName': ${e.message}",
    );
  } catch (e, s) {
    Logger.error(
      "Native exception during call to bridged superclass method '$bridgedClassName.$methodName': $e\n$s",
    );
    throw RuntimeD4rtException(
      "Native error in bridged superclass method '$bridgedClassName.$methodName': $e",
      originalException: e,
      originalStackTrace: s,
    );
  }
}