Branch: Tag:

2022-04-07

2022-04-07 08:48:06 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved handling of markers and PT_BINOP_MINUS.

4739:    aflags, bflags, remap_flags);       marker = alloc_remap_marker(remap, CAR_TO_INT(a), remap_flags); +  /* Marker value */    store_marker(remap, marker, tmp);       if (op != PT_BINOP_AND) {
4755:    }    }    +  /* Value to backpatch. */    store_marker(remap, marker | 0x100, tmp);       if (!tmp) return NULL;
4775:       marker = alloc_remap_marker(remap, CAR_TO_INT(b),    remap_flags ^ PT_FLAG_REMAP_SWAP_MARKERS); +  /* Marker value */    store_marker(remap, marker, tmp);       if (op != PT_BINOP_AND) {
4791:    }    }    +  /* Value to backpatch. */    store_marker(remap, marker | 0x100, tmp);    -  if (!tmp) return NULL; -  +  /* NB: We can only keep the marker assignment in the PT_BINOP_AND +  * case. +  * +  * See also the b->type == '0'..'9' case further below. +  */ +  if ((op == PT_BINOP_AND) && tmp) {    type_stack_mark();    push_finished_type(tmp);    push_assign_type(marker);    free_type(tmp); -  return pop_unfinished_type(); +  tmp = pop_unfinished_type();    } -  +  +  return tmp;    } -  +  }       /* Attributes and names. */    switch(a?a->type:PIKE_T_UNKNOWN) {
5210:       /* FIXME: Do we need to invert for PT_BINOP_MINUS here? */    store_marker(remap, marker, tmp); -  if (op == PT_BINOP_AND) { +  +  /* NB: We can only keep the marker in the PT_BINOP_AND case, +  * as in the other cases we do not have the corresponding +  * assignment in the result. +  * +  * See also the b->type == T_ASSIGN case further above. +  */ +  if ((op == PT_BINOP_AND) && tmp) {    store_marker(remap, marker | 0x100, tmp); -  } +     -  if (!tmp) return NULL; +     free_type(tmp); -  +     type_stack_mark();    push_type(marker);    return pop_unfinished_type();    } -  +  +  return tmp;    } -  +  }       /* Handle a or b being NULL. */    /* NB: We know that a != b due to an earlier test. */