mirror of
https://github.com/mappu/miqt.git
synced 2025-01-03 14:18:37 +00:00
genbindings: skip over more forward-declared classes in headers
This commit is contained in:
parent
b89aeb2aa7
commit
5db5c98bc3
@ -7,11 +7,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseHeader(inner []interface{}) (*CppParsedHeader, error) {
|
func parseHeader(topLevel []interface{}) (*CppParsedHeader, error) {
|
||||||
|
|
||||||
var ret CppParsedHeader
|
var ret CppParsedHeader
|
||||||
|
|
||||||
for _, node := range inner {
|
for _, node := range topLevel {
|
||||||
|
|
||||||
node, ok := node.(map[string]interface{})
|
node, ok := node.(map[string]interface{})
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -34,8 +34,21 @@ func parseHeader(inner []interface{}) (*CppParsedHeader, error) {
|
|||||||
|
|
||||||
fmt.Printf("-> %q name=%q\n", kind, nodename)
|
fmt.Printf("-> %q name=%q\n", kind, nodename)
|
||||||
|
|
||||||
if _, ok := node["inner"]; !ok {
|
// Skip over forward class declarations
|
||||||
continue // Forward class declaration only, do not include
|
// This is determined in two ways:
|
||||||
|
// 1. If the class has no inner nodes
|
||||||
|
nodeInner, ok := node["inner"].([]interface{})
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. If this class has only one `inner` entry that's a VisibilityAttr
|
||||||
|
if len(nodeInner) == 1 {
|
||||||
|
if node, ok := nodeInner[0].(map[string]interface{}); ok {
|
||||||
|
if kind, ok := node["kind"].(string); ok && kind == "VisibilityAttr" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the inner class definition
|
// Process the inner class definition
|
||||||
@ -150,7 +163,7 @@ nextMethod:
|
|||||||
return CppClass{}, errors.New("inner[] element not an object")
|
return CppClass{}, errors.New("inner[] element not an object")
|
||||||
}
|
}
|
||||||
|
|
||||||
kind, ok := node["kind"]
|
kind, ok := node["kind"].(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic("inner element has no kind")
|
panic("inner element has no kind")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user