Commit fd76b4f3 authored by Russ Cox's avatar Russ Cox

new builtin.c.boot from arm.

node printing fixes.
silence incorrect redeclaration error.

R=ken
OCL=35602
CL=35602
parent 10c7d19e
...@@ -71,6 +71,8 @@ char *sysimport = ...@@ -71,6 +71,8 @@ char *sysimport =
"func sys.uint64div (? uint64, ? uint64) (? uint64)\n" "func sys.uint64div (? uint64, ? uint64) (? uint64)\n"
"func sys.int64mod (? int64, ? int64) (? int64)\n" "func sys.int64mod (? int64, ? int64) (? int64)\n"
"func sys.uint64mod (? uint64, ? uint64) (? uint64)\n" "func sys.uint64mod (? uint64, ? uint64) (? uint64)\n"
"func sys.float64toint64 (? float64) (? int64)\n"
"func sys.int64tofloat64 (? int64) (? float64)\n"
"\n" "\n"
"$$\n"; "$$\n";
char *unsafeimport = char *unsafeimport =
......
...@@ -188,7 +188,11 @@ import_stmt: ...@@ -188,7 +188,11 @@ import_stmt:
if(my->name[0] == '_' && my->name[1] == '\0') if(my->name[0] == '_' && my->name[1] == '\0')
break; 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; lineno = $1;
redeclare(my, "as imported package name"); redeclare(my, "as imported package name");
} }
......
...@@ -36,6 +36,35 @@ exprfmt(Fmt *f, Node *n, int prec) ...@@ -36,6 +36,35 @@ exprfmt(Fmt *f, Node *n, int prec)
case ONONAME: case ONONAME:
case OPACK: case OPACK:
case OLITERAL: 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; nprec = 7;
break; break;
...@@ -232,6 +261,7 @@ exprfmt(Fmt *f, Node *n, int prec) ...@@ -232,6 +261,7 @@ exprfmt(Fmt *f, Node *n, int prec)
case OINDEX: case OINDEX:
case OINDEXMAP: case OINDEXMAP:
case OINDEXSTR:
exprfmt(f, n->left, 7); exprfmt(f, n->left, 7);
fmtprint(f, "["); fmtprint(f, "[");
exprfmt(f, n->right, 0); exprfmt(f, n->right, 0);
...@@ -261,6 +291,11 @@ exprfmt(Fmt *f, Node *n, int prec) ...@@ -261,6 +291,11 @@ exprfmt(Fmt *f, Node *n, int prec)
case OCONVNOP: case OCONVNOP:
case OCONVSLICE: case OCONVSLICE:
case OCONVIFACE: case OCONVIFACE:
case OARRAYBYTESTR:
case ORUNESTR:
if(n->type->sym == S)
fmtprint(f, "(%T)(", n->type);
else
fmtprint(f, "%T(", n->type); fmtprint(f, "%T(", n->type);
exprfmt(f, n->left, 0); exprfmt(f, n->left, 0);
fmtprint(f, ")"); fmtprint(f, ")");
...@@ -283,6 +318,16 @@ exprfmt(Fmt *f, Node *n, int prec) ...@@ -283,6 +318,16 @@ exprfmt(Fmt *f, Node *n, int prec)
exprlistfmt(f, n->list); exprlistfmt(f, n->list);
fmtprint(f, ")"); fmtprint(f, ")");
break; 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) if(prec > nprec)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment