allow multiline comments in functions

This commit is contained in:
Connor Skees 2020-08-04 02:13:15 -04:00
parent a79c62c2fa
commit 9c2d1200f7
2 changed files with 17 additions and 1 deletions

View File

@ -232,7 +232,11 @@ impl<'a> Parser<'a> {
self.whitespace();
match comment.node {
Comment::Silent => continue,
Comment::Loud(s) => stmts.push(Stmt::Comment(s)),
Comment::Loud(s) => {
if !self.flags.in_function() {
stmts.push(Stmt::Comment(s));
}
}
}
}
'\u{0}'..='\u{8}' | '\u{b}'..='\u{1f}' => {

View File

@ -318,3 +318,15 @@ error!(
}",
"Error: Functions can only contain variable declarations and control directives."
);
test!(
allows_multiline_comment,
"@function foo($a) {
/* foo */
@return $a;
}
a {
color: foo(nul);
}",
"a {\n color: nul;\n}\n"
);