createAltSSAPkg
This commit is contained in:
@@ -367,7 +367,6 @@ func buildPkg(prog llssa.Program, aPkg *aPackage, mode Mode, verbose bool) {
|
|||||||
}
|
}
|
||||||
syntax := pkg.Syntax
|
syntax := pkg.Syntax
|
||||||
if altPkg := aPkg.AltPkg; altPkg != nil {
|
if altPkg := aPkg.AltPkg; altPkg != nil {
|
||||||
// TODO: merge pkg.Types
|
|
||||||
syntax = append(syntax, altPkg.Syntax...)
|
syntax = append(syntax, altPkg.Syntax...)
|
||||||
}
|
}
|
||||||
ret, err := cl.NewPackageEx(prog, aPkg.SSA, aPkg.AltSSA, syntax)
|
ret, err := cl.NewPackageEx(prog, aPkg.SSA, aPkg.AltSSA, syntax)
|
||||||
@@ -421,7 +420,9 @@ func allPkgs(imp importer, initial []*packages.Package, mode ssa.BuilderMode) (p
|
|||||||
if _, ok := hasAltPkg[p.PkgPath]; ok {
|
if _, ok := hasAltPkg[p.PkgPath]; ok {
|
||||||
altPkgPath := "github.com/goplus/llgo/internal/lib/" + p.PkgPath
|
altPkgPath := "github.com/goplus/llgo/internal/lib/" + p.PkgPath
|
||||||
if altPkg = imp(altPkgPath); altPkg != nil {
|
if altPkg = imp(altPkgPath); altPkg != nil {
|
||||||
altSSA = prog.CreatePackage(altPkg.Types, altPkg.Syntax, altPkg.TypesInfo, true)
|
altSSA = createAltSSAPkg(prog, altPkg)
|
||||||
|
altSSA.Pkg = p.Types
|
||||||
|
// TODO(xsw): merge p.Types and altPkg.Types
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -433,6 +434,18 @@ func allPkgs(imp importer, initial []*packages.Package, mode ssa.BuilderMode) (p
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func createAltSSAPkg(prog *ssa.Program, alt *packages.Package) *ssa.Package {
|
||||||
|
packages.Visit([]*packages.Package{alt}, nil, func(p *packages.Package) {
|
||||||
|
typ := p.Types
|
||||||
|
if typ != nil && !p.IllTyped {
|
||||||
|
if prog.ImportedPackage(typ.Path()) == nil {
|
||||||
|
prog.CreatePackage(typ, p.Syntax, p.TypesInfo, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return prog.ImportedPackage(alt.Types.Path())
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// TODO(xsw): complete build flags
|
// TODO(xsw): complete build flags
|
||||||
buildFlags = map[string]bool{
|
buildFlags = map[string]bool{
|
||||||
|
|||||||
Reference in New Issue
Block a user