disallow selectors and styles in functions
This commit is contained in:
parent
3e5f69118b
commit
622d44ac63
@ -245,6 +245,13 @@ impl<'a> Parser<'a> {
|
||||
// dart-sass seems to special-case the error message here?
|
||||
'!' | '{' => return Err(("expected \"}\".", *pos).into()),
|
||||
_ => {
|
||||
if self.flags.in_function() {
|
||||
return Err((
|
||||
"Functions can only contain variable declarations and control directives.",
|
||||
self.span_before
|
||||
)
|
||||
.into());
|
||||
}
|
||||
if self.flags.in_keyframes() {
|
||||
match self.is_selector_or_style()? {
|
||||
SelectorOrStyle::Style(property, value) => {
|
||||
|
@ -305,3 +305,16 @@ error!(
|
||||
}",
|
||||
"Error: This at-rule is not allowed here."
|
||||
);
|
||||
error!(
|
||||
disallows_selectors,
|
||||
"@function foo($a) {
|
||||
functiona {
|
||||
@return $a;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
color: foo(nul);
|
||||
}",
|
||||
"Error: Functions can only contain variable declarations and control directives."
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user