1
0
mirror of https://github.com/golang/go synced 2024-11-23 10:30:03 -07:00

cmd/gc: fix runtime print(hex(x))

The code I wrote originally works for trivial functions
that are inlined at a call site in another package,
because that was how I wrote my local test.
Make hex(x) work for non-inlinable functions too.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/140830043
This commit is contained in:
Russ Cox 2014-09-02 14:36:25 -04:00
parent 6baf173b67
commit 8e89f87158

View File

@ -1838,7 +1838,7 @@ walkprint(Node *nn, NodeList **init, int defer)
}
} else {
if(et == TUINT64) {
if(t->sym->pkg == runtimepkg && strcmp(t->sym->name, "hex") == 0)
if((t->sym->pkg == runtimepkg || compiling_runtime) && strcmp(t->sym->name, "hex") == 0)
on = syslook("printhex", 0);
else
on = syslook("printuint", 0);