cpp2ffi: correct embeded_structs for untagged structs (ImNodes needs that)

This commit is contained in:
sonoro1234
2023-09-12 10:02:06 +02:00
parent 935ca882ec
commit 5140ea5c81

View File

@@ -1669,9 +1669,10 @@ function M.Parser()
end
end
if it.parent then --and (it.parent.re_name == "struct_re" or it.parent.re_name == "typedef_st_re" then
local embededst = (it.re_name == "struct_re" and it.item:match("struct%s+(%S+)"))
local embededst = (it.re_name == "struct_re" and it.item:match("struct%s+([^%s{]+)"))
or (it.re_name == "typedef_st_re" and it.item:match("%b{}%s*(%S+)%s*;"))
--TODO nesting namespace and class
if embededst then --discards false which can happen with untagged structs
local parname = get_parents_name(it)
if it.parent.re_name == "struct_re" then
--needed by cimnodes with struct tag name equals member name
@@ -1680,6 +1681,7 @@ function M.Parser()
self.embeded_structs[embededst] = parname..embededst
end
end
end
elseif it.re_name == "namespace_re" or it.re_name == "union_re" or it.re_name == "functype_re" then
--nop
elseif it.re_name == "functionD_re" or it.re_name == "function_re" then