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

Side by Side Diff: pkg/compiler/lib/src/compiler.dart

Issue 812523002: Change signature of lookupConstructor to only require a name. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: return null for unresolved default constructors Created 5 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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 913
914 /// A customizable filter that is applied to enqueued work items. 914 /// A customizable filter that is applied to enqueued work items.
915 QueueFilter enqueuerFilter = new QueueFilter(); 915 QueueFilter enqueuerFilter = new QueueFilter();
916 916
917 static const String MAIN = 'main'; 917 static const String MAIN = 'main';
918 static const String CALL_OPERATOR_NAME = 'call'; 918 static const String CALL_OPERATOR_NAME = 'call';
919 static const String NO_SUCH_METHOD = 'noSuchMethod'; 919 static const String NO_SUCH_METHOD = 'noSuchMethod';
920 static const int NO_SUCH_METHOD_ARG_COUNT = 1; 920 static const int NO_SUCH_METHOD_ARG_COUNT = 1;
921 static const String CREATE_INVOCATION_MIRROR = 921 static const String CREATE_INVOCATION_MIRROR =
922 'createInvocationMirror'; 922 'createInvocationMirror';
923 static const String FROM_ENVIRONMENT = 'fromEnvironment';
923 924
924 static const String RUNTIME_TYPE = 'runtimeType'; 925 static const String RUNTIME_TYPE = 'runtimeType';
925 926
926 static const String UNDETERMINED_BUILD_ID = 927 static const String UNDETERMINED_BUILD_ID =
927 "build number could not be determined"; 928 "build number could not be determined";
928 929
929 final Selector iteratorSelector = 930 final Selector iteratorSelector =
930 new Selector.getter('iterator', null); 931 new Selector.getter('iterator', null);
931 final Selector currentSelector = 932 final Selector currentSelector =
932 new Selector.getter('current', null); 933 new Selector.getter('current', null);
933 final Selector moveNextSelector = 934 final Selector moveNextSelector =
934 new Selector.call('moveNext', null, 0); 935 new Selector.call('moveNext', null, 0);
935 final Selector noSuchMethodSelector = new Selector.call( 936 final Selector noSuchMethodSelector = new Selector.call(
936 Compiler.NO_SUCH_METHOD, null, Compiler.NO_SUCH_METHOD_ARG_COUNT); 937 Compiler.NO_SUCH_METHOD, null, Compiler.NO_SUCH_METHOD_ARG_COUNT);
937 final Selector symbolValidatedConstructorSelector = new Selector.call( 938 final Selector symbolValidatedConstructorSelector = new Selector.call(
938 'validated', null, 1); 939 'validated', null, 1);
939 final Selector fromEnvironmentSelector = new Selector.callConstructor(
940 'fromEnvironment', null, 2);
941 940
942 bool enabledNoSuchMethod = false; 941 bool enabledNoSuchMethod = false;
943 bool enabledRuntimeType = false; 942 bool enabledRuntimeType = false;
944 bool enabledFunctionApply = false; 943 bool enabledFunctionApply = false;
945 bool enabledInvokeOn = false; 944 bool enabledInvokeOn = false;
946 bool hasIsolateSupport = false; 945 bool hasIsolateSupport = false;
947 946
948 Stopwatch progress; 947 Stopwatch progress;
949 948
950 bool get shouldPrintProgress { 949 bool get shouldPrintProgress {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 } 1352 }
1354 1353
1355 void onClassResolved(ClassElement cls) { 1354 void onClassResolved(ClassElement cls) {
1356 if (mirrorSystemClass == cls) { 1355 if (mirrorSystemClass == cls) {
1357 mirrorSystemGetNameFunction = 1356 mirrorSystemGetNameFunction =
1358 cls.lookupLocalMember('getName'); 1357 cls.lookupLocalMember('getName');
1359 } else if (symbolClass == cls) { 1358 } else if (symbolClass == cls) {
1360 symbolConstructor = cls.constructors.head; 1359 symbolConstructor = cls.constructors.head;
1361 } else if (symbolImplementationClass == cls) { 1360 } else if (symbolImplementationClass == cls) {
1362 symbolValidatedConstructor = symbolImplementationClass.lookupConstructor( 1361 symbolValidatedConstructor = symbolImplementationClass.lookupConstructor(
1363 symbolValidatedConstructorSelector); 1362 symbolValidatedConstructorSelector.name);
1364 } else if (mirrorsUsedClass == cls) { 1363 } else if (mirrorsUsedClass == cls) {
1365 mirrorsUsedConstructor = cls.constructors.head; 1364 mirrorsUsedConstructor = cls.constructors.head;
1366 } else if (intClass == cls) { 1365 } else if (intClass == cls) {
1367 intEnvironment = intClass.lookupConstructor(fromEnvironmentSelector); 1366 intEnvironment = intClass.lookupConstructor(FROM_ENVIRONMENT);
1368 } else if (stringClass == cls) { 1367 } else if (stringClass == cls) {
1369 stringEnvironment = 1368 stringEnvironment =
1370 stringClass.lookupConstructor(fromEnvironmentSelector); 1369 stringClass.lookupConstructor(FROM_ENVIRONMENT);
1371 } else if (boolClass == cls) { 1370 } else if (boolClass == cls) {
1372 boolEnvironment = boolClass.lookupConstructor(fromEnvironmentSelector); 1371 boolEnvironment =
1372 boolClass.lookupConstructor(FROM_ENVIRONMENT);
1373 } 1373 }
1374 } 1374 }
1375 1375
1376 void initializeCoreClasses() { 1376 void initializeCoreClasses() {
1377 final List missingCoreClasses = []; 1377 final List missingCoreClasses = [];
1378 ClassElement lookupCoreClass(String name) { 1378 ClassElement lookupCoreClass(String name) {
1379 ClassElement result = coreLibrary.find(name); 1379 ClassElement result = coreLibrary.find(name);
1380 if (result == null) { 1380 if (result == null) {
1381 missingCoreClasses.add(name); 1381 missingCoreClasses.add(name);
1382 } 1382 }
(...skipping 17 matching lines...) Expand all
1400 internalError( 1400 internalError(
1401 coreLibrary, 1401 coreLibrary,
1402 'dart:core library does not contain required classes: ' 1402 'dart:core library does not contain required classes: '
1403 '$missingCoreClasses'); 1403 '$missingCoreClasses');
1404 } 1404 }
1405 } 1405 }
1406 1406
1407 Element _unnamedListConstructor; 1407 Element _unnamedListConstructor;
1408 Element get unnamedListConstructor { 1408 Element get unnamedListConstructor {
1409 if (_unnamedListConstructor != null) return _unnamedListConstructor; 1409 if (_unnamedListConstructor != null) return _unnamedListConstructor;
1410 Selector callConstructor = new Selector.callConstructor( 1410 return _unnamedListConstructor = listClass.lookupDefaultConstructor();
1411 "", listClass.library);
1412 return _unnamedListConstructor =
1413 listClass.lookupConstructor(callConstructor);
1414 } 1411 }
1415 1412
1416 Element _filledListConstructor; 1413 Element _filledListConstructor;
1417 Element get filledListConstructor { 1414 Element get filledListConstructor {
1418 if (_filledListConstructor != null) return _filledListConstructor; 1415 if (_filledListConstructor != null) return _filledListConstructor;
1419 Selector callConstructor = new Selector.callConstructor( 1416 return _filledListConstructor = listClass.lookupConstructor("filled");
1420 "filled", listClass.library);
1421 return _filledListConstructor =
1422 listClass.lookupConstructor(callConstructor);
1423 } 1417 }
1424 1418
1425 /** 1419 /**
1426 * Get an [Uri] pointing to a patch for the dart: library with 1420 * Get an [Uri] pointing to a patch for the dart: library with
1427 * the given path. Returns null if there is no patch. 1421 * the given path. Returns null if there is no patch.
1428 */ 1422 */
1429 Uri resolvePatchUri(String dartLibraryPath); 1423 Uri resolvePatchUri(String dartLibraryPath);
1430 1424
1431 Future runCompiler(Uri uri) { 1425 Future runCompiler(Uri uri) {
1432 // TODO(ahe): This prevents memory leaks when invoking the compiler 1426 // TODO(ahe): This prevents memory leaks when invoking the compiler
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 InterfaceType get nullType => nullClass.computeType(compiler); 2382 InterfaceType get nullType => nullClass.computeType(compiler);
2389 2383
2390 @override 2384 @override
2391 InterfaceType get numType => numClass.computeType(compiler); 2385 InterfaceType get numType => numClass.computeType(compiler);
2392 2386
2393 @override 2387 @override
2394 InterfaceType get stringType => stringClass.computeType(compiler); 2388 InterfaceType get stringType => stringClass.computeType(compiler);
2395 } 2389 }
2396 2390
2397 typedef void InternalErrorFunction(Spannable location, String message); 2391 typedef void InternalErrorFunction(Spannable location, String message);
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698