findInstanceMethod method
Implementation
InterpretedFunction? findInstanceMethod(String name) {
final cached = _methodResolutionCache[name];
if (cached != null) return cached;
// Single-probe local hit (map value type is non-nullable, so a null read
// means absent).
final local = methods[name];
if (local != null) return _methodResolutionCache[name] = local;
// Check applied mixins in reverse order
for (int i = mixins.length - 1; i >= 0; i--) {
// Recursive call on mixin. Mixins don't change the 'this' binding
// context; the method returned here will be bound later if needed.
final mixinMethod = mixins[i].findInstanceMethod(name);
if (mixinMethod != null) return _methodResolutionCache[name] = mixinMethod;
}
if (superclass != null) {
final superMethod = superclass!.findInstanceMethod(name);
if (superMethod != null) return _methodResolutionCache[name] = superMethod;
return null;
}
// If not found in Dart hierarchy, check bridged superclass
if (bridgedSuperclass != null) {
final methodAdapter = bridgedSuperclass!.findInstanceMethodAdapter(name);
if (methodAdapter != null) {
// We need to return something callable. Create a synthetic InterpretedFunction
// that wraps the call to the bridge adapter.
// This is complex because the adapter expects the native target directly.
// For now, return null, SPropertyAccess visitor will handle it.
return null; // Placeholder - Requires more complex handling
}
}
return null;
}