Commit Graph

7839 Commits

Author SHA1 Message Date
ZyX
e1bbaca7ac executor,functests: Add tests for :luado, also some fixes
Fixes:
1. Allocate space for the NUL byte.
2. Do not exclude last line from range.
3. Remove code for sandbox: it is handled earlier.
4. Fix index in new_line_transformed when converting NULs to NLs.
5. Always allocate new_line_transformed, but save allocated value.
2017-03-27 00:12:42 +03:00
ZyX
9114d9be77 executor: Add :luado command 2017-03-27 00:12:42 +03:00
ZyX
b4e2860c69 doc,functests: Add documentation
Missing: updates to various lists.
2017-03-27 00:12:42 +03:00
ZyX
7a5646d594 functests: Add tests for :lua 2017-03-27 00:12:42 +03:00
ZyX
3d48c35d6b ex_getln: Refactor script_get()
1. Use `char *` for strings.
2. Add `const` qualifiers.
3. Add attributes and documentation.
4. Handle skipping *inside*.
5. Handle non-heredoc argument also inside: deferring this to the caller is
   pointless because all callers need the same thing. Though new ex_lua caller
   may live without allocations in this case, allocating nevertheless produces
   cleaner code.
6. Note that all callers call script_get with `eap` and `eap->arg`. Thus second
   argument is useless in practice: it is one and the same always and can be
   reached through the first argument.
2017-03-27 00:12:42 +03:00
ZyX
3531d8c8ea executor: Add some const qualifiers 2017-03-27 00:12:23 +03:00
ZyX
872a909150 executor: Add :lua command
Does not work currently.
2017-03-27 00:12:23 +03:00
ZyX
62fde31936 api: Also shift numbers in api_metadata output
Fixes problem introduced by “api: Allow kObjectTypeNil to be zero without 
breaking compatibility”: apparently there are clients which use metadata and 
there are which aren’t. For the first that commit would not be needed, for the 
second that commit misses this critical piece.
2017-03-27 00:12:23 +03:00
ZyX
140cd0da1d functests: Fix “function has more then 60 upvalues” error 2017-03-27 00:12:23 +03:00
ZyX
d836464cd2 cmake: Also include luajit directories for libnvim target 2017-03-27 00:12:23 +03:00
ZyX
ae4adcc707 gendeclarations: Make declarations generator work with macros funcs
Now it checks functions also after every semicolon and closing figure brace, 
possibly preceded by whitespaces (tabs and spaces). This should make messing 
with declarations in macros not needed.
2017-03-27 00:12:23 +03:00
ZyX
52c7066f4b gendeclarations: Handle case when text did not match 2017-03-27 00:12:23 +03:00
ZyX
c470fc32a8 gendeclarations: Also save information about directory 2017-03-27 00:12:23 +03:00
ZyX
f74322b9a5 gendeclarations: Save where declaration is comping from 2017-03-27 00:12:23 +03:00
ZyX
9c743df2d5 cmake: Use LuaJIT include directory for declarations generator 2017-03-27 00:12:23 +03:00
ZyX
d60302d517 cmake: Link libnvim-test with luajit in place of lua, disable ASAN
Reasoning: luajit is not being compiled with sanitizers, lua is. Given that 
linking with sanitized libraries requires sanitizers enabled, it is needed to 
either compile libnvim-test with sanitizers or link it with lua compiled without 
sanitizers. Most easy way to do the latter is just use luajit which is compiled 
without sanitizers (as they do not work well with luajit).
2017-03-27 00:12:23 +03:00
ZyX
d5228787ce deps: Always build lua with -fPIC and -O0 2017-03-27 00:12:23 +03:00
ZyX
d33b13dd6b cmake: Try fixing ASAN nvim-test compilation 2017-03-27 00:12:23 +03:00
ZyX
c5a2124e81 ci: When building lua use -fPIC 2017-03-27 00:12:23 +03:00
ZyX
22d3ce9c29 msgpack_rpc: Fix #HANDLE_TYPE_CONVERSION_IMPL
Function declarations generator is able to handle properly only the *first* 
function definition that is in macros, and only if it is the first entity in the 
macros. So msgpack_rpc_from_* was already really a static function, additionally 
its attributes were useless. This commit switches to explicit declarations and 
makes generated functions static.
2017-03-27 00:12:23 +03:00
ZyX
927e6efc3d clint: Allow omitting include guards in .c.h file and func_attr.h file 2017-03-27 00:12:23 +03:00
ZyX
ca4c8b7f8a api: Allow kObjectTypeNil to be zero without breaking compatibility 2017-03-27 00:12:23 +03:00
ZyX
6b4a51f7ea scripts: Make generate_vim_module more generic 2017-03-27 00:12:23 +03:00
ZyX
8fec4d53d0 ci: Make ASAN build link with lua, build lua with address sanitizer 2017-03-27 00:12:23 +03:00
ZyX
1646a28173 cmake: Allow switching from luajit to lua 2017-03-27 00:12:23 +03:00
ZyX
666d85d3ce functests: Some more tests 2017-03-27 00:12:22 +03:00
ZyX
53b89c1dcf executor/executor: Free lcmd on error 2017-03-27 00:12:22 +03:00
ZyX
bca9c2f3c4 functests: Move existing tests from lua_spec to lua/*, fix them 2017-03-27 00:12:22 +03:00
ZyX
f8d55266e4 executor/executor: When reporting errors use lua string length 2017-03-27 00:12:22 +03:00
ZyX
600bee9d4f genmsgpack: Include error source in error messages 2017-03-27 00:12:22 +03:00
ZyX
45feaa73d0 eval/decode: Fix memory leak in JSON functions 2017-03-27 00:12:22 +03:00
ZyX
a3ea05c1e5 functests: Add some tests 2017-03-27 00:12:22 +03:00
ZyX
8679feb3cb executor/converter: Use readable lua numbers for handles 2017-03-27 00:11:29 +03:00
ZyX
5c1b9a0d2a api: Reserve more numbers for internal calls
Reasoning; currently INTERNAL_CALL is mostly used to determine whether it is 
needed to deal with NL-used-as-NUL problem. This code is useful for nvim_… API 
calls done from VimL, but not for API calls done from lua, yet lua needs to 
supply something as channel_id.
2017-03-27 00:11:28 +03:00
ZyX
d932693d51 executor/converter: Allow converting self-referencing lua objects 2017-03-27 00:11:28 +03:00
ZyX
ba2f615cd4 functests: Test for error conditions
During testing found the following bugs:

1. msgpack-gen.lua script is completely unprepared for Float values either in 
   return type or in arguments. Specifically:

   1. At the time of writing relevant code FLOAT_OBJ did not exist as well as 
      FLOATING_OBJ, but it would be used by msgpack-gen.lua should return type 
      be Float. I added FLOATING_OBJ macros later because did not know that 
      msgpack-gen.lua uses these _OBJ macros, otherwise it would be FLOAT_OBJ.
   2. msgpack-gen.lua should use .data.floating in place of .data.float. But it 
      did not expect that .data subattribute may have name different from 
      lowercased type name.

2. vim_replace_termcodes returned its argument as-is if it receives an empty 
   string (as well as _vim_id*() functions did). But if something in returned 
   argument lives in an allocated memory such action will cause double free: 
   once when freeing arguments, then when freeing return value. It did not cause 
   problems yet because msgpack bindings return empty string as {NULL, 0} and 
   nothing was actually allocated.
3. New code in msgpack-gen.lua popped arguments in reversed order, making lua 
   bindings’ signatures be different from API ones.
2017-03-27 00:11:28 +03:00
ZyX
7a013e93e0 executor/converter: Make it possible to supply {} to Dictionary arg 2017-03-27 00:11:27 +03:00
ZyX
425d348f0f executor/converter: Make nlua_pop_Object not recursive 2017-03-27 00:11:27 +03:00
ZyX
9297d941e2 executor/converter: Fix how maxidx is determined 2017-03-27 00:11:27 +03:00
ZyX
3fa4ca8188 executor/converter: Fix conversion of self-containing containers 2017-03-27 00:11:26 +03:00
ZyX
ed3115bd26 executor: Make sure it works with API values 2017-03-27 00:11:25 +03:00
ZyX
a4dc8de073 *: Silence linter 2017-03-27 00:11:25 +03:00
ZyX
f551df17f3 viml/executor: Directly generate typval_T values
Note: this will *still* crash when using API in cases similar to the one
described in first commit. Just it needs different code to reproduce.
2017-03-27 00:11:24 +03:00
ZyX
e7bbd8256b eval: Add luaeval function
No tests yet, no documentation update, no :lua* stuff, no vim module.

converter.c should also work with typval_T, not Object.

Known problem: luaeval("1", {}) results in

    PANIC: unprotected error in call to Lua API (attempt to index a nil value)

Ref #3823
2017-03-27 00:11:24 +03:00
lonerover
f9a31e9850 vim-patch:7.4.2349 (#6368)
Problem:    Valgrind reports using uninitialzed memory. (Dominique Pelle)
Solution:   Check the length before checking for a NUL.

2321ca2a78
2017-03-26 19:04:57 +02:00
Yichao Zhou
43a99f77a8 highlight: :match should override 'list' (#6343)
Closes #4946
2017-03-26 13:04:20 +02:00
Justin M. Keyes
cf202b74db build: Do not ref libuv CMake target if USE_BUNDLED_LIBUV=OFF. (#6363)
CMake Warning: The dependency target "libuv" of target "luv-static" does
not exist. (CMP0046)

Closes #6355
2017-03-26 00:22:15 +01:00
Daniel Hahler
b60e5c85ad cmake: USE_BUNDLED_X instead of X_USE_BUNDLED (#6357) 2017-03-25 23:02:20 +01:00
Anmol Sethi
a346cb1d58 man.vim: call s:error in man#read_page (#6362)
The comment is incorrect, s:error does need to be called. I thought the
call was unnecessary because it didn't show any message for me but I had
shortmess+=F which was hiding the message.
2017-03-25 22:43:25 +01:00
Matthew Malcomson
098e91400e refactor: Remove allow_keys global (#6346)
* The allow_keys global is unused in nvim, remove it

* clint
2017-03-25 15:43:19 +01:00