reflect: implement Sizeof and Alignof for func values

This is a small change that appears to be necessary for encoding/json
support. It's simple enough to implement.
This commit is contained in:
Ayke van Laethem
2021-03-28 22:31:27 +02:00
committed by Ron Evans
parent 16e7dd83a3
commit 4f6d598ea8
3 changed files with 14 additions and 4 deletions
+3
View File
@@ -150,6 +150,9 @@ func (s *stdSizes) Sizeof(T types.Type) int64 {
return s.PtrSize * 2
case *types.Pointer:
return s.PtrSize
case *types.Signature:
// Func values in TinyGo are two words in size.
return s.PtrSize * 2
default:
panic("unknown type: " + t.String())
}