Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library elements.modelx; | 5 library elements.modelx; |
| 6 | 6 |
| 7 import 'dart:uri'; | 7 import 'dart:uri'; |
| 8 import 'dart:collection' show LinkedHashMap; | 8 import 'dart:collection' show LinkedHashMap; |
| 9 | 9 |
| 10 import 'elements.dart'; | 10 import 'elements.dart'; |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1514 /** | 1514 /** |
| 1515 * Find the first member in the class chain with the given [selector]. | 1515 * Find the first member in the class chain with the given [selector]. |
| 1516 * | 1516 * |
| 1517 * This method is NOT to be used for resolving | 1517 * This method is NOT to be used for resolving |
| 1518 * unqualified sends because it does not implement the scoping | 1518 * unqualified sends because it does not implement the scoping |
| 1519 * rules, where library scope comes before superclass scope. | 1519 * rules, where library scope comes before superclass scope. |
| 1520 * | 1520 * |
| 1521 * When called on the implementation element both members declared in the | 1521 * When called on the implementation element both members declared in the |
| 1522 * origin and the patch class are returned. | 1522 * origin and the patch class are returned. |
| 1523 */ | 1523 */ |
| 1524 Element lookupSelector(Selector selector) { | 1524 Element lookupSelector(Selector selector, {bool superLookup: false}) { |
| 1525 SourceString name = selector.name; | 1525 SourceString name = selector.name; |
| 1526 bool isPrivate = name.isPrivate(); | 1526 bool isPrivate = name.isPrivate(); |
| 1527 LibraryElement library = selector.library; | 1527 LibraryElement library = selector.library; |
| 1528 for (ClassElement current = this; | 1528 for (ClassElement current = this; |
| 1529 current != null; | 1529 current != null; |
| 1530 current = current.superclass) { | 1530 current = current.superclass) { |
| 1531 Element member = current.lookupLocalMember(name); | 1531 Element member = current.lookupLocalMember(name); |
| 1532 if (member == null) continue; | 1532 if (member == null) continue; |
| 1533 // Private members from a different library are not visible. | 1533 // Private members from a different library are not visible. |
| 1534 if (isPrivate && !identical(library, member.getLibrary())) continue; | 1534 if (isPrivate && !identical(library, member.getLibrary())) continue; |
| 1535 // Static members are not inherited. | 1535 // Static members are not inherited. |
| 1536 if (member.modifiers.isStatic() && !identical(this, current)) continue; | 1536 if (member.modifiers.isStatic() && |
| 1537 (superLookup || !identical(this, current))) { | |
|
kasperl
2013/03/05 07:32:36
Hmm. It sounds like superLookup means something di
ngeoffray
2013/03/05 08:46:25
The lookup rules are different when you're looking
| |
| 1538 continue; | |
| 1539 } | |
| 1537 // If we find an abstract field we have to make sure that it has | 1540 // If we find an abstract field we have to make sure that it has |
| 1538 // the getter or setter part we're actually looking | 1541 // the getter or setter part we're actually looking |
| 1539 // for. Otherwise, we continue up the superclass chain. | 1542 // for. Otherwise, we continue up the superclass chain. |
| 1540 if (member.isAbstractField()) { | 1543 if (member.isAbstractField()) { |
| 1541 AbstractFieldElement field = member; | 1544 AbstractFieldElement field = member; |
| 1542 FunctionElement getter = field.getter; | 1545 FunctionElement getter = field.getter; |
| 1543 FunctionElement setter = field.setter; | 1546 FunctionElement setter = field.setter; |
| 1544 if (selector.isSetter()) { | 1547 if (selector.isSetter()) { |
| 1545 if (setter != null) return setter; | 1548 if (setter != null) return setter; |
| 1546 } else { | 1549 } else { |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2008 | 2011 |
| 2009 MetadataAnnotation ensureResolved(Compiler compiler) { | 2012 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2010 if (resolutionState == STATE_NOT_STARTED) { | 2013 if (resolutionState == STATE_NOT_STARTED) { |
| 2011 compiler.resolver.resolveMetadataAnnotation(this); | 2014 compiler.resolver.resolveMetadataAnnotation(this); |
| 2012 } | 2015 } |
| 2013 return this; | 2016 return this; |
| 2014 } | 2017 } |
| 2015 | 2018 |
| 2016 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2019 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2017 } | 2020 } |
| OLD | NEW |