making range comprehensions compile safely, even when you assign to the same variable as your endposts.

This commit is contained in:
Jeremy Ashkenas
2010-01-01 10:55:43 -05:00
parent f622fc43bc
commit 305f883eab
2 changed files with 22 additions and 9 deletions

View File

@@ -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')