mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
genbindings: detect and skip over receiver-method pattern
This commit is contained in:
parent
148d8ea6e0
commit
43e32085a1
@ -283,6 +283,11 @@ nextMethod:
|
|||||||
|
|
||||||
mm.IsSignal = isSignal && !mm.IsStatic && mm.MethodName != `metaObject`
|
mm.IsSignal = isSignal && !mm.IsStatic && mm.MethodName != `metaObject`
|
||||||
|
|
||||||
|
if mm.IsReceiverMethod() {
|
||||||
|
log.Printf("Skipping method %q using non-projectable receiver pattern parameters", mm.MethodName)
|
||||||
|
continue nextMethod
|
||||||
|
}
|
||||||
|
|
||||||
ret.Methods = append(ret.Methods, mm)
|
ret.Methods = append(ret.Methods, mm)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -81,6 +81,26 @@ func IsArgcArgv(params []CppParameter, pos int) bool {
|
|||||||
params[pos+1].ParameterType == "char **")
|
params[pos+1].ParameterType == "char **")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsReceiverMethod(params []CppParameter, pos int) bool {
|
||||||
|
// Check if the arguments starting at position=pos are the receiver/member pattern.
|
||||||
|
// QMenu->addAction is the main example of this
|
||||||
|
return (len(params) > pos+1 &&
|
||||||
|
params[pos].ParameterName == "receiver" &&
|
||||||
|
params[pos].ParameterType == "QObject" &&
|
||||||
|
params[pos].Pointer &&
|
||||||
|
params[pos+1].ParameterName == "member" &&
|
||||||
|
params[pos+1].ParameterType == "char" &&
|
||||||
|
params[pos+1].Pointer)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (nm CppMethod) IsReceiverMethod() bool {
|
||||||
|
// Returns true if any of the parameters use the receiever-method pattern
|
||||||
|
for i := 0; i < len(nm.Parameters); i++ {
|
||||||
|
if IsReceiverMethod(nm.Parameters, i) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nm CppMethod) SafeMethodName() string {
|
func (nm CppMethod) SafeMethodName() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user