Created
August 5, 2011 11:58
-
-
Save mlschroe/1127381 to your computer and use it in GitHub Desktop.
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
--- ./src/Perl6/Actions.pm.orig 2011-08-02 12:56:25.000000000 +0000 | |
+++ ./src/Perl6/Actions.pm 2011-08-05 11:51:53.000000000 +0000 | |
@@ -3537,8 +3549,11 @@ class Perl6::Actions is HLL::Actions { | |
PAST::Var.new( :scope('lexical_6model'), :name('$!'), :isdecl(1) ), | |
PAST::Var.new( :scope('lexical_6model'), :name('$_') ), | |
), | |
+ PAST::Op.new( :pasttype('try'), | |
PAST::Op.new( :pasttype('call'), | |
$handler, | |
+ ), | |
+ PAST::Op.new( :inline(" .get_results (%r)\n rethrow_skipnextctx %r") ), | |
)); | |
$handler.symbol('$_', :scope('lexical_6model')); | |
$handler.symbol('$!', :scope('lexical_6model')); | |
--- ./src/ops/perl6.ops.orig 2011-08-04 07:59:53.000000000 +0000 | |
+++ ./src/ops/perl6.ops 2011-08-05 11:51:28.000000000 +0000 | |
@@ -1074,6 +1074,29 @@ inline op encodelocaltime(out INT, in PM | |
} | |
/* | |
+ | |
+=item rethrow_skipnextctx(in PMC) | |
+ | |
+Rethrow an exception, but skip the remaining handlers of the current | |
+context plus all handlers of the next context. We use this to bypass | |
+the original handler when en exception occures in an CATCH/CONTROL | |
+block. | |
+ | |
+=cut | |
+ | |
+*/ | |
+inline op rethrow_skipnextctx(in PMC) :base_core { | |
+ PMC * except = $1; | |
+ opcode_t * dest; | |
+ STRING *handler_iter_str = Parrot_str_new_constant(interp, "handler_iter"); | |
+ PMC *next_ctx = Parrot_pcc_get_caller_ctx(interp, CURRENT_CONTEXT(interp)); | |
+ VTABLE_set_attr_str(interp, except, handler_iter_str, PMCNULL); | |
+ VTABLE_set_pointer(interp, except, next_ctx); | |
+ dest = Parrot_ex_rethrow_from_op(interp, except); | |
+ goto ADDRESS(dest); | |
+} | |
+ | |
+/* | |
* Local variables: | |
* c-file-style: "parrot" | |
* End: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment