diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 81a3422..de5d5ee 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -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}' => { diff --git a/tests/functions.rs b/tests/functions.rs index 973dbe0..333d4a1 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -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" +);