Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Fix nameref errors exposed by Philippe's tests
- X-seq: zsh-workers 53557
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: Fix nameref errors exposed by Philippe's tests
- Date: Tue, 6 May 2025 07:54:28 -0700
- Archived-at: <https://zsh.org/workers/53557>
- In-reply-to: <CAH+w=7ZaHRhitCroqidHO30QDALDXJmoiWJfV=a+QMkXQJwChQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7Ztz9U_15u1R=LPVUa-5QBXcDzUeNiPBPi=3QxjjGO_5g@mail.gmail.com> <CAH+w=7YNUk+MfbahFy-mLKL6DTiq=sTmWr-Ygipbxm1C5eAeyQ@mail.gmail.com> <CAGdYcht4EoKoYccTXTfYOweWKdi4p6o0S4PzFNR_-LUGK5fY6w@mail.gmail.com> <CAH+w=7ZaHRhitCroqidHO30QDALDXJmoiWJfV=a+QMkXQJwChQ@mail.gmail.com>
On Mon, May 5, 2025 at 3:49 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Mon, May 5, 2025 at 1:52 PM Philippe Altherr
> <philippe.altherr@xxxxxxxxx> wrote:
> >
> > I don't understand why the results for nr-test -u {5..10} keep referring to "g".
>
> Hm. It's not looking one level above the current scope, it's looking
> one level above the parameter currently in scope.
To fix that scoping issue:
diff --git a/Src/params.c b/Src/params.c
index cb1f6d4b0..e6fb7fcd0 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -6404,14 +6404,14 @@ setscope(Param pm)
} else if (!pm->base) {
pm->base = basepm->level;
if ((pm->node.flags & PM_UPPER) &&
- (basepm = upscope(basepm, -(pm->level))))
+ (basepm = upscope(basepm, -(locallevel-1))))
pm->base = basepm->level;
}
} else if (pm->base < locallevel && refname &&
(basepm = (Param)getparamnode(realparamtab, refname))) {
pm->base = basepm->level;
if ((pm->node.flags & PM_UPPER) &&
- (basepm = upscope(basepm, -(pm->level))))
+ (basepm = upscope(basepm, -(locallevel-1))))
pm->base = basepm->level;
}
if (pm->base > pm->level) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author