genbindings: skip generating ctors for abstract classes

This commit is contained in:
mappu 2024-08-10 12:53:48 +12:00
parent c06acd0a1b
commit 012b62ee06

View File

@ -68,6 +68,17 @@ func processClassType(node map[string]interface{}, className string) (CppClass,
if tagUsed, ok := node["tagUsed"].(string); ok && tagUsed == "class" { if tagUsed, ok := node["tagUsed"].(string); ok && tagUsed == "class" {
visibility = false visibility = false
} }
// Check if this is an abstract class
if definitionData, ok := node["definitionData"].(map[string]interface{}); ok {
if isAbstract, ok := definitionData["isAbstract"].(bool); ok && isAbstract {
ret.Abstract = true
}
}
// Parse all methods
nextMethod: nextMethod:
for _, node := range inner { for _, node := range inner {
node, ok := node.(map[string]interface{}) node, ok := node.(map[string]interface{})
@ -105,6 +116,10 @@ nextMethod:
case "CXXConstructorDecl": case "CXXConstructorDecl":
if ret.Abstract {
continue // The bindings can't construct an abstract class
}
var mm CppMethod var mm CppMethod
err := parseMethod(node, &mm) err := parseMethod(node, &mm)