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

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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 } else { 1079 } else {
1080 return scope.lookup(typeName.source); 1080 return scope.lookup(typeName.source);
1081 } 1081 }
1082 } 1082 }
1083 1083
1084 // TODO(johnniwinther): Change [onFailure] and [whenResolved] to use boolean 1084 // TODO(johnniwinther): Change [onFailure] and [whenResolved] to use boolean
1085 // flags instead of closures. 1085 // flags instead of closures.
1086 // TODO(johnniwinther): Should never return [null] but instead an erroneous 1086 // TODO(johnniwinther): Should never return [null] but instead an erroneous
1087 // type. 1087 // type.
1088 DartType resolveTypeAnnotation(TypeAnnotation node, 1088 DartType resolveTypeAnnotation(TypeAnnotation node,
1089 [Scope inScope, ClassElement inClass, 1089 {Scope inScope, ClassElement inClass,
1090 onFailure(Node, MessageKind, [List arguments]), 1090 onFailure(Node, MessageKind, [List arguments]),
1091 whenResolved(Node, Type)]) { 1091 whenResolved(Node, Type)}) {
1092 if (onFailure === null) { 1092 if (onFailure === null) {
1093 onFailure = (n, k, [arguments]) {}; 1093 onFailure = (n, k, [arguments]) {};
1094 } 1094 }
1095 if (whenResolved === null) { 1095 if (whenResolved === null) {
1096 whenResolved = (n, t) {}; 1096 whenResolved = (n, t) {};
1097 } 1097 }
1098 if (inClass !== null) { 1098 if (inClass !== null) {
1099 inScope = inClass.buildScope(); 1099 inScope = inClass.buildScope();
1100 } 1100 }
1101 if (inScope === null) { 1101 if (inScope === null) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 if (type !== null) { 1313 if (type !== null) {
1314 if (inCheckContext) { 1314 if (inCheckContext) {
1315 compiler.enqueuer.resolution.registerIsCheck(type); 1315 compiler.enqueuer.resolution.registerIsCheck(type);
1316 } 1316 }
1317 return type.element; 1317 return type.element;
1318 } 1318 }
1319 return null; 1319 return null;
1320 } 1320 }
1321 1321
1322 Element defineElement(Node node, Element element, 1322 Element defineElement(Node node, Element element,
1323 [bool doAddToScope = true]) { 1323 {bool doAddToScope: true}) {
1324 compiler.ensure(element !== null); 1324 compiler.ensure(element !== null);
1325 mapping[node] = element; 1325 mapping[node] = element;
1326 if (doAddToScope) { 1326 if (doAddToScope) {
1327 Element existing = scope.add(element); 1327 Element existing = scope.add(element);
1328 if (existing != element) { 1328 if (existing != element) {
1329 error(node, MessageKind.DUPLICATE_DEFINITION, [node]); 1329 error(node, MessageKind.DUPLICATE_DEFINITION, [node]);
1330 } 1330 }
1331 } 1331 }
1332 return element; 1332 return element;
1333 } 1333 }
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 // [constructor.defaultImplementation] might be the implementation element 1891 // [constructor.defaultImplementation] might be the implementation element
1892 // and only declaration elements may be registered. 1892 // and only declaration elements may be registered.
1893 world.registerStaticUse(constructor.defaultImplementation.declaration); 1893 world.registerStaticUse(constructor.defaultImplementation.declaration);
1894 ClassElement cls = constructor.defaultImplementation.getEnclosingClass(); 1894 ClassElement cls = constructor.defaultImplementation.getEnclosingClass();
1895 // [cls] might be the implementation element and only declaration elements 1895 // [cls] might be the implementation element and only declaration elements
1896 // may be registered. 1896 // may be registered.
1897 world.registerInstantiatedClass(cls.declaration); 1897 world.registerInstantiatedClass(cls.declaration);
1898 // [cls] might be the declaration element and we want to include injected 1898 // [cls] might be the declaration element and we want to include injected
1899 // members. 1899 // members.
1900 cls.implementation.forEachInstanceField( 1900 cls.implementation.forEachInstanceField(
1901 (ClassElement enclosingClass, Element member) {
1902 world.addToWorkList(member);
1903 },
1901 includeBackendMembers: false, 1904 includeBackendMembers: false,
1902 includeSuperMembers: true, 1905 includeSuperMembers: true);
1903 f: (ClassElement enclosingClass, Element member) {
1904 world.addToWorkList(member);
1905 });
1906 return null; 1906 return null;
1907 } 1907 }
1908 1908
1909 /** 1909 /**
1910 * Try to resolve the constructor that is referred to by [node]. 1910 * Try to resolve the constructor that is referred to by [node].
1911 * Note: this function may return an ErroneousFunctionElement instead of 1911 * Note: this function may return an ErroneousFunctionElement instead of
1912 * [null], if there is no corresponding constructor, class or library. 1912 * [null], if there is no corresponding constructor, class or library.
1913 */ 1913 */
1914 FunctionElement resolveConstructor(NewExpression node) { 1914 FunctionElement resolveConstructor(NewExpression node) {
1915 // Resolve the constructor that [node] refers to. 1915 // Resolve the constructor that [node] refers to.
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
3227 return result; 3227 return result;
3228 } 3228 }
3229 Element lookup(SourceString name) => localLookup(name); 3229 Element lookup(SourceString name) => localLookup(name);
3230 Element lexicalLookup(SourceString name) => localLookup(name); 3230 Element lexicalLookup(SourceString name) => localLookup(name);
3231 3231
3232 Element add(Element newElement) { 3232 Element add(Element newElement) {
3233 throw "Cannot add an element in a patch library scope"; 3233 throw "Cannot add an element in a patch library scope";
3234 } 3234 }
3235 String toString() => 'PatchLibraryScope($origin,$patch)'; 3235 String toString() => 'PatchLibraryScope($origin,$patch)';
3236 } 3236 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/resolved_visitor.dart ('k') | lib/compiler/implementation/scanner/keyword.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698