Skip to content

Commit

Permalink
Merge pull request #3258 from matthew-dean/bugfix-2824
Browse files Browse the repository at this point in the history
Fixes #2824 - Expressions require a delimiter of some kind in mixin args
  • Loading branch information
matthew-dean authored Jul 11, 2018
2 parents 3f82ef5 + c66282d commit d99a1b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/less/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,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 @@ -952,7 +952,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) {
break;
}

Expand Down Expand Up @@ -1018,10 +1018,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 }

0 comments on commit d99a1b8

Please sign in to comment.