aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
Commit message (Collapse)AuthorAge
* refactor: reformat with uncrustify #15736dundargoc2021-09-20
| | | | * fix function parameter comments * remove space after star in function names
* refactor: format with uncrustify #15726dundargoc2021-09-20
|
* refactor: convert TRUE/FALSE to true/false (#15660)dundargoc2021-09-18
|
* fix(eval): partially port v8.2.3284Sean Dewar2021-09-16
| | | | | | | | | | | | | These were issues that I found while porting that I fixed upstream. :^) Very little of the patch can be exactly ported as we're a bit behind on dependant patches (we also can't use the exact :for emsg, as we don't support iterating over Strings yet), so just translate the fixes as best as we can for now. Include latest relevant doc changes from: - v8.1.0815 - v8.2.2658
* vim-patch:8.2.2712: memory leak when adding to a blob failsSean Dewar2021-09-16
| | | | | | Problem: Memory leak when adding to a blob fails. Solution: Clear the second typval before returning. https://github.com/vim/vim/commit/f2dd9cb9958962302d33fab8fe6439645a2d1e1b
* vim-patch:8.2.1473: items in a list given to :const can still be modifiedSean Dewar2021-09-16
| | | | | | | Problem: Items in a list given to :const can still be modified. Solution: Work like ":lockvar! name" but don't lock referenced items. Make locking a blob work. https://github.com/vim/vim/commit/021bda56710d98c09a6b35610a476ab2dd8c58ad
* vim-patch:8.2.0829: filter() may give misleading error messageSean Dewar2021-09-15
| | | | | | | | | Problem: filter() may give misleading error message. Solution: Also mention Blob as an allowed argument. https://github.com/vim/vim/commit/fcb0b61d15f66f0e9116a6bc56d9d8105bb913cf Rename Test_map_fails() to Test_map_filter_fails() from v8.2.0610 and include the modeline.
* vim-patch:8.2.0121: filter() and map() on blob don't workSean Dewar2021-09-15
| | | | | | Problem: filter() and map() on blob don't work. Solution: Correct the code. (closes vim/vim#5483) https://github.com/vim/vim/commit/49c57ce50019b667e5005ce1cfb8cdc2e48bf868
* vim-patch:8.1.1023: may use NULL pointer when indexing a blobSean Dewar2021-09-15
| | | | | | Problem: May use NULL pointer when indexing a blob. (Coverity) Solution: Break out of loop after using index on blob https://github.com/vim/vim/commit/61be376337b0374d55a4b1d8206b2ec87ca54252
* vim-patch:8.1.0802: negative index doesn't work for BlobSean Dewar2021-09-15
| | | | | | | | Problem: Negative index doesn't work for Blob. Solution: Make it work, add a test. (closes vim/vim#3856) https://github.com/vim/vim/commit/a5be9b62480a6f338a72c01e57c9edd0bca8048b Leave tv_blob_get()'s return type untouched.
* vim-patch:8.1.0798: changing a blob while iterating over it works strangelySean Dewar2021-09-15
| | | | | | Problem: Changing a blob while iterating over it works strangely. Solution: Make a copy of the Blob before iterating. https://github.com/vim/vim/commit/dd29ea18050284526174b5685781469240f5bc4a
* vim-patch:8.1.0765: string format of a Blob can't be parsed backSean Dewar2021-09-15
| | | | | | Problem: String format of a Blob can't be parsed back. Solution: Use 0z format. https://github.com/vim/vim/commit/4131fd5509b283e978e8c6161f09643b64719787
* vim-patch:8.1.0756: copy() does not make a copy of a BlobSean Dewar2021-09-15
| | | | | | | | Problem: copy() does not make a copy of a Blob. Solution: Make a copy. https://github.com/vim/vim/commit/3d28b58c519c9fc3427587201423c74746cc219e Replace vim_memsave() with xmemdup().
* vim-patch:8.1.0738: using freed memory, for loop over blob leaks memorySean Dewar2021-09-15
| | | | | | | Problem: Using freed memory, for loop over blob leaks memory. Solution: Clear pointer after freeing memory. Decrement reference count after for loop over blob. https://github.com/vim/vim/commit/ecc8bc482ba601b9301a6c129c92a0d1f8527f72
* vim-patch:8.1.0736: code for Blob not sufficiently testedSean Dewar2021-09-15
| | | | | | | | | Problem: Code for Blob not sufficiently tested. Solution: Add more tests. Fix uncovered crash. Add test_null_blob(). https://github.com/vim/vim/commit/c0f5a78c15b194f23bedb82e6825e34f481e6532 eval0 and ex_echo's emsg-specific changes have already been ported. These tests uncover another crash that was fixed in v8.1.0738.
* vim-patch:8.1.0735: cannot handle binary dataSean Dewar2021-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Cannot handle binary data. Solution: Add the Blob type. (Yasuhiro Matsumoto, closes vim/vim#3638) https://github.com/vim/vim/commit/6e5ea8d2a995b32bbc5972edc4f827b959f2702f Nvim-specific Blob conversions are implemented in future commits. Refactor write_blob() to use a FileDescriptor, as f_writefile() was refactored to use one (does not apply to read_blob()). Use var_check_lock() in f_add() for Blobs from v8.1.0897. Add a modeline to test_blob.vim and fix some doc typos. Include if_perl.txt's VIM::Blob() documentation. Interestingly, this function already worked before this port, as it just returns a Blob string literal, not an actual Blob object. N/A patches for version.c: vim-patch:8.1.0741: viminfo with Blob is not tested Problem: Viminfo with Blob is not tested. Solution: Extend the viminfo test. Fix reading a blob. Fixed storing a special variable value. https://github.com/vim/vim/commit/8c8b8bb56c724cc1bfc3d8520eec33f2d399697c vim-patch:8.1.1022: may use NULL pointer when out of memory Problem: May use NULL pointer when out of memory. (Coverity) Solution: Check for blob_alloc() returning NULL. https://github.com/vim/vim/commit/e142a9467a7f6845a426d8db6efedf246d3c13ac
* vim-patch:8.1.1722: error when scriptversion is 2 a making a dictionary accessSean Dewar2021-09-11
| | | | | | | | | Problem: Error when scriptversion is 2 a making a dictionary access. Solution: Parse the subscript even when not evaluating the sub-expression. (closes vim/vim#4704) https://github.com/vim/vim/commit/61343f0c44c8e71df04918d033e0a744c0b7f8aa :scriptversion is N/A.
* vim-patch:8.1.1355: obvious mistakes are accepted as valid expressionsSean Dewar2021-09-11
| | | | | | | | | Problem: Obvious mistakes are accepted as valid expressions. Solution: Be more strict about parsing numbers. (Yasuhiro Matsumoto, closes vim/vim#3981) https://github.com/vim/vim/commit/16e9b85113e0b354ece1cb4f5fcc7866850f3685 Update vim_str2nr_spec.lua to add more tests that use strict = true.
* Merge #15293 Vimscript "method" syntaxJustin M. Keyes2021-08-26
|\ | | | | Port VimL's method call syntax - vim-patch:8.1.{1638,1800,1803,1807,1809,1816,1820,1821,1828,1834,1835,1861,1863,1878,1879,1888,1909,1911,1912}
| * feat(v:lua): support calling v:lua as a methodSean Dewar2021-08-13
| |
| * fix(eval_lambda): cherry-pick leak fix from v8.1.2107Sean Dewar2021-08-12
| | | | | | | | | | That patch also includes a test using test_refcount() for lambdas, but such test functions are N/A for Nvim.
| * vim-patch:8.1.1878: negative float before method not parsed correctlySean Dewar2021-08-12
| | | | | | | | | | | | Problem: Negative float before method not parsed correctly. Solution: Apply "!" and "-" in front of expression before using ->. https://github.com/vim/vim/commit/9cfe8f6e68de4bfb5942d84f4465de914a747b3f
| * vim-patch:8.1.1834: cannot use a lambda as a methodSean Dewar2021-08-12
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Cannot use a lambda as a method. Solution: Implement ->{lambda}(). (closes vim/vim#4768) https://github.com/vim/vim/commit/22a0c0c4ecd23b6c43f79ba9b92899ca0b426e29 Add an additional lua_funcname argument to call_func_rettv() to maintain support for v:lua. A memory leak was introduced with this patch that was fixed in v8.1.2107.
| * vim-patch:8.1.1828: not strict enough checking syntax of method invocationSean Dewar2021-08-12
| | | | | | | | | | | | Problem: Not strict enough checking syntax of method invocation. Solution: Check there is no white space inside ->method(. https://github.com/vim/vim/commit/5184132ec015f5889a3195d911e609d214f06bed
| * vim-patch:8.1.1820: using expr->FuncRef() does not workSean Dewar2021-08-12
| | | | | | | | | | | | Problem: Using expr->FuncRef() does not work. Solution: Make FuncRef work as a method. https://github.com/vim/vim/commit/761fdf01c6e307c448cec2684f8b315ba6d1f454
| * vim-patch:8.1.1816: cannot use a user defined function as a methodSean Dewar2021-08-12
| | | | | | | | | | | | | | Problem: Cannot use a user defined function as a method. Solution: Pass the base as the first argument to the user defined function after "->". (partly by FUJIWARA Takuya) https://github.com/vim/vim/commit/fcfe1a9b8950b8b211ab3b24d84b17c6847ea43f
| * vim-patch:8.1.1803: all builtin functions are globalSean Dewar2021-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: All builtin functions are global. Solution: Add the method call operator ->. Implemented for a limited number of functions. https://github.com/vim/vim/commit/ac92e25a33c37ec5becbfffeccda136c73b761ac - Note that to *exactly* port hunk @@ -7376,18 +7444,19 from handle_subscript(), we need the :scriptversion patches (I have an open PR for those, but this patch works fine without them anyway). - Port call_internal_func() from v7.4.2058. - Adjust some error messages in tests, as they rely on the Blob patches. - Add a modeline to test_method.vim. Ignore the global_functions and base_method tables and prefer the current GPerf implementation. Instead, add an extra base_arg field to VimLFuncDef that holds the number of the argument to use as the base (1-indexed, so that 0 may be used to refer to functions that cannot be used as methods). This also means we support using any argument as a base from the get-go, rather than just the first (Vim includes this ability in future patches, however). To mark a function as usable as a method, use the "base" key as described in eval.lua.
| * vim-patch:8.1.1800: function call functions have too many argumentsSean Dewar2021-08-12
| | | | | | | | | | | | | | | | | | | | Problem: Function call functions have too many arguments. Solution: Pass values in a funcexe_T struct. https://github.com/vim/vim/commit/c6538bcc1cdd1fb83732f22fdc69bd9bb66f968a Use FUNCEXE_INIT to initialize funcexe_T instances. call_callback() and other Vim listener related stuff is N/A.
| * fix(eval): cherry-pick emsg changes from v8.1.0736Sean Dewar2021-08-12
| | | | | | | | | | | | | | | | | | | | | | v8.1.0736 made some changes for making some emsgs more specific. Includes the change for Test_lambda_fails() in test_lambda.vim. Adjust relevant functionaltests to expect the new emsgs. This patch has been fully ported in my Blob port PR, but it hasn't been merged yet, so just use what we need from it for now. Required for v8.1.1821.
* | refactor(map): remove extra-allocating map_new/map_free functionsBjörn Linse2021-08-22
| | | | | | | | | | | | | | | | | | | | Note: the reason for removing them is not that there after this refactor is no use of them, but rather that having them available is an anti-pattern: they manange an _extra_ heap allocation which has nothing to do with the functionality of the map itself (khash manages the real buffers internally). In case there happens to be a reason to allocate the map structure itself later, this should be made explicit using xcalloc/xfree calls.
* | perf(map): reduce double pointer indirection to single pointer indirectionBjörn Linse2021-08-22
|/ | | | | the only field of Map(...) was a pointer to a khash_t. make it contain the struct by value instead.
* chore: use codespell to spell check #15016dundargoc2021-07-07
|
* vim-patch:8.1.0897: can modify a:000 when using a reference (#14902)Jan Edmund Lazo2021-06-26
| | | | | | Problem: Can modify a:000 when using a reference. Solution: Make check for locked variable stricter. (Ozaki Kiichi, closes vim/vim#3930) https://github.com/vim/vim/commit/05c00c038bc16e862e17f9e5c8d5a72af6cf7788
* vim-patch:8.2.1255: cannot use a lambda with quickfix functionsJan Edmund Lazo2021-06-23
| | | | | | Problem: Cannot use a lambda with quickfix functions. Solution: Add support for lambda. (Yegappan Lakshmanan, closes vim/vim#6499) https://github.com/vim/vim/commit/d43906d2e5969288f239df851f5ad7b1dc2c7251
* vim-patch:8.1.1437: code to handle callbacks is duplicatedJan Edmund Lazo2021-06-23
| | | | | | | | | | | | | Problem: Code to handle callbacks is duplicated. Solution: Add callback_T and functions to deal with it. https://github.com/vim/vim/commit/3a97bb3f0f8bd118ae23f1c97e55d84ff42eef20 Port Vim's put_callback() as callback_put() because Neovim's naming convention is {type}_{action}, not {action}_{type}. Renaming put_callback type as PutCallback. https://neovim.io/develop/style-guide.xml#Type_Names
* clang/API: reject null string in timer_start()Jan Edmund Lazo2021-06-02
|
* Merge remote-tracking branch 'origin/master' into qftfkevinhwang912021-05-20
|\
| * Remove '- 1' for sizes passed to xstrlcpyJan Edmund Lazo2021-05-19
| | | | | | | | | | | | | | | | xstrlcpy() NUL-terminates the destination string such that reducing the destination string length by 1 to reserve the last byte for NUL is pointless. https://github.com/neovim/neovim/pull/14490#discussion_r635661185
* | vim-patch:8.2.0869: it is not possible to customize the quickfix window contentskevinhwang912021-05-20
|/ | | | | | Problem: It is not possible to customize the quickfix window contents. Solution: Add 'quickfixtextfunc'. (Yegappan Lakshmanan, closes vim/vim#5465) https://github.com/vim/vim/commit/858ba06d5f577b187da0367b231f7fa9461cb32d
* vim-patch:8.0.1394: cannot intercept a yank commandJan Edmund Lazo2021-05-13
| | | | | | | Problem: Cannot intercept a yank command. Solution: Add the TextYankPost autocommand event. (Philippe Vaucher et al., closes vim/vim#2333) https://github.com/vim/vim/commit/7e1652c63c96585b9e2235c195a3c322b1f11595
* vim-patch:8.1.1967: line() only works for the current windowJan Edmund Lazo2021-05-12
| | | | | | Problem: Line() only works for the current window. Solution: Add an optional argument for the window to use. https://github.com/vim/vim/commit/8e0a8e7eb7c177807f44db6b76d8e52314248ab5
* Merge pull request #14403 from seandewar/vim-8.2.1933Jan Edmund Lazo2021-05-09
|\ | | | | vim-patch:8.2.{0174,1933,1935,1946,2286,2287}
| * eval: port v:collateSean Dewar2021-04-20
| | | | | | | | Cherry-picked from patch v8.2.0988. Required for patch v8.2.1933.
* | vim-patch:d1caa941d876Jan Edmund Lazo2021-04-27
| | | | | | | | | | | | | | Update runtime files https://github.com/vim/vim/commit/d1caa941d876181aae0ebebc6ea954045bf0da24 Cherry-pick error E452 from patch v8.2.0486.
* | vim-patch:8.2.2388: no easy way to get the maximum or mininum number valueJan Edmund Lazo2021-04-27
| | | | | | | | | | | | Problem: No easy way to get the maximum or mininum number value. Solution: Add v:numbermax and v:numbermin. https://github.com/vim/vim/commit/57d5a01cb45d6edb16c3835a49b42d6d8fc0163e
* | vim-patch:8.2.0296: mixing up "long long" and __int64 may cause problemsJan Edmund Lazo2021-04-27
|/ | | | | | | Problem: Mixing up "long long" and __int64 may cause problems. (John Marriott) Solution: Pass varnumber_T to vim_snprintf(). Add v:numbersize. https://github.com/vim/vim/commit/f9706e9df0e37d214fb08eda30ba29627e97a607
* vim-patch:8.2.2319: "exptype_T" can be read as "expected type"Jan Edmund Lazo2021-04-11
| | | | | | | | Problem: "exptype_T" can be read as "expected type". Solution: Rename to "exprtype_T", expression type. https://github.com/vim/vim/commit/657137ca487c60d63989236115115161def270a5 Vim9 changes omitted.
* vim-patch:8.2.0069: ETYPE_ is used for two different enumsJan Edmund Lazo2021-04-11
| | | | | | Problem: ETYPE_ is used for two different enums. Solution: Rename one to use EXPR_. https://github.com/vim/vim/commit/87396072c5c468f0c129e4ec7cd944ac897b7752
* vim-patch:8.2.0045: script test failsJan Edmund Lazo2021-04-11
| | | | | | Problem: Script test fails. Solution: For numbers "is" and "isnot" work like "==" and "!=". https://github.com/vim/vim/commit/ec57ec692eb228ee061824a190d7c451f029c430
* vim-patch:8.2.0044: expression type is used inconsistentlyJan Edmund Lazo2021-04-11
| | | | | | | Problem: Expression type is used inconsistently. Solution: Add "ETYPE_IS" and "ETYPE_ISNOT" as separate enum values. Rename "TYPE_" to "ETYPE_" to avoid confusion. https://github.com/vim/vim/commit/07a3db89b8953bd0964895badb3b662f7514bc10