compiler: fix unsafe.Sizeof for chan and map values

These types are simply pointers. For some reason, they were never
implemented.

Fixes https://github.com/tinygo-org/tinygo/issues/3083.
This commit is contained in:
Ayke van Laethem
2022-08-31 23:02:17 +02:00
committed by Ayke
parent 9e8739bb47
commit b485e8bfbd
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -152,7 +152,7 @@ func (s *stdSizes) Sizeof(T types.Type) int64 {
return align(offsets[n-1]+s.Sizeof(fields[n-1].Type()), maxAlign)
case *types.Interface:
return s.PtrSize * 2
case *types.Pointer:
case *types.Pointer, *types.Chan, *types.Map:
return s.PtrSize
case *types.Signature:
// Func values in TinyGo are two words in size.