node printing fixes.
silence incorrect redeclaration error.
R=ken
OCL=35602
CL=35602
"func sys.uint64div (? uint64, ? uint64) (? uint64)\n"
"func sys.int64mod (? int64, ? int64) (? int64)\n"
"func sys.uint64mod (? uint64, ? uint64) (? uint64)\n"
+ "func sys.float64toint64 (? float64) (? int64)\n"
+ "func sys.int64tofloat64 (? int64) (? float64)\n"
"\n"
"$$\n";
char *unsafeimport =
if(my->name[0] == '_' && my->name[1] == '\0')
break;
- if(my->def) {
+ // Can end up with my->def->op set to ONONAME
+ // if one package refers to p without importing it.
+ // Don't want to give an error on a good import
+ // in another file.
+ if(my->def && my->def->op != ONONAME) {
lineno = $1;
redeclare(my, "as imported package name");
}
case ONONAME:
case OPACK:
case OLITERAL:
+ case ODOT:
+ case ODOTPTR:
+ case ODOTINTER:
+ case ODOTMETH:
+ case OARRAYBYTESTR:
+ case OCAP:
+ case OCLOSE:
+ case OCLOSED:
+ case OLEN:
+ case OMAKE:
+ case ONEW:
+ case OPANIC:
+ case OPANICN:
+ case OPRINT:
+ case OPRINTN:
+ case OCALL:
+ case OCONV:
+ case OCONVNOP:
+ case OCONVSLICE:
+ case OCONVIFACE:
+ case OMAKESLICE:
+ case ORUNESTR:
+ case OADDR:
+ case OCOM:
+ case OIND:
+ case OMINUS:
+ case ONOT:
+ case OPLUS:
+ case ORECV:
nprec = 7;
break;
case OINDEX:
case OINDEXMAP:
+ case OINDEXSTR:
exprfmt(f, n->left, 7);
fmtprint(f, "[");
exprfmt(f, n->right, 0);
case OCONVNOP:
case OCONVSLICE:
case OCONVIFACE:
- fmtprint(f, "%T(", n->type);
+ case OARRAYBYTESTR:
+ case ORUNESTR:
+ if(n->type->sym == S)
+ fmtprint(f, "(%T)(", n->type);
+ else
+ fmtprint(f, "%T(", n->type);
exprfmt(f, n->left, 0);
fmtprint(f, ")");
break;
exprlistfmt(f, n->list);
fmtprint(f, ")");
break;
+
+ case OMAKESLICE:
+ fmtprint(f, "make(%#T, ", n->type);
+ exprfmt(f, n->left, 0);
+ if(count(n->list) > 2) {
+ fmtprint(f, ", ");
+ exprfmt(f, n->right, 0);
+ }
+ fmtprint(f, ")");
+ break;
}
if(prec > nprec)