Fixing closures-generated-within-comprehensions to preserve block local scope for range comprehensions

This commit is contained in:
Jeremy Ashkenas
2010-08-08 10:52:59 -04:00
parent a749d43897
commit d286b33601
3 changed files with 17 additions and 6 deletions

View File

@@ -71,6 +71,13 @@ ok obj.two() is "I'm two"
ok obj.three() is "I'm three"
# Ensure that local variables are closed over for range comprehensions.
funcs = for i in [1..3]
-> -i
ok (func() for func in funcs).join(' ') is '-1 -2 -3'
# Even when referenced in the filter.
list = ['one', 'two', 'three']