build(api): unused labels in generated Lua bindings #40880

Problem:
Generated API bindings for Lua contain unused jump labels when the API
function has a non-KeyDict (e.g., Array) param after a KeyDict param, causing
the build to fail.

Solution:
Don't output a label when the current parameter is not a KeyDict but the
previous one is.
This commit is contained in:
dqnne
2026-07-21 12:53:41 +02:00
committed by GitHub
parent 08cfbb8f37
commit a71ee754ee

View File

@@ -952,7 +952,9 @@ local function process_function(fn)
for i = 1, #free_code do
local rev_i = #free_code - i + 1
local code = free_code[rev_i]
if i == 1 and not real_type(fn.parameters[1][1]):match('^KeyDict_') then
local cur_is_keydict = real_type(fn.parameters[i][1]):match('^KeyDict_')
local prev_is_keydict = i > 1 and real_type(fn.parameters[i - 1][1]):match('^KeyDict_')
if not cur_is_keydict and (i == 1 or prev_is_keydict) then
free_at_exit_code = free_at_exit_code .. ('\n%s'):format(code)
else
free_at_exit_code = free_at_exit_code .. ('\nexit_%u:\n%s'):format(rev_i, code)