handle while with empty condition

This commit is contained in:
ConnorSkees 2020-04-02 00:28:03 -04:00
parent e836ecb8ce
commit b93e3c6f21
2 changed files with 9 additions and 0 deletions

View File

@ -317,6 +317,11 @@ impl AtRule {
let mut stmts = Vec::new();
devour_whitespace(toks);
let cond = read_until_open_curly_brace(toks);
if cond.is_empty() {
return Err("Expected expression.".into());
}
toks.next();
let scope = &mut scope.clone();
let body = read_until_closing_curly_brace(toks);

View File

@ -23,3 +23,7 @@ test!(
"@while false {\na {\n color: $b;\n }\n $b: $b + 1;\n}",
""
);
error!(
while_empty_condition,
"@while {}", "Error: Expected expression."
);