summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2017-08-27 22:19:24 -0700
committerFather Chrysostomos <sprout@cpan.org>2017-08-28 12:27:23 -0700
commitcbf837914d6724cb703a328dab484c8c9995ca3a (patch)
tree18b60614d7cc62c3ec7ff038d79f6c80b3be4934 /toke.c
parent5783dc5192c36d5487bd5408fd7138e9ea36d70c (diff)
downloadperl-cbf837914d6724cb703a328dab484c8c9995ca3a.tar.gz
[perl #131883] Include pkg in :prototype warnings
The subref-in-stash optimisation was causing the package name to be dropped in prototype warnings triggered by the :prototype() attribute syntax, since the GV containing the stash name and the sub name did not exist because of the optimisation. Commit 2eaf799e, which introduced said optimisation, simply did not include the package name in validate_proto’s ‘name’ parameter, but just the sub name. This commit makes it tell validate_proto to use the current stash name.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index 5a430cf3cd..35940be787 100644
--- a/toke.c
+++ b/toke.c
@@ -1685,6 +1685,13 @@ Perl_validate_proto(pTHX_ SV *name, SV *proto, bool warn, bool curstash)
origlen, UNI_DISPLAY_ISPRINT)
: pv_pretty(tmpsv, p, origlen, 60, NULL, NULL, PERL_PV_ESCAPE_NONASCII);
+ if (curstash && !memchr(SvPVX(name), ':', SvCUR(name))) {
+ SV *name2 = sv_2mortal(newSVsv(PL_curstname));
+ sv_catpvs(name2, "::");
+ sv_catsv(name2, (SV *)name);
+ name = name2;
+ }
+
if (proto_after_greedy_proto)
Perl_warner(aTHX_ packWARN(WARN_ILLEGALPROTO),
"Prototype after '%c' for %" SVf " : %s",