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

@@ -108,7 +108,7 @@ func Do(args []string, conf *Config) {
var rt []*packages.Package
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
})