OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
6 | 6 |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 ErrorMsg("class '%s' does not have a superclass", | 1535 ErrorMsg("class '%s' does not have a superclass", |
1536 String::Handle(current_class().Name()).ToCString()); | 1536 String::Handle(current_class().Name()).ToCString()); |
1537 } | 1537 } |
1538 AstNode* implicit_argument = LoadReceiver(field_pos); | 1538 AstNode* implicit_argument = LoadReceiver(field_pos); |
1539 | 1539 |
1540 const String& getter_name = | 1540 const String& getter_name = |
1541 String::ZoneHandle(Field::GetterName(field_name)); | 1541 String::ZoneHandle(Field::GetterName(field_name)); |
1542 const Function& super_getter = Function::ZoneHandle( | 1542 const Function& super_getter = Function::ZoneHandle( |
1543 Resolver::ResolveDynamicAnyArgs(super_class, getter_name)); | 1543 Resolver::ResolveDynamicAnyArgs(super_class, getter_name)); |
1544 if (super_getter.IsNull()) { | 1544 if (super_getter.IsNull()) { |
| 1545 const String& setter_name = |
| 1546 String::ZoneHandle(Field::SetterName(field_name)); |
| 1547 const Function& super_setter = Function::ZoneHandle( |
| 1548 Resolver::ResolveDynamicAnyArgs(super_class, setter_name)); |
| 1549 if (!super_setter.IsNull()) { |
| 1550 return new StaticGetterNode( |
| 1551 field_pos, implicit_argument, true, super_class, field_name); |
| 1552 } |
| 1553 } |
| 1554 if (super_getter.IsNull()) { |
1545 // Check if this is an access to an implicit closure using 'super'. | 1555 // Check if this is an access to an implicit closure using 'super'. |
1546 // If a function exists of the specified field_name then try | 1556 // If a function exists of the specified field_name then try |
1547 // accessing it as a getter, at runtime we will handle this by | 1557 // accessing it as a getter, at runtime we will handle this by |
1548 // creating an implicit closure of the function and returning it. | 1558 // creating an implicit closure of the function and returning it. |
1549 const Function& super_function = Function::ZoneHandle( | 1559 const Function& super_function = Function::ZoneHandle( |
1550 Resolver::ResolveDynamicAnyArgs(super_class, field_name)); | 1560 Resolver::ResolveDynamicAnyArgs(super_class, field_name)); |
1551 if (super_function.IsNull()) { | 1561 if (super_function.IsNull()) { |
1552 ErrorMsg(field_pos, "field or getter '%s' not found in superclass", | 1562 ErrorMsg(field_pos, "field or getter '%s' not found in superclass", |
1553 field_name.ToCString()); | 1563 field_name.ToCString()); |
1554 } | 1564 } |
(...skipping 8199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9754 void Parser::SkipQualIdent() { | 9764 void Parser::SkipQualIdent() { |
9755 ASSERT(IsIdentifier()); | 9765 ASSERT(IsIdentifier()); |
9756 ConsumeToken(); | 9766 ConsumeToken(); |
9757 if (CurrentToken() == Token::kPERIOD) { | 9767 if (CurrentToken() == Token::kPERIOD) { |
9758 ConsumeToken(); // Consume the kPERIOD token. | 9768 ConsumeToken(); // Consume the kPERIOD token. |
9759 ExpectIdentifier("identifier expected after '.'"); | 9769 ExpectIdentifier("identifier expected after '.'"); |
9760 } | 9770 } |
9761 } | 9771 } |
9762 | 9772 |
9763 } // namespace dart | 9773 } // namespace dart |
OLD | NEW |