If C<typestash> is valid, the name is for a typed lexical; set the
name's stash to that value.
If C<ourstash> is valid, it's an our lexical, set the name's
-GvSTASH to that value
+OURSTASH to that value
If fake, it means we're cloning an existing entry
}
if (ourstash) {
SvPAD_OUR_on(namesv);
- GvSTASH(namesv) = ourstash;
+ OURSTASH_set(namesv, ourstash);
Perl_sv_add_backref(aTHX_ (SV*)ourstash, namesv);
}
&& sv != &PL_sv_undef
&& !SvFAKE(sv)
&& (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
- && ((SvPAD_OUR(sv)) && GvSTASH(sv) == ourstash)
+ && OURSTASH(sv) == ourstash
&& strEQ(name, SvPVX_const(sv)))
{
Perl_warner(aTHX_ packWARN(WARN_MISC),
SvPVX_const(*out_name_sv),
SvPAD_TYPED(*out_name_sv)
? SvSTASH(*out_name_sv) : NULL,
- SvPAD_OUR(*out_name_sv)
- ? GvSTASH(*out_name_sv) : NULL,
+ OURSTASH(*out_name_sv),
1 /* fake */
);
#define PAD_COMPNAME_TYPE(po) pad_compname_type(po)
#define PAD_COMPNAME_OURSTASH(po) \
- (GvSTASH(*av_fetch(PL_comppad_name, (po), FALSE)))
+ (OURSTASH(*av_fetch(PL_comppad_name, (po), FALSE)))
#define PAD_COMPNAME_GEN(po) SvCUR(AvARRAY(PL_comppad_name)[po])
((SvFLAGS(sv) & (SVpad_NAME|SVpad_OUR)) == (SVpad_NAME|SVpad_OUR))
#define SvPAD_OUR_on(sv) (SvFLAGS(sv) |= SVpad_NAME|SVpad_OUR)
+#define OURSTASH(sv) (SvPAD_OUR(sv) ? GvSTASH(sv) : NULL)
+#define OURSTASH_set(sv, st) \
+ STMT_START { \
+ assert(SvTYPE(sv) == SVt_PVGV); \
+ GvSTASH(sv) = st; \
+ } STMT_END
+
#ifdef PERL_DEBUG_COW
#define SvRV(sv) (0 + (sv)->sv_u.svu_rv)
#else