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

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: Fail gracefully on missing default constructors when evaluating constant constructors. Created 5 years, 11 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 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 } 1345 }
1346 1346
1347 void onClassResolved(ClassElement cls) { 1347 void onClassResolved(ClassElement cls) {
1348 if (mirrorSystemClass == cls) { 1348 if (mirrorSystemClass == cls) {
1349 mirrorSystemGetNameFunction = 1349 mirrorSystemGetNameFunction =
1350 cls.lookupLocalMember('getName'); 1350 cls.lookupLocalMember('getName');
1351 } else if (symbolClass == cls) { 1351 } else if (symbolClass == cls) {
1352 symbolConstructor = cls.constructors.head; 1352 symbolConstructor = cls.constructors.head;
1353 } else if (symbolImplementationClass == cls) { 1353 } else if (symbolImplementationClass == cls) {
1354 symbolValidatedConstructor = symbolImplementationClass.lookupConstructor( 1354 symbolValidatedConstructor = symbolImplementationClass.lookupConstructor(
1355 symbolValidatedConstructorSelector); 1355 symbolValidatedConstructorSelector.name);
1356 } else if (mirrorsUsedClass == cls) { 1356 } else if (mirrorsUsedClass == cls) {
1357 mirrorsUsedConstructor = cls.constructors.head; 1357 mirrorsUsedConstructor = cls.constructors.head;
1358 } else if (intClass == cls) { 1358 } else if (intClass == cls) {
1359 intEnvironment = intClass.lookupConstructor(fromEnvironmentSelector); 1359 intEnvironment = intClass.lookupConstructor(fromEnvironmentSelector.name);
Johnni Winther 2015/01/08 09:47:44 Do we still need [fromEnvironmentSelector] as a [S
herhut 2015/01/22 10:33:20 Done.
1360 } else if (stringClass == cls) { 1360 } else if (stringClass == cls) {
1361 stringEnvironment = 1361 stringEnvironment =
1362 stringClass.lookupConstructor(fromEnvironmentSelector); 1362 stringClass.lookupConstructor(fromEnvironmentSelector.name);
1363 } else if (boolClass == cls) { 1363 } else if (boolClass == cls) {
1364 boolEnvironment = boolClass.lookupConstructor(fromEnvironmentSelector); 1364 boolEnvironment =
1365 boolClass.lookupConstructor(fromEnvironmentSelector.name);
1365 } 1366 }
1366 } 1367 }
1367 1368
1368 void initializeCoreClasses() { 1369 void initializeCoreClasses() {
1369 final List missingCoreClasses = []; 1370 final List missingCoreClasses = [];
1370 ClassElement lookupCoreClass(String name) { 1371 ClassElement lookupCoreClass(String name) {
1371 ClassElement result = coreLibrary.find(name); 1372 ClassElement result = coreLibrary.find(name);
1372 if (result == null) { 1373 if (result == null) {
1373 missingCoreClasses.add(name); 1374 missingCoreClasses.add(name);
1374 } 1375 }
(...skipping 16 matching lines...) Expand all
1391 if (!missingCoreClasses.isEmpty) { 1392 if (!missingCoreClasses.isEmpty) {
1392 internalError(coreLibrary, 1393 internalError(coreLibrary,
1393 'dart:core library does not contain required classes: ' 1394 'dart:core library does not contain required classes: '
1394 '$missingCoreClasses'); 1395 '$missingCoreClasses');
1395 } 1396 }
1396 } 1397 }
1397 1398
1398 Element _unnamedListConstructor; 1399 Element _unnamedListConstructor;
1399 Element get unnamedListConstructor { 1400 Element get unnamedListConstructor {
1400 if (_unnamedListConstructor != null) return _unnamedListConstructor; 1401 if (_unnamedListConstructor != null) return _unnamedListConstructor;
1401 Selector callConstructor = new Selector.callConstructor( 1402 return _unnamedListConstructor = listClass.lookupDefaultConstructor();
1402 "", listClass.library);
1403 return _unnamedListConstructor =
1404 listClass.lookupConstructor(callConstructor);
1405 } 1403 }
1406 1404
1407 Element _filledListConstructor; 1405 Element _filledListConstructor;
1408 Element get filledListConstructor { 1406 Element get filledListConstructor {
1409 if (_filledListConstructor != null) return _filledListConstructor; 1407 if (_filledListConstructor != null) return _filledListConstructor;
1410 Selector callConstructor = new Selector.callConstructor( 1408 return _filledListConstructor = listClass.lookupConstructor("filled");
1411 "filled", listClass.library);
1412 return _filledListConstructor =
1413 listClass.lookupConstructor(callConstructor);
1414 } 1409 }
1415 1410
1416 /** 1411 /**
1417 * Get an [Uri] pointing to a patch for the dart: library with 1412 * Get an [Uri] pointing to a patch for the dart: library with
1418 * the given path. Returns null if there is no patch. 1413 * the given path. Returns null if there is no patch.
1419 */ 1414 */
1420 Uri resolvePatchUri(String dartLibraryPath); 1415 Uri resolvePatchUri(String dartLibraryPath);
1421 1416
1422 Future runCompiler(Uri uri) { 1417 Future runCompiler(Uri uri) {
1423 // TODO(ahe): This prevents memory leaks when invoking the compiler 1418 // TODO(ahe): This prevents memory leaks when invoking the compiler
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
2403 2398
2404 @override 2399 @override
2405 InterfaceType get nullType => nullClass.computeType(compiler); 2400 InterfaceType get nullType => nullClass.computeType(compiler);
2406 2401
2407 @override 2402 @override
2408 InterfaceType get numType => numClass.computeType(compiler); 2403 InterfaceType get numType => numClass.computeType(compiler);
2409 2404
2410 @override 2405 @override
2411 InterfaceType get stringType => stringClass.computeType(compiler); 2406 InterfaceType get stringType => stringClass.computeType(compiler);
2412 } 2407 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698