aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/gc/select.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gc/select.c')
-rw-r--r--src/cmd/gc/select.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/cmd/gc/select.c b/src/cmd/gc/select.c
index 8395dda319..909ad3aa4b 100644
--- a/src/cmd/gc/select.c
+++ b/src/cmd/gc/select.c
@@ -250,9 +250,8 @@ walkselect(Node *sel)
case OSEND:
// if c != nil && selectnbsend(c, v) { body } else { default body }
ch = cheapexpr(n->left, &r->ninit);
- r->ntest = nod(OANDAND, nod(ONE, ch, nodnil()),
- mkcall1(chanfn("selectnbsend", 2, ch->type),
- types[TBOOL], &r->ninit, ch, n->right));
+ r->ntest = mkcall1(chanfn("selectnbsend", 2, ch->type),
+ types[TBOOL], &r->ninit, typename(ch->type), ch, n->right);
break;
case OSELRECV:
@@ -260,9 +259,8 @@ walkselect(Node *sel)
r = nod(OIF, N, N);
r->ninit = cas->ninit;
ch = cheapexpr(n->right->left, &r->ninit);
- r->ntest = nod(OANDAND, nod(ONE, ch, nodnil()),
- mkcall1(chanfn("selectnbrecv", 2, ch->type),
- types[TBOOL], &r->ninit, n->left, ch));
+ r->ntest = mkcall1(chanfn("selectnbrecv", 2, ch->type),
+ types[TBOOL], &r->ninit, typename(ch->type), n->left, ch);
break;
case OSELRECV2:
@@ -270,9 +268,8 @@ walkselect(Node *sel)
r = nod(OIF, N, N);
r->ninit = cas->ninit;
ch = cheapexpr(n->right->left, &r->ninit);
- r->ntest = nod(OANDAND, nod(ONE, ch, nodnil()),
- mkcall1(chanfn("selectnbrecv2", 2, ch->type),
- types[TBOOL], &r->ninit, n->left, n->ntest, ch));
+ r->ntest = mkcall1(chanfn("selectnbrecv2", 2, ch->type),
+ types[TBOOL], &r->ninit, typename(ch->type), n->left, n->ntest, ch);
break;
}
typecheck(&r->ntest, Erv);