From ce169163b9c426feea34ab06e55853e3902ab2d3 Mon Sep 17 00:00:00 2001 From: visualfc Date: Tue, 17 Dec 2024 21:36:51 +0800 Subject: [PATCH] internal/runtime: NewNamedInterface check exist --- internal/runtime/z_face.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/runtime/z_face.go b/internal/runtime/z_face.go index 3785e588..113dcce2 100644 --- a/internal/runtime/z_face.go +++ b/internal/runtime/z_face.go @@ -225,6 +225,12 @@ func Func(in, out []*Type, variadic bool) *FuncType { } func NewNamedInterface(pkgPath, name string) *InterfaceType { + named := pkgPath + "." + name + for _, typ := range rtypeList { + if typ.named == named { + return typ.InterfaceType() + } + } ret := &struct { abi.InterfaceType u abi.UncommonType @@ -246,6 +252,7 @@ func NewNamedInterface(pkgPath, name string) *InterfaceType { PkgPath_: pkgPath, }, } + rtypeList = append(rtypeList, &rtype{Type: &ret.Type, named: named}) return &ret.InterfaceType }