In perl.git, the branch sprout/lvref has been updated <http://perl5.git.perl.org/perl.git/commitdiff/121395909e57260140b34015c6d07d894c243ccb?hp=ff728863c4cad35ca8dfe4a2fd8903405f3bec91>
- Log ----------------------------------------------------------------- commit 121395909e57260140b34015c6d07d894c243ccb Author: Father Chrysostomos <[email protected]> Date: Sun Sep 21 23:11:32 2014 -0700 Implement \my $x = ... ----------------------------------------------------------------------- Summary of changes: lib/B/Op_private.pm | 2 +- op.c | 3 +-- opcode.h | 4 ++-- pp.c | 4 ++++ regen/op_private | 2 +- t/op/lvref.t | 4 ++-- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm index cb45a23..b93d2fb 100644 --- a/lib/B/Op_private.pm +++ b/lib/B/Op_private.pm @@ -128,7 +128,7 @@ $bits{$_}{5} = 'OPpHUSH_VMSISH' for qw(dbstate nextstate); $bits{$_}{2} = 'OPpITER_REVERSED' for qw(enteriter iter); $bits{$_}{7} = 'OPpLVALUE' for qw(leave leaveloop); $bits{$_}{4} = 'OPpLVAL_DEFER' for qw(aelem helem); -$bits{$_}{7} = 'OPpLVAL_INTRO' for qw(aelem aslice cond_expr delete enteriter entersub gvsv helem hslice list padav padhv padrange padsv pos pushmark rv2av rv2gv rv2hv rv2sv substr vec); +$bits{$_}{7} = 'OPpLVAL_INTRO' for qw(aelem aslice cond_expr delete enteriter entersub gvsv helem hslice list padav padhv padrange padsv pos pushmark rv2av rv2gv rv2hv rv2sv sbind substr vec); $bits{$_}{3} = 'OPpMAYBE_LVSUB' for qw(aassign aelem aslice av2arylen helem hslice keys kvaslice kvhslice padav padhv pos rkeys rv2av rv2gv rv2hv substr vec); $bits{$_}{6} = 'OPpMAYBE_TRUEBOOL' for qw(padhv rv2hv); $bits{$_}{7} = 'OPpOFFBYONE' for qw(caller runcv wantarray); diff --git a/op.c b/op.c index 2333b37..8201f8f 100644 --- a/op.c +++ b/op.c @@ -9675,8 +9675,7 @@ Perl_ck_sassign(pTHX_ OP *o) bool stacked = 0; switch (varop->op_type) { case OP_PADSV: - if (varop->op_private & OPpLVAL_INTRO) - goto ret; /* XXX temporary */ + o->op_private = varop->op_private & OPpLVAL_INTRO; o->op_targ = varop->op_targ; varop->op_targ = 0; break; diff --git a/opcode.h b/opcode.h index 915aded..0b137d8 100644 --- a/opcode.h +++ b/opcode.h @@ -3073,7 +3073,7 @@ EXTCONST U16 PL_op_private_bitdefs[] = { /* runcv */ 0x00bd, /* fc */ 0x0003, /* padrange */ 0x25bc, 0x019b, - /* sbind */ 0x0067, + /* sbind */ 0x25bc, 0x0067, }; @@ -3461,7 +3461,7 @@ EXTCONST U8 PL_op_private_valid[] = { /* INTROCV */ (0), /* CLONECV */ (0), /* PADRANGE */ (OPpPADRANGE_COUNTMASK|OPpLVAL_INTRO), - /* SBIND */ (OPpARG2_MASK), + /* SBIND */ (OPpARG2_MASK|OPpLVAL_INTRO), }; diff --git a/pp.c b/pp.c index 2f8060e..619581f 100644 --- a/pp.c +++ b/pp.c @@ -6149,6 +6149,10 @@ PP(pp_sbind) SV * const old = PAD_SV(ARGTARG); PAD_SETSV(ARGTARG, SvREFCNT_inc_NN(SvRV(sv))); SvREFCNT_dec(old); + if (PL_op->op_private & OPpLVAL_INTRO) { + SvPADMY_on(PAD_SV(ARGTARG)); + SAVECLEARSV(PAD_SVl(ARGTARG)); + } break; } case SVt_PVGV: diff --git a/regen/op_private b/regen/op_private index b86a1bd..0378770 100644 --- a/regen/op_private +++ b/regen/op_private @@ -297,7 +297,7 @@ for (qw(nextstate dbstate)) { addbits($_, 7 => qw(OPpLVAL_INTRO LVINTRO)) for qw(pos substr vec gvsv rv2sv rv2hv rv2gv rv2av aelem helem aslice hslice delete padsv padav padhv enteriter entersub padrange - pushmark cond_expr), + pushmark cond_expr sbind), 'list', # this gets set in my_attrs() for some reason ; diff --git a/t/op/lvref.t b/t/op/lvref.t index 5fb6303..d5018a0 100644 --- a/t/op/lvref.t +++ b/t/op/lvref.t @@ -33,9 +33,9 @@ is \$x, \$y, '\$pkg_scalar = ...'; my $m; \$m = \$y; is \$m, \$y, '\$lexical = ...'; -on; -eval '\my $n = \$y'; +\my $n = \$y; is \$n, \$y, '\my $lexical = ...'; +on; @_ = \$_; eval '\($x) = @_'; is \$x, \$_, '\($pkgvar) = ... gives list context'; -- Perl5 Master Repository
