From 883ba8c131e7b484ad91612ebff484fcb80eff57 Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 19 Jan 2025 16:38:27 +1300 Subject: [PATCH] genbindings: change AllInherits() to return lookupResultClass --- cmd/genbindings/emitcabi.go | 4 ++-- cmd/genbindings/intermediate.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/genbindings/emitcabi.go b/cmd/genbindings/emitcabi.go index 0e2f93f3..52b1fbd4 100644 --- a/cmd/genbindings/emitcabi.go +++ b/cmd/genbindings/emitcabi.go @@ -608,9 +608,9 @@ func getReferencedTypes(src *CppParsedHeader) []string { } maybeAddType(vm.ReturnType) } - for _, cn := range c.AllInherits() { + for _, cn := range c.AllInheritsClassInfo() { maybeAddType(CppParameter{ - ParameterType: cn, + ParameterType: cn.Class.ClassName, }) } } diff --git a/cmd/genbindings/intermediate.go b/cmd/genbindings/intermediate.go index e4de0c5f..1036b2d6 100644 --- a/cmd/genbindings/intermediate.go +++ b/cmd/genbindings/intermediate.go @@ -505,17 +505,17 @@ func (c *CppClass) VirtualMethods() []CppMethod { return ret } -// AllInherits recursively finds and lists all the parent classes of this class. -func (c *CppClass) AllInherits() []string { - var ret []string +// AllInheritsClassInfo recursively finds and lists all the parent classes of this class. +func (c *CppClass) AllInheritsClassInfo() []lookupResultClass { + var ret []lookupResultClass // FIXME prevent duplicates arising from diamond inheritance for _, baseClassInfo := range c.DirectInheritClassInfo() { - ret = append(ret, baseClassInfo.Class.ClassName) + ret = append(ret, baseClassInfo) - recurseInfo := baseClassInfo.Class.AllInherits() + recurseInfo := baseClassInfo.Class.AllInheritsClassInfo() for _, childClass := range recurseInfo { ret = append(ret, childClass) } @@ -528,7 +528,7 @@ func (c *CppClass) AllInherits() []string { func (c *CppClass) DirectInheritClassInfo() []lookupResultClass { var ret []lookupResultClass - for _, inh := range c.DirectInherits { // AllInherits() { + for _, inh := range c.DirectInherits { cinfo, ok := KnownClassnames[inh] if !ok { if strings.HasPrefix(inh, `QList<`) {