mirror of
https://github.com/neovim/neovim.git
synced 2026-07-31 04:39:07 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user