Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(708)

Delta Between Two Patch Sets: src/cmd/gc/fmt.c

Issue 5319065: code review 5319065: gc: small fixes for printing. (Closed)
Left Patch Set: diff -r 64a7c82147a0 https://go.googlecode.com/hg/ Created 13 years, 4 months ago
Right Patch Set: diff -r 71dc491f16f9 https://go.googlecode.com/hg/ Created 13 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/cmd/gc/typecheck.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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
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 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b