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.344 2008/06/29 10:51:47 mast Exp $ + || $Id: pike_types.c,v 1.345 2008/06/29 11:04:52 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:4647:    comefrom_int_index:    if(p && n)    {    INT32 i;    if(n->token == F_ARROW)    {    if((i=FIND_LFUN(p,LFUN_ARROW))!=-1)    {    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)) { +  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)    {    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)) { +  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;    }    }
pike.git/src/pike_types.c:5142:    struct pike_type *t;    clear_markers();    t = low_key_type(type,n);    if(!t) {    copy_pike_type(t, mixed_type_string);    }    return t;   }       -  + /* Returns whether a value of type 'type' may be indexed with a value +  * of type 'index_type'. Returns -1 if the indexing operation is valid, +  * but will always fail. +  * The node 'n' is the node with the indexing operator. +  */   static int low_check_indexing(struct pike_type *type,    struct pike_type *index_type,    node *n)   {    switch(type->type)    {    case T_OR:    return low_check_indexing(type->car, index_type, n) ||    low_check_indexing(type->cdr, index_type, n);   
pike.git/src/pike_types.c:5194:    return 1;    }    return !!low_match_types(string_type_string, index_type,0);    }else{    return 1;    }    }       case T_MULTISET:    case T_MAPPING: -  /* FIXME: Why -1 and not 0? */ +  /* FIXME: Why -1 and not 0? +  * +  * There were complaints when people got compilation errors +  * for indexing operations that would always fail. +  */    return low_match_types(type->car, index_type, 0) ? 1 : -1;      #ifdef AUTO_BIGNUM    case T_INT:   #endif    case T_PROGRAM:    return !!low_match_types(string_type_string, index_type, 0);       case T_MIXED:    return 1;