mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
fixing an off-by-one error in Splat compilation
This commit is contained in:
parent
2d3f6b80c1
commit
a93229b14d
3 changed files with 15 additions and 3 deletions
|
@ -376,7 +376,7 @@
|
|||
}
|
||||
}
|
||||
this.last = parts[parts.length - 1];
|
||||
this.source = parts.length > 1 ? parts.slice(0, parts.length).join('') : null;
|
||||
this.source = parts.length > 1 ? parts.slice(0, (parts.length - 1)).join('') : null;
|
||||
code = parts.join('').replace(/\)\(\)\)/, '()))');
|
||||
if (!(soaked)) {
|
||||
return code;
|
||||
|
|
|
@ -283,7 +283,7 @@ ValueNode: exports.ValueNode: inherit Node, {
|
|||
parts.push(part)
|
||||
|
||||
@last: parts[parts.length - 1]
|
||||
@source: if parts.length > 1 then parts[0...parts.length].join('') else null
|
||||
@source: if parts.length > 1 then parts[0...(parts.length - 1)].join('') else null
|
||||
code: parts.join('').replace(/\)\(\)\)/, '()))')
|
||||
return code unless soaked
|
||||
'(' + code + ')'
|
||||
|
|
|
@ -32,4 +32,16 @@ medalists "Mighty Mouse", contenders...
|
|||
ok gold is "Mighty Mouse"
|
||||
ok silver is "Michael Phelps"
|
||||
ok bronze is "Liu Xiang"
|
||||
ok the_field.length is 8
|
||||
ok the_field.length is 8
|
||||
|
||||
|
||||
obj: {
|
||||
name: 'bob'
|
||||
accessor: (args...) ->
|
||||
[@name].concat(args).join(' ')
|
||||
getNames: ->
|
||||
args: ['jane', 'ted']
|
||||
@accessor(args...)
|
||||
}
|
||||
|
||||
ok obj.getNames() is 'bob jane ted'
|
Loading…
Add table
Reference in a new issue