mirror of
https://github.com/golang/go
synced 2024-11-20 02:54:39 -07:00
gc: fix newlines in %+N
fixes #2442 R=rsc CC=golang-dev https://golang.org/cl/5370066
This commit is contained in:
parent
45eef04ed4
commit
40afe58692
@ -1269,6 +1269,8 @@ indent(Fmt *fp)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if(dumpdepth > 1)
|
||||||
|
fmtstrcpy(fp, "\n");
|
||||||
for(i = 0; i < dumpdepth; ++i)
|
for(i = 0; i < dumpdepth; ++i)
|
||||||
fmtstrcpy(fp, ". ");
|
fmtstrcpy(fp, ". ");
|
||||||
}
|
}
|
||||||
@ -1286,10 +1288,10 @@ nodedump(Fmt *fp, Node *n)
|
|||||||
if(recur) {
|
if(recur) {
|
||||||
indent(fp);
|
indent(fp);
|
||||||
if(dumpdepth > 10)
|
if(dumpdepth > 10)
|
||||||
return fmtstrcpy(fp, "...\n");
|
return fmtstrcpy(fp, "...");
|
||||||
|
|
||||||
if(n->ninit != nil) {
|
if(n->ninit != nil) {
|
||||||
fmtprint(fp, "%O-init\n%H", n->op, n->ninit);
|
fmtprint(fp, "%O-init%H", n->op, n->ninit);
|
||||||
indent(fp);
|
indent(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1319,7 +1321,7 @@ nodedump(Fmt *fp, Node *n)
|
|||||||
if(recur && n->type == T && n->ntype) {
|
if(recur && n->type == T && n->ntype) {
|
||||||
fmtstrcpy(fp, "\n");
|
fmtstrcpy(fp, "\n");
|
||||||
indent(fp);
|
indent(fp);
|
||||||
fmtprint(fp, "%O-ntype\n%N", n->op, n->ntype);
|
fmtprint(fp, "%O-ntype%N", n->op, n->ntype);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1331,34 +1333,33 @@ nodedump(Fmt *fp, Node *n)
|
|||||||
fmtprint(fp, " %T", n->type);
|
fmtprint(fp, " %T", n->type);
|
||||||
|
|
||||||
if(recur) {
|
if(recur) {
|
||||||
fmtstrcpy(fp, "\n");
|
|
||||||
if(n->left)
|
if(n->left)
|
||||||
fmtprint(fp, "%N", n->left);
|
fmtprint(fp, "%N", n->left);
|
||||||
if(n->right)
|
if(n->right)
|
||||||
fmtprint(fp, "%N", n->right);
|
fmtprint(fp, "%N", n->right);
|
||||||
if(n->list) {
|
if(n->list) {
|
||||||
indent(fp);
|
indent(fp);
|
||||||
fmtprint(fp, "%O-list\n%H", n->op, n->list);
|
fmtprint(fp, "%O-list%H", n->op, n->list);
|
||||||
}
|
}
|
||||||
if(n->rlist) {
|
if(n->rlist) {
|
||||||
indent(fp);
|
indent(fp);
|
||||||
fmtprint(fp, "%O-rlist\n%H", n->op, n->rlist);
|
fmtprint(fp, "%O-rlist%H", n->op, n->rlist);
|
||||||
}
|
}
|
||||||
if(n->ntest) {
|
if(n->ntest) {
|
||||||
indent(fp);
|
indent(fp);
|
||||||
fmtprint(fp, "%O-test\n%N", n->op, n->ntest);
|
fmtprint(fp, "%O-test%N", n->op, n->ntest);
|
||||||
}
|
}
|
||||||
if(n->nbody) {
|
if(n->nbody) {
|
||||||
indent(fp);
|
indent(fp);
|
||||||
fmtprint(fp, "%O-body\n%H", n->op, n->nbody);
|
fmtprint(fp, "%O-body%H", n->op, n->nbody);
|
||||||
}
|
}
|
||||||
if(n->nelse) {
|
if(n->nelse) {
|
||||||
indent(fp);
|
indent(fp);
|
||||||
fmtprint(fp, "%O-else\n%H", n->op, n->nelse);
|
fmtprint(fp, "%O-else%H", n->op, n->nelse);
|
||||||
}
|
}
|
||||||
if(n->nincr) {
|
if(n->nincr) {
|
||||||
indent(fp);
|
indent(fp);
|
||||||
fmtprint(fp, "%O-incr\n%N", n->op, n->nincr);
|
fmtprint(fp, "%O-incr%N", n->op, n->nincr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1521,11 +1522,11 @@ fmtinstallgo(void)
|
|||||||
void
|
void
|
||||||
dumplist(char *s, NodeList *l)
|
dumplist(char *s, NodeList *l)
|
||||||
{
|
{
|
||||||
print("%s\n%+H", s, l);
|
print("%s\n%+H\n", s, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dump(char *s, Node *n)
|
dump(char *s, Node *n)
|
||||||
{
|
{
|
||||||
print("%s [%p]\n%+N", s, n, n);
|
print("%s [%p]\n%+N\n", s, n, n);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user