cl: fix package patching
This commit is contained in:
@@ -105,6 +105,8 @@ type aProgram struct {
|
||||
sizes types.Sizes // provided by Go compiler
|
||||
gocvt goTypes
|
||||
|
||||
patchType func(types.Type) types.Type
|
||||
|
||||
rt *types.Package
|
||||
rtget func() *types.Package
|
||||
|
||||
@@ -233,6 +235,17 @@ func NewProgram(target *Target) Program {
|
||||
}
|
||||
}
|
||||
|
||||
func (p Program) SetPatch(patchType func(types.Type) types.Type) {
|
||||
p.patchType = patchType
|
||||
}
|
||||
|
||||
func (p Program) patch(typ types.Type) types.Type {
|
||||
if p.patchType != nil {
|
||||
return p.patchType(typ)
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetRuntime sets the runtime.
|
||||
// Its type can be *types.Package or func() *types.Package.
|
||||
func (p Program) SetRuntime(runtime any) {
|
||||
|
||||
Reference in New Issue
Block a user