github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/compiler/testdata/gc.go (about) 1 package main 2 3 var ( 4 scalar1 *byte 5 scalar2 *int32 6 scalar3 *int64 7 scalar4 *float32 8 9 array1 *[3]byte 10 array2 *[71]byte 11 array3 *[3]*byte 12 13 struct1 *struct{} 14 struct2 *struct { 15 x int 16 y int 17 } 18 struct3 *struct { 19 x *byte 20 y [60]uintptr 21 z *byte 22 } 23 struct4 *struct { 24 x *byte 25 y [61]uintptr 26 } 27 28 slice1 []byte 29 slice2 []*int 30 slice3 [][]byte 31 ) 32 33 func newScalar() { 34 scalar1 = new(byte) 35 scalar2 = new(int32) 36 scalar3 = new(int64) 37 scalar4 = new(float32) 38 } 39 40 func newArray() { 41 array1 = new([3]byte) 42 array2 = new([71]byte) 43 array3 = new([3]*byte) 44 } 45 46 func newStruct() { 47 struct1 = new(struct{}) 48 struct2 = new(struct { 49 x int 50 y int 51 }) 52 struct3 = new(struct { 53 x *byte 54 y [60]uintptr 55 z *byte 56 }) 57 struct4 = new(struct { 58 x *byte 59 y [61]uintptr 60 }) 61 } 62 63 func newFuncValue() *func() { 64 return new(func()) 65 } 66 67 func makeSlice() { 68 slice1 = make([]byte, 5) 69 slice2 = make([]*int, 5) 70 slice3 = make([][]byte, 5) 71 } 72 73 func makeInterface(v complex128) interface{} { 74 return v // always stored in an allocation 75 }