From ed6230434b2b0a07ece03272b871412929bfcb53 Mon Sep 17 00:00:00 2001 From: Yatao Li Date: Thu, 5 Mar 2020 15:51:02 +0800 Subject: gen_api_dispatch.lua: allow msgpack int for Float args; test: add ui_pum_set_bounds and tv_dict_add_float tests --- src/nvim/generators/gen_api_dispatch.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/generators/gen_api_dispatch.lua') diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua index e861cfda35..6e80ad0e5c 100644 --- a/src/nvim/generators/gen_api_dispatch.lua +++ b/src/nvim/generators/gen_api_dispatch.lua @@ -237,6 +237,12 @@ for i = 1, #functions do (j - 1)..'].type == kObjectTypeInteger && args.items['..(j - 1)..'].data.integer >= 0) {') output:write('\n '..converted..' = (handle_T)args.items['..(j - 1)..'].data.integer;') end + if rt:match('^Float$') then + -- accept integers for Floats + output:write('\n } else if (args.items['.. + (j - 1)..'].type == kObjectTypeInteger) {') + output:write('\n '..converted..' = (Float)args.items['..(j - 1)..'].data.integer;') + end -- accept empty lua tables as empty dictionarys if rt:match('^Dictionary') then output:write('\n } else if (args.items['..(j - 1)..'].type == kObjectTypeArray && args.items['..(j - 1)..'].data.array.size == 0) {') --luacheck: ignore 631 -- cgit