pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:11700:    break;       case T_NOT:    if (arg_type && (arg_type->type == T_NOT)) {    /* Both sides are inverted. Pop both inversions. */    arg_type = arg_type->car;    fun_type = fun_type->car;    flags ^= CALL_INVERTED_TYPES;    goto loop;    } else { -  /* Move the inversion to the argument type. */ -  type_stack_mark(); -  push_finished_type(arg_type); -  push_type(T_NOT); -  arg_type = pop_unfinished_type(); +     res = lower_new_check_call(fun_type->car, arg_type,    flags ^ CALL_INVERTED_TYPES,    sval CHECK_CALL_ARGS); -  free_type(arg_type); +     if (res) { -  +  /* The argument matched the function type. */    /* Move the inversion back to the function type. */ -  if (res->type == T_NOT) { -  tmp = res->car; -  free_type(res); -  res = tmp; -  } else { +     type_stack_mark(); -  if ((res->type == T_MANY) && -  (fun_type->car->type == T_MANY) && -  res->car && (res->car->type == T_NOT)) { -  /* Exist criteria is fulfilled. -  * Reduce !function(!type...:type) to function(mixed...:type). -  * FIXME: Probably ought to move the inner inversion -  * to the result type, but that is incompatible -  * with current types. -  * FIXME: What about the limited number of args case? -  */ -  push_finished_type(mixed_type_string); -  free_type(res); -  } else { -  /* More arguments to check. */ +     push_finished_type(res);    free_type(res);    push_type(T_NOT); -  } +     res = pop_unfinished_type(); -  +  } else { +  /* The argument did not match the function type. +  * ie the inverted type got a full match. +  */ +  add_ref(any_type_string); +  res = any_type_string;    } -  } else if (!fun_type->car || -  ((fun_type->car->type != T_FUNCTION) && -  (fun_type->car->type != T_MANY)) || -  ((flags & CALL_NOT_LAST_ARG) && -  (fun_type->car->type == T_MANY))) { -  /* The next argument might match. */ -  add_ref(fun_type); -  res = fun_type; +     } -  } +     break;       case PIKE_T_TYPE:    /* FIXME: Check that the cast is valid. */    type_stack_mark();    push_finished_type(fun_type->car);    push_type(T_VOID);    push_type(T_MANY);    res = pop_unfinished_type();    break;
pike.git/src/pike_types.cmod:11926:       /* No need to perform advanced checking in the trivial case... */    if (arg_type != (tmp2 = fun_type->car)) {    if (!tmp2) {    if (flags & CALL_STRICT) goto no_match;    } else if (tmp2 == void_type_string) {    /* No more arguments accepted. */    goto no_match;    } else {    struct pike_type *bin_t = -  low_type_binop((flags & CALL_INVERTED_TYPES)? -  PT_BINOP_INVERSE_MINUS: -  PT_BINOP_MINUS, +  low_type_binop(PT_BINOP_MINUS,    arg_type, tmp2, &remap,    PT_FLAG_CMP_VOID_IS_ZERO,    PT_FLAG_CMP_VOID_IS_ZERO,    remap_flags|PT_FLAG_REMAP_EVAL_MARKERS);       if (bin_t) {    /* Partial or strict mismatch. */    free_type(bin_t);       if (flags & (CALL_INVERTED_TYPES|CALL_STRICT)) {
pike.git/src/pike_types.cmod:12347:    free_type(tmp);    free_type(tmp2);    break;    case T_NOT:    if (!(res = new_get_return_type(fun_type->car, flags))) {    copy_pike_type(res, mixed_type_string);    } else if (res->type == T_NOT) {    tmp = res;    copy_pike_type(res, tmp->car);    free_type(tmp); +  } else if ((res == mixed_type_string) || (res == any_type_string)) { +  free_type(res); +  return NULL;    } else {    type_stack_mark();    push_finished_type(res);    push_type(T_NOT);    free_type(res);    res = pop_unfinished_type();    }    break;    case PIKE_T_TYPE:    /* Casting requires an argument... */
pike.git/src/pike_types.cmod:12460:   #ifdef PIKE_DEBUG    if (l_flag>2) {    fprintf(stderr, "Failed.\n");    }   #endif /* PIKE_DEBUG */    return NULL;    }      #ifdef PIKE_DEBUG    if (l_flag>2) { -  fprintf(stderr, "Ok, cleaning up markers... "); +  fprintf(stderr, " Got return type "); +  simple_describe_type(res); +  fprintf(stderr, "\n Cleaning up markers...\n");    }   #endif /* PIKE_DEBUG */       type_stack_mark();       /* Get rid of any remaining markers. */    clear_markers();    push_finished_type_with_markers(res, a_markers, 0);       free_type(res);