Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: dart/frog/leg/resolver.dart

Issue 9692018: Unresolved super-send is not a compile-time error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review coments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/frog/leg/compiler.dart ('k') | dart/frog/leg/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // [target] may be null which means invoking noSuchMethod on
728 error(node.selector, MessageKind.METHOD_NOT_FOUND, 733 // super.
ngeoffray 2012/03/13 11:32:30 No warning?
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
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 }
OLDNEW
« no previous file with comments | « dart/frog/leg/compiler.dart ('k') | dart/frog/leg/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698