This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
change#4327 was inefficient
[perl5.git] / perly.y
diff --git a/perly.y b/perly.y
index ddc0efc..93e5f77 100644 (file)
--- a/perly.y
+++ b/perly.y
@@ -39,7 +39,22 @@ struct ysv {
     YYSTYPE oldyylval;
 };
 
-static void yydestruct(pTHXo_ void *ptr);
+static void yydestruct(void *ptr);
+
+static void
+yydestruct(void *ptr)
+{
+    struct ysv* ysave = (struct ysv*)ptr;
+    if (ysave->yyss) Safefree(ysave->yyss);
+    if (ysave->yyvs) Safefree(ysave->yyvs);
+    yydebug    = ysave->oldyydebug;
+    yynerrs    = ysave->oldyynerrs;
+    yyerrflag  = ysave->oldyyerrflag;
+    yychar     = ysave->oldyychar;
+    yyval      = ysave->oldyyval;
+    yylval     = ysave->oldyylval;
+    Safefree(ysave);
+}
 
 %}
 
@@ -200,7 +215,7 @@ sideff      :       error
 else   :       /* NULL */
                        { $$ = Nullop; }
        |       ELSE mblock
-                       { $$ = scope($2); }
+                       { ($2)->op_flags |= OPf_PARENS; $$ = scope($2); }
        |       ELSIF '(' mexpr ')' mblock else
                        { PL_copline = $1;
                            $$ = newCONDOP(0, $3, scope($5), $6);