safely preserving the arguments object through generated closure wrappers.

This commit is contained in:
Jeremy Ashkenas
2010-04-10 14:20:32 -04:00
parent 491ad6de95
commit f36acc27e5
3 changed files with 27 additions and 6 deletions

View File

@@ -92,3 +92,10 @@ store: (obj) -> result: obj
store (x * 2 for x in [3, 2, 1])
ok result.join(' ') is '6 4 2'
# Closure-wrapped comprehensions that refer to the "arguments" object.
expr: ->
result: item * item for item in arguments
ok expr(2, 4, 8).join(' ') is '4 16 64'