Chromium Code Reviews| Index: pkg/compiler/lib/src/compiler.dart |
| diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart |
| index 5abb3e1dd0b086b48c4a4fa2e67d6a456db698ca..052a1aaeb31ffed879ad564ffc7e789597d2184b 100644 |
| --- a/pkg/compiler/lib/src/compiler.dart |
| +++ b/pkg/compiler/lib/src/compiler.dart |
| @@ -437,22 +437,29 @@ abstract class Compiler implements LibraryLoaderListener { |
| /// for [library]. |
| Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { |
| Uri uri = library.canonicalUri; |
| - if (uri == Uris.dart_core) { |
| - initializeCoreClasses(); |
| - identicalFunction = coreLibrary.find('identical'); |
| - } else if (uri == Uris.dart_mirrors) { |
| - mirrorSystemClass = findRequiredElement(library, 'MirrorSystem'); |
| - mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed'); |
| - } else if (uri == Uris.dart_async) { |
| - asyncLibrary = library; |
| - deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary'); |
| - _coreTypes.futureClass = findRequiredElement(library, 'Future'); |
| - _coreTypes.streamClass = findRequiredElement(library, 'Stream'); |
| - } else if (uri == Uris.dart__native_typed_data) { |
| - typedDataClass = findRequiredElement(library, 'NativeTypedData'); |
| - } else if (uri == js_backend.BackendHelpers.DART_JS_HELPER) { |
| - patchAnnotationClass = findRequiredElement(library, '_Patch'); |
| - nativeAnnotationClass = findRequiredElement(library, 'Native'); |
| + // If the script of the library is synthesized, the library does not exist |
| + // and we do not try to load the helpers. |
| + // |
| + // This could for example happen if dart:async is disabled, then loading it |
| + // should not try to find the given element. |
| + if (!library.compilationUnit.script.isSynthesized) { |
|
Johnni Winther
2016/04/27 07:34:57
-> 'if (!library.isSynthesized) {'
sigurdm
2016/04/27 07:48:17
Does not work for elementz. Added a TODO
|
| + if (uri == Uris.dart_core) { |
| + initializeCoreClasses(); |
| + identicalFunction = coreLibrary.find('identical'); |
| + } else if (uri == Uris.dart_mirrors) { |
| + mirrorSystemClass = findRequiredElement(library, 'MirrorSystem'); |
| + mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed'); |
| + } else if (uri == Uris.dart_async) { |
| + asyncLibrary = library; |
| + deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary'); |
| + _coreTypes.futureClass = findRequiredElement(library, 'Future'); |
| + _coreTypes.streamClass = findRequiredElement(library, 'Stream'); |
| + } else if (uri == Uris.dart__native_typed_data) { |
| + typedDataClass = findRequiredElement(library, 'NativeTypedData'); |
| + } else if (uri == js_backend.BackendHelpers.DART_JS_HELPER) { |
| + patchAnnotationClass = findRequiredElement(library, '_Patch'); |
| + nativeAnnotationClass = findRequiredElement(library, 'Native'); |
| + } |
| } |
| return backend.onLibraryScanned(library, loader); |
| } |