Skip to content

Commit

Permalink
Fixes #3195 (#3215)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-dean committed Jun 16, 2018
1 parent 0de99e9 commit 468b532
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
34 changes: 19 additions & 15 deletions lib/less/tree/ruleset.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,21 +349,25 @@ Ruleset.prototype.parseValue = function(toParse) {
var self = this;
function transformDeclaration(decl) {
if (decl.value instanceof Anonymous && !decl.parsed) {
this.parse.parseNode(
decl.value.value,
["value", "important"],
decl.value.getIndex(),
decl.fileInfo(),
function(err, result) {
if (err) {
decl.parsed = true;
}
if (result) {
decl.value = result[0];
decl.important = result[1] || '';
decl.parsed = true;
}
});
if (typeof decl.value.value === "string") {
this.parse.parseNode(
decl.value.value,
["value", "important"],
decl.value.getIndex(),
decl.fileInfo(),
function(err, result) {
if (err) {
decl.parsed = true;
}
if (result) {
decl.value = result[0];
decl.important = result[1] || '';
decl.parsed = true;
}
});
} else {
decl.parsed = true;
}

return decl;
}
Expand Down
13 changes: 13 additions & 0 deletions test/less/extract-and-length.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@

// test late parsing
@cols: 1, 2;

.a(@i: length(@cols)) when (@i > 0) {
@divider: e(extract(@cols, @i));
}
.a;

.b(@j: 1) when (@j < length(@cols)) {
@divider: e(extract(@cols, @j));
}
.b;

// simple array/list:

.multiunit {
Expand Down

0 comments on commit 468b532

Please sign in to comment.