github.com/aykevl/tinygo@v0.5.0/loader/ssa.go (about)

     1  package loader
     2  
     3  import (
     4  	"golang.org/x/tools/go/ssa"
     5  )
     6  
     7  // LoadSSA constructs the SSA form of the loaded packages.
     8  //
     9  // The program must already be parsed and type-checked with the .Parse() method.
    10  func (p *Program) LoadSSA() *ssa.Program {
    11  	prog := ssa.NewProgram(p.fset, ssa.SanityCheckFunctions|ssa.BareInits|ssa.GlobalDebug)
    12  
    13  	for _, pkg := range p.Sorted() {
    14  		prog.CreatePackage(pkg.Pkg, pkg.Files, &pkg.Info, true)
    15  	}
    16  
    17  	return prog
    18  }