From 79496992297c8d62f86d0151a89c14fdea5f7675 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:58:09 -0500 Subject: [PATCH] Handle variables in binary ops in function calls --- src/args.rs | 3 ++- tests/functions.rs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/args.rs b/src/args.rs index 1497d33..9bdbb7b 100644 --- a/src/args.rs +++ b/src/args.rs @@ -143,7 +143,8 @@ pub(crate) fn eat_call_args>( 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); diff --git a/tests/functions.rs b/tests/functions.rs index d4aac96..7f9739d 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -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" +);