improvements for the , (comma) operator

This commit is contained in:
ceriel 1989-10-23 13:45:19 +00:00
parent 741b43044d
commit 788788edc0
2 changed files with 12 additions and 5 deletions

View file

@ -412,9 +412,16 @@ opnd2test(expp, oper)
register struct expr **expp; register struct expr **expp;
{ {
opnd2logical(expp, oper); opnd2logical(expp, oper);
if ((*expp)->ex_class == Oper && is_test_op((*expp)->OP_OPER)) if ((*expp)->ex_class == Oper) {
{ /* It is already a test */ } if (is_test_op((*expp)->OP_OPER)) {
else /* It is already a test */
return;
}
if ((*expp)->OP_OPER == ',') {
opnd2test(&((*expp)->OP_RIGHT), oper);
return;
}
}
ch7bin(expp, NOTEQUAL, intexpr((arith)0, INT)); ch7bin(expp, NOTEQUAL, intexpr((arith)0, INT));
} }

View file

@ -526,7 +526,7 @@ EVAL(expr, val, code, true_label, false_label)
break; break;
case ',': case ',':
EVAL(left, RVAL, FALSE, NO_LABEL, NO_LABEL); EVAL(left, RVAL, FALSE, NO_LABEL, NO_LABEL);
EVAL(right, RVAL, gencode, NO_LABEL, NO_LABEL); EVAL(right, RVAL, gencode, true_label, false_label);
break; break;
case '~': case '~':
EVAL(right, RVAL, gencode, NO_LABEL, NO_LABEL); EVAL(right, RVAL, gencode, NO_LABEL, NO_LABEL);