diff options
author | KillTheMule <KillTheMule@users.noreply.github.com> | 2018-05-21 21:40:51 +0200 |
---|---|---|
committer | KillTheMule <KillTheMule@users.noreply.github.com> | 2018-05-23 22:07:27 +0200 |
commit | 2ca62239675b0c1e68b01aae1a0d45567b15e319 (patch) | |
tree | 12ed475342c63c3825f1e892a2ffa725a0a93149 | |
parent | 333679ad0ea6cb387debeae37645ecc0a830de25 (diff) | |
download | rneovim-2ca62239675b0c1e68b01aae1a0d45567b15e319.tar.gz rneovim-2ca62239675b0c1e68b01aae1a0d45567b15e319.tar.bz2 rneovim-2ca62239675b0c1e68b01aae1a0d45567b15e319.zip |
API: Accept empty lists as dictionaries
-rw-r--r-- | src/nvim/generators/gen_api_dispatch.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua index 2ee1e5d4c5..15fcafb584 100644 --- a/src/nvim/generators/gen_api_dispatch.lua +++ b/src/nvim/generators/gen_api_dispatch.lua @@ -223,6 +223,11 @@ for i = 1, #functions do output:write('\n } else if (args.items['..(j - 1)..'].type == kObjectTypeInteger && args.items['..(j - 1)..'].data.integer >= 0) {') output:write('\n '..converted..' = (handle_T)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) {') + output:write('\n '..converted..' = (Dictionary)ARRAY_DICT_INIT;') + end output:write('\n } else {') output:write('\n api_set_error(error, kErrorTypeException, "Wrong type for argument '..j..', expecting '..param[1]..'");') output:write('\n goto cleanup;') |