diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-05-15 02:41:58 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-05-15 02:41:58 +0000 |
commit | 55d729e4e15089064cd25ed6dce2c105389f3837 (patch) | |
tree | 051c5ca4ce1910143237cc92caf129a28ce98436 /op.c | |
parent | 6ff81951f79dec32e15a779d288c1047f0e4fefb (diff) | |
download | perl-55d729e4e15089064cd25ed6dce2c105389f3837.tar.gz |
[win32] merge changes#922,944,949,965,970 from maintbranch
p4raw-link: @970 on //depot/maint-5.004/perl: 5362f8886d6c3fb908c863d910b1a158479419e2
p4raw-link: @965 on //depot/maint-5.004/perl: 8472ac73d6d802946d766b5459d2d9c334889a3f
p4raw-link: @949 on //depot/maint-5.004/perl: 4b161ae29769b4a3eb304314bbbfe5969417c8ec
p4raw-link: @944 on //depot/maint-5.004/perl: fa366f5fbba3f21113f9677105663454a3e0b678
p4raw-link: @922 on //depot/maint-5.004/perl: 68daf0ababdc0e913335a90c4361b792b2715301
p4raw-id: //depot/win32/perl@978
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 59 |
1 files changed, 57 insertions, 2 deletions
@@ -2672,7 +2672,7 @@ new_logop(I32 type, I32 flags, OP** firstp, OP** otherp) case OP_NULL: if (k2 && k2->op_type == OP_READLINE && (k2->op_flags & OPf_STACKED) - && (k1->op_type == OP_RV2SV || k1->op_type == OP_PADSV)) + && ((k1->op_flags & OPf_WANT) == OPf_WANT_SCALAR)) warnop = k2->op_type; break; @@ -2834,6 +2834,24 @@ newLOOPOP(I32 flags, I32 debuggable, OP *expr, OP *block) || (expr->op_type == OP_NULL && expr->op_targ == OP_GLOB)) { expr = newUNOP(OP_DEFINED, 0, newASSIGNOP(0, newDEFSVOP(), 0, expr) ); + } else if (expr->op_flags & OPf_KIDS) { + OP *k1 = ((UNOP*)expr)->op_first; + OP *k2 = (k1) ? k1->op_sibling : NULL; + switch (expr->op_type) { + case OP_NULL: + if (k2 && k2->op_type == OP_READLINE + && (k2->op_flags & OPf_STACKED) + && ((k1->op_flags & OPf_WANT) == OPf_WANT_SCALAR)) + expr = newUNOP(OP_DEFINED, 0, expr); + break; + + case OP_SASSIGN: + if (k1->op_type == OP_READDIR + || k1->op_type == OP_GLOB + || k1->op_type == OP_EACH) + expr = newUNOP(OP_DEFINED, 0, expr); + break; + } } } @@ -2869,6 +2887,24 @@ newWHILEOP(I32 flags, I32 debuggable, LOOP *loop, I32 whileline, OP *expr, OP *b || (expr->op_type == OP_NULL && expr->op_targ == OP_GLOB))) { expr = newUNOP(OP_DEFINED, 0, newASSIGNOP(0, newDEFSVOP(), 0, expr) ); + } else if (expr && (expr->op_flags & OPf_KIDS)) { + OP *k1 = ((UNOP*)expr)->op_first; + OP *k2 = (k1) ? k1->op_sibling : NULL; + switch (expr->op_type) { + case OP_NULL: + if (k2 && k2->op_type == OP_READLINE + && (k2->op_flags & OPf_STACKED) + && ((k1->op_flags & OPf_WANT) == OPf_WANT_SCALAR)) + expr = newUNOP(OP_DEFINED, 0, expr); + break; + + case OP_SASSIGN: + if (k1->op_type == OP_READDIR + || k1->op_type == OP_GLOB + || k1->op_type == OP_EACH) + expr = newUNOP(OP_DEFINED, 0, expr); + break; + } } if (!block) @@ -3310,7 +3346,8 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block) { dTHR; char *name = o ? SvPVx(cSVOPo->op_sv, na) : Nullch; - GV *gv = gv_fetchpv(name ? name : "__ANON__", GV_ADDMULTI, SVt_PVCV); + GV *gv = gv_fetchpv(name ? name : "__ANON__", + GV_ADDMULTI | (block ? 0 : GV_NOINIT), SVt_PVCV); char *ps = proto ? SvPVx(((SVOP*)proto)->op_sv, na) : Nullch; register CV *cv; I32 ix; @@ -3320,6 +3357,23 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block) if (proto) SAVEFREEOP(proto); + if (SvTYPE(gv) != SVt_PVGV) { /* Prototype now, and had + maximum a prototype before. */ + if (SvTYPE(gv) > SVt_NULL) { + if (!SvPOK((SV*)gv) && !(SvIOK((SV*)gv) && SvIVX((SV*)gv) == -1)) + warn("Runaway prototype"); + cv_ckproto((CV*)gv, NULL, ps); + } + if (ps) + sv_setpv((SV*)gv, ps); + else + sv_setiv((SV*)gv, -1); + SvREFCNT_dec(compcv); + compcv = NULL; + sub_generation++; + goto noblock; + } + if (!name || GvCVGEN(gv)) cv = Nullcv; else if (cv = GvCV(gv)) { @@ -3401,6 +3455,7 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block) } } if (!block) { + noblock: copline = NOLINE; LEAVE_SCOPE(floor); return cv; |