mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 16:03:41 +00:00
loader: switch to custom program loader
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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 {
|
||||
prog := ssa.NewProgram(p.fset, ssa.SanityCheckFunctions|ssa.BareInits|ssa.GlobalDebug)
|
||||
|
||||
for _, pkg := range p.Sorted() {
|
||||
prog.CreatePackage(pkg.Pkg, pkg.Files, &pkg.Info, true)
|
||||
}
|
||||
|
||||
return prog
|
||||
}
|
||||
Reference in New Issue
Block a user