compiler: make main function normally to compatible multiple main functions in testing mode

This commit is contained in:
Li Jie
2025-01-13 09:37:26 +08:00
parent 5cfeddef73
commit 85d01d6f28
6 changed files with 64 additions and 72 deletions

View File

@@ -231,18 +231,6 @@ func (p Program) tyGetAttrString() *types.Signature {
return p.getAttrStr
}
// PyInit initializes Python for a main package.
func (p Package) PyInit() bool {
if fn := p.FuncOf("main"); fn != nil {
b := fn.NewBuilder()
b.SetBlockEx(fn.Block(0), AtStart, false)
b.callPyInit()
b.Dispose()
return true
}
return false
}
// PyNewModVar creates a new global variable for a Python module.
func (p Package) PyNewModVar(name string, doInit bool) Global {
if v, ok := p.pymods[name]; ok {