"padav", "padhv", "enteriter");
$priv{$_}{64} = "REFC" for ("leave", "leavesub", "leavesublv", "leavewrite");
$priv{"aassign"}{64} = "COMMON";
-$priv{"aassign"}{32} = "PHASH" if $] < 5.009;
+$priv{"aassign"}{32} = $] < 5.009 ? "PHASH" : "STATE";
$priv{"sassign"}{32} = "STATE";
$priv{"sassign"}{64} = "BKWARD";
$priv{$_}{64} = "RTIME" for ("match", "subst", "substcont", "qr");
* to store these values, evil chicanery is done with SvCUR().
*/
+ {
OP *lastop = o;
PL_generation++;
for (curop = LINKLIST(o); curop != o; curop = LINKLIST(curop)) {
curop->op_type == OP_PADHV ||
curop->op_type == OP_PADANY)
{
+ if ((left->op_private & OPpLVAL_INTRO) && (curop->op_private & OPpPAD_STATE)) {
+ o->op_private |= OPpASSIGN_STATE;
+ /* hijacking PADSTALE for uninitialized state variables */
+ SvPADSTALE_on(PAD_SVl(curop->op_targ));
+ }
if (PAD_COMPNAME_GEN(curop->op_targ)
== (STRLEN)PL_generation)
break;
}
if (curop != o)
o->op_private |= OPpASSIGN_COMMON;
+ }
if (right && right->op_type == OP_SPLIT) {
OP* tmpop = ((LISTOP*)right)->op_first;
if (tmpop && (tmpop->op_type == OP_PUSHRE)) {
}
}
}
+ if (PL_op->op_private & OPpASSIGN_STATE) {
+ if (SvPADSTALE(*firstlelem))
+ SvPADSTALE_off(*firstlelem);
+ else
+ RETURN; /* ignore assignment */
+ }
relem = firstrelem;
lelem = firstlelem;
# stateless assignment to a state variable
sub stateless {
- (state $reinitme) = 42;
+ (state $reinitme, my $foo) = (42, 'bar');
++$reinitme;
}
is( stateless(), 43, 'stateless function, first time' );
my $ls = statelist();
is($ls, "12/23", 'list assignment to state scalars');
$ls = statelist();
-{
- local our $TODO = 'make aassign handle state vars';
- is($ls, "13/24", 'list assignment to state scalars');
-}
+is($ls, "13/24", 'list assignment to state scalars');