mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Look through all scopes for a mixin before giving up. Fixes #413 again
This commit is contained in:
@@ -10,14 +10,15 @@ tree.mixin.Call = function (elements, args, index, filename, important) {
|
||||
};
|
||||
tree.mixin.Call.prototype = {
|
||||
eval: function (env) {
|
||||
var mixins, args, rules = [], match = false, i, m, f, isRecursive;
|
||||
var mixins, args, rules = [], match = false, i, m, f, isRecursive, isOneFound;
|
||||
|
||||
args = this.arguments && this.arguments.map(function (a) {
|
||||
return { name: a.name, value: a.value.eval(env) };
|
||||
});
|
||||
|
||||
for (i = 0; i < env.frames.length; i++) {
|
||||
if ((mixins = env.frames[i].find(this.selector)).length > 0) {
|
||||
|
||||
args = this.arguments && this.arguments.map(function (a) {
|
||||
return { name: a.name, value: a.value.eval(env) };
|
||||
});
|
||||
isOneFound = true;
|
||||
for (m = 0; m < mixins.length; m++) {
|
||||
isRecursive = false;
|
||||
for(f = 0; f < env.frames.length; f++) {
|
||||
@@ -41,29 +42,31 @@ tree.mixin.Call.prototype = {
|
||||
}
|
||||
if (match) {
|
||||
return rules;
|
||||
} else {
|
||||
throw { type: 'Runtime',
|
||||
message: 'No matching definition was found for `' +
|
||||
this.selector.toCSS().trim() + '(' +
|
||||
(args ? args.map(function (a) {
|
||||
var argValue = "";
|
||||
if (a.name) {
|
||||
argValue += a.name + ":";
|
||||
}
|
||||
if (a.value.toCSS) {
|
||||
argValue += a.value.toCSS();
|
||||
} else {
|
||||
argValue += "???";
|
||||
}
|
||||
return argValue;
|
||||
}).join(', ') : "") + ")`",
|
||||
index: this.index, filename: this.filename };
|
||||
}
|
||||
}
|
||||
}
|
||||
throw { type: 'Name',
|
||||
if (isOneFound) {
|
||||
throw { type: 'Runtime',
|
||||
message: 'No matching definition was found for `' +
|
||||
this.selector.toCSS().trim() + '(' +
|
||||
(args ? args.map(function (a) {
|
||||
var argValue = "";
|
||||
if (a.name) {
|
||||
argValue += a.name + ":";
|
||||
}
|
||||
if (a.value.toCSS) {
|
||||
argValue += a.value.toCSS();
|
||||
} else {
|
||||
argValue += "???";
|
||||
}
|
||||
return argValue;
|
||||
}).join(', ') : "") + ")`",
|
||||
index: this.index, filename: this.filename };
|
||||
} else {
|
||||
throw { type: 'Name',
|
||||
message: this.selector.toCSS().trim() + " is undefined",
|
||||
index: this.index, filename: this.filename };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user