This commit is contained in:
ConnorSkees 2020-03-10 21:23:47 -04:00
parent 8458106833
commit 31fbb0a77e
2 changed files with 7 additions and 3 deletions

View File

@ -528,7 +528,9 @@ impl<'a> StyleSheetParser<'a> {
Expr::Style(s) => stmts.push(Stmt::Style(s)),
Expr::AtRule(a) => match a {
AtRule::For(s) => stmts.extend(s),
AtRule::Content => return Err("@content is only allowed within mixin declarations.".into()),
AtRule::Content => {
return Err("@content is only allowed within mixin declarations.".into())
}
r => stmts.push(Stmt::AtRule(r)),
},
Expr::Styles(s) => stmts.extend(s.into_iter().map(Box::new).map(Stmt::Style)),
@ -694,7 +696,9 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
AtRule::Warn(a, b) => Ok(Some(Expr::Warn(a, b))),
AtRule::Error(pos, err) => Err(SassError::new(err, pos)),
AtRule::Return(_) => todo!("@return in unexpected location!"),
AtRule::Content => return Err("@content is only allowed within mixin declarations.".into()),
AtRule::Content => {
return Err("@content is only allowed within mixin declarations.".into())
}
f @ AtRule::For(..) => Ok(Some(Expr::AtRule(f))),
u @ AtRule::Unknown(..) => Ok(Some(Expr::AtRule(u))),
};

View File

@ -98,7 +98,7 @@ impl Mixin {
match expr {
Expr::AtRule(a) => match a {
AtRule::Content => todo!("@content in mixin"),
_ => stmts.push(Stmt::AtRule(a))
_ => stmts.push(Stmt::AtRule(a)),
},
Expr::Style(s) => stmts.push(Stmt::Style(s)),
Expr::Styles(s) => stmts.extend(s.into_iter().map(Box::new).map(Stmt::Style)),