| 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 interface TreeElements { | 5 interface TreeElements { |
| 6 Element operator[](Node node); | 6 Element operator[](Node node); |
| 7 Selector getSelector(Send send); | 7 Selector getSelector(Send send); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class TreeElementMapping implements TreeElements { | 10 class TreeElementMapping implements TreeElements { |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 class ClassScope extends Scope { | 1546 class ClassScope extends Scope { |
| 1547 ClassScope(ClassElement element, LibraryElement library) | 1547 ClassScope(ClassElement element, LibraryElement library) |
| 1548 : super(new TopScope(library), element); | 1548 : super(new TopScope(library), element); |
| 1549 | 1549 |
| 1550 Element lookup(SourceString name) { | 1550 Element lookup(SourceString name) { |
| 1551 ClassElement cls = element; | 1551 ClassElement cls = element; |
| 1552 Element element = cls.lookupLocalMember(name); | 1552 Element element = cls.lookupLocalMember(name); |
| 1553 if (element != null) return element; | 1553 if (element != null) return element; |
| 1554 element = parent.lookup(name); | 1554 element = parent.lookup(name); |
| 1555 if (element != null) return element; | 1555 if (element != null) return element; |
| 1556 // TODO(ngeoffray): Lookup in the super class. | 1556 return cls.lookupSuperMember(name); |
| 1557 return null; | |
| 1558 } | 1557 } |
| 1559 | 1558 |
| 1560 Element add(Element element) { | 1559 Element add(Element element) { |
| 1561 throw "Cannot add an element in a class scope"; | 1560 throw "Cannot add an element in a class scope"; |
| 1562 } | 1561 } |
| 1563 } | 1562 } |
| 1564 | 1563 |
| 1565 class TopScope extends Scope { | 1564 class TopScope extends Scope { |
| 1566 LibraryElement get library() => element; | 1565 LibraryElement get library() => element; |
| 1567 | 1566 |
| 1568 TopScope(LibraryElement library) : super(null, library); | 1567 TopScope(LibraryElement library) : super(null, library); |
| 1569 Element lookup(SourceString name) => library.find(name); | 1568 Element lookup(SourceString name) => library.find(name); |
| 1570 | 1569 |
| 1571 Element add(Element element) { | 1570 Element add(Element element) { |
| 1572 throw "Cannot add an element in the top scope"; | 1571 throw "Cannot add an element in the top scope"; |
| 1573 } | 1572 } |
| 1574 } | 1573 } |
| OLD | NEW |