examples/components: a few more cases

This commit is contained in:
Michael McLoughlin
2018-12-19 00:16:18 -08:00
parent ca5c7e7454
commit 33f5561d91
4 changed files with 56 additions and 0 deletions

View File

@@ -9,6 +9,26 @@ import (
func main() {
Package("github.com/mmcloughlin/avo/examples/components")
TEXT("StringLen", "func(s string) int")
strlen := Load(Param("s").Len(), GP64v())
Store(strlen, ReturnIndex(0))
RET()
TEXT("SliceLen", "func(s []int) int")
slicelen := Load(Param("s").Len(), GP64v())
Store(slicelen, ReturnIndex(0))
RET()
TEXT("SliceCap", "func(s []int) int")
slicecap := Load(Param("s").Cap(), GP64v())
Store(slicecap, ReturnIndex(0))
RET()
TEXT("ArrayThree", "func(a [7]uint64) uint64")
a3 := Load(Param("a").Index(3), GP64v())
Store(a3, ReturnIndex(0))
RET()
TEXT("FieldByte", "func(s Struct) byte")
b := Load(Param("s").Field("Byte"), GP8v())
Store(b, ReturnIndex(0))