Chromium Code Reviews| Index: pkg/compiler/lib/src/library_loader.dart |
| diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart |
| index 796b7079258aa82484be499166323c36c0e83bd9..c769f3508aa6a2c275b29e2a8c6a1848a1e282d6 100644 |
| --- a/pkg/compiler/lib/src/library_loader.dart |
| +++ b/pkg/compiler/lib/src/library_loader.dart |
| @@ -27,6 +27,7 @@ import 'elements/modelx.dart' |
| LibraryDependencyElementX, |
| PrefixElementX, |
| SyntheticImportElement; |
| +import 'enqueue.dart' show DeferredAction; |
|
Siggi Cherem (dart-lang)
2017/03/14 05:27:55
consider moving Deferred action under util/deferre
Johnni Winther
2017/03/15 12:46:53
Will do in a later CL.
|
| import 'environment.dart'; |
| import 'resolved_uri_translator.dart'; |
| import 'script.dart'; |
| @@ -171,6 +172,13 @@ abstract class LibraryLoaderTask implements LibraryProvider, CompilerTask { |
| /// Similar to [resetAsync] but [reuseLibrary] maps all libraries to a list |
| /// of libraries that can be reused. |
| Future<Null> resetLibraries(ReuseLibrariesFunction reuseLibraries); |
| + |
| + /// Register a deferred action to be performed during resolution. |
| + void registerDeferredAction(DeferredAction action); |
| + |
| + /// Returns the deferred actions registered since the last call to |
| + /// [pullDeferredActions]. |
| + Iterable<DeferredAction> pullDeferredActions(); |
| } |
| /// Interface for an entity that provide libraries. For instance from normal |
| @@ -302,6 +310,8 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask { |
| /// conditional imports. |
| final Environment environment; |
| + List<DeferredAction> _deferredActions = <DeferredAction>[]; |
| + |
| final DiagnosticReporter reporter; |
| _LibraryLoaderTask( |
| @@ -760,6 +770,16 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask { |
| }); |
| return unit; |
| } |
| + |
| + void registerDeferredAction(DeferredAction action) { |
| + _deferredActions.add(action); |
| + } |
| + |
| + Iterable<DeferredAction> pullDeferredActions() { |
| + Iterable<DeferredAction> actions = _deferredActions.toList(); |
| + _deferredActions.clear(); |
| + return actions; |
| + } |
| } |
| /// A state machine for checking script tags come in the correct order. |