Chromium Code Reviews| 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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 716 SourceString name = node.selector.asIdentifier().source; | 716 SourceString name = node.selector.asIdentifier().source; |
| 717 if (node.isSuperCall) { | 717 if (node.isSuperCall) { |
| 718 if (isUserDefinableOperator(name.stringValue)) { | 718 if (isUserDefinableOperator(name.stringValue)) { |
| 719 name = Elements.constructOperatorName(const SourceString('operator'), | 719 name = Elements.constructOperatorName(const SourceString('operator'), |
| 720 name); | 720 name); |
| 721 } | 721 } |
| 722 if (!inInstanceContext) { | 722 if (!inInstanceContext) { |
| 723 error(node.receiver, MessageKind.NO_INSTANCE_AVAILABLE, [name]); | 723 error(node.receiver, MessageKind.NO_INSTANCE_AVAILABLE, [name]); |
| 724 return null; | 724 return null; |
| 725 } | 725 } |
| 726 if (currentClass.supertype === null) { | |
| 727 // This is just to guard against internal errors, so no need | |
| 728 // for a real error message. | |
| 729 error(node.receiver, MessageKind.GENERIC, "Object has no superclass"); | |
| 730 } | |
| 726 target = currentClass.lookupSuperMember(name); | 731 target = currentClass.lookupSuperMember(name); |
| 727 if (target === null) { | 732 // It is OK for target to be null, it means invoking |
|
kasperl
2012/03/13 08:55:30
Maybe rephrase: That target can be null which mean
ahe
2012/03/13 09:12:11
Done.
| |
| 728 error(node.selector, MessageKind.METHOD_NOT_FOUND, | 733 // noSuchMethod on super. |
| 729 [currentClass.superclass.name, name]); | |
| 730 } | |
| 731 } else if (resolvedReceiver === null) { | 734 } else if (resolvedReceiver === null) { |
| 732 return null; | 735 return null; |
| 733 } else if (resolvedReceiver.kind === ElementKind.CLASS) { | 736 } else if (resolvedReceiver.kind === ElementKind.CLASS) { |
| 734 ClassElement receiverClass = resolvedReceiver; | 737 ClassElement receiverClass = resolvedReceiver; |
| 735 target = receiverClass.ensureResolved(compiler).lookupLocalMember(name); | 738 target = receiverClass.ensureResolved(compiler).lookupLocalMember(name); |
| 736 if (target === null) { | 739 if (target === null) { |
| 737 error(node, MessageKind.METHOD_NOT_FOUND, [receiverClass.name, name]); | 740 error(node, MessageKind.METHOD_NOT_FOUND, [receiverClass.name, name]); |
| 738 } else if (target.isInstanceMember()) { | 741 } else if (target.isInstanceMember()) { |
| 739 error(node, MessageKind.MEMBER_NOT_STATIC, [receiverClass.name, name]); | 742 error(node, MessageKind.MEMBER_NOT_STATIC, [receiverClass.name, name]); |
| 740 } | 743 } |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1558 class TopScope extends Scope { | 1561 class TopScope extends Scope { |
| 1559 LibraryElement get library() => element; | 1562 LibraryElement get library() => element; |
| 1560 | 1563 |
| 1561 TopScope(LibraryElement library) : super(null, library); | 1564 TopScope(LibraryElement library) : super(null, library); |
| 1562 Element lookup(SourceString name) => library.find(name); | 1565 Element lookup(SourceString name) => library.find(name); |
| 1563 | 1566 |
| 1564 Element add(Element element) { | 1567 Element add(Element element) { |
| 1565 throw "Cannot add an element in the top scope"; | 1568 throw "Cannot add an element in the top scope"; |
| 1566 } | 1569 } |
| 1567 } | 1570 } |
| OLD | NEW |