From 503de4705ff6537018ae94e9179e16636748b2a6 Mon Sep 17 00:00:00 2001 From: Dave Mitchell Date: Mon, 16 Jul 2007 13:15:37 +0000 Subject: [perl #43425] local $[: fix scoping during parser error handling. Change 22306# inadvertently made 'local $[' statement-scoped rather than block-scoped; so revert that change and add a different fix. The problem was to ensure that the savestack got popped correctly while popping errored tokens. We how record the current value of PL_savestack_ix with each pushed parser state. p4raw-id: //depot/perl@31615 --- perly.y | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'perly.y') diff --git a/perly.y b/perly.y index 191d587b66..e649dbc5ff 100644 --- a/perly.y +++ b/perly.y @@ -79,7 +79,7 @@ %token LOCAL MY MYSUB REQUIRE %token COLONATTR -%type prog progstart remember mremember savescope +%type prog progstart remember mremember %type startsub startanonsub startformsub /* FIXME for MAD - are these two ival? */ %type mydefsv mintro @@ -175,9 +175,6 @@ mremember: /* NULL */ /* start a partial lexical scope */ { $$ = block_start(FALSE); } ; -savescope: /* NULL */ /* remember stack pos in case of error */ - { $$ = PL_savestack_ix; } - /* A collection of "lines" in the program */ lineseq : /* NULL */ { $$ = Nullop; } @@ -188,12 +185,13 @@ lineseq : /* NULL */ (LISTOP*)$1, (LISTOP*)$2), $1); } - | lineseq savescope line - { LEAVE_SCOPE($2); - $$ = append_list(OP_LINESEQ, - (LISTOP*)$1, (LISTOP*)$3); + | lineseq line + { $$ = append_list(OP_LINESEQ, + (LISTOP*)$1, (LISTOP*)$2); PL_pad_reset_pending = TRUE; - if ($1 && $3) PL_hints |= HINT_BLOCK_SCOPE; } + if ($1 && $2) + PL_hints |= HINT_BLOCK_SCOPE; + } ; /* A "line" in the program */ -- cgit v1.2.1