From fe07c3d87e4f43d7bcf8568e61cee6cd6f94c88e Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Thu, 18 Jun 2020 16:54:19 -0400 Subject: [PATCH] fix regression in mixin scoping --- CHANGELOG.md | 3 ++- src/parse/mixin.rs | 2 ++ tests/mixins.rs | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bdde4f..6831f9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 0.9.1 - - fix issue in which `@at-root` would panic when placed after a ruleset + - fix regression in which `@at-root` would panic when placed after a ruleset + - fix regression related to `@mixin` scoping and outer, local variables # 0.9.0 diff --git a/src/parse/mixin.rs b/src/parse/mixin.rs index e40102d..32b589c 100644 --- a/src/parse/mixin.rs +++ b/src/parse/mixin.rs @@ -116,6 +116,8 @@ impl<'a> Parser<'a> { } .parse()?; + self.scopes.pop(); + Ok(body) } diff --git a/tests/mixins.rs b/tests/mixins.rs index c92e338..a5cf865 100644 --- a/tests/mixins.rs +++ b/tests/mixins.rs @@ -242,3 +242,8 @@ test!( "@mixin c {}\n\na {\n @include c()\n}\n", "" ); +test!( + local_variable_declared_before_mixin_is_still_in_scope, + "@mixin foo {}\n\na {\n $a: red;\n @include foo;\n color: $a;\n}\n", + "a {\n color: red;\n}\n" +);