variables declared in mixins can be accessed after @content
This commit is contained in:
parent
f587a36367
commit
da9c0b78b2
@ -190,7 +190,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
Ok(if let Some(content) = &self.content.pop() {
|
||||
Ok(if let Some(content) = self.content.pop() {
|
||||
let stmts = if let Some(body) = content.content.clone() {
|
||||
Parser {
|
||||
toks: &mut body.into_iter().peekmore(),
|
||||
@ -212,8 +212,9 @@ impl<'a> Parser<'a> {
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
self.content.push(content.clone());
|
||||
self.scopes.exit_scope();
|
||||
|
||||
self.content.push(content);
|
||||
|
||||
stmts
|
||||
} else {
|
||||
Vec::new()
|
||||
|
@ -105,7 +105,7 @@ impl Scopes {
|
||||
if let Some(scope) = self.0.last_mut() {
|
||||
scope.merge(other)
|
||||
} else {
|
||||
panic!()
|
||||
self.0.push(other)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -449,6 +449,22 @@ test!(
|
||||
}",
|
||||
"a {\n color: foo;\n color: foo;\n}\n"
|
||||
);
|
||||
test!(
|
||||
can_access_variables_declared_before_content,
|
||||
"@mixin foo {
|
||||
$a: red;
|
||||
|
||||
@content;
|
||||
|
||||
color: $a;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
@include foo;
|
||||
}",
|
||||
"a {\n color: red;\n}\n"
|
||||
);
|
||||
error!(
|
||||
mixin_in_function,
|
||||
"@function foo() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user