diff --git a/lib/nodes.js b/lib/nodes.js index 0520ba91..008d5567 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -461,7 +461,7 @@ return '' + (meth) + ".call(this" + (args.length ? ', ' : '') + args + ")"; }; // If you call a function with a splat, it's converted into a JavaScript - // `.apply()` call to allow the variable-length arguments. + // `.apply()` call to allow an array of arguments to be passed. CallNode.prototype.compile_splat = function compile_splat(o) { var _a, _b, _c, arg, args, code, i, meth, obj, temp; meth = this.variable.compile(o); @@ -523,12 +523,14 @@ __extends(AccessorNode, BaseNode); AccessorNode.prototype.type = 'Accessor'; AccessorNode.prototype.compile_node = function compile_node(o) { - return '.' + (this.prototype ? 'prototype.' : '') + this.name.compile(o); + var proto_part; + proto_part = this.prototype ? 'prototype.' : ''; + return "." + proto_part + (this.name.compile(o)); }; return AccessorNode; }).call(this); //### IndexNode - // An indexed accessor into an array or object. + // A `[ ... ]` indexed accessor into an array or object. exports.IndexNode = (function() { IndexNode = function IndexNode(index, tag) { this.children = [(this.index = index)]; diff --git a/src/nodes.coffee b/src/nodes.coffee index aa7ee005..aca28381 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -352,7 +352,7 @@ exports.CallNode: class CallNode extends BaseNode "${meth}.call(this${ if args.length then ', ' else '' }$args)" # If you call a function with a splat, it's converted into a JavaScript - # `.apply()` call to allow the variable-length arguments. + # `.apply()` call to allow an array of arguments to be passed. compile_splat: (o) -> meth: @variable.compile o obj: @variable.source or 'this' @@ -408,11 +408,12 @@ exports.AccessorNode: class AccessorNode extends BaseNode this compile_node: (o) -> - '.' + (if @prototype then 'prototype.' else '') + @name.compile(o) + proto_part: if @prototype then 'prototype.' else '' + ".$proto_part${@name.compile(o)}" #### IndexNode -# An indexed accessor into an array or object. +# A `[ ... ]` indexed accessor into an array or object. exports.IndexNode: class IndexNode extends BaseNode type: 'Index'