summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2009-11-08 15:03:45 +0100
committerRafael Garcia-Suarez <rgs@consttype.org>2009-11-08 15:11:11 +0100
commitf7461760003db2ce68155c97ea6c1658e96fcd27 (patch)
tree3ef60fff1e3763bb814eb07f408a34688546c026 /proto.h
parent6bd7445c6d3b53823883c456e32ea27ce24bfc5c (diff)
downloadperl-f7461760003db2ce68155c97ea6c1658e96fcd27.tar.gz
Bareword sub lookups
Attached is a patch that changes how the tokeniser looks up subroutines, when they're referenced by a bareword, for prototype and const-sub purposes. Formerly, it has looked up bareword subs directly in the package, which is contrary to the way the generated op tree looks up the sub, via an rv2cv op. The patch makes the tokeniser generate the rv2cv op earlier, and dig around in that. The motivation for this is to allow modules to hook the rv2cv op creation, to affect the name->subroutine lookup process. Currently, such hooking affects op execution as intended, but everything goes wrong with a bareword ref where the tokeniser looks at some unrelated CV, or a blank space, in the package. With the patch in place, an rv2cv hook correctly affects the tokeniser and therefore the prototype-based aspects of parsing. The patch also changes ck_subr (which applies the argument context and checking parts of prototype behaviour) to handle subs referenced by an RV const op inside the rv2cv, where formerly it would only handle a gv op inside the rv2cv. This is to support the most likely kind of modified rv2cv op. The attached patch is the resulting revised version of the bareword sub patch. It incorporates the original patch (allowing rv2cv op hookers to control prototype processing), the GV-downgrading addition, and a mention in perldelta.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index c3322b8169..2a3b118dee 100644
--- a/proto.h
+++ b/proto.h
@@ -943,6 +943,11 @@ PERL_CALLCONV void Perl_gv_name_set(pTHX_ GV* gv, const char *name, U32 len, U32
#define PERL_ARGS_ASSERT_GV_NAME_SET \
assert(gv); assert(name)
+PERL_CALLCONV void Perl_gv_try_downgrade(pTHX_ GV* gv)
+ __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_GV_TRY_DOWNGRADE \
+ assert(gv)
+
PERL_CALLCONV HV* Perl_gv_stashpv(pTHX_ const char* name, I32 flags)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_GV_STASHPV \