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

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

Issue 11090016: Change core lib, dart2js, and more for new optional parameters syntax (Closed) Base URL: http://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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 } else { 1004 } else {
1005 return scope.lookup(typeName.source); 1005 return scope.lookup(typeName.source);
1006 } 1006 }
1007 } 1007 }
1008 1008
1009 // TODO(johnniwinther): Change [onFailure] and [whenResolved] to use boolean 1009 // TODO(johnniwinther): Change [onFailure] and [whenResolved] to use boolean
1010 // flags instead of closures. 1010 // flags instead of closures.
1011 // TODO(johnniwinther): Should never return [null] but instead an erroneous 1011 // TODO(johnniwinther): Should never return [null] but instead an erroneous
1012 // type. 1012 // type.
1013 DartType resolveTypeAnnotation(TypeAnnotation node, 1013 DartType resolveTypeAnnotation(TypeAnnotation node,
1014 [Scope inScope, ClassElement inClass, 1014 {Scope inScope, ClassElement inClass,
1015 onFailure(Node, MessageKind, [List arguments]), 1015 onFailure(Node, MessageKind, [List arguments]),
1016 whenResolved(Node, Type)]) { 1016 whenResolved(Node, Type)}) {
1017 if (onFailure === null) { 1017 if (onFailure === null) {
1018 onFailure = (n, k, [arguments]) {}; 1018 onFailure = (n, k, [arguments]) {};
1019 } 1019 }
1020 if (whenResolved === null) { 1020 if (whenResolved === null) {
1021 whenResolved = (n, t) {}; 1021 whenResolved = (n, t) {};
1022 } 1022 }
1023 if (inClass !== null) { 1023 if (inClass !== null) {
1024 inScope = inClass.buildScope(); 1024 inScope = inClass.buildScope();
1025 } 1025 }
1026 if (inScope === null) { 1026 if (inScope === null) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 if (type !== null) { 1238 if (type !== null) {
1239 if (inCheckContext) { 1239 if (inCheckContext) {
1240 compiler.enqueuer.resolution.registerIsCheck(type); 1240 compiler.enqueuer.resolution.registerIsCheck(type);
1241 } 1241 }
1242 return type.element; 1242 return type.element;
1243 } 1243 }
1244 return null; 1244 return null;
1245 } 1245 }
1246 1246
1247 Element defineElement(Node node, Element element, 1247 Element defineElement(Node node, Element element,
1248 [bool doAddToScope = true]) { 1248 {bool doAddToScope: true}) {
1249 compiler.ensure(element !== null); 1249 compiler.ensure(element !== null);
1250 mapping[node] = element; 1250 mapping[node] = element;
1251 if (doAddToScope) { 1251 if (doAddToScope) {
1252 Element existing = scope.add(element); 1252 Element existing = scope.add(element);
1253 if (existing != element) { 1253 if (existing != element) {
1254 error(node, MessageKind.DUPLICATE_DEFINITION, [node]); 1254 error(node, MessageKind.DUPLICATE_DEFINITION, [node]);
1255 } 1255 }
1256 } 1256 }
1257 return element; 1257 return element;
1258 } 1258 }
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 // [constructor.defaultImplementation] might be the implementation element 1827 // [constructor.defaultImplementation] might be the implementation element
1828 // and only declaration elements may be registered. 1828 // and only declaration elements may be registered.
1829 world.registerStaticUse(constructor.defaultImplementation.declaration); 1829 world.registerStaticUse(constructor.defaultImplementation.declaration);
1830 ClassElement cls = constructor.defaultImplementation.getEnclosingClass(); 1830 ClassElement cls = constructor.defaultImplementation.getEnclosingClass();
1831 // [cls] might be the implementation element and only declaration elements 1831 // [cls] might be the implementation element and only declaration elements
1832 // may be registered. 1832 // may be registered.
1833 world.registerInstantiatedClass(cls.declaration); 1833 world.registerInstantiatedClass(cls.declaration);
1834 // [cls] might be the declaration element and we want to include injected 1834 // [cls] might be the declaration element and we want to include injected
1835 // members. 1835 // members.
1836 cls.implementation.forEachInstanceField( 1836 cls.implementation.forEachInstanceField(
1837 (ClassElement enclosingClass, Element member) {
1838 world.addToWorkList(member);
1839 },
1837 includeBackendMembers: false, 1840 includeBackendMembers: false,
1838 includeSuperMembers: true, 1841 includeSuperMembers: true);
1839 f: (ClassElement enclosingClass, Element member) {
1840 world.addToWorkList(member);
1841 });
1842 return null; 1842 return null;
1843 } 1843 }
1844 1844
1845 /** 1845 /**
1846 * Try to resolve the constructor that is referred to by [node]. 1846 * Try to resolve the constructor that is referred to by [node].
1847 * Note: this function may return an ErroneousFunctionElement instead of 1847 * Note: this function may return an ErroneousFunctionElement instead of
1848 * [null], if there is no corresponding constructor, class or library. 1848 * [null], if there is no corresponding constructor, class or library.
1849 */ 1849 */
1850 FunctionElement resolveConstructor(NewExpression node) { 1850 FunctionElement resolveConstructor(NewExpression node) {
1851 // Resolve the constructor that [node] refers to. 1851 // Resolve the constructor that [node] refers to.
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
3152 return result; 3152 return result;
3153 } 3153 }
3154 Element lookup(SourceString name) => localLookup(name); 3154 Element lookup(SourceString name) => localLookup(name);
3155 Element lexicalLookup(SourceString name) => localLookup(name); 3155 Element lexicalLookup(SourceString name) => localLookup(name);
3156 3156
3157 Element add(Element newElement) { 3157 Element add(Element newElement) {
3158 throw "Cannot add an element in a patch library scope"; 3158 throw "Cannot add an element in a patch library scope";
3159 } 3159 }
3160 String toString() => 'PatchLibraryScope($origin,$patch)'; 3160 String toString() => 'PatchLibraryScope($origin,$patch)';
3161 } 3161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698