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

Fixed a small bug about flexible splats that occured when the leading array was a literal

This commit is contained in:
matehat 2010-03-18 00:08:05 -04:00
parent 79e4f30f69
commit 256525bfa2
2 changed files with 4 additions and 4 deletions

View file

@ -486,9 +486,9 @@
if (!(arg instanceof SplatNode)) {
prev = args[i - 1];
if (i === 1 && prev.substr(0, 1) === '[' && prev.substr(prev.length - 1, 1) === ']') {
args[i - 1] = '' + (prev.substr(0, prev.length - 2)) + ", " + code + "]";
args[i - 1] = '' + (prev.substr(0, prev.length - 1)) + ", " + code + "]";
continue;
} else if (i > 1 && prev.substr(8, 1) === '[' && prev.substr(prev.length - 2, 1) === ']') {
} else if (i > 1 && prev.substr(0, 9) === '.concat([' && prev.substr(prev.length - 2, 2) === '])') {
args[i - 1] = '' + (prev.substr(0, prev.length - 2)) + ", " + code + "])";
continue;
} else {

View file

@ -375,9 +375,9 @@ exports.CallNode: class CallNode extends BaseNode
if not (arg instanceof SplatNode)
prev: args[i - 1]
if i is 1 and prev.substr(0, 1) is '[' and prev.substr(prev.length - 1, 1) is ']'
args[i - 1]: "${prev.substr(0, prev.length - 2)}, $code]"
args[i - 1]: "${prev.substr(0, prev.length - 1)}, $code]"
continue
else if i > 1 and prev.substr(8, 1) is '[' and prev.substr(prev.length - 2, 1) is ']'
else if i > 1 and prev.substr(0, 9) is '.concat([' and prev.substr(prev.length - 2, 2) is '])'
args[i - 1]: "${prev.substr(0, prev.length - 2)}, $code])"
continue
else