handle while with empty condition
This commit is contained in:
parent
e836ecb8ce
commit
b93e3c6f21
@ -317,6 +317,11 @@ impl AtRule {
|
|||||||
let mut stmts = Vec::new();
|
let mut stmts = Vec::new();
|
||||||
devour_whitespace(toks);
|
devour_whitespace(toks);
|
||||||
let cond = read_until_open_curly_brace(toks);
|
let cond = read_until_open_curly_brace(toks);
|
||||||
|
|
||||||
|
if cond.is_empty() {
|
||||||
|
return Err("Expected expression.".into());
|
||||||
|
}
|
||||||
|
|
||||||
toks.next();
|
toks.next();
|
||||||
let scope = &mut scope.clone();
|
let scope = &mut scope.clone();
|
||||||
let body = read_until_closing_curly_brace(toks);
|
let body = read_until_closing_curly_brace(toks);
|
||||||
|
@ -23,3 +23,7 @@ test!(
|
|||||||
"@while false {\na {\n color: $b;\n }\n $b: $b + 1;\n}",
|
"@while false {\na {\n color: $b;\n }\n $b: $b + 1;\n}",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
|
error!(
|
||||||
|
while_empty_condition,
|
||||||
|
"@while {}", "Error: Expected expression."
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user