[Pkg-javascript-commits] [less.js] 31/50: Fixes a regression when a mixin guard can't see the mixin parameter variables in certain cases.

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:22:37 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 563c47b7d775d695f0f2b6dc87b032d10225226f
Author: seven-phases-max <seven.phases.max at gmail.com>
Date:   Sat May 10 07:42:07 2014 +0400

    Fixes a regression when a mixin guard can't see the mixin parameter variables in certain cases.
---
 lib/less/tree/mixin.js       |  2 +-
 test/css/mixins-guards.css   |  3 +++
 test/less/mixins-guards.less | 10 ++++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/less/tree/mixin.js b/lib/less/tree/mixin.js
index 164506e..94f48ef 100644
--- a/lib/less/tree/mixin.js
+++ b/lib/less/tree/mixin.js
@@ -283,7 +283,7 @@ tree.mixin.Definition.prototype = {
     matchCondition: function (args, env) {
         if (this.condition && !this.condition.eval(
             new(tree.evalEnv)(env,
-                [this.evalParams(env, new(tree.evalEnv)(env, this.frames.concat(env.frames)), args, [])] // the parameter variables
+                [this.evalParams(env, new(tree.evalEnv)(env, this.frames ? this.frames.concat(env.frames) : env.frames), args, [])] // the parameter variables
                     .concat(this.frames) // the parent namespace/mixin frames
                     .concat(env.frames)))) { // the current environment frames
             return false;
diff --git a/test/css/mixins-guards.css b/test/css/mixins-guards.css
index 27fa976..59b6f93 100644
--- a/test/css/mixins-guards.css
+++ b/test/css/mixins-guards.css
@@ -88,3 +88,6 @@
   a: 1;
   x: 1;
 }
+.mixin-generated-class {
+  a: 1;
+}
diff --git a/test/less/mixins-guards.less b/test/less/mixins-guards.less
index 62dc39d..5aec2e5 100644
--- a/test/less/mixins-guards.less
+++ b/test/less/mixins-guards.less
@@ -161,3 +161,13 @@
   }
 }
 .bug-100cm-1m(100cm);
+
+#ns {
+    .mixin-for-root-usage(@a) when (@a > 0) {
+        .mixin-generated-class {
+            a: @a;
+        }
+    }
+}
+
+#ns > .mixin-for-root-usage(1);

-- 
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