This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
MAD: disable constant subs when PL_madskills
authorGerard Goossen <gerard@tty.nl>
Wed, 27 Jun 2007 13:04:00 +0000 (15:04 +0200)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sat, 7 Jul 2007 08:07:58 +0000 (08:07 +0000)
Message-ID: <20070627110400.GC11336@ostwald>

p4raw-id: //depot/perl@31554

mad/t/p55.t
op.c
toke.c

index 9407f34..de18a87 100644 (file)
@@ -64,8 +64,6 @@ use Test::Differences;
 our %failing = map { $_, 1 } qw|
 ../t/comp/require.t
 
-../t/io/layers.t
-
 ../t/op/array.t
 ../t/op/local.t
 ../t/op/substr.t
@@ -147,7 +145,7 @@ s//m#.#/ge;
 #
 eval { require 5.005 }
 ########
-# TODO Reduced test case from t/io/layers.t
+# Reduced test case from t/io/layers.t
 sub PerlIO::F_UTF8 () { 0x00008000 } # from perliol.h
 BEGIN { PerlIO::Layer->find("encoding",1);}
 ########
diff --git a/op.c b/op.c
index cdd7aaf..d0c1c8b 100644 (file)
--- a/op.c
+++ b/op.c
@@ -5095,6 +5095,9 @@ Perl_op_const_sv(pTHX_ const OP *o, CV *cv)
     dVAR;
     SV *sv = NULL;
 
+    if (PL_madskills)
+       return NULL;
+
     if (!o)
        return NULL;
 
diff --git a/toke.c b/toke.c
index b2b6ba1..e84e18c 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -5430,18 +5430,7 @@ Perl_yylex(pTHX)
                            d++;
                        if (*d == ')' && (sv = gv_const_sv(gv))) {
                            s = d + 1;
-#ifdef PERL_MAD
-                           if (PL_madskills) {
-                               char *par = SvPVX(PL_linestr) + PL_realtokenstart; 
-                               sv_catpvn(PL_thistoken, par, s - par);
-                               if (PL_nextwhite) {
-                                   sv_free(PL_nextwhite);
-                                   PL_nextwhite = 0;
-                               }
-                           }
-                           else
-#endif
-                               goto its_constant;
+                           goto its_constant;
                        }
                    }
 #ifdef PERL_MAD
@@ -5488,7 +5477,7 @@ Perl_yylex(pTHX)
                                "Ambiguous use of -%s resolved as -&%s()",
                                PL_tokenbuf, PL_tokenbuf);
                    /* Check for a constant sub */
-                   if ((sv = gv_const_sv(gv)) && !PL_madskills) {
+                   if ((sv = gv_const_sv(gv))) {
                  its_constant:
                        SvREFCNT_dec(((SVOP*)yylval.opval)->op_sv);
                        ((SVOP*)yylval.opval)->op_sv = SvREFCNT_inc_simple(sv);