llgo/ssa.SetRuntime: prevent multiple loading of runtime

This commit is contained in:
xushiwei
2024-04-28 14:00:29 +08:00
parent 41dfafe957
commit 70623dd554
7 changed files with 35 additions and 22 deletions

View File

@@ -50,7 +50,7 @@ func GenFrom(fileOrPkg string) string {
prog := llssa.NewProgram(nil)
prog.SetRuntime(func() *types.Package {
rt, err := packages.Load(cfg, "github.com/goplus/llgo/internal/runtime")
rt, err := packages.Load(cfg, llssa.PkgRuntime)
check(err)
return rt[0].Types
})