Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/less/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ var Parser = function Parser(context, imports, fileInfo) {
returner = { args:null, variadic: false },
expressions = [], argsSemiColon = [], argsComma = [],
isSemiColonSeparated, expressionContainsNamed, name, nameLoop,
value, arg, expand;
value, arg, expand, hasSep = true;

parserInput.save();

Expand All @@ -950,7 +950,7 @@ var Parser = function Parser(context, imports, fileInfo) {
arg = entities.variable() || entities.property() || entities.literal() || entities.keyword() || this.call(true);
}

if (!arg) {
if (!arg || !hasSep) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this ever evaluate to true? It looks like hasSep isn't touched between hasSep = true and !hasSep. Unless there's some kind of non-linear code happening that would set it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's set per loop. The first time it's true; that's intentional because it doesn't need a separator. Then it continues to be set by the presence of a separator, but depends on what type during the loop. So if ever it finishes without detecting a true separation of args, it should fail... I think. It seems to work? lol

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for me.

break;
}

Expand Down Expand Up @@ -1016,10 +1016,12 @@ var Parser = function Parser(context, imports, fileInfo) {
argsComma.push({ name:nameLoop, value:value, expand:expand });

if (parserInput.$char(',')) {
hasSep = true;
continue;
}
hasSep = parserInput.$char(';') === ';';

if (parserInput.$char(';') || isSemiColonSeparated) {
if (hasSep || isSemiColonSeparated) {

if (expressionContainsNamed) {
error('Cannot mix ; and , as delimiter types');
Expand Down
7 changes: 7 additions & 0 deletions test/less/errors/mixin-not-defined-2.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.non-matching-mixin(@a @b) {
args: @a @b;
}

x {
.non-matching-mixin(x, y);
}
4 changes: 4 additions & 0 deletions test/less/errors/mixin-not-defined-2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RuntimeError: No matching definition was found for `.non-matching-mixin(x, y)` in {path}mixin-not-defined-2.less on line 6, column 3:
5 x {
6 .non-matching-mixin(x, y);
7 }