delete some code from walkexpr that is now
handled by typecheck.
second switch is gone
move floating point minus into back end
R=ken
OCL=32558
CL=32558
diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c
index cf250f2..eeadbf2 100644
--- a/src/cmd/gc/typecheck.c
+++ b/src/cmd/gc/typecheck.c
@@ -28,7 +28,7 @@
Node*
typecheck(Node **np, int top)
{
- int et, et1, et2, op, nerr, len;
+ int et, op, nerr, len;
NodeList *ll;
Node *n, *l, *r;
NodeList *args;
@@ -256,6 +256,7 @@
et = TINT;
if(t->etype != TIDEAL && !eqtype(l->type, r->type)) {
badbinary:
+ defaultlit2(&l, &r, 1);
yyerror("invalid operation: %#N (type %T %#O %T)", n, l->type, op, r->type);
goto error;
}
@@ -270,8 +271,15 @@
if(isslice(l->type) && !isnil(l) && !isnil(r))
goto badbinary;
t = l->type;
- if(iscmp[n->op])
+ if(iscmp[n->op]) {
t = types[TBOOL];
+ evconst(n);
+ if(n->op != OLITERAL) {
+ defaultlit2(&l, &r, 1);
+ n->left = l;
+ n->right = r;
+ }
+ }
n->type = t;
goto ret;
@@ -637,6 +645,8 @@
yyerror("invalid operation: %#N (non-chan type %T)", n, t);
goto error;
}
+ if(n->op == OCLOSED)
+ n->type = types[TBOOL];
goto ret;
case OCONV:
@@ -1023,7 +1033,6 @@
// no-op conversion
if(cvttype(t, n->type) == 1) {
- nop:
if(n->op == OLITERAL) {
// can convert literal in place
n1 = nod(OXXX, N, N);