Skip to content

Commit

Permalink
Additional check to avoid evaluating an expression if it is a comment (
Browse files Browse the repository at this point in the history
  • Loading branch information
rgroothuijsen committed Apr 30, 2020
1 parent 0715d90 commit 3bd995b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/less/parser/parser.js
Expand Up @@ -2321,6 +2321,11 @@ const Parser = function Parser(context, imports, fileInfo) {
continue;
}
e = this.addition() || this.entity();

if (e instanceof tree.Comment) {
e = null;
}

if (e) {
entities.push(e);
// operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
Expand Down
1 change: 1 addition & 0 deletions test/less/errors/invalid-color-with-comment.less
@@ -0,0 +1 @@
.test {color: #fffff /* comment */ ;}
2 changes: 2 additions & 0 deletions test/less/errors/invalid-color-with-comment.txt
@@ -0,0 +1,2 @@
ParseError: Unrecognised input in {path}invalid-color-with-comment.less on line 1, column 36:
1 .test {color: #fffff /* comment */ ;}

0 comments on commit 3bd995b

Please sign in to comment.