Fixed recursive mixin regression, updated tests to detect such regression in future.

This commit is contained in:
seven-phases-max
2014-03-19 05:55:11 +04:00
parent 0c8e117b85
commit 8afeae92d3
2 changed files with 6 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ tree.mixin.Call.prototype = {
eval: function (env) {
var mixins, mixin, args, rules = [], match = false, i, m, f, isRecursive, isOneFound, rule,
candidates = [], candidate, conditionResult = [], defaultFunc = tree.defaultFunc,
defaultResult, defNone = 0, defTrue = 1, defFalse = 2, count;
defaultResult, defNone = 0, defTrue = 1, defFalse = 2, count, originalRuleset;
args = this.arguments && this.arguments.map(function (a) {
return { name: a.name, value: a.value.eval(env) };
@@ -99,8 +99,9 @@ tree.mixin.Call.prototype = {
try {
mixin = candidates[m].mixin;
if (!(mixin instanceof tree.mixin.Definition)) {
originalRuleset = mixin.originalRuleset || mixin;
mixin = new tree.mixin.Definition("", [], mixin.rules, null, false);
mixin.originalRuleset = mixins[m].originalRuleset || mixins[m];
mixin.originalRuleset = originalRuleset;
}
Array.prototype.push.apply(
rules, mixin.evalCall(env, args, this.important).rules);

View File

@@ -136,6 +136,9 @@ h3 { .margin_between(15px, 5px); }
.clearfix {
.clearfix();
}
.clearfix {
.clearfix();
}
.foo {
.clearfix();
}