diff options
author | Robin Houston <robin@cpan.org> | 2001-03-14 00:43:45 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-03-14 02:40:50 +0000 |
commit | 36c66720946952b050ad9db88444230a58b3c69d (patch) | |
tree | 695d8454479dd4db316880a24d7e7e4135014018 /perly.y | |
parent | 30def704cafa11862a4b1be8a6e882e725a22b02 (diff) | |
download | perl-36c66720946952b050ad9db88444230a58b3c69d.tar.gz |
Re: [ID 20010309.004] my-variables lose values while goto'ing within a for(;;)-loop
Message-ID: <20010314004345.A15892@puffinry.freeserve.co.uk>
p4raw-id: //depot/perl@9139
Diffstat (limited to 'perly.y')
-rw-r--r-- | perly.y | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -248,13 +248,20 @@ loop : label WHILE '(' remember mtexpr ')' mblock cont newFOROP(0, $1, $2, Nullop, $5, $7, $8)); } | label FOR '(' remember mnexpr ';' mtexpr ';' mnexpr ')' mblock /* basically fake up an initialize-while lineseq */ - { OP *forop = append_elem(OP_LINESEQ, - scalar($5), - newWHILEOP(0, 1, (LOOP*)Nullop, - $2, scalar($7), - $11, scalar($9))); + { OP *forop; PL_copline = $2; - $$ = block_end($4, newSTATEOP(0, $1, forop)); } + forop = newSTATEOP(0, $1, + newWHILEOP(0, 1, (LOOP*)Nullop, + $2, scalar($7), + $11, $9)); + if ($5) { + forop = append_elem(OP_LINESEQ, + newSTATEOP(0, ($1?savepv($1):Nullch), + $5), + forop); + } + + $$ = block_end($4, forop); } | label block cont /* a block is a loop that happens once */ { $$ = newSTATEOP(0, $1, newWHILEOP(0, 1, (LOOP*)Nullop, |