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 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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 checkQueues(); | 915 checkQueues(); |
916 }); | 916 }); |
917 | 917 |
918 void fullyEnqueueLibrary(LibraryElement library, Enqueuer world) { | 918 void fullyEnqueueLibrary(LibraryElement library, Enqueuer world) { |
919 void enqueueAll(Element element) { | 919 void enqueueAll(Element element) { |
920 fullyEnqueueTopLevelElement(element, world); | 920 fullyEnqueueTopLevelElement(element, world); |
921 } | 921 } |
922 library.implementation.forEachLocalMember(enqueueAll); | 922 library.implementation.forEachLocalMember(enqueueAll); |
923 library.imports.forEach((ImportElement import) { | 923 library.imports.forEach((ImportElement import) { |
924 if (import.isDeferred) { | 924 if (import.isDeferred) { |
925 world.addToWorkList(import.prefix.loadLibrary); | 925 // `import.prefix` and `loadLibrary` may be `null` when the deferred |
| 926 // import has compile-time errors. |
| 927 GetterElement loadLibrary = import.prefix?.loadLibrary; |
| 928 if (loadLibrary != null) { |
| 929 world.addToWorkList(loadLibrary); |
| 930 } |
926 } | 931 } |
927 }); | 932 }); |
928 } | 933 } |
929 | 934 |
930 void fullyEnqueueTopLevelElement(Element element, Enqueuer world) { | 935 void fullyEnqueueTopLevelElement(Element element, Enqueuer world) { |
931 if (element.isClass) { | 936 if (element.isClass) { |
932 ClassElement cls = element; | 937 ClassElement cls = element; |
933 cls.ensureResolved(resolution); | 938 cls.ensureResolved(resolution); |
934 cls.forEachLocalMember(enqueuer.resolution.addToWorkList); | 939 cls.forEachLocalMember(enqueuer.resolution.addToWorkList); |
935 backend.registerInstantiatedType(cls.rawType, world, globalDependencies); | 940 backend.registerInstantiatedType(cls.rawType, world, globalDependencies); |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 _ElementScanner(this.scanner); | 2123 _ElementScanner(this.scanner); |
2119 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2124 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2120 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2125 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2121 } | 2126 } |
2122 | 2127 |
2123 class _EmptyEnvironment implements Environment { | 2128 class _EmptyEnvironment implements Environment { |
2124 const _EmptyEnvironment(); | 2129 const _EmptyEnvironment(); |
2125 | 2130 |
2126 String valueOf(String key) => null; | 2131 String valueOf(String key) => null; |
2127 } | 2132 } |
OLD | NEW |