pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:4458:    case T_NOT:    /* Swap the bits of the opcode pairwise.    *    * This converts B to ~B and vice versa.    */    op = (((op & PT_BINOP_B) << 1) | ((op >> 1) & PT_BINOP_B)) & PT_BINOP_ALL;    return low_type_binop(op, a, b->car,    remap, aflags, bflags, remap_flags);    }    -  /* NB: Complex types from this point onwards are containers, -  * and the voidable property does not propagate into them. -  */ -  avoidable = aflags & PT_FLAG_CMP_VOIDABLE; -  aflags &= ~PT_FLAG_CMP_VOIDABLE; -  bvoidable = bflags & PT_FLAG_CMP_VOIDABLE; -  bflags &= ~PT_FLAG_CMP_VOIDABLE; -  +     /* Check implicit casting. */    loop:    switch(TWOT(a->type & PIKE_T_MASK, b->type & PIKE_T_MASK)) {    case TWOT(T_PROGRAM, T_FUNCTION):    case TWOT(T_PROGRAM, T_MANY):    aret = a->car;    a = low_object_lfun_type(aret, LFUN_CREATE);    if (!a) {    a = void_function_type_string;    }
pike.git/src/pike_types.cmod:4566:    enum pt_cmp_flags avoidable = 0;    enum pt_cmp_flags bvoidable = 0;       /* Check the argument. */       /* NB: The MANY argument is always voidable. */    if (ai->type == T_MANY) avoidable |= PT_FLAG_CMP_VOIDABLE;    if (bi->type == T_MANY) bvoidable |= PT_FLAG_CMP_VOIDABLE;       tmp = low_type_binop(op, ai->car, bi->car, remap, -  aflags | avoidable, -  bflags | bvoidable, +  avoidable, +  bvoidable,    remap_flags);       if (remap_flags & PT_FLAG_REMAP_TRACE) {    fprintf(stderr, "got_empty: %d, got_full: %d\n"    "tmp: ",    got_empty, got_full);    simple_describe_type(tmp);    fprintf(stderr, "\n");    }   
pike.git/src/pike_types.cmod:4602:    free_type(tmp);    }       if (avoidable && bvoidable) {    /* Time to check the return types. */       if (!aret) aret = ai->cdr;    if (!bret) bret = bi->cdr;       tmp = low_type_binop(op, aret, bret, remap, -  aflags | PT_FLAG_CMP_VOIDABLE, -  bflags | PT_FLAG_CMP_VOIDABLE, remap_flags); +  0, 0, remap_flags);       if (remap_flags & PT_FLAG_REMAP_TRACE) {    fprintf(stderr, "ret_tmp: ");    simple_describe_type(tmp);    fprintf(stderr, "\n");    }    if (!tmp) goto function_fail;       nargs = pop_stack_mark();   
pike.git/src/pike_types.cmod:4649:    }       if (avoidable && bvoidable) {    /* Time to check the return types. */       if (!aret) aret = ai->cdr;    if (!bret) bret = bi->cdr;       /* NB: Ignore the return type if matching against void. */    tmp = low_type_binop(op, aret, bret, NULL, -  aflags | PT_FLAG_CMP_VOIDABLE, -  bflags | PT_FLAG_CMP_VOIDABLE, remap_flags); +  PT_FLAG_CMP_VOIDABLE, +  0, remap_flags);       if (remap_flags & PT_FLAG_REMAP_TRACE) {    fprintf(stderr, "got_empty: %d, got_full: %d\n"    "ret tmp: ",    got_empty, got_full);    simple_describe_type(tmp);    fprintf(stderr, "\n");    }       if (!tmp) {
pike.git/src/pike_types.cmod:4774:    case TWOT(T_INT, T_ZERO):    b = int0_type_string;    break;       /* T_TYPE and T_PROGRAM are essentially the same thing. */    case TWOT(T_TYPE, T_TYPE):    case TWOT(T_TYPE, T_PROGRAM):    case TWOT(T_PROGRAM, T_TYPE):    case TWOT(T_PROGRAM, T_PROGRAM):    tmp = low_type_binop(op, a->car, b->car, remap, -  aflags, bflags, remap_flags); +  0, 0, remap_flags);    if (!tmp) return NULL;       type_stack_mark();    push_finished_type(tmp);    if (a->type == b->type) {    push_type(a->type);    } else {    push_type(T_TYPE);    }    free_type(tmp);
pike.git/src/pike_types.cmod:4861:    type_stack_mark();    push_type(marker);    push_finished_type(tmp);    push_binop(op);    free_type(tmp);    return pop_unfinished_type();    }    }       if (a->type != b->type) { -  if ((a->type == T_VOID) && bvoidable) { +  if ((a->type == T_VOID) && (bflags & PT_FLAG_CMP_VOIDABLE)) {    b = a;    goto recur;    } -  if ((b->type == T_VOID) && avoidable) { +  if ((b->type == T_VOID) && (aflags & PT_FLAG_CMP_VOIDABLE)) {    a = b;    goto recur;    }       if (b->type == T_MIXED) {    /* NB: a being void has been handled above. */    if (op == PT_BINOP_MINUS) return NULL;    return remap_markers(a, NULL, remap, remap_flags);    }    if (a->type == T_MIXED) {
pike.git/src/pike_types.cmod:5107:    for (i = 1; i < nbounds; i++) {    push_type(T_OR);    }    return pop_unfinished_type();    }       case T_ARRAY:    case T_MAPPING:    case T_STRING:    tmp = low_type_binop(op, a->car, b->car, remap, -  aflags, bflags, remap_flags); +  0, 0, remap_flags);    if (!tmp && (op == PT_BINOP_AND)) return NULL;    tmp2 = low_type_binop(op, a->cdr, b->cdr, remap, -  aflags, bflags, remap_flags); +  0, 0, remap_flags);    if (!tmp2) {    if (op == PT_BINOP_AND) {    free_type(tmp);    return NULL;    } else if (!tmp) {    return NULL;    }    }    type_stack_mark();    if (op == PT_BINOP_MINUS) {
pike.git/src/pike_types.cmod:5148:    push_reverse_type(a->type);    free_type(tmp);    free_type(tmp2);    }    return pop_unfinished_type();       case T_MULTISET:    case T_PROGRAM:    case T_TYPE:    tmp = low_type_binop(op, a->car, b->car, remap, -  aflags, bflags, remap_flags); +  0, 0, remap_flags);    if (!tmp) return NULL;    type_stack_mark();    push_finished_type(tmp);    push_type(a->type);    free_type(tmp);    return pop_unfinished_type();       case T_OBJECT:    switch(op) {    case PT_BINOP_AND: