cl: after init check hasPatch
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/goplus/llgo/cl/blocks"
|
||||
"github.com/goplus/llgo/internal/typepatch"
|
||||
@@ -288,9 +289,14 @@ func (p *context) compileBlock(b llssa.Builder, block *ssa.BasicBlock, n int, do
|
||||
instrs = instrs[:last]
|
||||
} else {
|
||||
// TODO(xsw): confirm pyMod don't need to call AfterInit
|
||||
p.inits = append(p.inits, func() {
|
||||
after := func() {
|
||||
pkg.AfterInit(b, ret)
|
||||
})
|
||||
}
|
||||
if strings.HasSuffix(fn.Name(), "$hasPatch") {
|
||||
p.inits[len(p.inits)-1] = after
|
||||
} else {
|
||||
p.inits = append(p.inits, after)
|
||||
}
|
||||
}
|
||||
} else if doMainInit {
|
||||
argc := pkg.NewVar("__llgo_argc", types.NewPointer(types.Typ[types.Int32]), llssa.InC)
|
||||
|
||||
Reference in New Issue
Block a user