summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/scope.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/scope.c')
-rw-r--r--gnu/usr.bin/perl/scope.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/gnu/usr.bin/perl/scope.c b/gnu/usr.bin/perl/scope.c
index d9034b72f40..9136df946d9 100644
--- a/gnu/usr.bin/perl/scope.c
+++ b/gnu/usr.bin/perl/scope.c
@@ -13,6 +13,13 @@
* levels..."
*/
+/* This file contains functions to manipulate several of Perl's stacks;
+ * in particular it contains code to push various types of things onto
+ * the savestack, then to pop them off and perform the correct restorative
+ * action for each one. This corresponds to the cleanup Perl does at
+ * each scope exit.
+ */
+
#include "EXTERN.h"
#define PERL_IN_SCOPE_C
#include "perl.h"
@@ -930,14 +937,8 @@ Perl_leave_scope(pTHX_ I32 base)
break;
case SVt_PVCV:
Perl_croak(aTHX_ "panic: leave_scope pad code");
- case SVt_RV:
- case SVt_IV:
- case SVt_NV:
- (void)SvOK_off(sv);
- break;
default:
- (void)SvOK_off(sv);
- (void)SvOOK_off(sv);
+ SvOK_off(sv);
break;
}
}
@@ -1045,6 +1046,15 @@ Perl_leave_scope(pTHX_ I32 base)
AvARRAY((PAD*)ptr)[off] = (SV*)SSPOPPTR;
}
break;
+ case SAVEt_SAVESWITCHSTACK:
+ {
+ dSP;
+ AV* t = (AV*)SSPOPPTR;
+ AV* f = (AV*)SSPOPPTR;
+ SWITCHSTACK(t,f);
+ PL_curstackinfo->si_stack = f;
+ }
+ break;
default:
Perl_croak(aTHX_ "panic: leave_scope inconsistency");
}