Skip to content

Instantly share code, notes, and snippets.

@mlschroe
Created August 4, 2011 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlschroe/1124942 to your computer and use it in GitHub Desktop.
Save mlschroe/1124942 to your computer and use it in GitHub Desktop.
--- ./src/Perl6/Actions.pm.orig 2011-08-02 12:56:25.000000000 +0000
+++ ./src/Perl6/Actions.pm 2011-08-04 10:23:17.000000000 +0000
@@ -3537,8 +3537,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_nextctx %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-04 10:21:54.000000000 +0000
@@ -1073,6 +1073,17 @@ inline op encodelocaltime(out INT, in PM
$1 = mktime(&tm);
}
+inline op rethrow_nextctx(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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment