Chromium Code Reviews| Index: pkg/compiler/lib/src/deferred_load.dart |
| diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart |
| index 114bdcaaf8886442f87a8fc3b0fd7dbe63de1948..aa3bace09926215e4d1f4dadfbd8ecc01c5d9aab 100644 |
| --- a/pkg/compiler/lib/src/deferred_load.dart |
| +++ b/pkg/compiler/lib/src/deferred_load.dart |
| @@ -226,7 +226,14 @@ class DeferredLoadTask extends CompilerTask { |
| DeferredConstantValue constant, PrefixElement prefix) { |
| OutputUnit outputUnit = new OutputUnit(); |
| outputUnit.imports.add(new _DeclaredDeferredImport(prefix.deferredImport)); |
| - _constantToOutputUnit[constant] = outputUnit; |
| + |
| + // Check to see if there is already a canonical output unit registered. |
| + OutputUnit representative = allOutputUnits.lookup(outputUnit); |
|
Siggi Cherem (dart-lang)
2016/09/07 18:10:44
I see this logic replicated in a few places, maybe
Siggi Cherem (dart-lang)
2016/09/07 18:14:09
reading more into this, it feels like we are doing
Harry Terkelsen
2016/09/07 23:53:50
Done.
Harry Terkelsen
2016/09/07 23:53:50
added a todo
|
| + if (representative == null) { |
| + representative = outputUnit; |
| + allOutputUnits.add(representative); |
| + } |
| + _constantToOutputUnit[constant] = representative; |
| } |
| /// Answers whether [element] is explicitly deferred when referred to from |
| @@ -679,6 +686,11 @@ class DeferredLoadTask extends CompilerTask { |
| Map<ConstantValue, OutputUnit> constantToOutputUnitBuilder = |
| new Map<ConstantValue, OutputUnit>(); |
| + // Add all constants that may have been registered during |
| + // resolution with [registerConstantDeferredUse]. |
|
Siggi Cherem (dart-lang)
2016/09/07 18:10:44
would it make sense to store those somewhere else
Harry Terkelsen
2016/09/07 23:53:50
I wanted to do that at first, but it would mean ha
|
| + constantToOutputUnitBuilder.addAll(_constantToOutputUnit); |
| + _constantToOutputUnit.clear(); |
| + |
| // Reverse the mappings. For each element record an OutputUnit |
| // collecting all deferred imports mapped to this element. Same |
| // for constants. |