cl: funcOf fix: call pyfunc multiple times

This commit is contained in:
xushiwei
2024-05-19 00:15:23 +08:00
parent 0787909045
commit 63e678928b
5 changed files with 110 additions and 13 deletions

View File

@@ -301,8 +301,8 @@ func (p *context) funcOf(fn *ssa.Function) (aFn llssa.Function, pyFn llssa.PyObj
fnName := pysymPrefix + mod + "." + name
if pyFn = pkg.PyObjOf(fnName); pyFn == nil {
pyFn = pkg.PyNewFunc(fnName, fn.Signature, true)
return
}
return
}
ftype = ignoredFunc
case llgoInstr:
@@ -629,7 +629,7 @@ func (p *context) compileInstrOrValue(b llssa.Builder, iv instrOrValue, asValue
case llgoUnreachable: // func unreachable()
b.Unreachable()
default:
panic("todo")
log.Panicln("unknown ftype:", ftype)
}
default:
fn := p.compileValue(b, cv)
@@ -812,7 +812,7 @@ func (p *context) compileInstr(b llssa.Builder, instr ssa.Instruction) {
}
func (p *context) compileFunction(v *ssa.Function) (goFn llssa.Function, pyFn llssa.PyObjRef, kind int) {
// v.Pkg == nil: means auto generated function?
// TODO(xsw) v.Pkg == nil: means auto generated function?
if v.Pkg == p.goPkg || v.Pkg == nil {
// function in this package
goFn, pyFn, kind = p.compileFuncDecl(p.pkg, v)