IDL: Fixed functions that require _this.

This commit is contained in:
Бранимир Караџић
2019-07-05 08:19:45 -07:00
parent 4a96919315
commit 6c022fcc58
3 changed files with 73 additions and 58 deletions

View File

@@ -401,7 +401,7 @@ function codegen.nameconversion(all_types, all_funcs)
end
local classtype = { fulltype = classname .. "*" }
convert_arg(all_types, classtype, v)
v.this = classtype.ctype .. " _this"
v.this = classtype.ctype
v.this_conversion = string.format( "%s This = (%s)_this;", classtype.cpptype, classtype.cpptype)
v.this_to_c = string.format("(%s)this", classtype.ctype)
end
@@ -446,7 +446,7 @@ local function codetemp(func)
if func.class then
-- It's a member function
cargs[1] = func.this
cargs[1] = func.this .. " _this"
conversion[1] = func.this_conversion
cppfunc = "This->" .. func.name
callargs[1] = "_this"

View File

@@ -272,6 +272,21 @@ function converter.funcs(func)
local first = ""
local args = "("
if func.this ~= nil then
local thisType = func.this:gsub("const ", "")
if thisType == "bgfx_encoder_t*" then
thisType = "Encoder*"
elseif thisType == "bgfx_attachment_t*" then
thisType = "Attachment*"
elseif thisType == "bgfx_vertex_decl_t*" then
thisType = "VertexDecl*"
end
args = args .. thisType .. " " .. "_this"
first = ", "
end
for _, arg in ipairs(func.args) do
local argtype = convert_type(arg)