Index: runtime/vm/flow_graph_builder.cc |
=================================================================== |
--- runtime/vm/flow_graph_builder.cc (revision 13198) |
+++ runtime/vm/flow_graph_builder.cc (working copy) |
@@ -1994,7 +1994,31 @@ |
arguments->Add(PushArgument(receiver_value.value())); |
} else { |
getter_function = node->cls().LookupStaticFunction(getter_name); |
- ASSERT(!getter_function.IsNull()); |
+ if (getter_function.IsNull()) { |
+ // A StaticGetterNode without a function is created by the parser when |
+ // a corresponding setter exists so that the getter can be transformed |
+ // into the setter. In this case, the fake getter was not transformed into |
+ // a setter, so we throw a NoSuchMethodError. |
srdjan
2012/10/03 23:28:03
The comment is not very clear.
regis
2012/10/04 00:12:23
I tried to improve it.
|
+ // Location argument. |
+ Value* call_pos = Bind( |
+ new ConstantInstr(Smi::ZoneHandle(Smi::New(node->token_pos())))); |
+ arguments->Add(PushArgument(call_pos)); |
+ // Function name argument. |
+ const String& method_name = String::ZoneHandle(Symbols::New(getter_name)); |
+ Value* method_name_value = Bind(new ConstantInstr(method_name)); |
+ arguments->Add(PushArgument(method_name_value)); |
+ const String& cls_name = String::Handle(Symbols::NoSuchMethodError()); |
+ const String& func_name = String::Handle(Symbols::ThrowNew()); |
+ const Class& cls = Class::Handle( |
+ Library::Handle(Library::CoreImplLibrary()).LookupClass(cls_name)); |
+ ASSERT(!cls.IsNull()); |
+ getter_function = Resolver::ResolveStatic(cls, |
+ func_name, |
+ arguments->length(), |
+ Array::ZoneHandle(), |
+ Resolver::kIsQualified); |
+ ASSERT(!getter_function.IsNull()); |
+ } |
} |
StaticCallInstr* call = new StaticCallInstr(node->token_pos(), |
getter_function, |