Open lydell opened 10 years ago
Nope.
~/CoffeeScriptRedux [master|✔]
17:44 $ git checkout 5272d3c -q
~/CoffeeScriptRedux [:5272d3c|✔]
17:44 $ echo "for a in b by -1 then c" | bin/coffee --js --no-optimise
// Generated by CoffeeScript 2.0.0-beta9-dev
void function () {
var a;
for (var i$ = 0, length$ = b.length; i$ < length$; i$ += -1) {
a = b[i$];
c;
}
}.call(this);
Which is exactly the same output as in my original post.
This example might be clearer:
~/CoffeeScriptRedux [master|✔]
17:53 $ bin/coffee -e --cli "for i in [1,2,3] by -1 then console.log i.toString 2"
1
(cli):10
console.log(i.toString(2));
^
TypeError: Cannot call method 'toString' of undefined
at Object.<anonymous> ((cli):1:43, <js>:10:19)
at Object.<anonymous> ((cli) <js>:12:3)
at Module._compile (module.js:456:26)
at runModule (/home/lydell/CoffeeScriptRedux/lib/run.js:100:17)
at runMain (/home/lydell/CoffeeScriptRedux/lib/run.js:93:10)
at processInput (/home/lydell/CoffeeScriptRedux/lib/cli.js:276:7)
at Object.<anonymous> (/home/lydell/CoffeeScriptRedux/lib/cli.js:297:5)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
~/CoffeeScriptRedux [master|✔]
17:53 $ coffee -e "for i in [1,2,3] by -1 then console.log i.toString 2"
11
10
1
@lydell and congrats on that collaborator badge :-).
Ah I see, the test is not changed for negative step loops. Okay, I understand now.