summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-10-13 02:06:09 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-10-13 02:06:09 +0000
commit155fc61f8f24f48a8180aab9a504f33842272586 (patch)
treee47859a05a977e799beedf4df31ce98c05580a63 /op.c
parent9d080a6634fd73a615f3f2bc087428102f6a5c3e (diff)
downloadperl-155fc61f8f24f48a8180aab9a504f33842272586.tar.gz
ensure recursive attempts to findlex()icals know enough about where
the last eval'' context was encountered p4raw-id: //depot/perl@1943
Diffstat (limited to 'op.c')
-rw-r--r--op.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/op.c b/op.c
index cc79dfee5c..b2d6f77df2 100644
--- a/op.c
+++ b/op.c
@@ -48,7 +48,7 @@ static OP *too_few_arguments _((OP *o, char* name));
static OP *too_many_arguments _((OP *o, char* name));
static void null _((OP* o));
static PADOFFSET pad_findlex _((char* name, PADOFFSET newoff, U32 seq,
- CV* startcv, I32 cx_ix));
+ CV* startcv, I32 cx_ix, I32 saweval));
static OP *newDEFSVOP _((void));
static OP *new_logop _((I32 type, I32 flags, OP **firstp, OP **otherp));
#endif
@@ -170,7 +170,7 @@ pad_allocmy(char *name)
}
STATIC PADOFFSET
-pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix)
+pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix, I32 saweval)
{
dTHR;
CV *cv;
@@ -178,7 +178,6 @@ pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix)
SV *sv;
register I32 i;
register PERL_CONTEXT *cx;
- int saweval;
for (cv = startcv; cv; cv = CvOUTSIDE(cv)) {
AV *curlist = CvPADLIST(cv);
@@ -261,14 +260,13 @@ pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix)
* XXX This will also probably interact badly with eval tree caching.
*/
- saweval = 0;
for (i = cx_ix; i >= 0; i--) {
cx = &cxstack[i];
switch (cx->cx_type) {
default:
if (i == 0 && saweval) {
seq = cxstack[saweval].blk_oldcop->cop_seq;
- return pad_findlex(name, newoff, seq, PL_main_cv, 0);
+ return pad_findlex(name, newoff, seq, PL_main_cv, -1, saweval);
}
break;
case CXt_EVAL:
@@ -290,7 +288,7 @@ pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix)
continue;
}
seq = cxstack[saweval].blk_oldcop->cop_seq;
- return pad_findlex(name, newoff, seq, cv, i-1);
+ return pad_findlex(name, newoff, seq, cv, i-1, saweval);
}
}
@@ -336,7 +334,7 @@ pad_findmy(char *name)
}
/* See if it's in a nested scope */
- off = pad_findlex(name, 0, seq, CvOUTSIDE(PL_compcv), cxstack_ix);
+ off = pad_findlex(name, 0, seq, CvOUTSIDE(PL_compcv), cxstack_ix, 0);
if (off) {
/* If there is a pending local definition, this new alias must die */
if (pendoff)
@@ -3588,7 +3586,7 @@ cv_clone2(CV *proto, CV *outside)
char *name = SvPVX(namesv); /* XXX */
if (SvFLAGS(namesv) & SVf_FAKE) { /* lexical from outside? */
I32 off = pad_findlex(name, ix, SvIVX(namesv),
- CvOUTSIDE(cv), cxstack_ix);
+ CvOUTSIDE(cv), cxstack_ix, 0);
if (!off)
PL_curpad[ix] = SvREFCNT_inc(ppad[ix]);
else if (off != ix)