Branch: Tag:

1997-01-27

1997-01-27 01:28:34 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

support for `() added

Rev: src/pike_types.c:1.14

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: pike_types.c,v 1.13 1997/01/22 05:19:45 hubbe Exp $"); + RCSID("$Id: pike_types.c,v 1.14 1997/01/27 01:28:34 hubbe Exp $");   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"
119:    case T_UNKNOWN:    break;    -  +     case T_OBJECT:    t+=sizeof(INT32);    break;
706:    if(EXTRACT_UCHAR(b) == T_MIXED && !(flags & B_EXACT)) return a;       /* Special case (tm) */ -  if(EXTRACT_UCHAR(a) == T_PROGRAM && EXTRACT_UCHAR(b)==T_FUNCTION) +  +  /* Handle cloning with prog() */ +  if(EXTRACT_UCHAR(a) == T_PROGRAM && +  EXTRACT_UCHAR(b)==T_FUNCTION)    {    return a;    }    -  +  /* Handle the `() operator */ +  if(EXTRACT_UCHAR(a) == T_OBJECT && +  EXTRACT_UCHAR(b)==T_FUNCTION) +  { +  struct program *p; +  if(p=id_to_program(EXTRACT_INT(a+1))) +  { +  int i=p->lfuns[LFUN_CALL]; +  if(i == -1) return 0; +  return low_match_types(ID_FROM_INT(p, i)->type->str, b, flags); +  } +  return a; +  } +     if(EXTRACT_UCHAR(a) != EXTRACT_UCHAR(b)) return 0;       ret=a;
903:    {    if(n->token == F_ARROW)    { -  if(find_identifier("`->",p) != -1 || find_identifier("`->=",p) != -1) +  if(p->lfuns[LFUN_ARROW] != -1 || p->lfuns[LFUN_ASSIGN_ARROW] != -1)    {    reference_shared_string(mixed_type_string);    return mixed_type_string;    }    }else{ -  if(find_identifier("`[]",p) != -1 || find_identifier("`[]=",p) != -1) +  if(p->lfuns[LFUN_INDEX] != -1 || p->lfuns[LFUN_ASSIGN_INDEX] != -1)    {    reference_shared_string(mixed_type_string);    return mixed_type_string;
998:    {    if(n->token == F_ARROW)    { -  if(find_identifier("`->",p) != -1 || find_identifier("`->=",p) != -1) +  if(p->lfuns[LFUN_ARROW] != -1 || p->lfuns[LFUN_ASSIGN_ARROW] != -1)    return 1;    }else{ -  if(find_identifier("`[]",p) != -1 || find_identifier("`[]=",p) != -1) +  if(p->lfuns[LFUN_INDEX] != -1 || p->lfuns[LFUN_ASSIGN_INDEX] != -1)    return 1;    }    return !!low_match_types(string_type_string->str, index_type,0);