Commit 1dd0319b authored by Russ Cox's avatar Russ Cox

runtime: print unknown types in panic

R=r
CC=golang-dev
https://golang.org/cl/2683041
parent e5e92110
...@@ -111,6 +111,8 @@ type stringer interface { ...@@ -111,6 +111,8 @@ type stringer interface {
String() string String() string
} }
func typestring(interface{}) string
// For calling from C. // For calling from C.
// Prints an argument passed to panic. // Prints an argument passed to panic.
// There's room for arbitrary complexity here, but we keep it // There's room for arbitrary complexity here, but we keep it
...@@ -126,6 +128,6 @@ func printany(i interface{}) { ...@@ -126,6 +128,6 @@ func printany(i interface{}) {
case string: case string:
print(v) print(v)
default: default:
print(i) print("(", typestring(i), ") ", i)
} }
} }
...@@ -348,3 +348,11 @@ void ...@@ -348,3 +348,11 @@ void
{ {
write(fd, "\n", 1); write(fd, "\n", 1);
} }
void
·typestring(Eface e, String s)
{
s = *e.type->string;
FLUSH(&s);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment