pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:5521:    struct pike_type *a;       if(low_pike_types_le(string0_type_string, index_type, 0, 0) &&    (a = low_index_type(t->cdr, string0_type_string, n))) {    /* Possible to index the array with a string. */    type_stack_mark();    push_finished_type(a);    free_type(a);    push_unlimited_array_type(T_ARRAY);    -  if (low_match_types(int_type_string, index_type, 0)) { +  if (match_types(int_type_string, index_type)) {    /* Also possible to index the array with an int. */    push_finished_type(t->cdr);    push_type(T_OR);    }    return pop_unfinished_type();    } -  if (low_match_types(int_type_string, index_type, 0)) { +  if (match_types(int_type_string, index_type)) {    /* Possible to index the array with an int. */    add_ref(t->cdr);    return t->cdr;    }    /* Bad index type. */    return 0;    }    }   }   
pike.git/src/pike_types.cmod:5702:    case T_MULTISET:    case T_MAPPING:    /* Illegal range operation. */    /* FIXME: Strict type warning. */    return 0;       case T_ARRAY: /* FIXME: cdr */    case T_STRING:    /* Check that the index types are compatible with int. */    { -  if (index1_type && !low_match_types(int_type_string, index1_type, 0)) { +  if (index1_type && !match_types(int_type_string, index1_type)) {    ref_push_type_value(t);    yytype_report(REPORT_WARNING, NULL, 0, int_type_string,    NULL, 0, index1_type,    1, "Bad argument 1 to range operator on %O.");    /* Bad index1 type. */    return 0;    } -  if (index2_type && !low_match_types(int_type_string, index2_type, 0)) { +  if (index2_type && !match_types(int_type_string, index2_type)) {    ref_push_type_value(t);    yytype_report(REPORT_WARNING, NULL, 0, int_type_string,    NULL, 0, index2_type,    1, "Bad argument 2 to range operator on %O.");    /* Bad index2 type. */    return 0;    }    }    /* FALLTHROUGH */    default:
pike.git/src/pike_types.cmod:5959:    return 1;    }    return 0;       case PIKE_T_NAME:    case T_ASSIGN:    case T_SCOPE:    return low_check_indexing(type->cdr, index_type, n);       case T_ARRAY: -  if(low_match_types(string_type_string, index_type, 0) && +  if(match_types(string_type_string, index_type) &&    low_check_indexing(type->cdr, index_type, n))    return 1;    /* FALLTHRU */    case T_STRING: -  return !!low_match_types(int_type_string, index_type, 0); +  return match_types(int_type_string, index_type);       case T_OBJECT:    {    struct program *p = id_to_program(CDR_TO_INT(type));    if(p)    {    int i = -1;    /* Check against the LFUN types. */    if(n && (n->token == F_ARROW))    {
pike.git/src/pike_types.cmod:5989:    (i = FIND_LFUN(p,LFUN_ASSIGN_INDEX));    }    if (i != -1) {    if ((type = low_new_check_call(ID_FROM_INT(p, i)->type, index_type,    CALL_NOT_LAST_ARG, NULL))) {    free_type(type);    return 1;    }    return 0;    } -  return !!low_match_types(string_type_string, index_type,0); +  return match_types(string_type_string, index_type);    }else{    return 1;    }    }       case T_MULTISET:    case T_MAPPING:    /* 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; +  return match_types(type->car, index_type) ? 1 : -1;       case T_FUNCTION:    while ((type = type->cdr) && (type->type == T_FUNCTION))    ;    if (!type) return 0;       if (type->type != T_MANY) return 0;       /* FALLTHRU */       case T_MANY:    type = type->cdr;    if (!type || (type->type != T_OBJECT) || !type->car)    return 0;    /* function(... : object(is foo)) -- ie probably program(foo). */       /* FALLTHRU */       case T_INT:    case T_PROGRAM: -  return !!low_match_types(string_type_string, index_type, 0); +  return match_types(string_type_string, index_type);       case T_MIXED:    return 1;       default:    return 0;    }   }      int check_indexing(struct pike_type *type,
pike.git/src/pike_types.cmod:8226:    */       /* FALLTHRU */    case PIKE_T_MIXED:    copy_pike_type(res, mixed_type_string);    break;       case PIKE_T_FUNCTION:    if (!(flags & CALL_NOT_LAST_ARG) &&    (fun_type->cdr->type == PIKE_T_FUNCTION) && -  !low_match_types(fun_type->cdr->car, void_type_string, 0)) { +  !match_types(fun_type->cdr->car, void_type_string)) {    /* Last argument and more arguments required. */    res = NULL;    break;    }    /* FALLTHRU */    case T_MANY:    if ((res = fun_type->car)->type == T_VOID) {    res = NULL;    break;    }