| 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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 } else { | 694 } else { |
| 695 visit(node.argumentsNode); | 695 visit(node.argumentsNode); |
| 696 mapping.setSelector(node, Selector.BINARY_OPERATOR); | 696 mapping.setSelector(node, Selector.BINARY_OPERATOR); |
| 697 } | 697 } |
| 698 } else if (node.isIndex) { | 698 } else if (node.isIndex) { |
| 699 visit(node.argumentsNode); | 699 visit(node.argumentsNode); |
| 700 assert(node.arguments.tail.isEmpty()); | 700 assert(node.arguments.tail.isEmpty()); |
| 701 mapping.setSelector(node, Selector.INDEX); | 701 mapping.setSelector(node, Selector.INDEX); |
| 702 } else if (node.isPropertyAccess) { | 702 } else if (node.isPropertyAccess) { |
| 703 mapping.setSelector(node, Selector.GETTER); | 703 mapping.setSelector(node, Selector.GETTER); |
| 704 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { | |
| 705 AbstractFieldElement field = target; | |
| 706 target = field.getter; | |
| 707 } | |
| 708 } else { | 704 } else { |
| 709 handleArguments(node); | 705 handleArguments(node); |
| 710 } | 706 } |
| 707 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { |
| 708 AbstractFieldElement field = target; |
| 709 target = field.getter; |
| 710 } |
| 711 // TODO(ngeoffray): Warn if target is null and the send is | 711 // TODO(ngeoffray): Warn if target is null and the send is |
| 712 // unqualified. | 712 // unqualified. |
| 713 return useElement(node, target); | 713 return useElement(node, target); |
| 714 } | 714 } |
| 715 | 715 |
| 716 visitSendSet(SendSet node) { | 716 visitSendSet(SendSet node) { |
| 717 Element target = resolveSend(node); | 717 Element target = resolveSend(node); |
| 718 Element setter = null; | 718 Element setter = null; |
| 719 Element getter = null; | 719 Element getter = null; |
| 720 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { | 720 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 class TopScope extends Scope { | 1292 class TopScope extends Scope { |
| 1293 LibraryElement get library() => element; | 1293 LibraryElement get library() => element; |
| 1294 | 1294 |
| 1295 TopScope(LibraryElement library) : super(null, library); | 1295 TopScope(LibraryElement library) : super(null, library); |
| 1296 Element lookup(SourceString name) => library.find(name); | 1296 Element lookup(SourceString name) => library.find(name); |
| 1297 | 1297 |
| 1298 Element add(Element element) { | 1298 Element add(Element element) { |
| 1299 throw "Cannot add an element in the top scope"; | 1299 throw "Cannot add an element in the top scope"; |
| 1300 } | 1300 } |
| 1301 } | 1301 } |
| OLD | NEW |