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

Side by Side Diff: dart/lib/compiler/implementation/resolver.dart

Issue 10917170: Improve handling of built-in identifiers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 DartType getType(TypeAnnotation annotation); 8 DartType getType(TypeAnnotation annotation);
9 bool isParameterChecked(Element element); 9 bool isParameterChecked(Element element);
10 } 10 }
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 Send send = node.typeName.asSend(); 821 Send send = node.typeName.asSend();
822 return resolveTypeNameInternal(scope, typeName, send); 822 return resolveTypeNameInternal(scope, typeName, send);
823 } 823 }
824 824
825 Element resolveTypeNameInternal(Scope scope, Identifier typeName, Send send) { 825 Element resolveTypeNameInternal(Scope scope, Identifier typeName, Send send) {
826 if (send !== null) { 826 if (send !== null) {
827 typeName = send.selector; 827 typeName = send.selector;
828 } 828 }
829 if (typeName.source.stringValue === 'void') { 829 if (typeName.source.stringValue === 'void') {
830 return compiler.types.voidType.element; 830 return compiler.types.voidType.element;
831 } else if (typeName.source.stringValue === 'Dynamic') {
832 return compiler.dynamicClass;
831 } else if (send !== null) { 833 } else if (send !== null) {
832 Element e = scope.lookup(send.receiver.asIdentifier().source); 834 Element e = scope.lookup(send.receiver.asIdentifier().source);
833 if (e !== null && e.kind === ElementKind.PREFIX) { 835 if (e !== null && e.kind === ElementKind.PREFIX) {
834 // The receiver is a prefix. Lookup in the imported members. 836 // The receiver is a prefix. Lookup in the imported members.
835 PrefixElement prefix = e; 837 PrefixElement prefix = e;
836 return prefix.lookupLocalMember(typeName.source); 838 return prefix.lookupLocalMember(typeName.source);
837 } else if (e !== null && e.kind === ElementKind.CLASS) { 839 } else if (e !== null && e.kind === ElementKind.CLASS) {
838 // The receiver is the class part of a named constructor. 840 // The receiver is the class part of a named constructor.
839 return e; 841 return e;
840 } else { 842 } else {
(...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 2754
2753 Element localLookup(SourceString name) => library.find(name); 2755 Element localLookup(SourceString name) => library.find(name);
2754 Element lookup(SourceString name) => localLookup(name); 2756 Element lookup(SourceString name) => localLookup(name);
2755 Element lexicalLookup(SourceString name) => localLookup(name); 2757 Element lexicalLookup(SourceString name) => localLookup(name);
2756 2758
2757 Element add(Element newElement) { 2759 Element add(Element newElement) {
2758 throw "Cannot add an element in the top scope"; 2760 throw "Cannot add an element in the top scope";
2759 } 2761 }
2760 String toString() => '$element'; 2762 String toString() => '$element';
2761 } 2763 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698