- 
                Notifications
    
You must be signed in to change notification settings  - Fork 92
 
Open
Description
The provided example project that shows how to use custom types in avo generated asm functions depends on using a handcrafted stub.go file that is not overwritten by using a -stubs parameter.
It would be a very handy minor change to be able to specify one or more import statements to insert in generated stubs so that large/complex stub files don't need to be hand maintained as the example requires.
I'm imagining something like:
//go:build ignore
// +build ignore
package main
import . "github.com/mmcloughlin/avo/build"
func main() {
	Package("github.com/mmcloughlin/avo/examples/ext")
	Import("github.com/mmcloughlin/avo/examples/ext/ext")  // <-- Specify where type(s) defined
	TEXT("StructFieldB", NOSPLIT, "func(e ext.Struct) byte")
	Doc("StructFieldB returns field B.")
	b := Load(Param("e").Field("B"), GP8())
	Store(b, ReturnIndex(0))
	RET()
	Generate()
}Which could then generate with: //go:generate go run asm.go -out ext.s -stubs stub.go and generate a corresponding stub:
// Code generated by command: go run asm.go -out ext.s -stubs stub.go. DO NOT EDIT.
package ext
import "github.com/mmcloughlin/avo/examples/ext/ext"
// StructFieldB returns field B.
func StructFieldB(e ext.Struct) byteMetadata
Metadata
Assignees
Labels
No labels