up patchlevel &c
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index 8f19121..fa286f8 100644 (file)
--- a/op.c
+++ b/op.c
@@ -136,7 +136,7 @@ assertref(OP *o)
            SV *msg = sv_2mortal(
                        newSVpvf("(Did you mean $ or @ instead of %c?)\n",
                                 type == OP_ENTERSUB ? '&' : '%'));
-           if (PL_in_eval & 2)
+           if (PL_in_eval & EVAL_WARNONLY)
                warn("%_", msg);
            else if (PL_in_eval)
                sv_catsv(GvSV(PL_errgv), msg);
@@ -886,10 +886,19 @@ scalarvoid(OP *o)
     OP *kid;
     char* useless = 0;
     SV* sv;
+    U8 want;
+
+    if (o->op_type == OP_NEXTSTATE || o->op_type == OP_DBSTATE ||
+       (o->op_type == OP_NULL &&
+        (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE)))
+    {
+       dTHR;
+       PL_curcop = (COP*)o;            /* for warning below */
+    }
 
     /* assumes no premature commitment */
-    U8 want = o->op_flags & OPf_WANT;
-    if (!o || (want && want != OPf_WANT_SCALAR) || PL_error_count
+    want = o->op_flags & OPf_WANT;
+    if ((want && want != OPf_WANT_SCALAR) || PL_error_count
         || o->op_type == OP_RETURN)
        return o;
 
@@ -989,11 +998,6 @@ scalarvoid(OP *o)
            useless = "a variable";
        break;
 
-    case OP_NEXTSTATE:
-    case OP_DBSTATE:
-       WITH_THR(PL_curcop = ((COP*)o));                /* for warning below */
-       break;
-
     case OP_CONST:
        sv = cSVOPo->op_sv;
        if (cSVOPo->op_private & OPpCONST_STRICT)
@@ -1034,11 +1038,11 @@ scalarvoid(OP *o)
        break;
 
     case OP_NULL:
-       if (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE)
-           WITH_THR(PL_curcop = ((COP*)o));    /* for warning below */
        if (o->op_flags & OPf_STACKED)
            break;
        /* FALL THROUGH */
+    case OP_NEXTSTATE:
+    case OP_DBSTATE:
     case OP_ENTERTRY:
     case OP_ENTER:
     case OP_SCALAR:
@@ -1764,7 +1768,9 @@ newPROG(OP *o)
     if (PL_in_eval) {
        if (PL_eval_root)
                return;
-       PL_eval_root = newUNOP(OP_LEAVEEVAL, ((PL_in_eval & 4) ? OPf_SPECIAL : 0), o);
+       PL_eval_root = newUNOP(OP_LEAVEEVAL,
+                              ((PL_in_eval & EVAL_KEEPERR)
+                               ? OPf_SPECIAL : 0), o);
        PL_eval_start = linklist(PL_eval_root);
        PL_eval_root->op_next = 0;
        peep(PL_eval_start);
@@ -3997,7 +4003,7 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block)
            if (strEQ(s, "BEGIN")) {
                char *not_safe =
                    "BEGIN not safe after errors--compilation aborted";
-               if (PL_in_eval & 4)
+               if (PL_in_eval & EVAL_KEEPERR)
                    croak(not_safe);
                else {
                    /* force display of errors found but not reported */