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

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

Issue 9309061: Implement script tags. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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
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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 // TODO(ngeoffray): The lookup should continue on super 570 // TODO(ngeoffray): The lookup should continue on super
571 // classes. 571 // classes.
572 target = superElement.lookupLocalMember(name); 572 target = superElement.lookupLocalMember(name);
573 } 573 }
574 if (target === null) { 574 if (target === null) {
575 error(node, 575 error(node,
576 MessageKind.METHOD_NOT_FOUND, 576 MessageKind.METHOD_NOT_FOUND,
577 [superElement.name, name]); 577 [superElement.name, name]);
578 } 578 }
579 } 579 }
580 } else if (resolvedReceiver !== null 580 } else if (resolvedReceiver === null) {
581 && resolvedReceiver.kind === ElementKind.CLASS) { 581 return null;
582 } else if (resolvedReceiver.kind === ElementKind.CLASS) {
582 ClassElement receiverClass = resolvedReceiver; 583 ClassElement receiverClass = resolvedReceiver;
583 target = receiverClass.resolve(compiler).lookupLocalMember(name); 584 target = receiverClass.resolve(compiler).lookupLocalMember(name);
584 if (target === null) { 585 if (target === null) {
585 error(node, MessageKind.METHOD_NOT_FOUND, [receiverClass.name, name]); 586 error(node, MessageKind.METHOD_NOT_FOUND, [receiverClass.name, name]);
586 } else if (target.isInstanceMember()) { 587 } else if (target.isInstanceMember()) {
587 error(node, MessageKind.MEMBER_NOT_STATIC, 588 error(node, MessageKind.MEMBER_NOT_STATIC,
588 [receiverClass.name, name]); 589 [receiverClass.name, name]);
589 } 590 }
591 } else if (resolvedReceiver.kind === ElementKind.PREFIX) {
592 PrefixElement prefix = resolvedReceiver;
593 target = prefix.library.lookupLocalMember(name);
594 if (target == null) {
595 error(node, MessageKind.NO_SUCH_LIBRARY_MEMBER,
596 [resolvedReceiver.name, name]);
597 }
590 } 598 }
591 } 599 }
592 return target; 600 return target;
593 } 601 }
594 602
595 resolveTypeTest(TypeAnnotation node) { 603 resolveTypeTest(TypeAnnotation node) {
596 ClassElement cls = resolveTypeRequired(node); 604 ClassElement cls = resolveTypeRequired(node);
597 if (cls.name == const SourceString('String') || 605 if (cls.name == const SourceString('String') ||
598 cls.name == const SourceString('List') || 606 cls.name == const SourceString('List') ||
599 cls.name == const SourceString('int') || 607 cls.name == const SourceString('int') ||
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 class TopScope extends Scope { 1168 class TopScope extends Scope {
1161 LibraryElement library; 1169 LibraryElement library;
1162 1170
1163 TopScope(LibraryElement this.library) : super(null, null); 1171 TopScope(LibraryElement this.library) : super(null, null);
1164 Element lookup(SourceString name) => library.find(name); 1172 Element lookup(SourceString name) => library.find(name);
1165 1173
1166 Element add(Element element) { 1174 Element add(Element element) {
1167 throw "Cannot add an element in the top scope"; 1175 throw "Cannot add an element in the top scope";
1168 } 1176 }
1169 } 1177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698