diff --git a/src/parse/variable.rs b/src/parse/variable.rs index cd65284..ae17055 100644 --- a/src/parse/variable.rs +++ b/src/parse/variable.rs @@ -105,12 +105,8 @@ impl<'a> Parser<'a> { } else { self.global_scope.insert_var(ident, value); } - } else { - if self.flags.in_control_flow() && global { - self.scopes.insert_var_last(ident, value); - } else { - self.scopes.insert_var(ident, value); - } + } else if !(self.flags.in_control_flow() && global) { + self.scopes.insert_var(ident, value); } Ok(()) } diff --git a/tests/variables.rs b/tests/variables.rs index 2d1f8c7..309fa44 100644 --- a/tests/variables.rs +++ b/tests/variables.rs @@ -289,6 +289,23 @@ test!( }", "a {\n color: c;\n}\n" ); +test!( + inside_style_inside_control_flow_declared_outer_global_comes_prior, + "$a: a; + + a { + $a: b; + + @if true { + $a: c !global; + color: $a; + $a: e; + } + + color: $a; + }", + "a {\n color: b;\n color: e;\n}\n" +); // https://github.com/Kixiron/lasso/issues/7 test!( regression_test_for_lasso_0_3_0,