| OLD | NEW |
| 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 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 _coreTypes.stringClass = lookupCoreClass('String'); | 1371 _coreTypes.stringClass = lookupCoreClass('String'); |
| 1372 _coreTypes.functionClass = lookupCoreClass('Function'); | 1372 _coreTypes.functionClass = lookupCoreClass('Function'); |
| 1373 _coreTypes.listClass = lookupCoreClass('List'); | 1373 _coreTypes.listClass = lookupCoreClass('List'); |
| 1374 _coreTypes.typeClass = lookupCoreClass('Type'); | 1374 _coreTypes.typeClass = lookupCoreClass('Type'); |
| 1375 _coreTypes.mapClass = lookupCoreClass('Map'); | 1375 _coreTypes.mapClass = lookupCoreClass('Map'); |
| 1376 _coreTypes.nullClass = lookupCoreClass('Null'); | 1376 _coreTypes.nullClass = lookupCoreClass('Null'); |
| 1377 _coreTypes.stackTraceClass = lookupCoreClass('StackTrace'); | 1377 _coreTypes.stackTraceClass = lookupCoreClass('StackTrace'); |
| 1378 _coreTypes.iterableClass = lookupCoreClass('Iterable'); | 1378 _coreTypes.iterableClass = lookupCoreClass('Iterable'); |
| 1379 _coreTypes.symbolClass = lookupCoreClass('Symbol'); | 1379 _coreTypes.symbolClass = lookupCoreClass('Symbol'); |
| 1380 if (!missingCoreClasses.isEmpty) { | 1380 if (!missingCoreClasses.isEmpty) { |
| 1381 internalError(coreLibrary, | 1381 internalError( |
| 1382 coreLibrary, |
| 1382 'dart:core library does not contain required classes: ' | 1383 'dart:core library does not contain required classes: ' |
| 1383 '$missingCoreClasses'); | 1384 '$missingCoreClasses'); |
| 1384 } | 1385 } |
| 1385 } | 1386 } |
| 1386 | 1387 |
| 1387 Element _unnamedListConstructor; | 1388 Element _unnamedListConstructor; |
| 1388 Element get unnamedListConstructor { | 1389 Element get unnamedListConstructor { |
| 1389 if (_unnamedListConstructor != null) return _unnamedListConstructor; | 1390 if (_unnamedListConstructor != null) return _unnamedListConstructor; |
| 1390 Selector callConstructor = new Selector.callConstructor( | 1391 Selector callConstructor = new Selector.callConstructor( |
| 1391 "", listClass.library); | 1392 "", listClass.library); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 if (analyzeOnly) { | 1431 if (analyzeOnly) { |
| 1431 log('Analyzing $uri ($buildId)'); | 1432 log('Analyzing $uri ($buildId)'); |
| 1432 } else { | 1433 } else { |
| 1433 log('Compiling $uri ($buildId)'); | 1434 log('Compiling $uri ($buildId)'); |
| 1434 } | 1435 } |
| 1435 return libraryLoader.loadLibrary(uri).then((LibraryElement library) { | 1436 return libraryLoader.loadLibrary(uri).then((LibraryElement library) { |
| 1436 mainApp = library; | 1437 mainApp = library; |
| 1437 }); | 1438 }); |
| 1438 } | 1439 } |
| 1439 }).then((_) { | 1440 }).then((_) { |
| 1440 if (!compilationFailed) { | 1441 compileLoadedLibraries(); |
| 1441 // TODO(johnniwinther): Reenable analysis of programs with load failures | |
| 1442 // when these are handled as erroneous libraries/compilation units. | |
| 1443 compileLoadedLibraries(); | |
| 1444 } | |
| 1445 }); | 1442 }); |
| 1446 } | 1443 } |
| 1447 | 1444 |
| 1448 bool irEnabled() { | 1445 bool irEnabled() { |
| 1449 // TODO(sigurdm,kmillikin): Support checked-mode checks. | 1446 // TODO(sigurdm,kmillikin): Support checked-mode checks. |
| 1450 return const bool.fromEnvironment('USE_NEW_BACKEND') && | 1447 return const bool.fromEnvironment('USE_NEW_BACKEND') && |
| 1451 backend is DartBackend && | 1448 backend is DartBackend && |
| 1452 !enableTypeAssertions && | 1449 !enableTypeAssertions && |
| 1453 !enableConcreteTypeInference; | 1450 !enableConcreteTypeInference; |
| 1454 } | 1451 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 }); | 1494 }); |
| 1498 } | 1495 } |
| 1499 } | 1496 } |
| 1500 if (mainFunction == null) { | 1497 if (mainFunction == null) { |
| 1501 if (errorElement == null && !analyzeOnly && !analyzeAll) { | 1498 if (errorElement == null && !analyzeOnly && !analyzeAll) { |
| 1502 internalError(mainApp, "Problem with '$MAIN'."); | 1499 internalError(mainApp, "Problem with '$MAIN'."); |
| 1503 } else { | 1500 } else { |
| 1504 mainFunction = errorElement; | 1501 mainFunction = errorElement; |
| 1505 } | 1502 } |
| 1506 } | 1503 } |
| 1507 if (errorElement != null && errorElement.isSynthesized) { | 1504 if (errorElement != null && |
| 1505 errorElement.isSynthesized && |
| 1506 !mainApp.isSynthesized) { |
| 1508 reportWarning( | 1507 reportWarning( |
| 1509 errorElement, errorElement.messageKind, | 1508 errorElement, errorElement.messageKind, |
| 1510 errorElement.messageArguments); | 1509 errorElement.messageArguments); |
| 1511 } | 1510 } |
| 1512 } | 1511 } |
| 1513 | 1512 |
| 1514 /// Performs the compilation when all libraries have been loaded. | 1513 /// Performs the compilation when all libraries have been loaded. |
| 1515 void compileLoadedLibraries() { | 1514 void compileLoadedLibraries() { |
| 1516 computeMain(); | 1515 computeMain(); |
| 1517 | 1516 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1917 /** | 1916 /** |
| 1918 * Reads the script specified by the [readableUri]. | 1917 * Reads the script specified by the [readableUri]. |
| 1919 * | 1918 * |
| 1920 * See [LibraryLoader] for terminology on URIs. | 1919 * See [LibraryLoader] for terminology on URIs. |
| 1921 */ | 1920 */ |
| 1922 Future<Script> readScript(Spannable node, Uri readableUri) { | 1921 Future<Script> readScript(Spannable node, Uri readableUri) { |
| 1923 unimplemented(node, 'Compiler.readScript'); | 1922 unimplemented(node, 'Compiler.readScript'); |
| 1924 return null; | 1923 return null; |
| 1925 } | 1924 } |
| 1926 | 1925 |
| 1926 /// Compatible with [readScript] and used by [LibraryLoader] to create |
| 1927 /// synthetic scripts to recover from read errors and bad URIs. |
| 1928 Future<Script> synthesizeScript(Spannable node, Uri readableUri) { |
| 1929 unimplemented(node, 'Compiler.synthesizeScript'); |
| 1930 return null; |
| 1931 } |
| 1932 |
| 1927 Element lookupElementIn(ScopeContainerElement container, String name) { | 1933 Element lookupElementIn(ScopeContainerElement container, String name) { |
| 1928 Element element = container.localLookup(name); | 1934 Element element = container.localLookup(name); |
| 1929 if (element == null) { | 1935 if (element == null) { |
| 1930 throw 'Could not find $name in $container'; | 1936 throw 'Could not find $name in $container'; |
| 1931 } | 1937 } |
| 1932 return element; | 1938 return element; |
| 1933 } | 1939 } |
| 1934 | 1940 |
| 1935 bool get isMockCompilation => false; | 1941 bool get isMockCompilation => false; |
| 1936 | 1942 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 InterfaceType get nullType => nullClass.computeType(compiler); | 2362 InterfaceType get nullType => nullClass.computeType(compiler); |
| 2357 | 2363 |
| 2358 @override | 2364 @override |
| 2359 InterfaceType get numType => numClass.computeType(compiler); | 2365 InterfaceType get numType => numClass.computeType(compiler); |
| 2360 | 2366 |
| 2361 @override | 2367 @override |
| 2362 InterfaceType get stringType => stringClass.computeType(compiler); | 2368 InterfaceType get stringType => stringClass.computeType(compiler); |
| 2363 } | 2369 } |
| 2364 | 2370 |
| 2365 typedef void InternalErrorFunction(Spannable location, String message); | 2371 typedef void InternalErrorFunction(Spannable location, String message); |
| OLD | NEW |