closureStub

This commit is contained in:
xushiwei
2024-05-05 18:48:09 +08:00
parent 87ca3a39dc
commit 4f1b6e95a1
4 changed files with 50 additions and 18 deletions

View File

@@ -358,10 +358,7 @@ func (b Builder) UnOp(op token.Token, x Expr) Expr {
func checkExpr(v Expr, t types.Type, b Builder) Expr {
if t, ok := t.(*types.Struct); ok && isClosure(t) {
if v.kind != vkClosure {
log.Panicln("checkExpr:", v.impl.Name())
prog := b.Prog
nilVal := prog.Null(prog.VoidPtr()).impl
return b.aggregateValue(prog.rawType(t), v.impl, nilVal)
return b.Func.Pkg.closureStub(b, t, v)
}
}
return v