!global variables declared inside control flow not at root do not also add variable to current scope

This commit is contained in:
Connor Skees 2020-08-18 05:55:54 -04:00
parent 6630a1c2ea
commit 6debd2ef52
2 changed files with 19 additions and 6 deletions

View File

@ -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(())
}

View File

@ -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,