pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:1120:    }    if (!Pike_compiler->type_stackp[-1]) {    if ((type & PIKE_T_MASK) == T_AND) {    free_type(Pike_compiler->type_stackp[0]);    } else {    Pike_compiler->type_stackp[-1] = Pike_compiler->type_stackp[0];    }    Pike_compiler->type_stackp--;    return;    } +  if (type == T_AND) { +  if ((Pike_compiler->type_stackp[0] == any_type_string) || +  ((Pike_compiler->type_stackp[0] == mixed_type_string) && +  !(Pike_compiler->type_stackp[-1]->flags & PT_FLAG_VOIDABLE))) { +  free_type(low_pop_type()); +  return; +  } +  if ((Pike_compiler->type_stackp[-1] == any_type_string) || +  ((Pike_compiler->type_stackp[-1] == mixed_type_string) && +  !(Pike_compiler->type_stackp[0]->flags & PT_FLAG_VOIDABLE))) { +  struct pike_type *t = low_pop_type(); +  free_type(low_pop_type()); +  push_finished_type(t); +  free_type(t); +  return; +  } +  }    if (Pike_compiler->type_stackp[0]->type == type) {    /* The top type is the same as our type.    * Split it and join the parts with the other type.    */    struct pike_type *top = low_pop_type();    push_finished_type(top->cdr);    push_type(type);    push_finished_type(top->car);    push_type(type);    free_type(top); -  return; +  break;    }    if (type == T_OR) { -  +  /* check_trans_type(NULL, NULL, type); */    struct pike_type *t1 = low_pop_type(); -  +  /* check_trans_type(NULL, NULL, type); */    struct pike_type *t2 = low_pop_type();    low_or_pike_types(t1, t2, 0);    free_type(t2);    free_type(t1); -  return; +  break;    } -  +  if ((Pike_compiler->type_stackp[0] == int_type_string) && +  (Pike_compiler->type_stackp[-1]->type == T_INT)) { +  free_type(*(Pike_compiler->type_stackp--)); +  break; +  } +  if ((Pike_compiler->type_stackp[-1] == int_type_string) && +  (Pike_compiler->type_stackp[0]->type == T_INT)) { +  free_type(*(--Pike_compiler->type_stackp)); +  Pike_compiler->type_stackp[0] = Pike_compiler->type_stackp[1]; +  break; +  }    /* FALLTHRU */ -  +  case T_ARRAY: +  case T_STRING: +  if ((type == T_ARRAY) || (type == T_STRING)) { +  if (peek_type_stack() == zero_type_string) { +  /* Zero-length ==> unrestricted content. */ +  free_type(Pike_compiler->type_stackp[-1]); +  Pike_compiler->type_stackp[-1] = NULL; +  } +  } +  /* FALLTHRU */    case T_FUNCTION:    case T_MANY:    case T_TUPLE:    case T_MAPPING:    case PIKE_T_RING: -  case T_ARRAY: -  case T_STRING: +     case PIKE_T_TRANSITIVE:    /* Make a new type of the top two types. */    --Pike_compiler->type_stackp;    *Pike_compiler->type_stackp = mk_type(type,    *(Pike_compiler->type_stackp+1),    *Pike_compiler->type_stackp,    PT_COPY_BOTH);    break;       case T_PROGRAM: