Allow function declarations inside rulesets
This commit is contained in:
parent
195a9b1552
commit
3919e92dcb
@ -64,7 +64,7 @@ impl Function {
|
||||
return Err("unexpected EOF (TODO: better error message)".into());
|
||||
}
|
||||
}
|
||||
|
||||
devour_whitespace(toks);
|
||||
Ok((name, Function::new(scope, args, body)))
|
||||
}
|
||||
|
||||
|
@ -53,3 +53,13 @@ test!(
|
||||
"$x: 0;\na {\n color: if($x != 0, a, b);\n}\n",
|
||||
"a {\n color: b;\n}\n"
|
||||
);
|
||||
test!(
|
||||
function_decl_in_ruleset,
|
||||
"a {\n @function foo() {\n @return 3;\n }\n color: foo();\n}\n",
|
||||
"a {\n color: 3;\n}\n"
|
||||
);
|
||||
test!(
|
||||
function_decl_in_foreign_ruleset,
|
||||
"a {\n @function foo() {\n @return 3;\n }\n}\nb {\n color: foo();\n}\n",
|
||||
"b {\n color: foo();\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user