pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:1101:   void debug_push_type(unsigned int type)   {    /* fprintf(stderr, "push_type(%d)\n", type); */       switch(type & PIKE_T_MASK) {    case T_OR:    case T_AND:    /* Special case: Check if the two top elements are equal. */    if (Pike_compiler->type_stackp[-1] == Pike_compiler->type_stackp[0]) {    free_type(*(Pike_compiler->type_stackp--)); -  return; +  break;    }    if (!Pike_compiler->type_stackp[0]) {    Pike_compiler->type_stackp--;    if ((type & PIKE_T_MASK) == T_AND) {    free_type(Pike_compiler->type_stackp[0]);    Pike_compiler->type_stackp[0] = NULL;    } -  return; +  break;    }    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; +  break;    }    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; +  break;    }    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; +  break;    }    }    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);
pike.git/src/pike_types.cmod:1170:    (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;    } +  if ((Pike_compiler->type_stackp[0]->type == T_STRING) && +  (Pike_compiler->type_stackp[-1]->type == T_STRING)) { +  struct pike_type *t1 = low_pop_type(); +  struct pike_type *t2 = low_pop_type(); +  push_finished_type(t1->cdr); +  push_finished_type(t2->cdr); +  push_type(T_AND); +  push_finished_type(t1->car); +  push_finished_type(t2->car); +  push_type(T_AND); +  push_type(T_STRING); +  free_type(t1); +  free_type(t2); +  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;    }    }