mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-14 13:38:31 +01:00
cpp2ffi: add destructors location info and realdestructor field
This commit is contained in:
@@ -802,13 +802,26 @@ end
|
|||||||
local function ADDdestructors(FP)
|
local function ADDdestructors(FP)
|
||||||
local defsT = FP.defsT
|
local defsT = FP.defsT
|
||||||
local newcdefs = {}
|
local newcdefs = {}
|
||||||
--TODO add constructor = true
|
|
||||||
|
local keep_dest_locat = {}
|
||||||
|
--first get destructor locations
|
||||||
|
for numcdef,t in ipairs(FP.funcdefs) do
|
||||||
|
if t.cimguiname then
|
||||||
|
local defT = defsT[t.cimguiname]
|
||||||
|
if not defT[1].ret and not defT[1].constructor then --if constructor not processed
|
||||||
|
if defT[1].funcname:match("~") then
|
||||||
|
keep_dest_locat[defT[1].stname] = defT[1].location
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
assert(false,"no cimguiname")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for numcdef,t in ipairs(FP.funcdefs) do
|
for numcdef,t in ipairs(FP.funcdefs) do
|
||||||
newcdefs[#newcdefs+1] = t
|
newcdefs[#newcdefs+1] = t
|
||||||
if t.cimguiname then
|
if t.cimguiname then
|
||||||
local defT = defsT[t.cimguiname]
|
local defT = defsT[t.cimguiname]
|
||||||
--local defT = cimf[t.signature]
|
|
||||||
--for fname,defT in pairs(FP.defsT) do
|
|
||||||
if not defT[1].ret and not defT[1].constructor then --if constructor not processed
|
if not defT[1].ret and not defT[1].constructor then --if constructor not processed
|
||||||
if defT[1].funcname:match("~") then
|
if defT[1].funcname:match("~") then
|
||||||
defsT[t.cimguiname] = nil --clear destructor
|
defsT[t.cimguiname] = nil --clear destructor
|
||||||
@@ -824,10 +837,12 @@ local function ADDdestructors(FP)
|
|||||||
local def = {}
|
local def = {}
|
||||||
def.stname = defT[1].stname
|
def.stname = defT[1].stname
|
||||||
def.templated = defT[1].templated
|
def.templated = defT[1].templated
|
||||||
|
def.location = keep_dest_locat[defT[1].stname]
|
||||||
def.ret = "void"
|
def.ret = "void"
|
||||||
def.ov_cimguiname = def.stname.."_destroy"
|
def.ov_cimguiname = def.stname.."_destroy"
|
||||||
def.cimguiname = def.ov_cimguiname
|
def.cimguiname = def.ov_cimguiname
|
||||||
def.destructor = true
|
def.destructor = true
|
||||||
|
def.realdestructor = def.location and true
|
||||||
def.args = "("..def.stname.."* self)"
|
def.args = "("..def.stname.."* self)"
|
||||||
def.call_args = "(self)"
|
def.call_args = "(self)"
|
||||||
def.signature = "("..def.stname.."*)"
|
def.signature = "("..def.stname.."*)"
|
||||||
|
Reference in New Issue
Block a user