Branch: Tag:

1999-12-15

1999-12-15 19:42:12 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

better error messages

Rev: src/las.c:1.144
Rev: src/pike_types.c:1.99
Rev: src/program.c:1.186
Rev: src/program.h:1.72

5:   \*/   /**/   #include "global.h" - RCSID("$Id: pike_types.c,v 1.98 1999/12/15 17:04:13 grubba Exp $"); + RCSID("$Id: pike_types.c,v 1.99 1999/12/15 19:42:09 hubbe Exp $");   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"
81:      static struct pike_string *a_markers[10],*b_markers[10];    + static struct program *implements_a; + static struct program *implements_b; +    static void clear_markers(void)   {    unsigned int e;
1875:   #else /* !1 */    if(EXTRACT_UCHAR(a+1))    { -  if(!implements(ap,bp)) +  if(!implements(implements_a=ap,implements_b=bp))    return 0;    }else{ -  if(!implements(bp,ap)) +  if(!implements(implements_a=bp,implements_b=ap))    return 0;    }   #endif /* 1 */
2342:    /* Shouldn't happen... */    return 0;    } -  return implements(ap, bp); +  return implements(implements_a=ap, implements_b=bp);    }    break;   
3228:    }    }   } +  +  + void yyexplain_nonmatching_types(struct pike_string *type_a, +  struct pike_string *type_b) + { +  implements_a=0; +  implements_b=0; +  +  match_types(type_a,type_b); +  +  if(!(implements_a && implements_b && +  type_a->str[0]==T_OBJECT && +  type_b->str[0]==T_OBJECT)) +  { +  struct pike_string *s1,*s2; +  s1=describe_type(type_a); +  s2=describe_type(type_b); +  my_yyerror("Expected: %s",s1->str); +  my_yyerror("Got : %s",s2->str); +  free_string(s1); +  free_string(s2); +  } +  +  if(implements_a && implements_b) +  yyexplain_not_implements(implements_a,implements_b); + }