invokeNoSuchMethod method
ghissues46: answers invocation - a member this instance's class does
not have - with its noSuchMethod: an interpreted one, else the one a
bridged superclass or mixin declares, run on the native object. Returns
noNoSuchMethod when the class has neither (Object's noSuchMethod: the
caller reports the miss).
Implementation
Object? invokeNoSuchMethod(
InterpreterVisitor visitor,
Invocation invocation,
) {
final interpreted = klass.findInstanceMethod('noSuchMethod');
if (interpreted != null) {
try {
return interpreted.bind(this).call(visitor, [invocation], {});
} on ReturnException catch (returnExc) {
return returnExc.value;
}
}
final bridged = klass.bridgedNoSuchMethodSource();
if (bridged == null) return noNoSuchMethod;
final target = nativeReceiverFor(bridged.name, visitor);
if (target == null) throw noReceiverError(bridged.name, 'noSuchMethod');
return bridged.methods['noSuchMethod']!(
visitor,
target,
[invocation],
const {},
null,
);
}