Chromium Code Reviews| Index: pkg/compiler/lib/src/types/types.dart |
| diff --git a/pkg/compiler/lib/src/types/types.dart b/pkg/compiler/lib/src/types/types.dart |
| index ad890dc6c79f6aaaee44a7880f2eb00d1abbeba8..ca5d19583c60052ec9c15e611df5968f712fe826 100644 |
| --- a/pkg/compiler/lib/src/types/types.dart |
| +++ b/pkg/compiler/lib/src/types/types.dart |
| @@ -128,23 +128,28 @@ class GlobalTypeInferenceTask extends CompilerTask { |
| final String name = 'Type inference'; |
| final Compiler compiler; |
| - TypesInferrer typesInferrer; |
| - CommonMasks masks; |
| + |
| + /// The [TypeInferrer] used by the global type inference. This should by |
| + /// accessed from outside this class for testing only. |
| + TypesInferrer typesInferrerInternal; |
| + |
| GlobalTypeInferenceResults results; |
| GlobalTypeInferenceTask(Compiler compiler) |
| - : masks = new CommonMasks(compiler), |
| - compiler = compiler, |
| - super(compiler.measurer) { |
| - typesInferrer = new TypeGraphInferrer(compiler, masks); |
| - } |
| + : compiler = compiler, |
| + super(compiler.measurer); |
| /// Runs the global type-inference algorithm once. |
| void runGlobalTypeInference(Element mainElement) { |
| measure(() { |
| - typesInferrer.analyzeMain(mainElement); |
| - typesInferrer.clear(); |
| - results = new GlobalTypeInferenceResults(typesInferrer, compiler, masks); |
| + CommonMasks masks = compiler.closedWorld.commonMasks; |
| + if (typesInferrerInternal == null) { |
|
Harry Terkelsen
2016/11/11 22:07:30
typesInferrerInternal ??= ...
Johnni Winther
2016/11/14 09:16:06
Done.
|
| + typesInferrerInternal = new TypeGraphInferrer(compiler, masks); |
| + } |
| + typesInferrerInternal.analyzeMain(mainElement); |
| + typesInferrerInternal.clear(); |
| + results = new GlobalTypeInferenceResults( |
| + typesInferrerInternal, compiler, masks); |
| }); |
| } |
| } |