mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 19:34:27 -05:00
Put back every utility functions on the global scope, automatically prefixed with __ and set them dynamically as reserved on the lexer.
This commit is contained in:
@@ -843,13 +843,13 @@ exports.SplatNode: class SplatNode extends BaseNode
|
||||
for trailing in @trailings
|
||||
o.scope.assign(trailing.compile(o), "arguments[arguments.length - $@trailings.length + $i]")
|
||||
i: + 1
|
||||
"$name = Array.prototype.slice.call(arguments, $@index, arguments.length - ${@trailings.length})"
|
||||
"$name = ${o.scope.utility('arraySlice')}.call(arguments, $@index, arguments.length - ${@trailings.length})"
|
||||
|
||||
# A compiling a splat as a destructuring assignment means slicing arguments
|
||||
# from the right-hand-side's corresponding array.
|
||||
compile_value: (o, name, index, trailings) ->
|
||||
if trailings? then "Array.prototype.slice.call($name, $index, ${name}.length - $trailings)" \
|
||||
else "Array.prototype.slice.call($name, $index)"
|
||||
if trailings? then "${o.scope.utility('arraySlice')}.call($name, $index, ${name}.length - $trailings)" \
|
||||
else "${o.scope.utility('arraySlice')}.call($name, $index)"
|
||||
|
||||
# Utility function that converts arbitrary number of elements, mixed with
|
||||
# splats, to a proper array
|
||||
|
||||
Reference in New Issue
Block a user