NewPackage: altSSA

This commit is contained in:
xushiwei
2024-06-15 12:10:08 +08:00
parent fa712aa3a0
commit e0a25b5098
5 changed files with 10 additions and 5 deletions

View File

@@ -365,7 +365,12 @@ func buildPkg(prog llssa.Program, aPkg *aPackage, mode Mode, verbose bool) {
pkg.ExportFile = ""
return
}
ret, err := cl.NewPackage(prog, aPkg.SSA, pkg.Syntax)
syntax := pkg.Syntax
if altPkg := aPkg.AltPkg; altPkg != nil {
// TODO: merge pkg.Types
syntax = append(syntax, altPkg.Syntax...)
}
ret, err := cl.NewPackage(prog, aPkg.SSA, aPkg.AltSSA, syntax)
check(err)
if needLLFile(mode) {
pkg.ExportFile += ".ll"

View File

@@ -80,7 +80,7 @@ func Gen(pkgPath, inFile string, src any) string {
return ret
})
ret, err := cl.NewPackage(prog, ssaPkg, files)
ret, err := cl.NewPackage(prog, ssaPkg, nil, files)
check(err)
if prog.NeedPyInit { // call PyInit if needed

View File

@@ -80,7 +80,7 @@ func GenFrom(fileOrPkg string) string {
ssaPkg.WriteTo(os.Stderr)
}
ret, err := cl.NewPackage(prog, ssaPkg, pkg.Syntax)
ret, err := cl.NewPackage(prog, ssaPkg, nil, pkg.Syntax)
check(err)
if prog.NeedPyInit { // call PyInit if needed