Index: pkg/compiler/lib/src/js_backend/type_variable_handler.dart |
diff --git a/pkg/compiler/lib/src/js_backend/type_variable_handler.dart b/pkg/compiler/lib/src/js_backend/type_variable_handler.dart |
index ff8822db01b97b127b5a733cf5be76a48d5a5b60..a32a3b59059b4e4efe94fc013a3cc060785b408a 100644 |
--- a/pkg/compiler/lib/src/js_backend/type_variable_handler.dart |
+++ b/pkg/compiler/lib/src/js_backend/type_variable_handler.dart |
@@ -44,9 +44,13 @@ class TypeVariableHandler { |
Map<TypeVariableElement, jsAst.Expression> _typeVariableConstants = |
new Map<TypeVariableElement, jsAst.Expression>(); |
+ /// Impact builder used for the resolution world computation. |
+ final StagedWorldImpactBuilder impactBuilderForResolution = |
+ new StagedWorldImpactBuilder(); |
+ |
/// Impact builder used for the codegen world computation. |
- // TODO(johnniwinther): Add impact builder for resolution. |
- final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder(); |
+ final StagedWorldImpactBuilder impactBuilderForCodegen = |
+ new StagedWorldImpactBuilder(); |
TypeVariableHandler(this._compiler); |
@@ -59,16 +63,18 @@ class TypeVariableHandler { |
/// Compute the [WorldImpact] for the type variables registered since last |
/// flush. |
WorldImpact flush({bool forResolution}) { |
- if (forResolution) return const WorldImpact(); |
- return impactBuilder.flush(); |
+ if (forResolution) { |
+ return impactBuilderForResolution.flush(); |
+ } else { |
+ return impactBuilderForCodegen.flush(); |
+ } |
} |
- void registerClassWithTypeVariables(ClassElement cls, Enqueuer enqueuer) { |
- if (enqueuer.isResolutionQueue) { |
+ void registerClassWithTypeVariables(ClassElement cls, {bool forResolution}) { |
+ if (forResolution) { |
// On first encounter, we have to ensure that the support classes get |
// resolved. |
if (!_seenClassesWithTypeVariables) { |
- _backend.enqueueClass(enqueuer, _typeVariableClass); |
_typeVariableClass.ensureResolved(_compiler.resolution); |
Link constructors = _typeVariableClass.constructors; |
if (constructors.isEmpty && constructors.tail.isEmpty) { |
@@ -76,11 +82,12 @@ class TypeVariableHandler { |
"Class '$_typeVariableClass' should only have one constructor"); |
} |
_typeVariableConstructor = _typeVariableClass.constructors.head; |
- _backend.enqueue(enqueuer, _typeVariableConstructor); |
- enqueuer.registerInstantiatedType(_typeVariableClass.rawType); |
- enqueuer.registerStaticUse(new StaticUse.staticInvoke( |
- _backend.registerBackendUse(_backend.helpers.createRuntimeType), |
- CallStructure.ONE_ARG)); |
+ _backend.impactTransformer.registerBackendStaticUse( |
+ impactBuilderForResolution, _typeVariableConstructor); |
+ _backend.impactTransformer.registerBackendInstantiation( |
+ impactBuilderForResolution, _typeVariableClass); |
+ _backend.impactTransformer.registerBackendStaticUse( |
+ impactBuilderForResolution, _backend.helpers.createRuntimeType); |
_seenClassesWithTypeVariables = true; |
} |
} else { |
@@ -117,7 +124,8 @@ class TypeVariableHandler { |
_backend.constants.evaluate(constant); |
ConstantValue value = _backend.constants.getConstantValue(constant); |
- _backend.computeImpactForCompileTimeConstant(value, impactBuilder, false); |
+ _backend.computeImpactForCompileTimeConstant( |
+ value, impactBuilderForCodegen, false); |
_backend.addCompileTimeConstantForEmission(value); |
constants |
.add(_reifyTypeVariableConstant(value, currentTypeVariable.element)); |