Merge pull request #433 from xushiwei/q

abitype: support Patch (Clone + Merge); patch: os.File
This commit is contained in:
xushiwei
2024-07-01 19:09:32 +08:00
committed by GitHub
15 changed files with 567 additions and 202 deletions

View File

@@ -315,6 +315,9 @@ func lastParamType(prog Program, fn Expr) Type {
func (p Package) abiTypeInit(g Global, t types.Type, pub bool) {
b := p.afterBuilder()
if p.patch != nil {
t = p.patch(t)
}
tabi := b.abiTypeOf(t)
expr := g.Expr
var eq Expr

View File

@@ -568,6 +568,7 @@ type aPackage struct {
strs map[string]llvm.Value
named map[types.Type]Expr
afterb unsafe.Pointer
patch func(types.Type) types.Type
iRoutine int
}
@@ -635,6 +636,11 @@ func (p Package) String() string {
return p.mod.String()
}
// SetPatch sets a patch function.
func (p Package) SetPatch(fn func(types.Type) types.Type) {
p.patch = fn
}
// -----------------------------------------------------------------------------
func (p Package) afterBuilder() Builder {