#define PL_in_clean_all (vTHX->Iin_clean_all)
#define PL_in_clean_objs (vTHX->Iin_clean_objs)
#define PL_in_load_module (vTHX->Iin_load_module)
-#define PL_in_my (vTHX->Iin_my)
-#define PL_in_my_stash (vTHX->Iin_my_stash)
#define PL_incgv (vTHX->Iincgv)
#define PL_initav (vTHX->Iinitav)
#define PL_inplace (vTHX->Iinplace)
#define PL_Iin_clean_all PL_in_clean_all
#define PL_Iin_clean_objs PL_in_clean_objs
#define PL_Iin_load_module PL_in_load_module
-#define PL_Iin_my PL_in_my
-#define PL_Iin_my_stash PL_in_my_stash
#define PL_Iincgv PL_incgv
#define PL_Iinitav PL_initav
#define PL_Iinplace PL_inplace
PERLVAR(Iors_sv, SV *) /* output record separator $\ */
/* statics moved here for shared library purposes */
PERLVARI(Igensym, I32, 0) /* next symbol for getsym() to define */
-PERLVAR(Iin_my, U16) /* we're compiling a "my" (or "our") declaration */
PERLVARI(Ilaststype, U16, OP_STAT)
PERLVARI(Ilaststatval, int, -1)
PERLVAR(Ipadix_floor, I32) /* how low may inner block reset padix */
PERLVAR(Ipad_reset_pending, I32) /* reset pad on next attempted alloc */
-PERLVAR(Iin_my_stash, HV *) /* declared class of this "my" declaration */
-
PERLVAR(Ihints, U32) /* pragma-tic compile-time flags */
PERLVAR(Idebug, VOL U32) /* flags given to -D switch */
{
dVAR;
PADOFFSET off;
- const bool is_our = (PL_in_my == KEY_our);
+ const bool is_our = (PL_parser->in_my == KEY_our);
/* complain about "my $<special_var>" etc etc */
if (*name &&
/* check for duplicate declaration */
pad_check_dup(name, is_our, (PL_curstash ? PL_curstash : PL_defstash));
- if (PL_in_my_stash && *name != '$') {
+ if (PL_parser->in_my_stash && *name != '$') {
yyerror(Perl_form(aTHX_
"Can't declare class for non-scalar %s in \"%s\"",
name,
- is_our ? "our" : PL_in_my == KEY_state ? "state" : "my"));
+ is_our ? "our"
+ : PL_parser->in_my == KEY_state ? "state" : "my"));
}
/* allocate a spare slot and store the name in that slot */
off = pad_add_name(name,
- PL_in_my_stash,
+ PL_parser->in_my_stash,
(is_our
/* $_ is always in main::, even with our */
? (PL_curstash && !strEQ(name,"$_") ? PL_curstash : PL_defstash)
: NULL
),
0, /* not fake */
- PL_in_my == KEY_state
+ PL_parser->in_my == KEY_state
);
return off;
}
if (cUNOPo->op_first->op_type != OP_GV) { /* MJD 20011224 */
yyerror(Perl_form(aTHX_ "Can't declare %s in \"%s\"",
OP_DESC(o),
- PL_in_my == KEY_our ? "our" : PL_in_my == KEY_state ? "state" : "my"));
+ PL_parser->in_my == KEY_our
+ ? "our"
+ : PL_parser->in_my == KEY_state ? "state" : "my"));
} else if (attrs) {
GV * const gv = cGVOPx_gv(cUNOPo->op_first);
- PL_in_my = FALSE;
- PL_in_my_stash = NULL;
+ PL_parser->in_my = FALSE;
+ PL_parser->in_my_stash = NULL;
apply_attrs(GvSTASH(gv),
(type == OP_RV2SV ? GvSV(gv) :
type == OP_RV2AV ? (SV*)GvAV(gv) :
{
yyerror(Perl_form(aTHX_ "Can't declare %s in \"%s\"",
OP_DESC(o),
- PL_in_my == KEY_our ? "our" : PL_in_my == KEY_state ? "state" : "my"));
+ PL_parser->in_my == KEY_our
+ ? "our"
+ : PL_parser->in_my == KEY_state ? "state" : "my"));
return o;
}
else if (attrs && type != OP_PUSHMARK) {
HV *stash;
- PL_in_my = FALSE;
- PL_in_my_stash = NULL;
+ PL_parser->in_my = FALSE;
+ PL_parser->in_my_stash = NULL;
/* check for C<my Dog $spot> when deciding package */
stash = PAD_COMPNAME_TYPE(o->op_targ);
}
o->op_flags |= OPf_MOD;
o->op_private |= OPpLVAL_INTRO;
- if (PL_in_my == KEY_state)
+ if (PL_parser->in_my == KEY_state)
o->op_private |= OPpPAD_STATE;
return o;
}
else
o = append_list(OP_LIST, (LISTOP*)o, (LISTOP*)rops);
}
- PL_in_my = FALSE;
- PL_in_my_stash = NULL;
+ PL_parser->in_my = FALSE;
+ PL_parser->in_my_stash = NULL;
return o;
}
if (sigil && (*s == ';' || *s == '=')) {
Perl_warner(aTHX_ packWARN(WARN_PARENTHESIS),
"Parentheses missing around \"%s\" list",
- lex ? (PL_in_my == KEY_our ? "our" : PL_in_my == KEY_state ? "state" : "my")
- : "local");
+ lex
+ ? (PL_parser->in_my == KEY_our
+ ? "our"
+ : PL_parser->in_my == KEY_state
+ ? "state"
+ : "my")
+ : "local");
}
}
}
o = my(o);
else
o = mod(o, OP_NULL); /* a bit kludgey */
- PL_in_my = FALSE;
- PL_in_my_stash = NULL;
+ PL_parser->in_my = FALSE;
+ PL_parser->in_my_stash = NULL;
return o;
}
break; /* "our" masking "our" */
Perl_warner(aTHX_ packWARN(WARN_MISC),
"\"%s\" variable %s masks earlier declaration in same %s",
- (is_our ? "our" : PL_in_my == KEY_my ? "my" : "state"),
+ (is_our ? "our" : PL_parser->in_my == KEY_my ? "my" : "state"),
name,
(COP_SEQ_RANGE_HIGH(sv) == PAD_MAX ? "scope" : "statement"));
--off;
bool preambled;
SUBLEXINFO sublex_info;
SV *linestr; /* current chunk of src text */
- line_t copline; /* current line number */
char *bufptr;
char *oldbufptr;
char *oldoldbufptr;
char *linestart; /* beginning of most recently read line */
char *last_uni; /* position of last named-unary op */
char *last_lop; /* position of last list operator */
+ line_t copline; /* current line number */
+ U16 in_my; /* we're compiling a "my"/"our" declaration */
U8 lex_state; /* next token is determined */
+ /* space for a U8 here */
+ HV *in_my_stash; /* declared class of this "my" declaration */
PerlIO *rsfp; /* current source file pointer */
AV *rsfp_filters; /* holds chain of active source filters */
#define PL_in_clean_objs (*Perl_Iin_clean_objs_ptr(aTHX))
#undef PL_in_load_module
#define PL_in_load_module (*Perl_Iin_load_module_ptr(aTHX))
-#undef PL_in_my
-#define PL_in_my (*Perl_Iin_my_ptr(aTHX))
-#undef PL_in_my_stash
-#define PL_in_my_stash (*Perl_Iin_my_stash_ptr(aTHX))
#undef PL_incgv
#define PL_incgv (*Perl_Iincgv_ptr(aTHX))
#undef PL_initav
case 200:
#line 1293 "perly.y"
- { PL_in_my = 0; (yyval.opval) = my((ps[(1) - (1)].val.opval)); ;}
+ { PL_parser->in_my = 0; (yyval.opval) = my((ps[(1) - (1)].val.opval)); ;}
break;
case 201:
/* A little bit of trickery to make "for my $foo (@bar)" actually be
lexical */
my_scalar: scalar
- { PL_in_my = 0; $$ = my($1); }
+ { PL_parser->in_my = 0; $$ = my($1); }
;
amper : '&' indirob
parser->rsfp = fp_dup(proto->rsfp, '<', param);
/* rsfp_filters entries have fake IoDIRP() */
parser->rsfp_filters= av_dup_inc(proto->rsfp_filters, param);
+ parser->in_my = proto->in_my;
+ parser->in_my_stash = hv_dup(proto->in_my_stash, param);
parser->linestr = sv_dup_inc(proto->linestr, param);
PL_subline = proto_perl->Isubline;
PL_subname = sv_dup_inc(proto_perl->Isubname, param);
- PL_in_my = proto_perl->Iin_my;
- PL_in_my_stash = hv_dup(proto_perl->Iin_my_stash, param);
#ifdef FCRYPT
PL_cryptseen = proto_perl->Icryptseen;
#endif
#define PL_lex_state (PL_parser->lex_state)
#define PL_rsfp (PL_parser->rsfp)
#define PL_rsfp_filters (PL_parser->rsfp_filters)
+#define PL_in_my (PL_parser->in_my)
+#define PL_in_my_stash (PL_parser->in_my_stash)
#ifdef PERL_MAD
# define PL_endwhite (PL_parser->endwhite)
PUSHs(sv_2mortal(newSViv(none)));
PUTBACK;
if (IN_PERL_COMPILETIME) {
- /* XXX ought to be handled by lex_start */
- SAVEI16(PL_in_my);
- PL_in_my = 0;
sv_setpv(tokenbufsv, PL_tokenbuf);
}
errsv_save = newSVsv(ERRSV);