unconditionally exit mixin scope

This commit is contained in:
Connor Skees 2020-07-10 21:19:11 -04:00
parent a3ebcb298a
commit 3c756f661d
2 changed files with 25 additions and 2 deletions

View File

@ -145,10 +145,10 @@ impl<'a> Parser<'a> {
.parse()?; .parse()?;
self.content.pop(); self.content.pop();
self.scopes.exit_scope();
if declared_at_root { if declared_at_root {
mem::swap(self.scopes, self.content_scopes); mem::swap(self.scopes, self.content_scopes);
} else {
self.scopes.exit_scope();
} }
Ok(body) Ok(body)

View File

@ -426,3 +426,26 @@ test!(
}", }",
"a {\n color: 1rem;\n}\n" "a {\n color: 1rem;\n}\n"
); );
test!(
can_access_global_variables_set_after_other_include,
"$x: true;
@mixin foobar() {
@if $x {
$x: false !global;
color: foo;
}
@else {
$x: true !global;
color: bar;
}
}
a {
@include foobar();
$x: true !global;
@include foobar();
}",
"a {\n color: foo;\n color: foo;\n}\n"
);