proper error message for out of place @return
This commit is contained in:
parent
242cd7857f
commit
78d7d5ce36
@ -616,7 +616,7 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
|
|||||||
AtRule::Debug(a, b) => Ok(Some(Expr::Debug(a, b))),
|
AtRule::Debug(a, b) => Ok(Some(Expr::Debug(a, b))),
|
||||||
AtRule::Warn(a, b) => Ok(Some(Expr::Warn(a, b))),
|
AtRule::Warn(a, b) => Ok(Some(Expr::Warn(a, b))),
|
||||||
AtRule::Error(pos, err) => Err(SassError::new(err, pos)),
|
AtRule::Error(pos, err) => Err(SassError::new(err, pos)),
|
||||||
AtRule::Return(_) => todo!("@return in unexpected location!"),
|
AtRule::Return(_) => Err("This at-rule is not allowed here.".into()),
|
||||||
AtRule::Content => {
|
AtRule::Content => {
|
||||||
return Err("@content is only allowed within mixin declarations.".into())
|
return Err("@content is only allowed within mixin declarations.".into())
|
||||||
}
|
}
|
||||||
|
@ -15,3 +15,7 @@ error!(
|
|||||||
toplevel_invalid_atrule_ident,
|
toplevel_invalid_atrule_ident,
|
||||||
"@`or $i from 1 through 3 {}", "Error: Expected identifier."
|
"@`or $i from 1 through 3 {}", "Error: Expected identifier."
|
||||||
);
|
);
|
||||||
|
error!(
|
||||||
|
return_as_style,
|
||||||
|
"a {@return foo;}", "Error: This at-rule is not allowed here."
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user