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

Side by Side 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, 7 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
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 library dart2js.compiler_base; 5 library dart2js.compiler_base;
6 6
7 import 'dart:async' show EventSink, Future; 7 import 'dart:async' show EventSink, Future;
8 8
9 import '../compiler_new.dart' as api; 9 import '../compiler_new.dart' as api;
10 import 'cache_strategy.dart' show CacheStrategy; 10 import 'cache_strategy.dart' show CacheStrategy;
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 /// been scanned. 430 /// been scanned.
431 /// 431 ///
432 /// Use this callback method to store references to specific member declared 432 /// Use this callback method to store references to specific member declared
433 /// in certain libraries. Note that [library] has not been patched yet, nor 433 /// in certain libraries. Note that [library] has not been patched yet, nor
434 /// has its imports/exports been resolved. 434 /// has its imports/exports been resolved.
435 /// 435 ///
436 /// Use [loader] to register the creation and scanning of a patch library 436 /// Use [loader] to register the creation and scanning of a patch library
437 /// for [library]. 437 /// for [library].
438 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { 438 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) {
439 Uri uri = library.canonicalUri; 439 Uri uri = library.canonicalUri;
440 if (uri == Uris.dart_core) { 440 // If the script of the library is synthesized, the library does not exist
441 initializeCoreClasses(); 441 // and we do not try to load the helpers.
442 identicalFunction = coreLibrary.find('identical'); 442 //
443 } else if (uri == Uris.dart_mirrors) { 443 // This could for example happen if dart:async is disabled, then loading it
444 mirrorSystemClass = findRequiredElement(library, 'MirrorSystem'); 444 // should not try to find the given element.
445 mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed'); 445 // TODO(johnniwinther): This should just be library.isSynthesized, but that
446 } else if (uri == Uris.dart_async) { 446 // does not work yet for deserialized elements.
447 asyncLibrary = library; 447 if (!library.compilationUnit.script.isSynthesized) {
448 deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary'); 448 if (uri == Uris.dart_core) {
449 _coreTypes.futureClass = findRequiredElement(library, 'Future'); 449 initializeCoreClasses();
450 _coreTypes.streamClass = findRequiredElement(library, 'Stream'); 450 identicalFunction = coreLibrary.find('identical');
451 } else if (uri == Uris.dart__native_typed_data) { 451 } else if (uri == Uris.dart_mirrors) {
452 typedDataClass = findRequiredElement(library, 'NativeTypedData'); 452 mirrorSystemClass = findRequiredElement(library, 'MirrorSystem');
453 } else if (uri == js_backend.BackendHelpers.DART_JS_HELPER) { 453 mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed');
454 patchAnnotationClass = findRequiredElement(library, '_Patch'); 454 } else if (uri == Uris.dart_async) {
455 nativeAnnotationClass = findRequiredElement(library, 'Native'); 455 asyncLibrary = library;
456 deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary');
457 _coreTypes.futureClass = findRequiredElement(library, 'Future');
458 _coreTypes.streamClass = findRequiredElement(library, 'Stream');
459 } else if (uri == Uris.dart__native_typed_data) {
460 typedDataClass = findRequiredElement(library, 'NativeTypedData');
461 } else if (uri == js_backend.BackendHelpers.DART_JS_HELPER) {
462 patchAnnotationClass = findRequiredElement(library, '_Patch');
463 nativeAnnotationClass = findRequiredElement(library, 'Native');
464 }
456 } 465 }
457 return backend.onLibraryScanned(library, loader); 466 return backend.onLibraryScanned(library, loader);
458 } 467 }
459 468
460 /// Compute the set of distinct import chains to the library at [uri] within 469 /// Compute the set of distinct import chains to the library at [uri] within
461 /// [loadedLibraries]. 470 /// [loadedLibraries].
462 /// 471 ///
463 /// The chains are strings of the form 472 /// The chains are strings of the form
464 /// 473 ///
465 /// <main-uri> => <intermediate-uri1> => <intermediate-uri2> => <uri> 474 /// <main-uri> => <intermediate-uri1> => <intermediate-uri2> => <uri>
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2061 _ElementScanner(this.scanner); 2070 _ElementScanner(this.scanner);
2062 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 2071 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
2063 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 2072 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
2064 } 2073 }
2065 2074
2066 class _EmptyEnvironment implements Environment { 2075 class _EmptyEnvironment implements Environment {
2067 const _EmptyEnvironment(); 2076 const _EmptyEnvironment();
2068 2077
2069 String valueOf(String key) => null; 2078 String valueOf(String key) => null;
2070 } 2079 }
OLDNEW
« 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