mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-20 04:19:04 +00:00
reflect: fix Type.Name to return empty string for non-named types
// Name returns the type's name within its package for a defined type.
// For other (non-defined) types it returns the empty string.
This commit is contained in:
committed by
Damian Gryski
parent
c6728643e6
commit
9f02340a26
+5
-1
@@ -923,7 +923,11 @@ func (t *rawType) Name() string {
|
|||||||
return readStringZ(unsafe.Pointer(&ntype.name[0]))
|
return readStringZ(unsafe.Pointer(&ntype.name[0]))
|
||||||
}
|
}
|
||||||
|
|
||||||
return t.Kind().String()
|
if t.Kind() <= UnsafePointer {
|
||||||
|
return t.Kind().String()
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *rawType) Key() Type {
|
func (t *rawType) Key() Type {
|
||||||
|
|||||||
Reference in New Issue
Block a user