@content may have call args even when it has no parens

This commit is contained in:
Connor Skees 2020-08-17 03:30:54 -04:00
parent 5bcf499942
commit a0786619de
2 changed files with 26 additions and 11 deletions

View File

@ -213,18 +213,20 @@ impl<'a> Parser<'a> {
let mut entered_scope = false; let mut entered_scope = false;
if let Some(Token { kind: '(', .. }) = self.toks.peek() { let call_args = if self.consume_char_if_exists('(') {
self.toks.next(); self.parse_call_args()?
let args = self.parse_call_args()?; } else {
if let Some(ref content_args) = content.content_args { CallArgs::new(self.span_before)
args.max_args(content_args.len())?; };
let scope = self.eval_args(content_args.clone(), args)?; if let Some(ref content_args) = content.content_args {
scope_at_decl.enter_scope(scope); call_args.max_args(content_args.len())?;
entered_scope = true;
} else { let scope = self.eval_args(content_args.clone(), call_args)?;
args.max_args(0)?; scope_at_decl.enter_scope(scope);
} entered_scope = true;
} else {
call_args.max_args(0)?;
} }
let stmts = if let Some(body) = content.content.clone() { let stmts = if let Some(body) = content.content.clone() {

View File

@ -525,6 +525,19 @@ test!(
}", }",
"a {\n color: red;\n}\n" "a {\n color: red;\n}\n"
); );
test!(
content_default_arg_value_no_parens,
"a {
@mixin foo {
@content;
}
@include foo using ($a: red) {
color: $a;
}
}",
"a {\n color: red;\n}\n"
);
error!( error!(
mixin_in_function, mixin_in_function,
"@function foo() { "@function foo() {