llgo/ssa: rtType, rtFunc

This commit is contained in:
xushiwei
2024-04-27 17:39:25 +08:00
parent f1761c0c9c
commit 6a02c3ac4c
14 changed files with 259 additions and 19 deletions

View File

@@ -17,6 +17,7 @@
package llgen
import (
"go/types"
"os"
"github.com/goplus/llgo/cl"
@@ -48,6 +49,12 @@ func GenFromFile(inFile string) string {
ssaPkg.Build()
prog := llssa.NewProgram(nil)
prog.SetRuntime(func() *types.Package {
rt, err := packages.Load(cfg, "github.com/goplus/llgo/internal/runtime")
check(err)
return rt[0].Types
})
ret, err := cl.NewPackage(prog, ssaPkg, pkg.Syntax)
check(err)