Handle variables in binary ops in function calls

This commit is contained in:
ConnorSkees 2020-02-29 18:58:09 -05:00
parent c5f2d04c6c
commit 7949699229
2 changed files with 7 additions and 1 deletions

View File

@ -143,7 +143,8 @@ pub(crate) fn eat_call_args<I: Iterator<Item = Token>>(
TokenKind::Variable(_) => {
let v = toks.next().unwrap();
devour_whitespace_or_comment(toks);
if toks.next().unwrap().is_symbol(Symbol::Colon) {
if toks.peek().unwrap().is_symbol(Symbol::Colon) {
toks.next();
name = v.kind.to_string();
} else {
val.push(v);

View File

@ -48,3 +48,8 @@ test!(
"@function a() {\n @return 1; @return 2;\n}\n\nb {\ncolor: a();\n}\n",
"b {\n color: 1;\n}\n"
);
test!(
value_after_variable,
"$x: 0;\na {\n color: if($x != 0, a, b);\n}\n",
"a {\n color: b;\n}\n"
);