genbindings: move AllowClass from parse-time to transformation AST pass

This exposes some more valid types.
This commit is contained in:
mappu 2024-10-26 12:08:36 +13:00
parent 2fa853d836
commit c1b31e787b
2 changed files with 17 additions and 5 deletions

View File

@ -212,11 +212,6 @@ func processClassType(node map[string]interface{}, addNamePrefix string) (CppCla
log.Printf("-> Processing class %q...\n", nodename)
// Also skip over any custom exceptions
if !AllowClass(nodename) {
return CppClass{}, ErrNoContent
}
// Skip over forward class declarations
// This is determined in two ways:
// 1. If the class has no inner nodes

View File

@ -4,6 +4,23 @@ package main
// and entire classes that may be disallowed.
func astTransformBlocklist(parsed *CppParsedHeader) {
// Whole-classes
j := 0
for _, c := range parsed.Classes {
if !AllowClass(c.ClassName) {
continue
}
// Keep
parsed.Classes[j] = c
j++
}
parsed.Classes = parsed.Classes[:j] // reslice
// For the kept classes, filter ctors and methods within the class, based
// on the parameter types and return types
for i, c := range parsed.Classes {
// Constructors