From 018a4ee0fce39b8b0c43125bcfb8cdc057b307ee Mon Sep 17 00:00:00 2001 From: Jonathan Worthington Date: Thu, 2 Jun 2016 15:35:51 +0200 Subject: [PATCH] Implement callerlex throwing mode. Skips the current routine (and then any thunks) before looking for a lexical handler. Which is precisely what Perl 6 returns need. --- src/core/exceptions.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/exceptions.c b/src/core/exceptions.c index a0af799e66..217195741d 100644 --- a/src/core/exceptions.c +++ b/src/core/exceptions.c @@ -145,6 +145,12 @@ static LocatedHandler search_for_handler_from(MVMThreadContext *tc, MVMFrame *f, } } else { + if (mode == MVM_EX_THROW_LEX_CALLER) { + f = f->caller; + while (f && f->static_info->body.is_thunk) + f = f->caller; + mode = MVM_EX_THROW_LEX; + } while (f != NULL) { if (search_frame_handlers(tc, f, cat, payload, &lh)) { lh.frame = f;