OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include <u.h> | 5 #include <u.h> |
6 #include <libc.h> | 6 #include <libc.h> |
7 #include "go.h" | 7 #include "go.h" |
8 #include "opnames.h" | 8 #include "opnames.h" |
9 | 9 |
10 // | 10 // |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 if(n > HISTSZ) | 150 if(n > HISTSZ) |
151 n = HISTSZ; | 151 n = HISTSZ; |
152 | 152 |
153 for(i=n-1; i>=0; i--) { | 153 for(i=n-1; i>=0; i--) { |
154 if(i != n-1) { | 154 if(i != n-1) { |
155 if(fp->flags & ~(FmtWidth|FmtPrec)) | 155 if(fp->flags & ~(FmtWidth|FmtPrec)) |
156 break; | 156 break; |
157 fmtprint(fp, " "); | 157 fmtprint(fp, " "); |
158 } | 158 } |
159 » » if(debug['L']) | 159 » » if(debug['L'] || (fp->flags&FmtLong)) |
160 fmtprint(fp, "%s/", pathname); | 160 fmtprint(fp, "%s/", pathname); |
161 if(a[i].line) | 161 if(a[i].line) |
162 fmtprint(fp, "%s:%d[%s:%d]", | 162 fmtprint(fp, "%s:%d[%s:%d]", |
163 a[i].line->name, lno-a[i].ldel+1, | 163 a[i].line->name, lno-a[i].ldel+1, |
164 a[i].incl->name, lno-a[i].idel+1); | 164 a[i].incl->name, lno-a[i].idel+1); |
165 else | 165 else |
166 fmtprint(fp, "%s:%d", | 166 fmtprint(fp, "%s:%d", |
167 a[i].incl->name, lno-a[i].idel+1); | 167 a[i].incl->name, lno-a[i].idel+1); |
168 lno = a[i].incl->line - 1; // now print out start of this f
ile | 168 lno = a[i].incl->line - 1; // now print out start of this f
ile |
169 } | 169 } |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 // return fmtprint(f, "%T { %H }", n->type, n->nbody); this prin
ts the list/rlist turned to types, not what we want | 1109 // return fmtprint(f, "%T { %H }", n->type, n->nbody); this prin
ts the list/rlist turned to types, not what we want |
1110 if(!n->rlist) | 1110 if(!n->rlist) |
1111 return fmtprint(f, "func(%,H) { %H } ", n->list, n->nbod
y); | 1111 return fmtprint(f, "func(%,H) { %H } ", n->list, n->nbod
y); |
1112 if(!n->rlist->next && !n->rlist->n->left) | 1112 if(!n->rlist->next && !n->rlist->n->left) |
1113 return fmtprint(f, "func(%,H) %N { %H } ", n->list, n->r
list->n->right, n->nbody); | 1113 return fmtprint(f, "func(%,H) %N { %H } ", n->list, n->r
list->n->right, n->nbody); |
1114 return fmtprint(f, "func(%,H) (%,H) { %H } ", n->list, n->rlist,
n->nbody); | 1114 return fmtprint(f, "func(%,H) (%,H) { %H } ", n->list, n->rlist,
n->nbody); |
1115 | 1115 |
1116 case OCOMPLIT: | 1116 case OCOMPLIT: |
1117 return fmtstrcpy(f, "composite literal"); | 1117 return fmtstrcpy(f, "composite literal"); |
1118 | 1118 |
| 1119 case OPTRLIT: |
| 1120 if(fmtmode == FErr) |
| 1121 return fmtprint(f, "&%T literal", n->type->type); |
| 1122 return fmtprint(f, "&%T{ %,H }", n->type->type, n->list); |
| 1123 |
1119 case OARRAYLIT: | 1124 case OARRAYLIT: |
1120 case OMAPLIT: | 1125 case OMAPLIT: |
1121 case OSTRUCTLIT: | 1126 case OSTRUCTLIT: |
1122 if(fmtmode == FErr) | 1127 if(fmtmode == FErr) |
1123 return fmtprint(f, "%T literal", n->type); | 1128 return fmtprint(f, "%T literal", n->type); |
1124 return fmtprint(f, "%T{ %,H }", n->type, n->list); | 1129 return fmtprint(f, "%T{ %,H }", n->type, n->list); |
1125 | 1130 |
1126 case OKEY: | 1131 case OKEY: |
1127 if(n->left && n->right) | 1132 if(n->left && n->right) |
1128 return fmtprint(f, "%N:%N", n->left, n->right); | 1133 return fmtprint(f, "%N:%N", n->left, n->right); |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 dumplist(char *s, NodeList *l) | 1528 dumplist(char *s, NodeList *l) |
1524 { | 1529 { |
1525 print("%s\n%+H\n", s, l); | 1530 print("%s\n%+H\n", s, l); |
1526 } | 1531 } |
1527 | 1532 |
1528 void | 1533 void |
1529 dump(char *s, Node *n) | 1534 dump(char *s, Node *n) |
1530 { | 1535 { |
1531 print("%s [%p]\n%+N\n", s, n, n); | 1536 print("%s [%p]\n%+N\n", s, n, n); |
1532 } | 1537 } |
OLD | NEW |