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

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

Issue 2735763002: Create ResolutionEnqueuer after library loading. (Closed)
Patch Set: Updated cf. comments. Created 3 years, 9 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/compiler.dart ('k') | pkg/compiler/lib/src/js_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/enqueue.dart
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index 8963fb3b6256f6f4c50db6f1ba687171fec877c2..3bc0cc0a5c05db8fca1f61c203d39dea7f225e31 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -34,10 +34,12 @@ class EnqueueTask extends CompilerTask {
EnqueueTask(Compiler compiler)
: this.compiler = compiler,
- super(compiler.measurer) {
- createResolutionEnqueuer();
- }
+ super(compiler.measurer);
+
+ // TODO(johnniwinther): Remove the need for this.
+ bool get hasResolution => _resolution != null;
+ // TODO(johnniwinther): Remove the need for this.
ResolutionEnqueuer get resolution {
assert(invariant(NO_LOCATION_SPANNABLE, _resolution != null,
message: "ResolutionEnqueuer has not been created yet."));
@@ -192,7 +194,7 @@ class ResolutionEnqueuer extends EnqueuerImpl {
/// Queue of deferred resolution actions to execute when the resolution queue
/// has been emptied.
- final Queue<_DeferredAction> _deferredQueue = new Queue<_DeferredAction>();
+ final Queue<DeferredAction> _deferredQueue = new Queue<DeferredAction>();
ResolutionEnqueuer(this.task, this._options, this._reporter, this.strategy,
this.listener, this._worldBuilder, this._workItemBuilder,
@@ -415,14 +417,18 @@ class ResolutionEnqueuer extends EnqueuerImpl {
/// emptied.
///
/// The queue is processed in FIFO order.
- void addDeferredAction(Entity entity, void action()) {
+ void addDeferredAction(DeferredAction deferredAction) {
if (queueIsClosed) {
throw new SpannableAssertionFailure(
- entity,
+ deferredAction.element,
"Resolution work list is closed. "
- "Trying to add deferred action for $entity");
+ "Trying to add deferred action for ${deferredAction.element}");
}
- _deferredQueue.add(new _DeferredAction(entity, action));
+ _deferredQueue.add(deferredAction);
+ }
+
+ void addDeferredActions(Iterable<DeferredAction> deferredActions) {
+ deferredActions.forEach(addDeferredAction);
}
/// [_onQueueEmpty] is called whenever the queue is drained. [recentClasses]
@@ -441,7 +447,7 @@ class ResolutionEnqueuer extends EnqueuerImpl {
void _emptyDeferredQueue() {
while (!_deferredQueue.isEmpty) {
- _DeferredAction task = _deferredQueue.removeFirst();
+ DeferredAction task = _deferredQueue.removeFirst();
_reporter.withCurrentElement(task.element, task.action);
}
}
@@ -536,13 +542,13 @@ class EnqueuerImplImpactVisitor implements WorldImpactVisitor {
}
}
-typedef void _DeferredActionFunction();
+typedef void DeferredActionFunction();
-class _DeferredAction {
+class DeferredAction {
final Entity element;
- final _DeferredActionFunction action;
+ final DeferredActionFunction action;
- _DeferredAction(this.element, this.action);
+ DeferredAction(this.element, this.action);
}
/// Interface for creating work items for enqueued member entities.
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698