pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: pike_types.c,v 1.341 2008/06/18 21:49:51 grubba Exp $ + || $Id: pike_types.c,v 1.342 2008/06/27 16:23:10 grubba Exp $   */      #include "global.h"   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"
pike.git/src/pike_types.c:1986:    fprintf(stderr, "object(%s %"PRINTPTRDIFFT"d)",    s->car?"is":"implements",    CDR_TO_INT(s));    break;    case T_FUNCTION:    case T_MANY:    fprintf(stderr, "function(");    while(s->type == T_FUNCTION) {    simple_describe_type(s->car);    s = s->cdr; +  while(s->type == T_ASSIGN) { +  fprintf(stderr, "%"PRINTPTRDIFFT"d = ", CAR_TO_INT(s)); +  s = s->cdr; +  }    if ((s->type == T_FUNCTION) ||    (s->car->type != T_VOID)) {    fprintf(stderr, ", ");    }    }    if (s->car->type != T_VOID) {    simple_describe_type(s->car);    fprintf(stderr, "...");    }    fprintf(stderr, ":");
pike.git/src/pike_types.c:2277:    */    /* done */    } else {    my_strcat("(");    s=0;    while(t->type != T_MANY)    {    if(s++) my_strcat(", ");    my_describe_type(t->car);    t = t->cdr; +  while(t->type == T_ASSIGN) { +  my_putchar('0' + CAR_TO_INT(t)); +  my_putchar('='); +  t = t->cdr;    } -  +  }    if(t->car->type != T_VOID)    {    if(s++) my_strcat(", ");    my_describe_type(t->car);    my_strcat(" ...");    }    my_strcat(" : ");    my_describe_type(t->cdr);    my_strcat(")");    }
pike.git/src/pike_types.c:4634:    case T_OBJECT:    {    p = id_to_program(CDR_TO_INT(t));       comefrom_int_index:    if(p && n)    {    INT32 i;    if(n->token == F_ARROW)    { -  /* FIXME: make this stricter */ +     if((i=FIND_LFUN(p,LFUN_ARROW))!=-1)    { -  /* FIXME: function_type_string should be replaced with something -  * derived from type_string -  */ -  if(i!=-1 && -  (tmp=check_call(function_type_string, ID_FROM_INT(p, i)->type, -  0))) -  return tmp; +  INT32 args = 0; +  add_ref(tmp = ID_FROM_INT(p, i)->type); +  if (tmp = new_check_call(lfun_strings[LFUN_ARROW], tmp, CDR(n), +  &args, 0)) { +  struct pike_type *ret = new_get_return_type(tmp, 0); +  free_type(tmp); +  if (ret) return ret; +  }    -  +  /* Invalid type for lfun::`->(). */    add_ref(mixed_type_string);    return mixed_type_string;    }    }else{    if((i=FIND_LFUN(p,LFUN_INDEX)) != -1)    { -  /* FIXME: function_type_string should be replaced with something -  * derived from type_string -  */ -  if(i!=-1 && -  (tmp=check_call(function_type_string, ID_FROM_INT(p, i)->type, -  0))) -  return tmp; +  INT32 args = 0; +  add_ref(tmp = ID_FROM_INT(p, i)->type); +  if (tmp = new_check_call(lfun_strings[LFUN_INDEX], tmp, CDR(n), +  &args, 0)) { +  struct pike_type *ret = new_get_return_type(tmp, 0); +  free_type(tmp); +  if (ret) return ret; +  }    -  +  /* Invalid type for lfun::`[](). */    add_ref(mixed_type_string);    return mixed_type_string;    }    }    if(CDR(n)->token == F_CONSTANT && CDR(n)->u.sval.type==T_STRING)    {    i = find_shared_string_identifier(CDR(n)->u.sval.u.string, p);    if(i==-1)    {    add_ref(mixed_type_string);
pike.git/src/pike_types.c:5054:    {    case T_OBJECT:    {    struct program *p = id_to_program(CDR_TO_INT(t));    if(p && n)    {    if(n->token == F_ARROW)    {    if(FIND_LFUN(p,LFUN_ARROW)!=-1 || FIND_LFUN(p,LFUN_ASSIGN_ARROW)!=-1)    { +  /* FIXME: Get the type of the first argument of the function. +  * FIXME: Probably ought to always be a string. +  */    add_ref(mixed_type_string);    return mixed_type_string;    }    }else{    if(FIND_LFUN(p,LFUN_INDEX) != -1 || FIND_LFUN(p,LFUN_ASSIGN_INDEX) != -1)    { -  +  /* FIXME: Get the type of the first argument of the function. */    add_ref(mixed_type_string);    return mixed_type_string;    }    }    }    add_ref(string_type_string);    return string_type_string;    }    default:    add_ref(mixed_type_string);
pike.git/src/pike_types.c:5161:    return 1;    /* FALL_THROUGH */    case T_STRING:    return !!low_match_types(int_type_string, index_type, 0);       case T_OBJECT:    {    struct program *p = id_to_program(CDR_TO_INT(type));    if(p)    { +  /* FIXME: Ought to check against the LFUN types. */    if(n->token == F_ARROW)    {    if(FIND_LFUN(p,LFUN_ARROW)!=-1 || FIND_LFUN(p,LFUN_ASSIGN_ARROW)!=-1)    return 1;    }else{    if(FIND_LFUN(p,LFUN_INDEX)!=-1 || FIND_LFUN(p,LFUN_ASSIGN_INDEX)!=-1)    return 1;    }    return !!low_match_types(string_type_string, index_type,0);    }else{