diff --git a/cmd/genbindings/config-allowlist.go b/cmd/genbindings/config-allowlist.go index c1510be8..9486cb56 100644 --- a/cmd/genbindings/config-allowlist.go +++ b/cmd/genbindings/config-allowlist.go @@ -171,7 +171,7 @@ func AllowClass(className string) bool { } func AllowSignal(mm CppMethod) bool { - if mm.ReturnType.ParameterType != "void" { + if !mm.ReturnType.Void() { // This affects how we cast the signal function pointer for connect // It would be fixable, but, real signals always have void return types anyway return false diff --git a/cmd/genbindings/emitcabi.go b/cmd/genbindings/emitcabi.go index a8582fa0..325cdb09 100644 --- a/cmd/genbindings/emitcabi.go +++ b/cmd/genbindings/emitcabi.go @@ -343,7 +343,7 @@ func emitAssignCppToCabi(assignExpression string, p CppParameter, rvalue string) namePrefix := makeNamePrefix(p.ParameterName) - if p.ParameterType == "void" && !p.Pointer { + if p.Void() { shouldReturn = "" } else if p.ParameterType == "QString" { diff --git a/cmd/genbindings/emitgo.go b/cmd/genbindings/emitgo.go index 12f505a3..3395f525 100644 --- a/cmd/genbindings/emitgo.go +++ b/cmd/genbindings/emitgo.go @@ -404,7 +404,7 @@ func (gfs *goFileState) emitCabiToGo(assignExpr string, rt CppParameter, rvalue afterword := "" namePrefix := makeNamePrefix(rt.ParameterName) - if rt.ParameterType == "void" && !rt.Pointer { + if rt.Void() { shouldReturn = "" return shouldReturn + " " + rvalue + "\n" + afterword diff --git a/cmd/genbindings/intermediate.go b/cmd/genbindings/intermediate.go index 11d222c5..9d9bac66 100644 --- a/cmd/genbindings/intermediate.go +++ b/cmd/genbindings/intermediate.go @@ -207,6 +207,10 @@ func (p CppParameter) IntType() bool { } } +func (p CppParameter) Void() bool { + return p.ParameterType == "void" && !p.Pointer +} + type CppProperty struct { PropertyName string PropertyType string