This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove bogus gv-handling code from toke.c
authorFather Chrysostomos <sprout@cpan.org>
Sun, 7 Sep 2014 05:51:15 +0000 (22:51 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 15 Sep 2014 13:19:32 +0000 (06:19 -0700)
This code was added by 211a4342c, which was actually restoring some
code that f74617600 removed.

Its purpose was to expand a proxy to a real GV after we found out that
we really are going to compile a sub call op.

This code is actually unreachable at present (sub call lookup via
rv2cv ops expands stub declarations, but not references to constants;
references to constants are not compiled to sub calls), which is a
good thing, because (1) it does not take UTF8 names into account and
(2) it does not work with rv2cv hooks or our subs, because it assumes
that the value of PL_tokenbuf is normative and can be used to
reify a glob.

toke.c

diff --git a/toke.c b/toke.c
index edd458d..ea022f9 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -6681,7 +6681,6 @@ Perl_yylex(pTHX)
                /* Not a method, so call it a subroutine (if defined) */
 
                if (cv) {
-                   OP *gvop;
                    /* Check for a constant sub */
                    if ((sv = cv_const_sv_or_av(cv))) {
                  its_constant:
@@ -6699,20 +6698,6 @@ Perl_yylex(pTHX)
                        TOKEN(WORD);
                    }
 
-                   /* Resolve to GV now if this is a placeholder. */
-                   if (!off && (gvop = cUNOPx(rv2cv_op)->op_first)
-                    && gvop->op_type == OP_GV) {
-                       GV *gv2 = cGVOPx_gv(gvop);
-                       if (gv2 && !isGV(gv2)) {
-                           gv = gv_fetchpv(PL_tokenbuf, 0, SVt_PVCV);
-                           assert (SvTYPE(gv) == SVt_PVGV);
-                           /* cv must have been some sort of placeholder,
-                              so now needs replacing with a real code
-                              reference.  */
-                           cv = GvCV(gv);
-                       }
-                   }
-
                    op_free(pl_yylval.opval);
                    pl_yylval.opval =
                        off ? (OP *)newCVREF(0, rv2cv_op) : rv2cv_op;