resolve todo!() inside malformed module fn call

This commit is contained in:
Connor Skees 2020-08-18 12:29:01 -04:00
parent b771befed4
commit 7358eb16dc
3 changed files with 11 additions and 4 deletions

View File

@ -40,7 +40,12 @@ impl<'a> Iterator for Lexer<'a> {
impl<'a> Lexer<'a> {
pub fn new(file: &'a Arc<File>) -> Lexer<'a> {
Lexer {
buf: file.source().trim_start_matches("\u{ef}\u{bb}\u{bf}").trim_start_matches("\u{feff}").chars().peekable(),
buf: file
.source()
.trim_start_matches("\u{ef}\u{bb}\u{bf}")
.trim_start_matches("\u{feff}")
.chars()
.peekable(),
pos: 0,
file,
}

View File

@ -220,9 +220,7 @@ impl<'a> Parser<'a> {
.get_fn(fn_name)?
.ok_or(("Undefined function.", fn_name.span))?;
if !matches!(self.toks.next(), Some(Token { kind: '(', .. })) {
todo!()
}
self.expect_char('(')?;
let call_args = self.parse_call_args()?;

View File

@ -34,6 +34,10 @@ error!(
unknown_function,
"@use \"sass:math\";\na { color: math.bar(); }", "Error: Undefined function."
);
error!(
module_function_missing_open_parens,
"@use \"sass:math\";\na { color: math.floor; }", "Error: expected \"(\"."
);
test!(
use_as,
"@use \"sass:math\" as foo;