From 55bcd1d1ddbb141751480693663845eecb202f85 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Tue, 4 Aug 2020 01:35:49 -0400 Subject: [PATCH] resolve panic from malformed filter argument --- src/parse/args.rs | 4 +++- tests/args.rs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/parse/args.rs b/src/parse/args.rs index 8de7c39..d8875d2 100644 --- a/src/parse/args.rs +++ b/src/parse/args.rs @@ -341,7 +341,9 @@ impl<'a> Parser<'a> { return Err(("expected \")\".", pos).into()); } } - Some(..) => unreachable!(), + Some(Token { pos, .. }) => { + return Err(("expected \")\".", *pos).into()); + } None => return Err(("expected \")\".", span).into()), } } diff --git a/tests/args.rs b/tests/args.rs index e06da77..adde390 100644 --- a/tests/args.rs +++ b/tests/args.rs @@ -172,6 +172,10 @@ error!( unclosed_paren_in_nested_args, "a { color: a(b(red); }", "Error: expected \")\"." ); +error!( + filter_rhs_missing_closing_paren, + "a { color: lighten(red=(green); }", "Error: expected \")\"." +); test!( space_after_loud_comment, "@mixin foo($x) {