warn on C<my($foo,$foo)>
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index ca89229..9b2284d 100644 (file)
--- a/op.c
+++ b/op.c
@@ -131,12 +131,11 @@ pad_allocmy(char *name)
        for (off = AvFILLp(PL_comppad_name); off > PL_comppad_name_floor; off--) {
            if ((sv = svp[off])
                && sv != &PL_sv_undef
-               && SvIVX(sv) == 999999999       /* var is in open scope */
                && strEQ(name, SvPVX(sv)))
            {
                warner(WARN_UNSAFE,
-                       "\"my\" variable %s masks earlier declaration in same scope", 
-                       name);
+                       "\"my\" variable %s masks earlier declaration in same %s", 
+                       name, (SvIVX(sv) == 999999999 ? "scope" : "statement"));
                break;
            }
        }
@@ -1135,7 +1134,8 @@ mod(OP *o, I32 type)
        if (type == OP_GREPSTART || type == OP_ENTERSUB || type == OP_REFGEN)
            break;
        yyerror(form("Can't modify %s in %s",
-                    op_desc[o->op_type],
+                    (o->op_type == OP_NULL && (o->op_flags & OPf_SPECIAL)
+                     ? "do block" : op_desc[o->op_type]),
                     type ? op_desc[type] : "local"));
        return o;
 
@@ -1264,7 +1264,9 @@ mod(OP *o, I32 type)
        break;
 
     case OP_NULL:
-       if (!(o->op_flags & OPf_KIDS))
+       if (o->op_flags & OPf_SPECIAL)          /* do BLOCK */
+           goto nomod;
+       else if (!(o->op_flags & OPf_KIDS))
            break;
        if (o->op_targ != OP_LIST) {
            mod(cBINOPo->op_first, type);
@@ -4019,6 +4021,7 @@ newXS(char *name, void (*subaddr) (CV * _CPERLproto), char *filename)
            if (!PL_initav)
                PL_initav = newAV();
            av_push(PL_initav, (SV *)cv);
+           GvCV(gv) = 0;
        }
     }
     else