2006-11-28 | paulb | file changeset files shortlog | Introduced ReturnFromFunction and ReturnFromBlock nodes, replacing usage of Return nodes and improving the handling of locals snapshots and return values. Added pop-up elements for certain keywords in the viewer. Expanded operation node support. Tidied the construction of various node representations. Reordered various methods for potentially easier navigation. Expanded tests, adding for2.py: a test of return values within blocks. |
paulb@107 | 1 | class A: |
paulb@107 | 2 | pass |
paulb@107 | 3 | class B: |
paulb@107 | 4 | pass |
paulb@107 | 5 | class C: |
paulb@107 | 6 | pass |
paulb@122 | 7 | |
paulb@122 | 8 | def f(): |
paulb@122 | 9 | x = 1 |
paulb@122 | 10 | try: |
paulb@122 | 11 | if x: |
paulb@122 | 12 | raise A |
paulb@122 | 13 | else: |
paulb@122 | 14 | raise B |
paulb@122 | 15 | except A, e: |
paulb@122 | 16 | a = e |
paulb@122 | 17 | except (B, C), f: |
paulb@122 | 18 | a = f |
paulb@111 | 19 | else: |
paulb@122 | 20 | a = x |
paulb@133 | 21 | return a |
paulb@122 | 22 | |
paulb@122 | 23 | f() |