| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 allowedCategory |= | 761 allowedCategory |= |
| 762 ElementCategory.CLASS | ElementCategory.PREFIX | ElementCategory.SUPER; | 762 ElementCategory.CLASS | ElementCategory.PREFIX | ElementCategory.SUPER; |
| 763 Element resolvedReceiver = visit(node.receiver); | 763 Element resolvedReceiver = visit(node.receiver); |
| 764 allowedCategory = oldCategory; | 764 allowedCategory = oldCategory; |
| 765 | 765 |
| 766 Element target; | 766 Element target; |
| 767 SourceString name = node.selector.asIdentifier().source; | 767 SourceString name = node.selector.asIdentifier().source; |
| 768 if (name.stringValue === 'this') { | 768 if (name.stringValue === 'this') { |
| 769 error(node.selector, MessageKind.GENERIC, ["expected an identifier"]); | 769 error(node.selector, MessageKind.GENERIC, ["expected an identifier"]); |
| 770 } else if (node.isSuperCall) { | 770 } else if (node.isSuperCall) { |
| 771 if (isUserDefinableOperator(name.stringValue)) { | 771 if (node.isOperator) { |
| 772 name = Elements.constructOperatorName(const SourceString('operator'), | 772 if (isUserDefinableOperator(name.stringValue)) { |
| 773 name); | 773 name = Elements.constructOperatorName(const SourceString('operator'), |
| 774 name); |
| 775 } else { |
| 776 error(node.selector, MessageKind.ILLEGAL_SUPER_SEND, [name]); |
| 777 } |
| 774 } | 778 } |
| 775 if (!inInstanceContext) { | 779 if (!inInstanceContext) { |
| 776 error(node.receiver, MessageKind.NO_INSTANCE_AVAILABLE, [name]); | 780 error(node.receiver, MessageKind.NO_INSTANCE_AVAILABLE, [name]); |
| 777 return null; | 781 return null; |
| 778 } | 782 } |
| 779 if (currentClass.supertype === null) { | 783 if (currentClass.supertype === null) { |
| 780 // This is just to guard against internal errors, so no need | 784 // This is just to guard against internal errors, so no need |
| 781 // for a real error message. | 785 // for a real error message. |
| 782 error(node.receiver, MessageKind.GENERIC, ["Object has no superclass"]); | 786 error(node.receiver, MessageKind.GENERIC, ["Object has no superclass"]); |
| 783 } | 787 } |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 | 1780 |
| 1777 TopScope(LibraryElement library) : super(null, library); | 1781 TopScope(LibraryElement library) : super(null, library); |
| 1778 Element lookup(SourceString name) { | 1782 Element lookup(SourceString name) { |
| 1779 return library.find(name); | 1783 return library.find(name); |
| 1780 } | 1784 } |
| 1781 | 1785 |
| 1782 Element add(Element element) { | 1786 Element add(Element element) { |
| 1783 throw "Cannot add an element in the top scope"; | 1787 throw "Cannot add an element in the top scope"; |
| 1784 } | 1788 } |
| 1785 } | 1789 } |
| OLD | NEW |