Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: hiding of specials and namerefs



+    if (usepm && (on & PM_HIDE) &&
+ (pm->node.flags & (PM_SPECIAL|PM_AUTOLOAD)) &&
+ pm->level <= locallevel) {

Since my first review, I was disturbed by the last condition. First I thought that it was wrong and instead should be "pm->level == locallevel" but no, we need the "<" in case one attempts a "typeset -gh" from a local scope. Now, it occurred to me that the condition isn't needed at all; it's always true because the parameter table is never supposed to contain a parameter whose level is higher than the locallevel. The condition should be dropped.

Philippe

diff --git a/Src/builtin.c b/Src/builtin.c
index e35d7fe2c..55fa7ffb2 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2210,8 +2210,7 @@ typeset_single(char *cname, char *pname, Param pm, int func,
 	*/
     }
     if (usepm && (on & PM_HIDE) &&
-	(pm->node.flags & (PM_SPECIAL|PM_AUTOLOAD)) &&
-	pm->level <= locallevel) {
+	(pm->node.flags & (PM_SPECIAL|PM_AUTOLOAD))) {
 #if 0
 	zwarnnam(cname, "%s: can't change parameter attribute", pname);
 	/* return NULL; */	/* this has always been a no-op */


Messages sorted by: Reverse Date, Date, Thread, Author