summaryrefslogtreecommitdiff
path: root/src/cmd/gc/walk.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-04-15 22:38:09 -0700
committerRuss Cox <rsc@golang.org>2009-04-15 22:38:09 -0700
commit5eda790c67ef577f56e3347bb3589f4de21c7c0a (patch)
treefa0ae467a3dbe9e5d670fd2b28e6914481b2596a /src/cmd/gc/walk.c
parent9f568f6ab34901c689185b451ec397e4e4e583b6 (diff)
downloadgolang-5eda790c67ef577f56e3347bb3589f4de21c7c0a.tar.gz
panicln: emit just one newline
R=ken OCL=27537 CL=27545
Diffstat (limited to 'src/cmd/gc/walk.c')
-rw-r--r--src/cmd/gc/walk.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c
index a9606cfae..1fa07dec0 100644
--- a/src/cmd/gc/walk.c
+++ b/src/cmd/gc/walk.c
@@ -271,7 +271,7 @@ loop:
if(top != Etop)
goto nottop;
walktype(n->left, Erv);
- indir(n, list(prcompat(n->left, 1), nodpanic(n->lineno)));
+ indir(n, list(prcompat(n->left, 2), nodpanic(n->lineno)));
goto ret;
case OLITERAL:
@@ -1980,6 +1980,10 @@ ascompat(Type *dst, Type *src)
return 0;
}
+// generate code for print
+// fmt = 0: print
+// fmt = 1: println
+// fmt = 2: panicln (like println but no trailing newline)
Node*
prcompat(Node *n, int fmt)
{
@@ -1995,7 +1999,7 @@ prcompat(Node *n, int fmt)
loop:
if(l == N) {
- if(fmt) {
+ if(fmt == 1) {
on = syslook("printnl", 0);
r = list(r, nod(OCALL, on, N));
}