X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=indirect.xs;h=5ec4e03e786b56147f88792b0ce23041d7593c8b;hb=c5fbf355ad97cc620713b8f5363bbacfa6960785;hp=6a21c3ab389a592b937a04715d170d02bec65418;hpb=d88f7fa514b663b22b177493b63bac78d530d78e;p=perl%2Fmodules%2Findirect.git diff --git a/indirect.xs b/indirect.xs index 6a21c3a..5ec4e03 100644 --- a/indirect.xs +++ b/indirect.xs @@ -87,7 +87,6 @@ STATIC const char *indirect_map_fetch(pTHX_ const OP *o, SV ** const name) { STATIC void indirect_map_delete(pTHX_ const OP *o) { #define indirect_map_delete(O) indirect_map_delete(aTHX_ (O)) char buf[32]; - SV *val; hv_delete(indirect_map, buf, OP2STR(o), G_DISCARD); } @@ -129,13 +128,15 @@ STATIC const char *indirect_find(pTHX_ SV *sv, const char *s) { STATIC OP *(*indirect_old_ck_const)(pTHX_ OP *) = 0; STATIC OP *indirect_ck_const(pTHX_ OP *o) { + o = CALL_FPTR(indirect_old_ck_const)(aTHX_ o); + if (indirect_hint()) { SV *sv = cSVOPo_sv; if (SvPOK(sv) && (SvTYPE(sv) >= SVt_PV)) indirect_map_store(o, indirect_find(sv, PL_parser->oldbufptr), sv); } - return CALL_FPTR(indirect_old_ck_const)(aTHX_ o); + return o; } /* ... ck_rv2sv ............................................................ */ @@ -145,11 +146,29 @@ STATIC OP *(*indirect_old_ck_rv2sv)(pTHX_ OP *) = 0; STATIC OP *indirect_ck_rv2sv(pTHX_ OP *o) { if (indirect_hint()) { OP *op = cUNOPo->op_first; - SV *name = cSVOPx_sv(op); - if (SvPOK(name) && (SvTYPE(name) >= SVt_PV)) { + const char *name = NULL; + STRLEN len; + switch (op->op_type) { + case OP_GV: + case OP_GVSV: { + GV *gv = cGVOPx_gv(op); + name = GvNAME(gv); + len = GvNAMELEN(gv); + break; + } + default: { + SV *sv = cSVOPx_sv(op); + if (SvPOK(sv) && (SvTYPE(sv) >= SVt_PV)) + name = SvPV_const(sv, len); + break; + } + } + if (name) { SV *sv = sv_2mortal(newSVpvn("$", 1)); - sv_catsv(sv, name); + sv_catpvn(sv, name, len); + o = CALL_FPTR(indirect_old_ck_rv2sv)(aTHX_ o); indirect_map_store(o, indirect_find(sv, PL_parser->oldbufptr), sv); + return o; } } @@ -161,6 +180,8 @@ STATIC OP *indirect_ck_rv2sv(pTHX_ OP *o) { STATIC OP *(*indirect_old_ck_padany)(pTHX_ OP *) = 0; STATIC OP *indirect_ck_padany(pTHX_ OP *o) { + o = CALL_FPTR(indirect_old_ck_padany)(aTHX_ o); + if (indirect_hint()) { SV *sv; const char *s = PL_parser->oldbufptr, *t = PL_parser->bufptr - 1; @@ -172,7 +193,7 @@ STATIC OP *indirect_ck_padany(pTHX_ OP *o) { indirect_map_store(o, s, sv); } - return CALL_FPTR(indirect_old_ck_padany)(aTHX_ o); + return o; } /* ... ck_method ........................................................... */ @@ -212,6 +233,8 @@ STATIC OP *indirect_ck_entersub(pTHX_ OP *o) { OP *om, *oo; IV hint = indirect_hint(); + o = CALL_FPTR(indirect_old_ck_entersub)(aTHX_ o); + if (hint) { const char *pm, *po; SV *svm, *svo; @@ -241,7 +264,7 @@ done: indirect_map_clean(o); } - return CALL_FPTR(indirect_old_ck_entersub)(aTHX_ o); + return o; } STATIC U32 indirect_initialized = 0;