loader: switch to custom program loader

This commit is contained in:
Ayke van Laethem
2018-11-25 17:37:31 +01:00
parent 564b1b3312
commit e10d05c74f
7 changed files with 416 additions and 20 deletions
+18
View File
@@ -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
}