From 7fda7a16f336248d2686e3e72acfe71aa8316776 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Mon, 8 Sep 1997 20:36:13 -0700
Subject: [PATCH] foo->bar now finds the right function!

Rev: src/builtin_functions.c:1.43
Rev: src/docode.c:1.21
Rev: src/interpret.c:1.46
Rev: src/las.c:1.37
Rev: src/object.c:1.22
Rev: src/program.c:1.39
Rev: src/program.h:1.19
Rev: src/testsuite.in:1.51
---
 src/builtin_functions.c |   4 +-
 src/docode.c            |   8 ++--
 src/interpret.c         |  12 ++---
 src/las.c               |   8 ++--
 src/object.c            |  20 ++++----
 src/program.c           | 100 +++++++++++++++++++++++-----------------
 src/program.h           |   4 +-
 src/testsuite.in        |  14 ++++--
 8 files changed, 96 insertions(+), 74 deletions(-)

diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index 54e0ebd01d..c845dd7410 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: builtin_functions.c,v 1.42 1997/09/06 13:50:08 grubba Exp $");
+RCSID("$Id: builtin_functions.c,v 1.43 1997/09/09 03:36:10 hubbe Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -1737,7 +1737,7 @@ static void f_get_prof_info(INT32 args)
   push_int(prog->num_clones);
 
   for(num_functions=i=0; i<prog->num_identifiers; i++) {
-    if (IDENTIFIER_IS_FUNCTION(prog->identifiers[i].flags)) {
+    if (IDENTIFIER_IS_FUNCTION(prog->identifiers[i].identifier_flags)) {
       num_functions++;
       prog->identifiers[i].name->refs++;
       push_string(prog->identifiers[i].name);
diff --git a/src/docode.c b/src/docode.c
index cec88bc8f2..67fbe6f705 100644
--- a/src/docode.c
+++ b/src/docode.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: docode.c,v 1.20 1997/08/30 18:35:27 grubba Exp $");
+RCSID("$Id: docode.c,v 1.21 1997/09/09 03:36:11 hubbe Exp $");
 #include "las.h"
 #include "program.h"
 #include "language.h"
@@ -450,7 +450,7 @@ static int do_docode2(node *n,int flags)
 	break;
 
       case F_IDENTIFIER:
-	if(!IDENTIFIER_IS_VARIABLE( ID_FROM_INT(& fake_program, CDR(n)->u.number)->flags))
+	if(!IDENTIFIER_IS_VARIABLE( ID_FROM_INT(& fake_program, CDR(n)->u.number)->identifier_flags))
 	{
 	  yyerror("Cannot assign functions or constants.\n");
 	}else{
@@ -703,7 +703,7 @@ static int do_docode2(node *n,int flags)
       return 1;
     }
     else if(CAR(n)->token == F_IDENTIFIER &&
-	    IDENTIFIER_IS_FUNCTION(ID_FROM_INT(& fake_program, CAR(n)->u.number)->flags))
+	    IDENTIFIER_IS_FUNCTION(ID_FROM_INT(& fake_program, CAR(n)->u.number)->identifier_flags))
     {
       emit2(F_MARK);
       do_docode(CDR(n),0);
@@ -1060,7 +1060,7 @@ static int do_docode2(node *n,int flags)
     }
 
   case F_IDENTIFIER:
-    if(IDENTIFIER_IS_FUNCTION(ID_FROM_INT(& fake_program, n->u.number)->flags))
+    if(IDENTIFIER_IS_FUNCTION(ID_FROM_INT(& fake_program, n->u.number)->identifier_flags))
     {
       if(flags & DO_LVALUE)
       {
diff --git a/src/interpret.c b/src/interpret.c
index fa8c4eccf7..805f2422c6 100644
--- a/src/interpret.c
+++ b/src/interpret.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: interpret.c,v 1.45 1997/08/30 18:35:34 grubba Exp $");
+RCSID("$Id: interpret.c,v 1.46 1997/09/09 03:36:11 hubbe Exp $");
 #include "interpret.h"
 #include "object.h"
 #include "program.h"
@@ -748,7 +748,7 @@ static void eval_instruction(unsigned char *pc)
 
 	i=ID_FROM_INT(fp->current_object->prog, tmp);
 
-	if(!IDENTIFIER_IS_VARIABLE(i->flags))
+	if(!IDENTIFIER_IS_VARIABLE(i->identifier_flags))
 	  error("Cannot re-assign functions or constants.\n");
 
 	if(i->run_time_type == T_MIXED)
@@ -804,7 +804,7 @@ static void eval_instruction(unsigned char *pc)
 	  error("Cannot access global variables in destructed object.\n");
 
 	i=ID_FROM_INT(fp->current_object->prog, tmp);
-	if(!IDENTIFIER_IS_VARIABLE(i->flags))
+	if(!IDENTIFIER_IS_VARIABLE(i->identifier_flags))
 	  error("Cannot assign functions or constants.\n");
 	if(i->run_time_type == T_MIXED)
 	{
@@ -825,7 +825,7 @@ static void eval_instruction(unsigned char *pc)
 	  error("Cannot access global variables in destructed object.\n");
 
 	i=ID_FROM_INT(fp->current_object->prog, tmp);
-	if(!IDENTIFIER_IS_VARIABLE(i->flags))
+	if(!IDENTIFIER_IS_VARIABLE(i->identifier_flags))
 	  error("Cannot assign functions or constants.\n");
 
 	if(i->run_time_type == T_MIXED)
@@ -1362,7 +1362,7 @@ void apply_low(struct object *o, int fun, int args)
   if(function->func.offset == -1)
     error("Calling undefined function '%s'.\n",function->name->str);
 
-  if(function->flags & IDENTIFIER_C_FUNCTION)
+  if(function->identifier_flags & IDENTIFIER_C_FUNCTION)
   {
     fp->num_args=args;
     new_frame.num_locals=args;
@@ -1384,7 +1384,7 @@ void apply_low(struct object *o, int fun, int args)
       args += num_args-args;
     }
 
-    if(function->flags & IDENTIFIER_VARARGS)
+    if(function->identifier_flags & IDENTIFIER_VARARGS)
     {
       f_aggregate(args - num_args); /* make array */
       args = num_args+1;
diff --git a/src/las.c b/src/las.c
index 6f73e3a392..6f7e665dae 100644
--- a/src/las.c
+++ b/src/las.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: las.c,v 1.36 1997/08/30 18:35:37 grubba Exp $");
+RCSID("$Id: las.c,v 1.37 1997/09/09 03:36:11 hubbe Exp $");
 
 #include "language.h"
 #include "interpret.h"
@@ -412,7 +412,7 @@ node *mkidentifiernode(int i)
   copy_shared_string(res->type, ID_FROM_INT(&fake_program, i)->type);
 
   /* FIXME */
-  if(IDENTIFIER_IS_CONSTANT(ID_FROM_INT(&fake_program, i)->flags))
+  if(IDENTIFIER_IS_CONSTANT(ID_FROM_INT(&fake_program, i)->identifier_flags))
   {
     res->node_info = OPT_EXTERNAL_DEPEND;
   }else{
@@ -465,7 +465,7 @@ void resolv_constant(node *n)
       setup_fake_program();
       i=ID_FROM_INT(& fake_program, n->u.number);
 	
-      if(IDENTIFIER_IS_CONSTANT(i->flags))
+      if(IDENTIFIER_IS_CONSTANT(i->identifier_flags))
       {
 	push_svalue(PROG_FROM_INT(&fake_program, n->u.number)->constants +
 		    i->func.offset);
@@ -1566,7 +1566,7 @@ static void optimize(node *n)
 	{
 	  struct identifier *id;
 	  id=ID_FROM_INT(CAR(n)->u.sval.u.object->prog, i);
-	  if(IDENTIFIER_IS_VARIABLE(id->flags)) break;
+	  if(IDENTIFIER_IS_VARIABLE(id->identifier_flags)) break;
 	}
 	ref_push_object(CAR(n)->u.sval.u.object);
 	ref_push_string(CDR(n)->u.sval.u.string);
diff --git a/src/object.c b/src/object.c
index c57f1d9c42..24acce9e1d 100644
--- a/src/object.c
+++ b/src/object.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: object.c,v 1.21 1997/08/30 18:35:45 grubba Exp $");
+RCSID("$Id: object.c,v 1.22 1997/09/09 03:36:12 hubbe Exp $");
 #include "object.h"
 #include "dynamic_buffer.h"
 #include "interpret.h"
@@ -76,7 +76,7 @@ struct object *low_clone(struct program *p)
 
     for(d=0;d<(int)frame.context.prog->num_identifiers;d++)
     {
-      if(!IDENTIFIER_IS_VARIABLE(frame.context.prog->identifiers[d].flags))
+      if(!IDENTIFIER_IS_VARIABLE(frame.context.prog->identifiers[d].identifier_flags))
 	continue;
       
       if(frame.context.prog->identifiers[d].run_time_type == T_MIXED)
@@ -217,7 +217,7 @@ void destruct(struct object *o)
 
     for(d=0;d<(int)frame.context.prog->num_identifiers;d++)
     {
-      if(!IDENTIFIER_IS_VARIABLE(frame.context.prog->identifiers[d].flags)) 
+      if(!IDENTIFIER_IS_VARIABLE(frame.context.prog->identifiers[d].identifier_flags)) 
 	continue;
       
       if(frame.context.prog->identifiers[d].run_time_type == T_MIXED)
@@ -327,7 +327,7 @@ void low_object_index_no_free(struct svalue *to,
 
   i=ID_FROM_INT(p, f);
 
-  switch(i->flags & (IDENTIFIER_FUNCTION | IDENTIFIER_CONSTANT))
+  switch(i->identifier_flags & (IDENTIFIER_FUNCTION | IDENTIFIER_CONSTANT))
   {
   case IDENTIFIER_FUNCTION:
   case IDENTIFIER_C_FUNCTION:
@@ -437,7 +437,7 @@ static void object_low_set_index(struct object *o,
 
   i=ID_FROM_INT(p, f);
 
-  if(!IDENTIFIER_IS_VARIABLE(i->flags))
+  if(!IDENTIFIER_IS_VARIABLE(i->identifier_flags))
   {
     error("Cannot assign functions or constants.\n");
   }
@@ -520,7 +520,7 @@ static union anything *object_low_get_item_ptr(struct object *o,
 
   i=ID_FROM_INT(p, f);
 
-  if(!IDENTIFIER_IS_VARIABLE(i->flags))
+  if(!IDENTIFIER_IS_VARIABLE(i->identifier_flags))
   {
     error("Cannot assign functions or constants.\n");
   }
@@ -609,7 +609,7 @@ void verify_all_objects(void)
       {
 	struct identifier *i;
 	i=ID_FROM_INT(o->prog, e);
-	if(!IDENTIFIER_IS_VARIABLE(i->flags))
+	if(!IDENTIFIER_IS_VARIABLE(i->identifier_flags))
 	  continue;
 
 	if(i->run_time_type == T_MIXED)
@@ -667,7 +667,7 @@ int object_equal_p(struct object *a, struct object *b, struct processing *p)
     {
       struct identifier *i;
       i=ID_FROM_INT(a->prog, e);
-      if(!IDENTIFIER_IS_VARIABLE(i->flags))
+      if(!IDENTIFIER_IS_VARIABLE(i->identifier_flags))
 	continue;
 
       if(i->run_time_type == T_MIXED)
@@ -798,7 +798,7 @@ void gc_mark_object_as_referenced(struct object *o)
 
       for(d=0;d<(int)frame.context.prog->num_identifiers;d++)
       {
-	if(!IDENTIFIER_IS_VARIABLE(frame.context.prog->identifiers[d].flags)) 
+	if(!IDENTIFIER_IS_VARIABLE(frame.context.prog->identifiers[d].identifier_flags)) 
 	  continue;
 	
 	if(frame.context.prog->identifiers[d].run_time_type == T_MIXED)
@@ -837,7 +837,7 @@ void gc_check_all_objects(void)
 	
 	i=ID_FROM_INT(o->prog, e);
 	
-	if(!IDENTIFIER_IS_VARIABLE(i->flags)) continue;
+	if(!IDENTIFIER_IS_VARIABLE(i->identifier_flags)) continue;
 	
 	if(i->run_time_type == T_MIXED)
 	{
diff --git a/src/program.c b/src/program.c
index af16d13bf7..693169288e 100644
--- a/src/program.c
+++ b/src/program.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: program.c,v 1.38 1997/09/08 01:04:54 hubbe Exp $");
+RCSID("$Id: program.c,v 1.39 1997/09/09 03:36:12 hubbe Exp $");
 #include "program.h"
 #include "object.h"
 #include "dynamic_buffer.h"
@@ -163,7 +163,7 @@ int find_module_identifier(struct pike_string *ident)
       {
 	struct identifier *id;
 	id=ID_FROM_INT(&p->fake_program, i);
-	if(IDENTIFIER_IS_CONSTANT(id->flags))
+	if(IDENTIFIER_IS_CONSTANT(id->identifier_flags))
 	{
 	  push_svalue(PROG_FROM_INT(&p->fake_program, i)->constants+
 		      id->func.offset);
@@ -322,6 +322,7 @@ void really_free_program(struct program *p)
 }
 
 #ifdef DEBUG
+
 void dump_program_desc(struct program *p)
 {
   int e,d,q;
@@ -337,12 +338,19 @@ void dump_program_desc(struct program *p)
   }
 */
 
-  fprintf(stderr,"All identifiers:\n");
+  fprintf(stderr,"All identifiers: (this=%08x)\n",(unsigned int)p);
   for(e=0;e<(int)p->num_identifier_references;e++)
   {
     fprintf(stderr,"%3d:",e);
     for(d=0;d<INHERIT_FROM_INT(p,e)->inherit_level;d++) fprintf(stderr,"  ");
-    fprintf(stderr,"%s;\n",ID_FROM_INT(p,e)->name->str);
+    fprintf(stderr," (%08x) %s;\t",
+	    (unsigned int)INHERIT_FROM_INT(p,e)->prog,
+	    ID_FROM_INT(p,e)->name->str);
+    if(p->identifier_references[e].id_flags&ID_HIDDEN)
+      fprintf(stderr," (hidden)");
+    if(p->identifier_references[e].id_flags&ID_INHERITED)
+      fprintf(stderr," (inherited)");
+    fprintf(stderr,"\n");
   }
   fprintf(stderr,"All sorted identifiers:\n");
   for(q=0;q<(int)p->num_identifier_indexes;q++)
@@ -350,7 +358,14 @@ void dump_program_desc(struct program *p)
     e=p->identifier_index[q];
     fprintf(stderr,"%3d (%3d):",e,q);
     for(d=0;d<INHERIT_FROM_INT(p,e)->inherit_level;d++) fprintf(stderr,"  ");
-    fprintf(stderr,"%s;\n", ID_FROM_INT(p,e)->name->str);
+    fprintf(stderr," (%08x) %s;\t",
+	    (unsigned int)INHERIT_FROM_INT(p,e)->prog,
+	    ID_FROM_INT(p,e)->name->str);
+    if(p->identifier_references[e].id_flags & ID_HIDDEN)
+      fprintf(stderr," (hidden)");
+    if(p->identifier_references[e].id_flags&ID_INHERITED)
+      fprintf(stderr," (inherited)");
+    fprintf(stderr,"\n");
   }
 }
 #endif
@@ -497,7 +512,7 @@ void check_program(struct program *p)
     check_string(p->identifiers[e].name);
     check_string(p->identifiers[e].type);
 
-    if(p->identifiers[e].flags & ~15)
+    if(p->identifiers[e].identifier_flags & ~15)
       fatal("Unknown flags in identifier flag field.\n");
 
     if(p->identifiers[e].run_time_type!=T_MIXED)
@@ -616,29 +631,28 @@ struct program *end_program(void)
       struct reference *funp;
       struct identifier *fun;
       funp=prog->identifier_references+i;
-      if(funp->flags & (ID_HIDDEN|ID_STATIC)) continue;
-      if(funp->flags & ID_INHERITED)
+      if(funp->id_flags & (ID_HIDDEN|ID_STATIC|ID_PRIVATE)) continue;
+
+      if(funp->id_flags & ID_INHERITED)
       {
-	if(funp->flags & ID_PRIVATE) continue;
 	fun=ID_FROM_PTR(prog, funp);
 	/* if(fun->func.offset == -1) continue; prototype */
-
+	
 	/* check for multiple definitions */
-	for(t=0;t>=0 && t<(int)prog->num_identifier_references;t++)
+	for(t=i+1;t>=0 && t<(int)prog->num_identifier_references;t++)
 	{
 	  struct reference *funpb;
 	  struct identifier *funb;
-
-	  if(t==i) continue;
+	  
 	  funpb=prog->identifier_references+t;
-	  if(funpb->flags & (ID_HIDDEN|ID_STATIC)) continue;
-	  if((funpb->flags & ID_INHERITED) && t>i) continue;
+	  if(funpb->id_flags & (ID_HIDDEN|ID_STATIC)) continue;
 	  funb=ID_FROM_PTR(prog,funpb);
 	  if(funb->func.offset == -1) continue; /* prototype */
 	  if(fun->name==funb->name) t=-10;
 	}
 	if(t<0) continue;
       }
+
       prog->identifier_index[e]=i;
       e++;
     }
@@ -730,7 +744,7 @@ int low_reference_inherited_identifier(int e,struct pike_string *name)
   i=find_shared_string_identifier(name,p);
   if(i==-1) return i;
 
-  if(p->identifier_references[i].flags & ID_HIDDEN)
+  if(p->identifier_references[i].id_flags & ID_HIDDEN)
     return -1;
 
   if(ID_FROM_INT(p,i)->func.offset == -1) /* prototype */
@@ -738,7 +752,7 @@ int low_reference_inherited_identifier(int e,struct pike_string *name)
 
   funp=p->identifier_references[i];
   funp.inherit_offset+=e;
-  funp.flags|=ID_HIDDEN;
+  funp.id_flags|=ID_HIDDEN;
 
   for(d=0;d<(int)fake_program.num_identifier_references;d++)
   {
@@ -844,7 +858,7 @@ void do_inherit(struct program *p,INT32 flags, struct pike_string *name)
     name=ID_FROM_PTR(p,&fun)->name;
     fun.inherit_offset += inherit_offset;
 
-    if (fun.flags & ID_NOMASK)
+    if (fun.id_flags & ID_NOMASK)
     {
       int n;
       n = isidentifier(name);
@@ -852,14 +866,14 @@ void do_inherit(struct program *p,INT32 flags, struct pike_string *name)
 	my_yyerror("Illegal to redefine 'nomask' function/variable \"%s\"",name->str);
     }
 
-    if(fun.flags & ID_PRIVATE) fun.flags|=ID_HIDDEN;
+    if(fun.id_flags & ID_PRIVATE) fun.id_flags|=ID_HIDDEN;
 
-    if (fun.flags & ID_PUBLIC)
-      fun.flags |= flags & ~ID_PRIVATE;
+    if (fun.id_flags & ID_PUBLIC)
+      fun.id_flags |= flags & ~ID_PRIVATE;
     else
-      fun.flags |= flags;
+      fun.id_flags |= flags;
 
-    fun.flags |= ID_INHERITED;
+    fun.id_flags |= ID_INHERITED;
     add_to_mem_block(A_IDENTIFIER_REFERENCES, (char *)&fun, sizeof fun);
   }
 
@@ -910,9 +924,9 @@ int isidentifier(struct pike_string *s)
 {
   INT32 e;
   setup_fake_program();
-  for(e=0;e<(int)fake_program.num_identifier_references;e++)
+  for(e=(int)fake_program.num_identifier_references-1;e>=0;e--)
   {
-    if(fake_program.identifier_references[e].flags & ID_HIDDEN) continue;
+    if(fake_program.identifier_references[e].id_flags & ID_HIDDEN) continue;
     
     if(ID_FROM_INT(& fake_program, e)->name == s)
       return e;
@@ -932,7 +946,7 @@ int low_define_variable(struct pike_string *name,
   
   copy_shared_string(dummy.name, name);
   copy_shared_string(dummy.type, type);
-  dummy.flags = 0;
+  dummy.identifier_flags = 0;
   dummy.run_time_type=run_time_type;
   dummy.func.offset=offset;
   
@@ -940,7 +954,7 @@ int low_define_variable(struct pike_string *name,
   dummy.num_calls = 0;
 #endif /* PROFILING */
 
-  ref.flags=flags;
+  ref.id_flags=flags;
   ref.identifier_offset=areas[A_IDENTIFIERS].s.len / sizeof dummy;
   ref.inherit_offset=0;
 
@@ -993,7 +1007,7 @@ int define_variable(struct pike_string *name,
   {
     setup_fake_program();
 
-    if (IDENTIFIERP(n)->flags & ID_NOMASK)
+    if (IDENTIFIERP(n)->id_flags & ID_NOMASK)
       my_yyerror("Illegal to redefine 'nomask' variable/functions \"%s\"", name->str);
 
     if(PROG_FROM_INT(& fake_program, n) == &fake_program)
@@ -1002,7 +1016,7 @@ int define_variable(struct pike_string *name,
     if(ID_FROM_INT(& fake_program, n)->type != type)
       my_yyerror("Illegal to redefine inherited variable with different type.");
 
-    if(ID_FROM_INT(& fake_program, n)->flags != flags)
+    if(ID_FROM_INT(& fake_program, n)->identifier_flags != flags)
       my_yyerror("Illegal to redefine inherited variable with different type.");
 
   } else {
@@ -1038,7 +1052,7 @@ int add_constant(struct pike_string *name,
   copy_shared_string(dummy.name, name);
   dummy.type = get_type_of_svalue(c);
   
-  dummy.flags = IDENTIFIER_CONSTANT;
+  dummy.identifier_flags = IDENTIFIER_CONSTANT;
   dummy.run_time_type=c->type;
   
   dummy.func.offset=store_constant(c, 0);
@@ -1048,7 +1062,7 @@ int add_constant(struct pike_string *name,
   dummy.num_calls = 0;
 #endif /* PROFILING */
 
-  ref.flags=flags;
+  ref.id_flags=flags;
   ref.identifier_offset=fake_program.num_identifiers;
   ref.inherit_offset=0;
 
@@ -1057,7 +1071,7 @@ int add_constant(struct pike_string *name,
 
   if(n != -1)
   {
-    if (IDENTIFIERP(n)->flags & ID_NOMASK)
+    if (IDENTIFIERP(n)->id_flags & ID_NOMASK)
       my_yyerror("Illegal to redefine 'nomask' identifier \"%s\"", name->str);
 
     if(PROG_FROM_INT(& fake_program, n) == &fake_program)
@@ -1206,7 +1220,7 @@ INT32 define_function(struct pike_string *name,
     /* it's just another prototype, don't define anything */
     if(!func || func->offset == -1) return i;
 
-    if((ref.flags & ID_NOMASK) &&
+    if((ref.id_flags & ID_NOMASK) &&
        !(funp->func.offset == -1))
     {
       my_yyerror("Illegal to redefine 'nomask' function %s.",name->str);
@@ -1220,7 +1234,7 @@ INT32 define_function(struct pike_string *name,
       else
 	funp->func.offset = -1;
 
-      funp->flags=function_flags;
+      funp->identifier_flags=function_flags;
     }else{
       /* Otherwise we make a new definition */
       copy_shared_string(fun.name, name);
@@ -1228,7 +1242,7 @@ INT32 define_function(struct pike_string *name,
 
       fun.run_time_type=T_FUNCTION;
 
-      fun.flags=function_flags;
+      fun.identifier_flags=function_flags;
 
       if(func)
 	fun.func = *func;
@@ -1244,7 +1258,7 @@ INT32 define_function(struct pike_string *name,
     }
 
     ref.inherit_offset = 0;
-    ref.flags = flags;
+    ref.id_flags = flags;
     fake_program.identifier_references[i]=ref;
   }else{
     /* define it */
@@ -1252,7 +1266,7 @@ INT32 define_function(struct pike_string *name,
     copy_shared_string(fun.name, name);
     copy_shared_string(fun.type, type);
 
-    fun.flags=function_flags;
+    fun.identifier_flags=function_flags;
 
     fun.run_time_type=T_FUNCTION;
 
@@ -1264,7 +1278,7 @@ INT32 define_function(struct pike_string *name,
     i=fake_program.num_identifiers;
     add_to_mem_block(A_IDENTIFIERS, (char *)&fun, sizeof(fun));
 
-    ref.flags = flags;
+    ref.id_flags = flags;
     ref.identifier_offset = i;
     ref.inherit_offset = 0;
 
@@ -1308,13 +1322,13 @@ static int low_find_shared_string_identifier(struct pike_string *name,
     for(i=0;i<(int)prog->num_identifier_references;i++)
     {
       funp = prog->identifier_references + i;
-      if(funp->flags & ID_HIDDEN) continue;
+      if(funp->id_flags & ID_HIDDEN) continue;
       fun = ID_FROM_PTR(prog, funp);
       if(fun->func.offset == -1) continue; /* Prototype */
       if(!is_same_string(fun->name,name)) continue;
-      if(funp->flags & ID_INHERITED)
+      if(funp->id_flags & ID_INHERITED)
       {
-        if(funp->flags & ID_PRIVATE) continue;
+        if(funp->id_flags & ID_PRIVATE) continue;
 	for(t=0; t>=0 && t<(int)prog->num_identifier_references; t++)
 	{
 	  struct reference *funpb;
@@ -1322,8 +1336,8 @@ static int low_find_shared_string_identifier(struct pike_string *name,
 	  
 	  if(t==i) continue;
 	  funpb=prog->identifier_references+t;
-	  if(funpb->flags & (ID_HIDDEN|ID_STATIC)) continue;
-	  if((funpb->flags & ID_INHERITED) && t>i) continue;
+	  if(funpb->id_flags & (ID_HIDDEN|ID_STATIC)) continue;
+	  if((funpb->id_flags & ID_INHERITED) && t<i) continue;
 	  funb=ID_FROM_PTR(prog,funpb);
 	  /* if(funb->func.offset == -1) continue; * prototype */
 	  if(fun->name==funb->name) t=-10;
diff --git a/src/program.h b/src/program.h
index bffba84517..3a7ebca5e7 100644
--- a/src/program.h
+++ b/src/program.h
@@ -94,7 +94,7 @@ struct identifier
 {
   struct pike_string *name;
   struct pike_string *type;
-  unsigned INT16 flags; /* IDENTIFIER_??? */
+  unsigned INT16 identifier_flags; /* IDENTIFIER_??? */
   unsigned INT16 run_time_type;
 #ifdef PROFILING
   unsigned INT32 num_calls;
@@ -123,7 +123,7 @@ struct reference
 {
   unsigned INT16 inherit_offset;
   unsigned INT16 identifier_offset;
-  INT16 flags; /* static, private etc.. */
+  INT16 id_flags; /* ID_* static, private etc.. */
 };
 
 struct inherit
diff --git a/src/testsuite.in b/src/testsuite.in
index fcf7a34cc7..0d68b10583 100644
--- a/src/testsuite.in
+++ b/src/testsuite.in
@@ -1,4 +1,4 @@
-test_true([["$Id: testsuite.in,v 1.50 1997/09/08 19:08:57 hubbe Exp $"]])
+test_true([["$Id: testsuite.in,v 1.51 1997/09/09 03:36:13 hubbe Exp $"]])
 test_eq(1e1,10.0)
 test_eq(1E1,10.0)
 test_eq(1e+1,10.0)
@@ -6,11 +6,19 @@ test_eq(1.1e1,11.0)
 test_eq(1e-1,0.1)
 test_eq('\x20',32)
 test_eq("\x20","\040")
+
 test_any([[
 class p1 { int foo() { return 1; }};
-class p2 { int foo() { return 2; }};
+class p2 { int foo() { return 3; }};
 class c1 { inherit p1; inherit p2; int foo() { return p1::foo()+p2::foo(); }};
- class c2 { inherit c1; }; return c2()->foo();]],3)
+class c2 { inherit c1; }; return c2()->foo();]],4)
+
+test_any([[
+class p1 { int foo() { return 1; } };
+class p2 { int foo() { return 2; } };
+class c1 { inherit p1; inherit p2; };
+return c1()->foo();]],2);
+
 test_any([[class foo { int x=random(100); int `<(object o) { return x < o->x; } }; object *o=Array.map(allocate(100),foo); sort(o); for(int e=1;e<100;e++) if(o[e-1]->x > o[e]->x) return e; return -1;]],-1)
 test_compile_error([[void foo() { return destruct(this_object()); }]])
 test_any([[class foo { constant x=17; }; class bar { inherit foo; constant x=18; }; return bar()->x;]],18)
-- 
GitLab