mirror of
https://github.com/danog/dart-sass.git
synced 2024-12-04 02:27:47 +01:00
Fix a bug in setting global variables.
Setting a global variable would clobber any local variables with the same name.
This commit is contained in:
parent
9d4efd2120
commit
17e29fd06e
@ -166,7 +166,9 @@ class Environment {
|
|||||||
/// previous scope. If it's undefined, it'll set it in the current scope.
|
/// previous scope. If it's undefined, it'll set it in the current scope.
|
||||||
void setVariable(String name, Value value, {bool global: false}) {
|
void setVariable(String name, Value value, {bool global: false}) {
|
||||||
if (global || _variables.length == 1) {
|
if (global || _variables.length == 1) {
|
||||||
_variableIndices[name] = 0;
|
// Don't set the index if there's already a variable with the given name,
|
||||||
|
// since local accesses should still return the local variable.
|
||||||
|
_variableIndices.putIfAbsent(name, () => 0);
|
||||||
_variables.first[name] = value;
|
_variables.first[name] = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user