mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 16:03:41 +00:00
loader: use name "main" for the main package
This should make exported names a bit more consistent. I believe there was a bug report for this issue, but I can't easily find it. In any case, I think it's an important improvement to match the behavior of the Go toolchain.
This commit is contained in:
committed by
Ron Evans
parent
c4d642007e
commit
dbc438b2ae
@@ -67,7 +67,7 @@ func NewProgram(lprogram *loader.Program) *Program {
|
||||
program := lprogram.LoadSSA()
|
||||
program.Build()
|
||||
|
||||
mainPkg := program.ImportedPackage(lprogram.MainPkg().ImportPath)
|
||||
mainPkg := program.Package(lprogram.MainPkg().Pkg)
|
||||
if mainPkg == nil {
|
||||
panic("could not find main package")
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func NewProgram(lprogram *loader.Program) *Program {
|
||||
}
|
||||
|
||||
for _, pkg := range lprogram.Sorted() {
|
||||
p.AddPackage(program.ImportedPackage(pkg.ImportPath))
|
||||
p.AddPackage(program.Package(pkg.Pkg))
|
||||
}
|
||||
|
||||
return p
|
||||
|
||||
Reference in New Issue
Block a user