gc: small fixes for printing.
mark OADDR inserted by typecheck as implicit
OCOPY takes ->left and ->right, not ->list
OMAKE*'s can all have arguments
precedence for OIND was initalized twice
fixes #2414
R=rsc, dave
CC=golang-dev
https://golang.org/cl/5319065
diff --git a/src/cmd/gc/fmt.c b/src/cmd/gc/fmt.c
index 12ea3028..9447e9b 100644
--- a/src/cmd/gc/fmt.c
+++ b/src/cmd/gc/fmt.c
@@ -921,7 +921,6 @@
[OINDEXMAP] = 8,
[OINDEX] = 8,
- [OIND] = 8,
[ODOTINTER] = 8,
[ODOTMETH] = 8,
[ODOTPTR] = 8,
@@ -1146,6 +1145,7 @@
exprfmt(f, n->left, nprec);
return fmtprint(f, "[%N]", n->right);
+ case OCOPY:
case OCOMPLEX:
return fmtprint(f, "%#O(%N, %N)", n->op, n->left, n->right);
@@ -1167,7 +1167,6 @@
case OCAP:
case OCLOSE:
case OLEN:
- case OCOPY:
case OMAKE:
case ONEW:
case OPANIC:
@@ -1188,13 +1187,11 @@
return fmtprint(f, "(%,H...)", n->list);
return fmtprint(f, "(%,H)", n->list);
- case OMAKESLICE:
- if(count(n->list) > 2)
- return fmtprint(f, "make(%T, %N, %N)", n->type, n->left, n->right); // count list, but print l/r?
- return fmtprint(f, "make(%T, %N)", n->type, n->left);
-
case OMAKEMAP:
case OMAKECHAN:
+ case OMAKESLICE:
+ if(n->list->next)
+ return fmtprint(f, "make(%T, %,H)", n->type, n->list->next);
return fmtprint(f, "make(%T)", n->type);
case OADD:
diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c
index 87a8d78..d2268e6 100644
--- a/src/cmd/gc/typecheck.c
+++ b/src/cmd/gc/typecheck.c
@@ -745,6 +745,7 @@
defaultlit(&n->right->right, T);
if(isfixedarray(n->left->type)) {
n->left = nod(OADDR, n->left, N);
+ n->left->implicit = 1;
typecheck(&n->left, top);
}
if(n->right->left != N) {