Index: pkg/compiler/lib/src/common/resolution.dart |
diff --git a/pkg/compiler/lib/src/common/resolution.dart b/pkg/compiler/lib/src/common/resolution.dart |
index 9012c822c421e62cda59129e175bc4a6606ce944..2adfe261e94d278396406729510bd509ce4b457e 100644 |
--- a/pkg/compiler/lib/src/common/resolution.dart |
+++ b/pkg/compiler/lib/src/common/resolution.dart |
@@ -41,18 +41,24 @@ import 'backend_api.dart'; |
import 'work.dart' show WorkItem; |
/// [WorkItem] used exclusively by the [ResolutionEnqueuer]. |
-class ResolutionWorkItem extends WorkItem { |
+abstract class ResolutionWorkItem implements WorkItem { |
+ factory ResolutionWorkItem(Resolution resolution, AstElement element) = |
+ _ResolutionWorkItem; |
+} |
+ |
+class _ResolutionWorkItem extends WorkItem implements ResolutionWorkItem { |
bool _isAnalyzed = false; |
+ final Resolution resolution; |
- ResolutionWorkItem(AstElement element) : super(element); |
+ _ResolutionWorkItem(this.resolution, AstElement element) : super(element); |
- WorldImpact run(Compiler compiler, ResolutionEnqueuer world) { |
- WorldImpact impact = compiler.analyze(this, world); |
+ WorldImpact run() { |
+ assert(invariant(element, !_isAnalyzed, |
+ message: 'Element ${element} has already been analyzed')); |
+ WorldImpact impact = resolution.computeWorldImpact(element); |
_isAnalyzed = true; |
return impact; |
} |
- |
- bool get isAnalyzed => _isAnalyzed; |
} |
class ResolutionImpact extends WorldImpact { |
@@ -210,11 +216,8 @@ abstract class Resolution implements Frontend { |
/// A container of commonly used dependencies for tasks that involve parsing. |
abstract class ParsingContext { |
- factory ParsingContext( |
- DiagnosticReporter reporter, |
- ParserTask parser, |
- PatchParserTask patchParser, |
- Backend backend) = _ParsingContext; |
+ factory ParsingContext(DiagnosticReporter reporter, ParserTask parser, |
+ PatchParserTask patchParser, Backend backend) = _ParsingContext; |
DiagnosticReporter get reporter; |
ParserTask get parser; |
@@ -238,8 +241,7 @@ class _ParsingContext implements ParsingContext { |
final PatchParserTask patchParser; |
final Backend backend; |
- _ParsingContext(this.reporter, this.parser, |
- this.patchParser, this.backend); |
+ _ParsingContext(this.reporter, this.parser, this.patchParser, this.backend); |
@override |
measure(f()) => parser.measure(f); |