genbindings: detect signals

This commit is contained in:
mappu 2024-08-18 15:56:48 +12:00
parent feb7b1d5f4
commit 2a93cbf2d3
2 changed files with 14 additions and 0 deletions

View File

@ -159,6 +159,8 @@ func processClassType(node map[string]interface{}, className string) (CppClass,
}
}
isSignal := false
// Parse all methods
nextMethod:
@ -190,6 +192,15 @@ nextMethod:
panic("unexpected access visibility '" + access + "'")
}
// Clang sees Q_SIGNALS/signals as being a macro for `public`
// If this AccessSpecDecl was imported from a macro, assume it's signals
isSignal = false
if loc, ok := node["loc"].(map[string]interface{}); ok {
if _, ok := loc["expansionLoc"].(map[string]interface{}); ok {
isSignal = true
}
}
case "FriendDecl":
// Safe to ignore
@ -270,6 +281,8 @@ nextMethod:
return CppClass{}, err
}
mm.IsSignal = isSignal && !mm.IsStatic && mm.MethodName != `metaObject`
ret.Methods = append(ret.Methods, mm)
default:

View File

@ -67,6 +67,7 @@ type CppMethod struct {
ReturnType CppParameter // Name not used
Parameters []CppParameter
IsStatic bool
IsSignal bool
}
func IsArgcArgv(params []CppParameter) bool {