Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional check to avoid evaluating an expression if it is a comment #3494

Merged
merged 1 commit into from Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 */ ;}