1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

fixing off-by-one error in compile_splat_arguments

This commit is contained in:
Jeremy Ashkenas 2010-03-17 22:07:11 -04:00
parent 6fd7810d89
commit 884637468e
3 changed files with 6 additions and 2 deletions

View file

@ -489,7 +489,7 @@
args[i - 1] = '' + (prev.substr(0, prev.length - 2)) + ", " + code + "]";
continue;
} else if (i > 1 && prev.substr(8, 1) === '[' && prev.substr(prev.length - 2, 1) === ']') {
args[i - 1] = '' + (prev.substr(0, prev.length - 3)) + ", " + code + "])";
args[i - 1] = '' + (prev.substr(0, prev.length - 2)) + ", " + code + "])";
continue;
} else {
code = "[" + code + "]";

View file

@ -378,7 +378,7 @@ exports.CallNode: class CallNode extends BaseNode
args[i - 1]: "${prev.substr(0, prev.length - 2)}, $code]"
continue
else if i > 1 and prev.substr(8, 1) is '[' and prev.substr(prev.length - 2, 1) is ']'
args[i - 1]: "${prev.substr(0, prev.length - 3)}, $code])"
args[i - 1]: "${prev.substr(0, prev.length - 2)}, $code])"
continue
else
code: "[$code]"

View file

@ -45,6 +45,10 @@ ok bronze is "Mighty Mouse"
ok last is "Michael Phelps"
ok the_field.length is 8
medalists contenders..., 'Tim', 'Bob', 'Jim'
ok last is 'Jim'
obj: {
name: 'bob'
accessor: (args...) ->