Branch: Tag:

2001-11-09

2001-11-09 14:06:49 by Martin Stjernholm <mast@lysator.liu.se>

Do not clobber constants with 0 as value in dirnode. This specifically
allows constants to be zero in module.pmod files.

Rev: lib/master.pike.in:1.176

1:   /* -*- Pike -*-    * -  * $Id: master.pike.in,v 1.175 2001/11/08 14:46:36 grubba Exp $ +  * $Id: master.pike.in,v 1.176 2001/11/09 14:06:49 mast Exp $    *    * Master-file for Pike.    *
876:   #ifdef MODULE_TRACE    werror("%*nDirnode(%O) module[%O] -> ???\n",sizeof(backtrace()),dirname,index);   #endif -  object o; +  mixed o;   // _describe(module);    if(!zero_type(o=module[index]))    {
931:   #ifdef MODULE_TRACE    werror("%*nDirnode(%O) cache[%O] -> %O\n",sizeof(backtrace()),dirname,index, ret);   #endif -  // The check below is to (hopefully) avoid calling any function -  // in ret (like `! or `==) in case it's an object. -  if(!intp (ret) || ret) return ret; +  if (ret != ZERO_TYPE) return ret;    return UNDEFINED;    }    ret=ind(index);
941:    // Kluge!    if(ret == __placeholder_object) return ret;    -  return cache[index]=ret; +  cache[index] = zero_type(ret) ? ZERO_TYPE : ret; +  return ret;    }       static int _cache_full;
987:    {    // werror("indices(%O) called\n", dirname);    fill_cache(); -  return indices(filter(cache, lambda(mixed x){ return !intp (x) || x; })); +  return indices(filter(cache, lambda(mixed x) {return cache[x] != ZERO_TYPE;}));    }    array(mixed) _values()    {    // werror("values(%O) called\n", dirname);    fill_cache(); -  return values(cache)-({0}); +  return values(cache) - ({ZERO_TYPE});    }       string _sprintf(int as)
1088:    array(string) _indices()    {    fill_cache(); -  return indices(cache); +  return indices(filter(cache, lambda(mixed x){ return cache[x] != ZERO_TYPE; }));    }    array(mixed) _values()    {    fill_cache(); -  return values(cache); +  return values(cache) - ({ZERO_TYPE});    }   };