Branch: Tag:

1999-12-13

1999-12-13 00:56:14 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Made implements() stricter (it now works as documented).

Rev: src/program.c:1.179

5:   \*/   /**/   #include "global.h" - RCSID("$Id: program.c,v 1.178 1999/12/07 09:41:01 hubbe Exp $"); + RCSID("$Id: program.c,v 1.179 1999/12/13 00:56:14 grubba Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
3446:   /* returns 1 if a implements b */   static int low_implements(struct program *a, struct program *b)   { -  int e,num=0; +  int e;    struct pike_string *s=findstring("__INIT");    for(e=0;e<b->num_identifier_references;e++)    {    struct identifier *bid=ID_FROM_INT(b,e);    int i; -  if(s==bid->name) continue; -  i=find_shared_string_identifier(bid->name,a); -  if(i!=-1) -  { +  if(s == bid->name) continue; /* Skip __INIT */ +  i = find_shared_string_identifier(bid->name,a); +  if (i == -1) return 0; +     if(!match_types(ID_FROM_INT(a,i)->type, bid->type))    return 0; -  num++; +     } -  +  return 1;   } -  return num; - } +       #define IMPLEMENTS_CACHE_SIZE 4711   struct implements_cache_s { INT32 aid, bid, ret; };