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,10 +412,17 @@ opnd2test(expp, oper)
register struct expr **expp;
{
opnd2logical(expp, oper);
if ((*expp)->ex_class == Oper && is_test_op((*expp)->OP_OPER))
{ /* It is already a test */ }
else
ch7bin(expp, NOTEQUAL, intexpr((arith)0, INT));
if ((*expp)->ex_class == Oper) {
if (is_test_op((*expp)->OP_OPER)) {
/* It is already a test */
return;
}
if ((*expp)->OP_OPER == ',') {
opnd2test(&((*expp)->OP_RIGHT), oper);
return;
}
}
ch7bin(expp, NOTEQUAL, intexpr((arith)0, INT));
}
int

View file

@ -526,7 +526,7 @@ EVAL(expr, val, code, true_label, false_label)
break;
case ',':
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;
case '~':
EVAL(right, RVAL, gencode, NO_LABEL, NO_LABEL);