Skip to content

Commit 11f8354

Browse files
committed
Fix a case where a variable was considered unconfigurable
This didn't account for forwarded modules when determining which variables were configurable in a given module.
1 parent 1b3c2f9 commit 11f8354

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

lib/src/async_environment.dart

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,9 +1089,24 @@ final class _EnvironmentModule implements Module {
10891089
}
10901090

10911091
bool couldHaveBeenConfigured(Set<String> variables) =>
1092-
variables.length < _environment._configurableVariables.length
1092+
// Check if this module defines a configurable variable with any of the
1093+
// given names.
1094+
(variables.length < _environment._configurableVariables.length
10931095
? variables.any(_environment._configurableVariables.contains)
1094-
: _environment._configurableVariables.any(variables.contains);
1096+
: _environment._configurableVariables.any(variables.contains)) ||
1097+
// Find forwarded modules whose variables overlap with [variables] and
1098+
// check if they define configurable variables with any of the given
1099+
// names.
1100+
(variables.length < _modulesByVariable.length
1101+
? {
1102+
for (var variable in variables)
1103+
if (_modulesByVariable[variable] case var module?) module
1104+
}
1105+
: {
1106+
for (var (variable, module) in _modulesByVariable.pairs)
1107+
if (variables.contains(variable)) module
1108+
})
1109+
.any((module) => module.couldHaveBeenConfigured(variables));
10951110

10961111
Module cloneCss() {
10971112
if (!transitivelyContainsCss) return this;

lib/src/environment.dart

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// DO NOT EDIT. This file was generated from async_environment.dart.
66
// See tool/grind/synchronize.dart for details.
77
//
8-
// Checksum: f947505f8d0057a36a175e81ba8279c70e59e9dc
8+
// Checksum: 72b802e4004aae8a84f7aa78ec728861339b846b
99
//
1010
// ignore_for_file: unused_import
1111

@@ -1099,9 +1099,24 @@ final class _EnvironmentModule implements Module<Callable> {
10991099
}
11001100

11011101
bool couldHaveBeenConfigured(Set<String> variables) =>
1102-
variables.length < _environment._configurableVariables.length
1102+
// Check if this module defines a configurable variable with any of the
1103+
// given names.
1104+
(variables.length < _environment._configurableVariables.length
11031105
? variables.any(_environment._configurableVariables.contains)
1104-
: _environment._configurableVariables.any(variables.contains);
1106+
: _environment._configurableVariables.any(variables.contains)) ||
1107+
// Find forwarded modules whose variables overlap with [variables] and
1108+
// check if they define configurable variables with any of the given
1109+
// names.
1110+
(variables.length < _modulesByVariable.length
1111+
? {
1112+
for (var variable in variables)
1113+
if (_modulesByVariable[variable] case var module?) module
1114+
}
1115+
: {
1116+
for (var (variable, module) in _modulesByVariable.pairs)
1117+
if (variables.contains(variable)) module
1118+
})
1119+
.any((module) => module.couldHaveBeenConfigured(variables));
11051120

11061121
Module<Callable> cloneCss() {
11071122
if (!transitivelyContainsCss) return this;

0 commit comments

Comments
 (0)