globalType: support typepatch

This commit is contained in:
xushiwei
2024-06-18 00:06:40 +08:00
parent edaba44c87
commit 3b2e97a729
4 changed files with 16 additions and 3 deletions

View File

@@ -58,7 +58,6 @@ type Once struct {
}
func (o *Once) Do(f func()) {
println("Once.Do start", o.done)
if !o.done {
o.m.Lock()
defer o.m.Unlock()

View File

@@ -60,6 +60,9 @@ const (
)
func IsPatched(pkg *types.Package) bool {
if pkg == nil {
return false
}
p := (*typesPackage)(unsafe.Pointer(pkg))
return *(*uint8)(unsafe.Pointer(&p.complete)) == tagPatched
}