add begin.t from Method::Signatures
[p5sagit/Function-Parameters.git] / padop_on_crack.c.inc
index 28078a7..6677059 100644 (file)
@@ -716,7 +716,7 @@ static PADOFFSET S_pad_alloc_name(pTHX_ SV *namesv, U32 flags, HV *typestash, HV
        return offset;
 }
 
-PADOFFSET static S_pad_add_name_pvn(pTHX_ const char *namepv, STRLEN namelen, U32 flags, HV *typestash, HV *ourstash) {
+static PADOFFSET S_pad_add_name_pvn(pTHX_ const char *namepv, STRLEN namelen, U32 flags, HV *typestash, HV *ourstash) {
        dVAR;
        PADOFFSET offset;
        SV *namesv;
@@ -1052,6 +1052,23 @@ static PADOFFSET S_pad_findmy(pTHX_ const char *name, U32 flags) {
 
 #endif
 
+#ifndef pad_findmy_pvs
+  #define pad_findmy_pvs(S, FLAGS) S_pad_findmy(aTHX_ "" S "", FLAGS)
+#endif
+
+static OP *S_newDEFSVOP(pTHX) {
+       dVAR;
+       const PADOFFSET offset = pad_findmy_pvs("$_", 0);
+       if (offset == NOT_IN_PAD || PAD_COMPNAME_FLAGS_isOUR(offset)) {
+               return newSVREF(newGVOP(OP_GV, 0, PL_defgv));
+       }
+       else {
+               OP * const o = newOP(OP_PADSV, 0);
+               o->op_targ = offset;
+               return o;
+       }
+}
+
 static U32 S_intro_my(pTHX) {
        dVAR;
        SV **svp;