resolve todo!() on malformed @use missing string

This commit is contained in:
Connor Skees 2020-08-19 03:14:33 -04:00
parent 10e08fc8ec
commit 849a8b4414
2 changed files with 7 additions and 1 deletions

View File

@ -186,7 +186,9 @@ impl<'a> Parser<'a> {
let quote = match self.toks.next() {
Some(Token { kind: q @ '"', .. }) | Some(Token { kind: q @ '\'', .. }) => q,
Some(..) | None => todo!(),
Some(..) | None => {
return Err(("Expected string.", self.span_before).into())
}
};
let Spanned { node: module, span } = self.parse_quoted_string(quote)?;

View File

@ -38,6 +38,10 @@ error!(
module_function_missing_open_parens,
"@use \"sass:math\";\na { color: math.floor; }", "Error: expected \"(\"."
);
error!(
module_not_quoted_string,
"@use a", "Error: Expected string."
);
test!(
use_as,
"@use \"sass:math\" as foo;