LEFT | RIGHT |
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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 if(t == T) | 546 if(t == T) |
547 return fmtstrcpy(fp, "<T>"); | 547 return fmtstrcpy(fp, "<T>"); |
548 | 548 |
549 if (t == bytetype || t == runetype) { | 549 if (t == bytetype || t == runetype) { |
550 // in %-T mode collapse rune and byte with their originals. | 550 // in %-T mode collapse rune and byte with their originals. |
551 if(fmtmode != FTypeId) | 551 if(fmtmode != FTypeId) |
552 return fmtprint(fp, "%hS", t->sym); | 552 return fmtprint(fp, "%hS", t->sym); |
553 t = types[t->etype]; | 553 t = types[t->etype]; |
554 } | 554 } |
555 | 555 |
| 556 if(t == errortype) |
| 557 return fmtstrcpy(fp, "error"); |
| 558 |
556 // Unless the 'l' flag was specified, if the type has a name, just print
that name. | 559 // Unless the 'l' flag was specified, if the type has a name, just print
that name. |
557 if(!(fp->flags&FmtLong) && t->sym && t->etype != TFIELD && t != types[t-
>etype]) { | 560 if(!(fp->flags&FmtLong) && t->sym && t->etype != TFIELD && t != types[t-
>etype]) { |
558 switch(fmtmode) { | 561 switch(fmtmode) { |
559 case FTypeId: | 562 case FTypeId: |
560 if(fp->flags&FmtShort) | 563 if(fp->flags&FmtShort) |
561 return fmtprint(fp, "%hS", t->sym); | 564 return fmtprint(fp, "%hS", t->sym); |
562 if(fp->flags&FmtUnsigned) | 565 if(fp->flags&FmtUnsigned) |
563 return fmtprint(fp, "%uS", t->sym); | 566 return fmtprint(fp, "%uS", t->sym); |
564 // fallthrough | 567 // fallthrough |
565 case FExp: | 568 case FExp: |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 dumplist(char *s, NodeList *l) | 1510 dumplist(char *s, NodeList *l) |
1508 { | 1511 { |
1509 print("%s\n%+H", s, l); | 1512 print("%s\n%+H", s, l); |
1510 } | 1513 } |
1511 | 1514 |
1512 void | 1515 void |
1513 dump(char *s, Node *n) | 1516 dump(char *s, Node *n) |
1514 { | 1517 { |
1515 print("%s [%p]\n%+N", s, n, n); | 1518 print("%s [%p]\n%+N", s, n, n); |
1516 } | 1519 } |
LEFT | RIGHT |