handle () inside default value of function args
This commit is contained in:
parent
f60089f4f9
commit
56f198f2a7
@ -241,10 +241,11 @@ pub(crate) fn eat_func_args<I: Iterator<Item = Token>>(
|
|||||||
close_paren_span = tok.pos();
|
close_paren_span = tok.pos();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_ => {
|
'(' => {
|
||||||
let tok = toks.next().expect("we know this exists!");
|
default.push(toks.next().unwrap());
|
||||||
default.push(tok)
|
default.extend(read_until_closing_paren(toks));
|
||||||
}
|
}
|
||||||
|
_ => default.push(toks.next().unwrap()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,3 +35,8 @@ test!(
|
|||||||
"$index: 1;\n\n@function foo($a) {\n @return $a;\n}\n\na {\n color: foo($index - 1);\n}\n",
|
"$index: 1;\n\n@function foo($a) {\n @return $a;\n}\n\na {\n color: foo($index - 1);\n}\n",
|
||||||
"a {\n color: 0;\n}\n"
|
"a {\n color: 0;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
parens_in_default_arg_value,
|
||||||
|
"@function foo($arg1: bar()) {\n @return true;\n}\n\na {\n color: foo();\n}\n",
|
||||||
|
"a {\n color: true;\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user