mirror of
https://github.com/danog/dart-sass.git
synced 2024-12-02 17:49:38 +01:00
Fix a few variable assignment semantics.
This commit is contained in:
parent
87e03f17eb
commit
4e6a3d0ea9
@ -165,10 +165,17 @@ class Environment {
|
||||
/// Otherwise, if the variable was already defined, it'll set it in the
|
||||
/// previous scope. If it's undefined, it'll set it in the current scope.
|
||||
void setVariable(String name, Value value, {bool global: false}) {
|
||||
var index = global || _variables.length == 1
|
||||
? 0
|
||||
: _variableIndices.putIfAbsent(
|
||||
name, () => _inSemiGlobalScope ? 0 : _variables.length - 1);
|
||||
int index;
|
||||
if (global || _variables.length == 1) {
|
||||
index = 0;
|
||||
} else {
|
||||
index = _variableIndices.putIfAbsent(name, () => _variables.length - 1);
|
||||
if (!_inSemiGlobalScope && index == 0) {
|
||||
index = _variables.length - 1;
|
||||
_variableIndices[name] = index;
|
||||
}
|
||||
}
|
||||
|
||||
_variables[index][name] = value;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user