Fix regression in deferred loading.

Ensure closures are not moved out of the main output unit accidentally.

This was seen in a large app, I haven't yet come up with a small repro for our
unit tests.

Change-Id: Ie1d4b3b5396eeeb41528e355c7f0d4abdfca7154
Reviewed-on: https://dart-review.googlesource.com/57521
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem 2018-05-31 00:12:41 +00:00 committed by commit-bot@chromium.org
parent 2911f1f107
commit fa9ff9a061

View file

@ -522,8 +522,13 @@ abstract class DeferredLoadTask extends CompilerTask {
for (Local localFunction in dependencies.localFunctions) { for (Local localFunction in dependencies.localFunctions) {
// Local function are not updated recursively because the dependencies are // Local function are not updated recursively because the dependencies are
// already visited as dependencies of the enclosing member, so we just // already visited as dependencies of the enclosing member, so we just
// assign the [newSet] to each local function. // assign the [newSet] to each local function that is not already assigned
_localFunctionToSet[localFunction] = newSet; // to the main output unit.
ImportSet currentSet = _localFunctionToSet[localFunction];
if (currentSet != newSet && currentSet != importSets.mainSet) {
assert(currentSet == oldSet);
_localFunctionToSet[localFunction] = newSet;
}
} }
for (ConstantValue dependency in dependencies.constants) { for (ConstantValue dependency in dependencies.constants) {