Chromium Code Reviews| Index: runtime/vm/ast.cc |
| diff --git a/runtime/vm/ast.cc b/runtime/vm/ast.cc |
| index 26618b51f23308e76dfb7051f3f86006c1836b62..319ecd1bdb21f4da53504d9d8dc9d5cda24d9329 100644 |
| --- a/runtime/vm/ast.cc |
| +++ b/runtime/vm/ast.cc |
| @@ -572,9 +572,11 @@ AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) { |
| if (is_super_getter()) { |
| ASSERT(receiver() != NULL); |
| const String& setter_name = |
| - String::ZoneHandle(zone, Field::SetterSymbol(field_name_)); |
| - Function& setter = Function::ZoneHandle(zone, |
| - Resolver::ResolveDynamicAnyArgs(cls(), setter_name)); |
| + String::ZoneHandle(zone, Field::LookupSetterSymbol(field_name_)); |
| + Function& setter = Function::ZoneHandle(zone); |
| + if (!setter_name.IsNull()) { |
| + setter = Resolver::ResolveDynamicAnyArgs(cls(), setter_name); |
|
hausner
2015/09/03 20:48:49
Extra space after =
srdjan
2015/09/03 20:55:36
Done.
|
| + } |
| if (setter.IsNull() || setter.is_abstract()) { |
| // No instance setter found in super class chain, |
| // noSuchMethod will be called at runtime. |
| @@ -618,15 +620,17 @@ AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) { |
| } |
| // No field found in prefix. Look for a setter function. |
| - const String& setter_name = String::Handle(zone, |
| - Field::SetterName(field_name_)); |
| - obj = prefix.LookupObject(setter_name); |
| - if (obj.IsFunction()) { |
| - const Function& setter = Function::ZoneHandle(zone, |
| - Function::Cast(obj).raw()); |
| - ASSERT(setter.is_static() && setter.IsSetterFunction()); |
| - return new StaticSetterNode( |
| - token_pos(), NULL, field_name_, setter, rhs); |
| + const String& setter_name = |
| + String::Handle(zone, Field::LookupSetterSymbol(field_name_)); |
| + if (!setter_name.IsNull()) { |
| + obj = prefix.LookupObject(setter_name); |
| + if (obj.IsFunction()) { |
| + const Function& setter = |
| + Function::ZoneHandle(zone, Function::Cast(obj).raw()); |
| + ASSERT(setter.is_static() && setter.IsSetterFunction()); |
| + return new StaticSetterNode( |
| + token_pos(), NULL, field_name_, setter, rhs); |
| + } |
| } |
| // No writeable field and no setter found in the prefix. Return a |
| @@ -651,14 +655,17 @@ AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) { |
| } |
| // No field found in library. Look for a setter function. |
| - const String& setter_name = String::Handle(zone, |
| - Field::SetterName(field_name_)); |
| - obj = library.ResolveName(setter_name); |
| - if (obj.IsFunction()) { |
| - const Function& setter = Function::ZoneHandle(zone, |
| - Function::Cast(obj).raw()); |
| - ASSERT(setter.is_static() && setter.IsSetterFunction()); |
| - return new StaticSetterNode(token_pos(), NULL, field_name_, setter, rhs); |
| + const String& setter_name = |
| + String::Handle(zone, Field::LookupSetterSymbol(field_name_)); |
| + if (!setter_name.IsNull()) { |
| + obj = library.ResolveName(setter_name); |
| + if (obj.IsFunction()) { |
| + const Function& setter = |
| + Function::ZoneHandle(zone, Function::Cast(obj).raw()); |
| + ASSERT(setter.is_static() && setter.IsSetterFunction()); |
| + return |
| + new StaticSetterNode(token_pos(), NULL, field_name_, setter, rhs); |
| + } |
| } |
| // No writeable field and no setter found in the library. Return a |
| @@ -685,8 +692,8 @@ AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) { |
| return new StaticSetterNode(token_pos(), NULL, cls(), field_name_, rhs); |
| } |
| #if defined(DEBUG) |
| - const String& getter_name = String::Handle(zone, |
| - Field::GetterName(field_name_)); |
| + const String& getter_name = |
|
hausner
2015/09/03 20:48:49
Is getter_name_ guaranteed to be non-null? If not,
srdjan
2015/09/03 20:55:36
The assert below says getter must exist. Adding AS
|
| + String::Handle(zone, Field::LookupGetterSymbol(field_name_)); |
| const Function& getter = |
| Function::Handle(zone, cls().LookupStaticFunction(getter_name)); |
| ASSERT(!getter.IsNull() && |
| @@ -741,7 +748,10 @@ const Instance* StaticGetterNode::EvalConstExpr() const { |
| return NULL; |
| } |
| const String& getter_name = |
| - String::Handle(Field::GetterName(this->field_name())); |
| + String::Handle(Field::LookupGetterSymbol(this->field_name())); |
| + if (getter_name.IsNull()) { |
| + return NULL; |
| + } |
| const Function& getter_func = |
| Function::Handle(this->cls().LookupStaticFunction(getter_name)); |
| if (getter_func.IsNull() || !getter_func.is_const()) { |