summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-08-20 05:21:51 -0500
committerJesse Luehrs <doy@tozt.net>2012-08-20 05:21:51 -0500
commit9ee73e1c063c73a143f52026174e1c35d08f933c (patch)
treea0a33d3c738c9744159993f95be68bc7349e326b
parent9076c7808a4ef83e73998c7083866b3333b9c378 (diff)
downloadfun-9ee73e1c063c73a143f52026174e1c35d08f933c.tar.gz
fun-9ee73e1c063c73a143f52026174e1c35d08f933c.zip
named functions shouldn't leave a runtime call to Fun::fun
-rw-r--r--Fun.xs15
1 files changed, 15 insertions, 0 deletions
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);
}