Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes #698: incorrect function call within for with named argument

  • Loading branch information...
commit c40251a1bdce16dc33c4b1a3769d7f307346e3f7 1 parent 76e3d3b
Tõnis Tiigi authored
11 lib/visitor/evaluator.js
View
@@ -326,9 +326,11 @@ Evaluator.prototype.visitCall = function(call){
// Evaluate arguments
this.return++;
- var args = this.visit(call.args);
- for (var key in call.args.map) {
- call.args.map[key] = this.visit(call.args.map[key]);
+ var args = this.visit(call.args)
+ , mapCopy = {};
+ for (var key in args.map) {
+ mapCopy[key] = args.map[key];
+ args.map[key] = this.visit(mapCopy[key].clone());
}
this.return--;
@@ -342,6 +344,9 @@ Evaluator.prototype.visitCall = function(call){
ret = this.invokeFunction(fn, args);
}
+ for (key in mapCopy) {
+ args.map[key] = mapCopy[key];
+ }
this.calling.pop();
this.ignoreColors = false;
return ret;
5 test/cases/for.css
View
@@ -36,6 +36,11 @@ body foo {
body foo {
bar: 3;
}
+body {
+ bar: 1;
+ bar: 2;
+ bar: 3;
+}
body foo bar {
baz: 1;
}
7 test/cases/for.styl
View
@@ -29,6 +29,13 @@ body
for n in 1 2 3
foo
bar n
+
+func(num)
+ return num
+
+body
+ for n in 1 2 3
+ bar func(num: n)
test(args...)
foo
Please sign in to comment.
Something went wrong with that request. Please try again.