Index: runtime/vm/flow_graph_builder.cc |
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc |
index 63bdb2473654b5a8bc1386ba554e5dff4186d9f8..a6889e4690d544fa5eac8cd8803b95a6f7463ec8 100644 |
--- a/runtime/vm/flow_graph_builder.cc |
+++ b/runtime/vm/flow_graph_builder.cc |
@@ -4442,8 +4442,23 @@ StaticCallInstr* EffectGraphVisitor::BuildStaticNoSuchMethodCall( |
*method_arguments, |
temp, |
is_super_invocation); |
- const Function& no_such_method_func = Function::ZoneHandle(Z, |
- Resolver::ResolveDynamicAnyArgs(target_class, Symbols::NoSuchMethod())); |
+ // Make sure we resolve to a compatible noSuchMethod, otherwise call |
+ // noSuchMethod of class Object. |
+ const int kNumArguments = 2; |
+ ArgumentsDescriptor args_desc( |
+ Array::Handle(ArgumentsDescriptor::New(kNumArguments))); |
srdjan
2016/02/09 23:48:09
Handle(Z,
regis
2016/02/10 00:06:46
Done.
Actually, ZoneHandle(Z,
|
+ Function& no_such_method_func = Function::ZoneHandle(Z, |
+ Resolver::ResolveDynamicForReceiverClass(target_class, |
+ Symbols::NoSuchMethod(), |
+ args_desc)); |
+ if (no_such_method_func.IsNull()) { |
+ const Class& object_class = |
+ Class::ZoneHandle(Z, isolate()->object_store()->object_class()); |
+ no_such_method_func = |
+ Resolver::ResolveDynamicForReceiverClass(object_class, |
+ Symbols::NoSuchMethod(), |
+ args_desc); |
+ } |
// We are guaranteed to find noSuchMethod of class Object. |
ASSERT(!no_such_method_func.IsNull()); |
ZoneGrowableArray<PushArgumentInstr*>* push_arguments = |