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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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) { |
| 1525 return internalLookupSelector(selector, false); | |
| 1526 } | |
| 1527 | |
| 1528 Element lookupSuperSelector(Selector selector) { | |
| 1529 return internalLookupSelector(selector, true); | |
| 1530 } | |
| 1531 | |
| 1532 Element internalLookupSelector(Selector selector, bool isSuperLookup) { | |
| 1525 SourceString name = selector.name; | 1533 SourceString name = selector.name; |
| 1526 bool isPrivate = name.isPrivate(); | 1534 bool isPrivate = name.isPrivate(); |
| 1527 LibraryElement library = selector.library; | 1535 LibraryElement library = selector.library; |
| 1528 for (ClassElement current = this; | 1536 for (ClassElement current = isSuperLookup ? getEnclosingClass() : this; |
|
kasperl
2013/03/05 08:57:42
When is the enclosing class of a class element not
ngeoffray
2013/03/05 09:09:40
That was a braino caught by tests: should have bee
| |
| 1529 current != null; | 1537 current != null; |
| 1530 current = current.superclass) { | 1538 current = current.superclass) { |
| 1531 Element member = current.lookupLocalMember(name); | 1539 Element member = current.lookupLocalMember(name); |
| 1532 if (member == null) continue; | 1540 if (member == null) continue; |
| 1533 // Private members from a different library are not visible. | 1541 // Private members from a different library are not visible. |
| 1534 if (isPrivate && !identical(library, member.getLibrary())) continue; | 1542 if (isPrivate && !identical(library, member.getLibrary())) continue; |
| 1535 // Static members are not inherited. | 1543 // Static members are not inherited. |
| 1536 if (member.modifiers.isStatic() && !identical(this, current)) continue; | 1544 if (member.modifiers.isStatic() && !identical(this, current)) { |
|
kasperl
2013/03/05 08:57:42
Fits on one line?
ngeoffray
2013/03/05 09:09:40
Done.
| |
| 1545 continue; | |
| 1546 } | |
| 1537 // If we find an abstract field we have to make sure that it has | 1547 // If we find an abstract field we have to make sure that it has |
| 1538 // the getter or setter part we're actually looking | 1548 // the getter or setter part we're actually looking |
| 1539 // for. Otherwise, we continue up the superclass chain. | 1549 // for. Otherwise, we continue up the superclass chain. |
| 1540 if (member.isAbstractField()) { | 1550 if (member.isAbstractField()) { |
| 1541 AbstractFieldElement field = member; | 1551 AbstractFieldElement field = member; |
| 1542 FunctionElement getter = field.getter; | 1552 FunctionElement getter = field.getter; |
| 1543 FunctionElement setter = field.setter; | 1553 FunctionElement setter = field.setter; |
| 1544 if (selector.isSetter()) { | 1554 if (selector.isSetter()) { |
| 1545 if (setter != null) return setter; | 1555 if (setter != null) return setter; |
| 1546 } else { | 1556 } else { |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2008 | 2018 |
| 2009 MetadataAnnotation ensureResolved(Compiler compiler) { | 2019 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2010 if (resolutionState == STATE_NOT_STARTED) { | 2020 if (resolutionState == STATE_NOT_STARTED) { |
| 2011 compiler.resolver.resolveMetadataAnnotation(this); | 2021 compiler.resolver.resolveMetadataAnnotation(this); |
| 2012 } | 2022 } |
| 2013 return this; | 2023 return this; |
| 2014 } | 2024 } |
| 2015 | 2025 |
| 2016 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2026 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2017 } | 2027 } |
| OLD | NEW |