py: Implement break and continue byte codes, and add tests.

Also fixes a bug in the for-in-range optimiser.

I hope to remove break and continue byte codes in the future and just
use jump (if possible).
This commit is contained in:
Damien George
2014-01-21 23:48:04 +00:00
parent 2c30256382
commit 600ae734cf
4 changed files with 47 additions and 3 deletions

16
tests/basics/continue.py Normal file
View File

@@ -0,0 +1,16 @@
for i in range(4):
print('one', i)
if i > 2:
continue
print('two', i)
for i in range(4):
print('one', i)
if i < 2:
continue
print('two', i)
for i in [1, 2, 3, 4]:
if i == 3:
continue
print(i)