[Pkg-javascript-commits] [less.js] 11/50: Fixed recursive mixin regression, updated tests to detect such regression in future.

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:22:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v1.7.1
in repository less.js.

commit 8afeae92d3ef2eb54b06de0c9784ba4e4e7afd74
Author: seven-phases-max <seven.phases.max at gmail.com>
Date:   Wed Mar 19 05:55:11 2014 +0400

    Fixed recursive mixin regression, updated tests to detect such regression in future.
---
 lib/less/tree/mixin.js | 5 +++--
 test/less/mixins.less  | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/less/tree/mixin.js b/lib/less/tree/mixin.js
index 506561b..164506e 100644
--- a/lib/less/tree/mixin.js
+++ b/lib/less/tree/mixin.js
@@ -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);
diff --git a/test/less/mixins.less b/test/less/mixins.less
index be9e2bb..b98836c 100644
--- a/test/less/mixins.less
+++ b/test/less/mixins.less
@@ -136,6 +136,9 @@ h3 { .margin_between(15px, 5px); }
 .clearfix {
   .clearfix();
 }
+.clearfix {
+  .clearfix();
+}
 .foo {
   .clearfix();
 }
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list