diff options
-rw-r--r-- | gv.c | 17 | ||||
-rw-r--r-- | op.c | 7 |
2 files changed, 12 insertions, 12 deletions
@@ -426,18 +426,17 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type) tmpbuf[len++] = ':'; tmpbuf[len] = '\0'; gvp = (GV**)hv_fetch(stash,tmpbuf,len,add); + gv = gvp ? *gvp : Nullgv; + if (gv && gv != (GV*)&sv_undef) { + if (SvTYPE(gv) != SVt_PVGV) + gv_init(gv, stash, tmpbuf, len, (add & 2)); + else + GvMULTI_on(gv); + } if (tmpbuf != autobuf) Safefree(tmpbuf); - if (!gvp || *gvp == (GV*)&sv_undef) + if (!gv || gv == (GV*)&sv_undef) return Nullgv; - gv = *gvp; - - if (SvTYPE(gv) == SVt_PVGV) - GvMULTI_on(gv); - else if (!add) - return Nullgv; - else - gv_init(gv, stash, nambeg, namend - nambeg, (add & 2)); if (!(stash = GvHV(gv))) stash = GvHV(gv) = newHV(); @@ -4612,7 +4612,7 @@ ck_subr(OP *o) kid->op_sibling = 0; o2 = newUNOP(OP_RV2GV, 0, kid); o2->op_sibling = sib; - prev->op_sibling = o; + prev->op_sibling = o2; } goto wrapref; case '\\': @@ -4641,9 +4641,10 @@ ck_subr(OP *o) wrapref: { OP* kid = o2; - o2 = newUNOP(OP_REFGEN, 0, kid); - o2->op_sibling = kid->op_sibling; + OP* sib = kid->op_sibling; kid->op_sibling = 0; + o2 = newUNOP(OP_REFGEN, 0, kid); + o2->op_sibling = sib; prev->op_sibling = o2; } break; |