diff options
-rw-r--r-- | embedvar.h | 4 | ||||
-rw-r--r-- | intrpvar.h | 3 | ||||
-rw-r--r-- | op.c | 46 | ||||
-rw-r--r-- | pad.c | 2 | ||||
-rw-r--r-- | parser.h | 5 | ||||
-rw-r--r-- | perlapi.h | 4 | ||||
-rw-r--r-- | perly.act | 2 | ||||
-rw-r--r-- | perly.y | 2 | ||||
-rw-r--r-- | sv.c | 4 | ||||
-rw-r--r-- | toke.c | 2 | ||||
-rw-r--r-- | utf8.c | 3 |
11 files changed, 39 insertions, 38 deletions
diff --git a/embedvar.h b/embedvar.h index ba97800b49..99f0864527 100644 --- a/embedvar.h +++ b/embedvar.h @@ -218,8 +218,6 @@ #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) @@ -466,8 +464,6 @@ #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 diff --git a/intrpvar.h b/intrpvar.h index fbbe64f535..2bb2f88201 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -189,7 +189,6 @@ PERLVAR(Imess_sv, SV *) 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) @@ -300,8 +299,6 @@ PERLVAR(Ipadix, I32) /* max used index in current "register" pad */ 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 */ @@ -352,7 +352,7 @@ Perl_allocmy(pTHX_ const char *const name) { 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 && @@ -373,24 +373,25 @@ Perl_allocmy(pTHX_ const char *const 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; } @@ -1969,11 +1970,13 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) 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) : @@ -1990,14 +1993,16 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) { 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); @@ -2007,7 +2012,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) } 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; } @@ -2041,8 +2046,8 @@ Perl_my_attrs(pTHX_ OP *o, OP *attrs) 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; } @@ -2287,8 +2292,13 @@ Perl_localize(pTHX_ OP *o, I32 lex) 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"); } } } @@ -2296,8 +2306,8 @@ Perl_localize(pTHX_ OP *o, I32 lex) 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; } @@ -550,7 +550,7 @@ Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash) 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; @@ -61,7 +61,6 @@ typedef struct yy_parser { bool preambled; SUBLEXINFO sublex_info; SV *linestr; /* current chunk of src text */ - line_t copline; /* current line number */ char *bufptr; char *oldbufptr; char *oldoldbufptr; @@ -69,7 +68,11 @@ typedef struct yy_parser { 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 */ @@ -312,10 +312,6 @@ END_EXTERN_C #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 @@ -1535,7 +1535,7 @@ case 2: 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: @@ -1290,7 +1290,7 @@ listexprcom: /* NULL */ /* 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 @@ -9579,6 +9579,8 @@ Perl_parser_dup(pTHX_ const yy_parser *proto, CLONE_PARAMS* param) 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); @@ -11266,8 +11268,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, 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 @@ -63,6 +63,8 @@ #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) @@ -1595,9 +1595,6 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits 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); |