Skip to content

Commit 3bd995b

Browse files
Additional check to avoid evaluating an expression if it is a comment (#3494)
1 parent 0715d90 commit 3bd995b

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

lib/less/parser/parser.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,11 @@ const Parser = function Parser(context, imports, fileInfo) {
23212321
continue;
23222322
}
23232323
e = this.addition() || this.entity();
2324+
2325+
if (e instanceof tree.Comment) {
2326+
e = null;
2327+
}
2328+
23242329
if (e) {
23252330
entities.push(e);
23262331
// operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.test {color: #fffff /* comment */ ;}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ParseError: Unrecognised input in {path}invalid-color-with-comment.less on line 1, column 36:
2+
1 .test {color: #fffff /* comment */ ;}

0 commit comments

Comments
 (0)