diff --git a/lib/nodes.js b/lib/nodes.js index d6624cf3..c05f9cdb 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -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; diff --git a/src/nodes.coffee b/src/nodes.coffee index f0ea8613..c4a7131c 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -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 + ')' diff --git a/test/test_splats.coffee b/test/test_splats.coffee index 7270103c..87b0afd7 100644 --- a/test/test_splats.coffee +++ b/test/test_splats.coffee @@ -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 \ No newline at end of file +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' \ No newline at end of file