ssa: closure use specific struct field name { $f ftype, $data unsafe.pointer }

This commit is contained in:
visualfc
2024-12-21 21:37:46 +08:00
parent 070d64f365
commit a6a3c09c05
14 changed files with 238 additions and 190 deletions

View File

@@ -176,8 +176,8 @@ func Instantiate(orig types.Type, t *types.Named) (types.Type, bool) {
func (p goTypes) cvtClosure(sig *types.Signature) *types.Struct {
raw := p.cvtFunc(sig, nil)
flds := []*types.Var{
types.NewField(token.NoPos, nil, "f", raw, false),
types.NewField(token.NoPos, nil, "data", types.Typ[types.UnsafePointer], false),
types.NewField(token.NoPos, nil, "$f", raw, false),
types.NewField(token.NoPos, nil, "$data", types.Typ[types.UnsafePointer], false),
}
return types.NewStruct(flds, nil)
}