Branch: Tag:

2021-12-19

2021-12-19 13:25:12 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Handle marker propagation for T_OR.

4619:    switch(a?a->type:PIKE_T_UNKNOWN) {    case T_OR:    /* (a1 | a2) op b <==> (a1 op b) | (a2 op b) */ +  { +  struct mapping *orig_markers = NULL; +  if (remap) { +  /* Do not propagate marker changes between the branches +  * of the T_OR node. +  * +  * FIXME: It is theoretically possible to propagate marker +  * changes up if they are compatible in both branches. +  */ +  orig_markers = remap->markers; +  remap->markers = copy_mapping(orig_markers); +  }    tmp = low_type_binop(op, a->car, b, remap, aflags, bflags, remap_flags); -  +  if (remap) { +  do_free_mapping(remap->markers); +  remap->markers = copy_mapping(orig_markers); +  }    tmp2 = low_type_binop(op, a->cdr, b, remap, aflags, bflags, remap_flags); -  +  if (remap) { +  do_free_mapping(remap->markers); +  remap->markers = orig_markers; +  } +  }    if ((op & PT_BINOP_NOT_A) || (aflags & PT_FLAG_CMP_INSEPARABLE)) {    if (!tmp2) {    free_type(tmp);
4690:    }    switch(b?b->type:PIKE_T_UNKNOWN) {    case T_OR: +  /* FIXME: Handle marker propagation. */    if ((op == PT_BINOP_MINUS) || (op == PT_BINOP_OR)) {    /* Special case to avoid excessively complicated expressions    * in the result.