pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:2969:    init_string_builder(&s, 0);    SET_ONERROR(err, free_string_builder, &s);    low_describe_type(&s, type);    UNSET_ONERROR(err);    return finish_string_builder(&s);   }         /******/    - TYPE_T compile_type_to_runtime_type(struct pike_type *t) + static TYPE_T low_compile_type_to_runtime_type(struct pike_type *t)   { -  switch(t->type) /* Note: No masking here. */ +  switch(t?t->type:PIKE_T_UNKNOWN) /* Note: No masking here. */    {    case PIKE_T_RING: -  return compile_type_to_runtime_type(t->car); +  return low_compile_type_to_runtime_type(t->car);       case T_OR:    { -  TYPE_T tmp = compile_type_to_runtime_type(t->car); -  if(tmp == compile_type_to_runtime_type(t->cdr)) -  return tmp; +  TYPE_T car_t = low_compile_type_to_runtime_type(t->car); +  TYPE_T cdr_t = low_compile_type_to_runtime_type(t->cdr); +  if(car_t = cdr_t) +  return car_t; +  if (car_t == PIKE_T_VOID) { +  car_t = PIKE_T_ZERO;    } -  +  if (cdr_t == PIKE_T_VOID) { +  cdr_t = PIKE_T_ZERO; +  } +  if ((car_t == PIKE_T_ZERO) && (cdr_t != PIKE_T_FLOAT)) { +  return cdr_t; +  } +  if ((cdr_t == PIKE_T_ZERO) && (car_t != PIKE_T_FLOAT)) { +  return car_t; +  } +  }    /* FALLTHRU */       case T_TUPLE:    /* FIXME: Shouldn't occur/should be converted to array? */    /* FALLTHRU */    default:    return T_MIXED;    -  case T_ZERO: -  return T_INT; -  +     case T_SCOPE:    case PIKE_T_NAME:    case PIKE_T_ATTRIBUTE: -  return compile_type_to_runtime_type(t->cdr); +  return low_compile_type_to_runtime_type(t->cdr);       case T_MANY:    case PIKE_T_FIND_LFUN:    return T_FUNCTION;       case T_ARRAY:    case T_MAPPING:    case T_MULTISET:       case T_OBJECT:    case T_PROGRAM:    case T_FUNCTION:       case T_STRING:    case T_TYPE:    case T_INT:    case T_FLOAT: -  +  case T_ZERO: +  case T_VOID:    return t->type;    }   }    -  + TYPE_T compile_type_to_runtime_type(struct pike_type *t) + { +  TYPE_T ret = low_compile_type_to_runtime_type(t); +  +  if ((ret == PIKE_T_ZERO) || (ret == PIKE_T_VOID)) { +  return PIKE_T_INT; +  } +  return ret; + } +    /**    * Check whether a type is for a __deprecated__ value.    *    * @param t    * Type to check.    */   int deprecated_typep(struct pike_type *t)   {    struct pike_string *deprecated_string;    MAKE_CONST_STRING(deprecated_string, "deprecated");