aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators/gen_api_dispatch.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/generators/gen_api_dispatch.lua')
-rw-r--r--src/nvim/generators/gen_api_dispatch.lua33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua
index 04b4363e42..62c99ce082 100644
--- a/src/nvim/generators/gen_api_dispatch.lua
+++ b/src/nvim/generators/gen_api_dispatch.lua
@@ -259,8 +259,12 @@ put('version')
fixdict(1 + #version)
for _, item in ipairs(version) do
-- NB: all items are mandatory. But any error will be less confusing
- -- with placholder vim.NIL (than invalid mpack data)
- put(item[1], item[2] or vim.NIL)
+ -- with placeholder vim.NIL (than invalid mpack data)
+ local val = item[2]
+ if val == nil then
+ val = vim.NIL
+ end
+ put(item[1], val)
end
put('build', version_build)
@@ -716,23 +720,6 @@ end
-- start building lua output
output = assert(io.open(lua_c_bindings_outputf, 'wb'))
-output:write([[
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-
-#include "nvim/ex_docmd.h"
-#include "nvim/ex_getln.h"
-#include "nvim/func_attr.h"
-#include "nvim/globals.h"
-#include "nvim/api/private/defs.h"
-#include "nvim/api/private/helpers.h"
-#include "nvim/api/private/dispatch.h"
-#include "nvim/lua/converter.h"
-#include "nvim/lua/executor.h"
-#include "nvim/memory.h"
-
-]])
include_headers(output, headers)
output:write('\n')
@@ -913,7 +900,7 @@ exit_0:
write_shifted_output(string.format(
[[
if (lua_gettop(lstate) == 0) {
- nlua_push_%s(lstate, %sret, true);
+ nlua_push_%s(lstate, %sret, kNluaPushSpecial | kNluaPushFreeRefs);
}
]],
return_type,
@@ -927,10 +914,10 @@ exit_0:
else
local special = (fn.since ~= nil and fn.since < 11)
write_shifted_output(
- ' nlua_push_%s(lstate, %sret, %s);\n',
+ ' nlua_push_%s(lstate, %sret, %s | kNluaPushFreeRefs);\n',
return_type,
ret_mode,
- tostring(special)
+ special and 'kNluaPushSpecial' or '0'
)
end
@@ -975,8 +962,6 @@ end
output:write(string.format(
[[
void nlua_add_api_functions(lua_State *lstate)
- REAL_FATTR_NONNULL_ALL;
-void nlua_add_api_functions(lua_State *lstate)
{
lua_createtable(lstate, 0, %u);
]],