Branch: Tag:

2021-01-05

2021-01-05 12:58:32 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved handling of OR in low_type_binop().

4508:    }    switch(b->type) {    case T_OR: +  /* op secondary +  * 0 0000 0 0000 +  * 1 0001 7 0111 +  * 2 0010 1 0001 +  * 3 0011 1, 3, 5, 7 0011 +  * 4 0100 7 0111 +  * 5 0101 7 0111 +  * 6 0110 - +  * 7 0111 7 0111 +  * 8 1000 1 0001 +  * 9 1001 - +  * 10 1010 1 0001 +  * 11 1011 1 0001 +  * 12 1100 1, 3, 5, 7 0011 +  * 13 1101 1 0111 +  * 14 1110 1 0001 +  * 15 1111 15 1111 +  */    tmp = low_type_binop(op, a, b->car, remap, aflags, bflags, remap_flags);    tmp2 = low_type_binop(op, a, b->cdr, remap, aflags, bflags, remap_flags); -  +  +  /* NB: XOR and XNOR not supported cf above. +  * This is not a problem in practice, as they +  * are handled earlier. +  */ +  if ("071377-71-113117"[op] == '1') { +  /* Secondary operator is AND. */ +  if (!tmp2) { +  free_type(tmp); +  return NULL; +  } +  if (!tmp) { +  free_type(tmp2); +  return NULL; +  } +  +  type_stack_mark(); +  push_finished_type(tmp); +  push_finished_type(tmp2); +  push_reverse_type(T_AND); +  } else { +  /* Secondary operator is OR. */    if (!tmp2) return tmp;    if (!tmp) return tmp2;   
4517:    push_finished_type(tmp);    push_finished_type(tmp2);    push_reverse_type(T_OR); +  }    free_type(tmp);    free_type(tmp2);    return pop_unfinished_type();