pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:8153:   #else    /* FIXME */    add_ref(a);    return a;   #endif    }    }       /* 'mixed' matches anything */    -  if((a->type == T_ZERO || a->type == T_MIXED) && -  !(flags & (A_EXACT|B_EXACT)) && +  if(((a->type == T_MIXED) || +  ((a->type == T_ZERO) && !(flags & (A_EXACT|B_EXACT)))) &&    (b->type != T_VOID))    { - #if 1 +     ret = NULL;    switch(b->type)    {    /* These types can contain sub-types */    case T_ARRAY:    ret = low_match_types(array_type_string, b, flags);    break;    case T_MAPPING:    ret = low_match_types(mapping_type_string, b, flags);    break;    case T_FUNCTION:    case T_MANY:    ret = low_match_types(function_type_string, b, flags);    break;    case T_MULTISET:    ret = low_match_types(multiset_type_string, b, flags);    break;    } -  + #if 0 +  if (a->type == T_ZERO) {    if (ret) free_type(ret); -  +  ret = a; +  add_ref(ret); +  } else if (!ret) { +  ret = b; +  add_ref(ret); +  } + #else +  if (ret) free_type(ret); +  ret = a; +  add_ref(ret);   #endif -  add_ref(a); -  return a; +  return ret;    }    -  if((b->type == T_ZERO || b->type == T_MIXED) && -  !(flags & (A_EXACT|B_EXACT)) && +  if(((b->type == T_MIXED) || +  ((b->type == T_ZERO) && !(flags & (A_EXACT|B_EXACT)))) &&    (a->type != T_VOID))    { - #if 1 +     ret = NULL;    switch(a->type)    {    /* These types can contain sub-types */    case T_ARRAY:    ret = low_match_types(a, array_type_string, flags);    break;    case T_MAPPING:    ret = low_match_types(a, mapping_type_string, flags);    break;    case T_FUNCTION:    case T_MANY:    ret = low_match_types(a, function_type_string, flags);    break;    case T_MULTISET:    ret = low_match_types(a, multiset_type_string, flags);    break;    } -  + #if 0 +  if (b->type == T_ZERO) {    if (ret) free_type(ret); -  +  ret = b; +  add_ref(ret); +  } else if (!ret) { +  ret = a; +  add_ref(ret); +  } + #else +  if (ret) free_type(ret); +  ret = a; +  add_ref(ret);   #endif -  add_ref(a); -  return a; +  return ret;    }       /* Special cases (tm) */    switch(TWOT(a->type, b->type))    {    case TWOT(T_PROGRAM, T_FUNCTION):    case TWOT(T_FUNCTION, T_PROGRAM):    case TWOT(T_PROGRAM, T_MANY):    case TWOT(T_MANY, T_PROGRAM):    /* FIXME: Should look at the sub-type of the program