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

Unified Diff: pkg/compiler/lib/src/compiler.dart

Issue 1918903004: Make support for async/await syntax optional in the frontend. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add todo Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/dart_backend/backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8cca351c2d7ca1b5d7cd14d3afb15aa690d30534 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -437,22 +437,31 @@ 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.
+ // TODO(johnniwinther): This should just be library.isSynthesized, but that
+ // does not work yet for deserialized elements.
+ if (!library.compilationUnit.script.isSynthesized) {
+ 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);
}
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/dart_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698