This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pmichaud@kiwi:~/nom$ cat x.pir | |
| .sub 'main' :main | |
| $P0 = new ['ExceptionHandler'] | |
| set_label $P0, handler | |
| push_eh $P0 | |
| 'a'() | |
| 'a'() | |
| exit 0 | |
| handler: | |
| .local pmc exception | |
| .get_results (exception) | |
| say 'caught exception' | |
| pop_eh | |
| $P0 = getattribute exception, 'resume' | |
| say 'resuming after exception' | |
| $P0() | |
| .end | |
| .sub 'a' | |
| say "In subroutine 'a'" | |
| die "exception" | |
| say "resumed 'a' after exception" | |
| say "leaving 'a'" | |
| .end | |
| pmichaud@kiwi:~/nom$ install/bin/parrot x.pir | |
| In subroutine 'a' | |
| caught exception | |
| resuming after exception | |
| resumed 'a' after exception | |
| leaving 'a' | |
| In subroutine 'a' | |
| exception | |
| current instr.: 'a' pc 51 (x.pir:21) | |
| called from Sub 'main' pc 24 (x.pir:6) | |
| pmichaud@kiwi:~/nom$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment