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..8865f1e6e28183e1a0f9e7178fa11c0e90e11908 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; |
import 'environment.dart'; |
import 'resolved_uri_translator.dart'; |
import 'script.dart'; |
@@ -171,6 +172,14 @@ 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); |
+ |
+ // TODO(johnniwinther): Move these to a separate interface. |
+ /// 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 +311,8 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask { |
/// conditional imports. |
final Environment environment; |
+ List<DeferredAction> _deferredActions = <DeferredAction>[]; |
+ |
final DiagnosticReporter reporter; |
_LibraryLoaderTask( |
@@ -760,6 +771,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. |