pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:5024:    return NULL;    } else if (!tmp) {    return NULL;    }    }    type_stack_mark();    if (op == PT_BINOP_MINUS) {    if (tmp) {    push_finished_type(a->cdr);    push_finished_type(tmp); -  push_reverse_type(a->type); +  push_type(a->type);    free_type(tmp);    }    if (tmp2) {    push_finished_type(tmp2);    push_finished_type(a->car); -  push_reverse_type(a->type); +  push_type(a->type);    free_type(tmp2);    }    if (peek_stack_mark() == 2) push_type(T_OR);    } else {    /* PT_BINOP_AND */    push_finished_type(tmp);    push_finished_type(tmp2);    push_reverse_type(a->type);    free_type(tmp);    free_type(tmp2);
pike.git/src/pike_types.cmod:5055:    case T_PROGRAM:    case T_TYPE:    tmp = low_type_binop(op, a->car, b->car, remap,    aflags, bflags, remap_flags);    if (!tmp) return NULL;    type_stack_mark();    push_finished_type(tmp);    push_type(a->type);    return pop_unfinished_type();    -  /* FIXME: AND only from this point on. ======================= */ -  +     case T_OBJECT: -  +  switch(op) { +  case PT_BINOP_AND:    if (!a->cdr) {    add_ref(b);    return b;    }    if (!b->cdr) {    add_ref(a);    return a;    }    if (a->cdr == b->cdr) {    /* We know that they differ due to the a == b test at
pike.git/src/pike_types.cmod:5094:    struct program *bp = id_to_program(CDR_TO_INT(b));       if (!b->car && implements(ap, bp)) {    add_ref(a);    return a;    }    if (!a->car && implements(bp, ap)) {    add_ref(b);    return b;    } -  if ((a->car == b->car) && is_compatible(ap, bp)) { -  /* Both car must be 0 due to test above. -  * It is possible to implement a class that +  if ((a->car != b->car) || !is_compatible(ap, bp)) { +  /* It is not possible to implement a class that    * implements both of the classes.    */ -  type_stack_mark(); -  push_finished_type(a); -  push_finished_type(b); -  push_reverse_type(T_AND); -  return pop_unfinished_type(); +  return NULL;    } -  +  } +  case PT_BINOP_MINUS: +  if (!b->cdr) {    return NULL;    } -  +  if (a->cdr) { +  if (a->cdr == b->cdr) { +  return NULL;    } -  +  if (a->car && b->car) { +  /* This is only possible if a->cdr == b->cdr, but that is +  * handled above. +  */ +  add_ref(a); +  return a; +  } +  { +  struct program *ap = id_to_program(CDR_TO_INT(a)); +  struct program *bp = id_to_program(CDR_TO_INT(b));    -  +  if (!b->car && implements(ap, bp)) { +  return NULL; +  } +  if (!is_compatible(ap, bp)) { +  add_ref(a); +  return a; +  } +  } +  } +  break; +  default: +  break; +  } +  +  type_stack_mark(); +  push_finished_type(b); +  push_finished_type(a); +  push_binop(op); +  return pop_unfinished_type(); +  } +     /* Leaf type. */ -  +  if (op & PT_BINOP_AND) {    add_ref(a);    return a;    } -  +  return NULL; + }      /**    * Low-level subtraction (aka And-not) of two types.    *    * Note:    * There are two major operating modes; the external, where    * the two types have unrelated markers, which then need to    * be remapped in the result, and the internal, where the    * two types have related markers (this mode is used mainly    * when evaluating a type).
pike.git/src/pike_types.cmod:5756:    return NULL;    }    if (!is_compatible(ap, bp)) {    add_ref(a);    return a;    }    }    }       type_stack_mark(); -  push_finished_type(a); +     push_finished_type(b);    push_type(T_NOT); -  push_reverse_type(T_AND); +  push_finished_type(a); +  push_type(T_AND);    return pop_unfinished_type();    }       /* Leaf type. */    return NULL;   }      struct pike_type *subtract_types(struct pike_type *a,    struct pike_type *b,    enum pt_cmp_flags aflags,