mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
c4ef38fbf9
Fixes #4884 by upgrading the ssa package. The fix is in v0.26.0, which also bumps the minimum Go to 1.22. The latest x/tools module still depending on 1.22 is v0.30.0.
29 lines
937 B
Go
29 lines
937 B
Go
package loader
|
|
|
|
import (
|
|
"golang.org/x/tools/go/ssa"
|
|
)
|
|
|
|
// LoadSSA constructs the SSA form of the loaded packages.
|
|
//
|
|
// The program must already be parsed and type-checked with the .Parse() method.
|
|
func (p *Program) LoadSSA() *ssa.Program {
|
|
// TODO: re-enable SanityCheckFunctions when x/tools is upgraded to
|
|
// a version with a fix for https://golang.org/issues/73594.
|
|
prog := ssa.NewProgram(p.fset /*ssa.SanityCheckFunctions|*/, ssa.BareInits|ssa.GlobalDebug|ssa.InstantiateGenerics)
|
|
|
|
for _, pkg := range p.sorted {
|
|
prog.CreatePackage(pkg.Pkg, pkg.Files, &pkg.info, true)
|
|
}
|
|
|
|
return prog
|
|
}
|
|
|
|
// LoadSSA constructs the SSA form of this package.
|
|
//
|
|
// The program must already be parsed and type-checked with the .Parse() method.
|
|
func (p *Package) LoadSSA() *ssa.Package {
|
|
prog := ssa.NewProgram(p.program.fset, ssa.SanityCheckFunctions|ssa.BareInits|ssa.GlobalDebug)
|
|
return prog.CreatePackage(p.Pkg, p.Files, &p.info, true)
|
|
}
|