pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:4588:    aflags, bflags | PT_FLAG_CMP_INSEPARABLE,    remap_flags);    if (!tmp) return NULL;    type_stack_mark();    push_finished_type(tmp);    push_scope_type(CAR_TO_INT(b));    free_type(tmp);    return pop_unfinished_type();    }    -  if (remap_flags & PT_FLAG_REMAP_TRACE) { -  fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); -  } -  +     /* Check consolidated types. */    switch(a?a->type:PIKE_T_UNKNOWN) {    case T_OR:    /* (a1 | a2) op b <==> (a1 op b) | (a2 op b) */    tmp = low_type_binop(op, a->car, b, remap, aflags, bflags, remap_flags);    tmp2 = low_type_binop(op, a->cdr, b, remap, aflags, bflags, remap_flags);    if ((op & PT_BINOP_NOT_A) || (aflags & PT_FLAG_CMP_INSEPARABLE)) {    if (!tmp2) {    free_type(tmp);    return NULL;
pike.git/src/pike_types.cmod:4768:    /* 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: At this point a and b are either NULL or a basic type. +  * NB: At this point a and b are either NULL, a basic type or a marker.    */    -  +  loop: +  switch(a ? a->type : PIKE_T_UNKNOWN) { +  case '0': case '1': case '2': case '3': case '4': +  case '5': case '6': case '7': case '8': case '9': +  { +  int marker = remap_marker(remap, a->type, remap_flags); +  if (!marker) { +  a = NULL; +  break; +  } +  +  tmp = remap_markers(b, NULL, remap, +  remap_flags ^ PT_FLAG_REMAP_SWAP_MARKERS); +  if (!tmp) { +  b = NULL; +  break; +  } +  type_stack_mark(); +  push_finished_type(tmp); +  push_type(marker); +  push_binop(op); +  free_type(tmp); +  return pop_unfinished_type(); +  } +  } +  switch(b ? b->type : PIKE_T_UNKNOWN) { +  case '0': case '1': case '2': case '3': case '4': +  case '5': case '6': case '7': case '8': case '9': +  { +  int marker = remap_marker(remap, b->type, +  remap_flags ^ PT_FLAG_REMAP_SWAP_MARKERS); +  if (!marker) { +  b = NULL; +  break; +  } +  +  tmp = remap_markers(a, NULL, remap, remap_flags); +  if (!tmp) { +  a = NULL; +  break; +  } +  type_stack_mark(); +  push_type(marker); +  push_finished_type(tmp); +  push_binop(op); +  free_type(tmp); +  return pop_unfinished_type(); +  } +  } +     /* Handle a or b being NULL. */    /* NB: We know that a != b due to an earlier test. */    if (!a) {    if (op & PT_BINOP_INVERSE_MINUS) {    if (!((b == void_type_string) && (aflags & PT_FLAG_CMP_VOIDABLE)) &&    !((b == zero_type_string) && (aflags & PT_FLAG_CMP_NULLABLE))) {    add_ref(b);    return b;    }    }
pike.git/src/pike_types.cmod:4794:    if (op & PT_BINOP_MINUS) {    if (!((a == void_type_string) && (bflags & PT_FLAG_CMP_VOIDABLE)) &&    !((a == zero_type_string) && (bflags & PT_FLAG_CMP_NULLABLE))) {    add_ref(a);    return a;    }    }    return NULL;    }    +  /* +  * NB: At this point a and b are basic types. +  */ +     /* Check implicit casting. */ -  loop: +     switch(TWOT(a->type & PIKE_T_MASK, b->type & PIKE_T_MASK)) {    case TWOT(T_PROGRAM, T_TYPE):    case TWOT(T_PROGRAM, T_PROGRAM):    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:5235:    ret = low_type_binop(op, a, tmp, remap, aflags, bflags, remap_flags);    free_type(tmp);    return ret;      #if 0    /* FIXME: */    case PIKE_T_RING:   #endif    }    -  switch(a->type) { -  case '0': case '1': case '2': case '3': case '4': -  case '5': case '6': case '7': case '8': case '9': -  { -  int marker = remap_marker(remap, a->type, remap_flags); -  if (!marker) return NULL; -  -  tmp = remap_markers(b, NULL, remap, -  remap_flags ^ PT_FLAG_REMAP_SWAP_MARKERS); -  if (!tmp) return NULL; -  type_stack_mark(); -  push_finished_type(tmp); -  push_type(marker); -  push_binop(op); -  free_type(tmp); -  return pop_unfinished_type(); -  } -  } -  switch(b->type) { -  case '0': case '1': case '2': case '3': case '4': -  case '5': case '6': case '7': case '8': case '9': -  { -  int marker = remap_marker(remap, b->type, -  remap_flags ^ PT_FLAG_REMAP_SWAP_MARKERS); -  if (!marker) return NULL; -  -  tmp = remap_markers(a, NULL, remap, remap_flags); -  if (!tmp) return NULL; -  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) {    if (bflags & PT_FLAG_CMP_VOIDABLE) {    b = a;    goto recur;    }    if (aflags & (PT_FLAG_CMP_NULLABLE | PT_FLAG_CMP_VOID_IS_ZERO)) {    a = zero_type_string;    goto recur;    }