1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-30 03:50:56 +01:00

51374: Expose named references in $parameters, fix substitution error.

This commit is contained in:
Bart Schaefer 2023-02-12 11:29:10 -08:00
parent 102145b048
commit 3e55a135c1
5 changed files with 110 additions and 21 deletions

View file

@ -105,10 +105,15 @@ getpmparameter(UNUSED(HashTable ht), const char *name)
pm->node.nam = dupstring(name);
pm->node.flags = PM_SCALAR | PM_READONLY;
pm->gsu.s = &nullsetscalar_gsu;
if ((rpm = (Param) realparamtab->getnode(realparamtab, name)) &&
!(rpm->node.flags & PM_UNSET))
if ((rpm = (Param) realparamtab->getnode2(realparamtab, name)) &&
!(rpm->node.flags & PM_UNSET)) {
pm->u.str = paramtypestr(rpm);
else {
if ((rpm->node.flags & PM_NAMEREF) &&
(rpm = (Param) realparamtab->getnode(realparamtab, name)) &&
!(rpm->node.flags & PM_UNSET)) {
pm->u.str = zhtricat(pm->u.str, "-", paramtypestr(rpm));
}
} else {
pm->u.str = dupstring("");
pm->node.flags |= (PM_UNSET|PM_SPECIAL);
}