From 9ee73e1c063c73a143f52026174e1c35d08f933c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 20 Aug 2012 05:21:51 -0500 Subject: named functions shouldn't leave a runtime call to Fun::fun --- Fun.xs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Fun.xs b/Fun.xs index e808cd7..2886389 100644 --- a/Fun.xs +++ b/Fun.xs @@ -296,6 +296,20 @@ static OP *parse_fun(pTHX_ GV *namegv, SV *psobj, U32 *flagsp) } } +static OP *check_fun(pTHX_ OP *entersubop, GV *namegv, SV *ckobj) +{ + OP *kids, *args; + + kids = cUNOPx(entersubop)->op_first; + args = cLISTOPx(kids)->op_first->op_sibling; + if (args->op_type == OP_NULL) { + op_free(entersubop); + return newOP(OP_NULL, 0); + } + else { + return entersubop; + } +} MODULE = Fun PACKAGE = Fun @@ -304,4 +318,5 @@ PROTOTYPES: DISABLE BOOT: { cv_set_call_parser(get_cv("Fun::fun", 0), parse_fun, &PL_sv_undef); + cv_set_call_checker(get_cv("Fun::fun", 0), check_fun, &PL_sv_undef); } -- cgit v1.2.3-54-g00ecf