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

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

Issue 11021008: Added 'dynamic' keyword, so that 'Dynamic' can be deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 abstract class TreeElements { 5 abstract class 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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 Send send = node.typeName.asSend(); 848 Send send = node.typeName.asSend();
849 return resolveTypeNameInternal(scope, typeName, send); 849 return resolveTypeNameInternal(scope, typeName, send);
850 } 850 }
851 851
852 Element resolveTypeNameInternal(Scope scope, Identifier typeName, Send send) { 852 Element resolveTypeNameInternal(Scope scope, Identifier typeName, Send send) {
853 if (send !== null) { 853 if (send !== null) {
854 typeName = send.selector; 854 typeName = send.selector;
855 } 855 }
856 if (typeName.source.stringValue === 'void') { 856 if (typeName.source.stringValue === 'void') {
857 return compiler.types.voidType.element; 857 return compiler.types.voidType.element;
858 } else if (typeName.source.stringValue === 'Dynamic') { 858 } else if (
859 // TODO(aprelev@gmail.com): Remove deprecated Dynamic keyword support.
860 typeName.source.stringValue === 'Dynamic'
861 || typeName.source.stringValue === 'dynamic') {
859 return compiler.dynamicClass; 862 return compiler.dynamicClass;
860 } else if (send !== null) { 863 } else if (send !== null) {
861 Element e = scope.lookup(send.receiver.asIdentifier().source); 864 Element e = scope.lookup(send.receiver.asIdentifier().source);
862 if (e !== null && e.kind === ElementKind.PREFIX) { 865 if (e !== null && e.kind === ElementKind.PREFIX) {
863 // The receiver is a prefix. Lookup in the imported members. 866 // The receiver is a prefix. Lookup in the imported members.
864 PrefixElement prefix = e; 867 PrefixElement prefix = e;
865 return prefix.lookupLocalMember(typeName.source); 868 return prefix.lookupLocalMember(typeName.source);
866 } else if (e !== null && e.kind === ElementKind.CLASS) { 869 } else if (e !== null && e.kind === ElementKind.CLASS) {
867 // The receiver is the class part of a named constructor. 870 // The receiver is the class part of a named constructor.
868 return e; 871 return e;
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 2883
2881 Element localLookup(SourceString name) => library.find(name); 2884 Element localLookup(SourceString name) => library.find(name);
2882 Element lookup(SourceString name) => localLookup(name); 2885 Element lookup(SourceString name) => localLookup(name);
2883 Element lexicalLookup(SourceString name) => localLookup(name); 2886 Element lexicalLookup(SourceString name) => localLookup(name);
2884 2887
2885 Element add(Element newElement) { 2888 Element add(Element newElement) {
2886 throw "Cannot add an element in the top scope"; 2889 throw "Cannot add an element in the top scope";
2887 } 2890 }
2888 String toString() => '$element'; 2891 String toString() => '$element';
2889 } 2892 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698