SvNVX(namesv) = (double)PL_curcop->cop_seq;
SvIVX(namesv) = PAD_MAX; /* A ref, intro immediately */
SvFAKE_on(namesv); /* A ref, not a real var */
+ if (SvOBJECT(sv)) { /* A typed var */
+ SvOBJECT_on(namesv);
+ (void)SvUPGRADE(namesv, SVt_PVMG);
+ SvSTASH(namesv) = (HV*)SvREFCNT_inc((SV*)SvSTASH(sv));
+ PL_sv_objcount++;
+ }
if (CvANON(PL_compcv) || SvTYPE(PL_compcv) == SVt_PVFM) {
/* "It's closures all the way down." */
CvCLONE_on(PL_compcv);
SV **svp = AvARRAY(PL_comppad_name);
U32 seq = PL_cop_seqmax;
PERL_CONTEXT *cx;
+ CV *outside;
#ifdef USE_THREADS
/*
}
}
- /* Check if if we're in an eval'', and adjust seq to be the eval's
- * seq number */
- if (cxstack_ix >= 0) {
+ outside = CvOUTSIDE(PL_compcv);
+
+ /* Check if if we're compiling an eval'', and adjust seq to be the
+ * eval's seq number. This depends on eval'' having a non-null
+ * CvOUTSIDE() while it is being compiled. The eval'' itself is
+ * identified by CvUNIQUE being set and CvGV being null. */
+ if (outside && CvUNIQUE(PL_compcv) && !CvGV(PL_compcv) && cxstack_ix >= 0) {
cx = &cxstack[cxstack_ix];
if (CxREALEVAL(cx))
seq = cx->blk_oldcop->cop_seq;
}
/* See if it's in a nested scope */
- off = pad_findlex(name, 0, seq, CvOUTSIDE(PL_compcv), cxstack_ix, 0);
+ off = pad_findlex(name, 0, seq, outside, cxstack_ix, 0);
if (off) {
/* If there is a pending local definition, this new alias must die */
if (pendoff)
first->op_last = last->op_last;
first->op_children += last->op_children;
if (first->op_children)
- last->op_flags |= OPf_KIDS;
+ first->op_flags |= OPf_KIDS;
Safefree(last);
return (OP*)first;
cv,
(CvANON(cv) ? "ANON"
: (cv == PL_main_cv) ? "MAIN"
- : CvUNIQUE(outside) ? "UNIQUE"
+ : CvUNIQUE(cv) ? "UNIQUE"
: CvGV(cv) ? GvNAME(CvGV(cv)) : "UNDEFINED"),
outside,
(!outside ? "null"
CvSTASH(cv) = PL_curstash;
#ifdef USE_THREADS
CvOWNER(cv) = 0;
- if (!CvMUTEXP(cv))
+ if (!CvMUTEXP(cv)) {
New(666, CvMUTEXP(cv), 1, perl_mutex);
- MUTEX_INIT(CvMUTEXP(cv));
+ MUTEX_INIT(CvMUTEXP(cv));
+ }
#endif /* USE_THREADS */
if (ps)