mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 11:31:20 -05:00
making range comprehensions compile safely, even when you assign to the same variable as your endposts.
This commit is contained in:
@@ -5,4 +5,11 @@ negs: negs[0..2]
|
||||
|
||||
result: nums.concat(negs).join(', ')
|
||||
|
||||
print(result is '3, 6, 9, -20, -19, -18')
|
||||
print(result is '3, 6, 9, -20, -19, -18')
|
||||
|
||||
# Ensure that ranges are safe. This used to infinite loop:
|
||||
j = 5
|
||||
result: for j in [j..(j+3)]
|
||||
j
|
||||
|
||||
print(result.join(' ') is '5 6 7 8')
|
||||
Reference in New Issue
Block a user