improvements for the , (comma) operator
This commit is contained in:
parent
741b43044d
commit
788788edc0
2 changed files with 12 additions and 5 deletions
|
@ -412,10 +412,17 @@ 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 */
|
||||||
ch7bin(expp, NOTEQUAL, intexpr((arith)0, INT));
|
return;
|
||||||
|
}
|
||||||
|
if ((*expp)->OP_OPER == ',') {
|
||||||
|
opnd2test(&((*expp)->OP_RIGHT), oper);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ch7bin(expp, NOTEQUAL, intexpr((arith)0, INT));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue