pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:9443:   /*    * Check validity of soft-cast.    * Note: This uses a weaker check of function arguments, since    * people get confused otherwise.    */   int check_soft_cast(struct pike_type *to, struct pike_type *from)   {    return low_pike_types_le(to, from, 0, LE_WEAK_OBJECTS);   }    - /* -  * Return the return type from a function call. + /** +  * Return the return type from a function call (old API). +  * +  * @param a +  * The function type. +  * +  * @param b +  * The function type for the arguments. +  * +  * See also check_call().    */   static int low_get_return_type(struct pike_type *a, struct pike_type *b)   {    struct compilation *c = THIS_COMPILATION;    struct pike_type *t;    int tmp; -  +     CHECK_COMPILER(); -  +  + #if 0    switch(a->type & PIKE_T_MASK)    {    case T_OR:    {    struct pike_type *o1, *o2;    o1=o2=0;       type_stack_mark();    if(low_get_return_type(a->car, b))    {
pike.git/src/pike_types.cmod:9574:    return 1;       default:    push_type(T_MIXED);    free_type(t);    return 1;    }    free_type(t);    }    return 0; + #else +  if (!a) return 0; +  +  add_ref(a); +  +  while (a && b && +  ((b->type == T_FUNCTION) || +  ((b->type == T_MANY) && (b->car != void_type_string) && +  (a->type == T_FUNCTION)))) { +  struct pike_type *cont = low_new_check_call(a, b->car, 0, NULL); +  free_type(a); +  a = cont; +  if (b->type == T_FUNCTION) b = b->cdr;    }    -  +  if (!a) return 0;    -  +  b = new_get_return_type(a, 0); +  free_type(a); +  +  if (b) { +  push_finished_type(b); +  free_type(b); +  return 1; +  } +  return 0; + #endif + } +  +    int match_types(struct pike_type *a, struct pike_type *b)   {    struct pike_type *res;   #ifdef PIKE_EXTRA_DEBUG    struct remap_state remap;    struct pike_type *tmp, *tmp2;       INIT_REMAP_STATE(remap);       tmp = low_type_binop(PT_BINOP_AND, a, b, &remap, 0, 0, 0);
pike.git/src/pike_types.cmod:10577:      #if 0    fprintf(stderr,"minimum_arguments(");    simple_describe_type(s);    fprintf(stderr," ) -> %d\n",ret);   #endif       return ret;   }    + /** +  * Return the return type from a function call (old API). +  * +  * @param type +  * The function type. +  * +  * @param args +  * The function type for the arguments. +  * +  * See also low_get_return_type(). +  */   struct pike_type *check_call(struct pike_type *args,    struct pike_type *type,    int strict)   {    clear_markers();    type_stack_mark();    max_correct_args=0;       if(low_get_return_type(type, args))    {