'return', 'break', 'continue' and possibly some other statements need some workaround to get them working properly inside with:
x = 0
for i in range(10):
x += 1
x += 100
This code has to call contextmanager.exit() before doing 'continue'.
Walk 'with' body AST and replace control statements with 'raise WithFlowStatement(statementtype)', which would be caught by 'with', and statement would be issued after finalizing context-manager.
Problem: we cannot simply add "if (statement=='continue') continue" as that would be syntax error. Translator should know whether it is inside loop/func or not.
Original issue: http://code.google.com/p/pyjamas/issues/detail?id=625 (July 01, 2011 06:52:00)