aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
Commit message (Collapse)AuthorAge
...
| * refactor(api): new helper macrosFamiu Haque2023-05-23
| | | | | | | | Adds new API helper macros `CSTR_AS_OBJ()`, `STATIC_CSTR_AS_OBJ()`, and `STATIC_CSTR_TO_OBJ()`, which cleans up a lot of the current code. These macros will also be used extensively in the upcoming option refactor PRs because then API Objects will be used to get/set options. This PR also modifies pre-existing code to use old API helper macros like `CSTR_TO_OBJ()` to make them cleaner.
| * refactor(map): avoid duplicated khash_t types for valuesbfredl2023-05-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reduces the total number of khash_t instantiations from 22 to 8. Make the khash internal functions take the size of values as a runtime parameter. This is abstracted with typesafe Map containers which are still specialized for both key, value type. Introduce `Set(key)` type for when there is no value. Refactor shada.c to use Map/Set instead of khash directly. This requires `map_ref` operation to be more flexible. Return pointers to both key and value, plus an indicator for new_item. As a bonus, `map_key` is now redundant. Instead of Map(cstr_t, FileMarks), use a pointer map as the FileMarks struct is humongous. Make `event_strings` actually work like an intern pool instead of wtf it was doing before.
| * test(old): remove python2 tests (#23547)zeertzjq2023-05-09
| | | | | | Because python2 provider is no longer supported.
| * vim-patch:8.2.2459: Coverity reports dead code (#23531)zeertzjq2023-05-08
| | | | | | | | | | | | | | | | Problem: Coverity reports dead code. Solution: Remove the dead code. https://github.com/vim/vim/commit/8bead9a058907e7f10ad25893d8475d2d9dd173c Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.0904: various comment and indent flaws (#23498)zeertzjq2023-05-06
| | | | | | | | | | | | | | | | | | | | | | Problem: Various comment and indent flaws. Solution: Improve comments and indenting. https://github.com/vim/vim/commit/88456cd3c49a3dd1fda17cf350daa9b8216b1aa6 Omit test_function_lists.vim change as that file is likely not applicable to Nvim due to the existence of Nvim-only functions. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.1508: catch does not work when lines are joined with a newlinezeertzjq2023-05-06
| | | | | | | | | | | | | | Problem: Catch does not work when lines are joined with a newline. Solution: Set "nextcmd" appropriately. (closes vim/vim#12348) https://github.com/vim/vim/commit/f2588b6fc90ba85b333ee8f747e8d1ebbc7e6300
| * vim-patch:8.2.2141: a user command with try/catch may not catch an ↵zeertzjq2023-05-06
| | | | | | | | | | | | | | | | | | | | | | expression error Problem: A user command with try/catch may not catch an expression error. Solution: When an expression fails check for following "|". (closes vim/vim#7469) https://github.com/vim/vim/commit/8143a53c533bc7776c57e5db063d185bdd5750f3 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.2094: when an expression fails getting next command may be wrongzeertzjq2023-05-06
| | | | | | | | | | | | | | | | | | Problem: When an expression fails getting the next command may be wrong. Solution: Do not check for a next command after :eval fails. (closes vim/vim#7415) https://github.com/vim/vim/commit/d0fe620cbbf5f5e00446efa89893036265c5c302 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.4890: inconsistent capitalization in error messageszeertzjq2023-05-05
| | | | | | | | | | | | | | | | | | Problem: Inconsistent capitalization in error messages. Solution: Make capitalization consistent. (Doug Kearns) https://github.com/vim/vim/commit/cf030578b26460643dca4a40e7f2e3bc19c749aa Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1697: inconsistent capitalization of error messages (#23476)zeertzjq2023-05-04
| | | | | | | | | | | | | | | | | | | | Problem: Inconsistent capitalization of error messages. Solution: Always start with a capital. https://github.com/vim/vim/commit/7707228aace9aff16434edf5377a354c6ad07316 Most of these errors are Vim9 script only. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.2756: Vim9: blob index and slice not implemented yetzeertzjq2023-05-04
| | | | | | | | | | | | | | | | | | Problem: Vim9: blob index and slice not implemented yet. Solution: Implement blob index and slice. https://github.com/vim/vim/commit/cfc3023cb6ce5aaec13f49bc4b821feb05e3fb03 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.2344: using inclusive index for slice is not always desiredzeertzjq2023-05-04
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Using inclusive index for slice is not always desired. Solution: Add the slice() method, which has an exclusive index. (closes vim/vim#7408) https://github.com/vim/vim/commit/6601b62943a19d4f8818c3638440663d67a17b6a Cherry-pick a line in docs added later. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1466: Vim9: cannot index or slice a variable with type "any"zeertzjq2023-05-04
| | | | | | | | | | | | | | | | | | | | | | Problem: Vim9: cannot index or slice a variable with type "any". Solution: Add runtime index and slice. https://github.com/vim/vim/commit/cc673e746ab98566556ff964d7a76f2fb46d7f84 Missing changes from the last PR. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1462: Vim9: string slice not supported yetzeertzjq2023-05-04
| | | | | | | | | | | | | | | | | | Problem: Vim9: string slice not supported yet. Solution: Add support for string slicing. https://github.com/vim/vim/commit/11107bab7ead9124f46a7ddf6aa3bb66b43a8246 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1461: Vim9: string indexes are counted in byteszeertzjq2023-05-04
| | | | | | | | | | | | | | | | | | Problem: Vim9: string indexes are counted in bytes. Solution: Use character indexes. (closes vim/vim#6574) https://github.com/vim/vim/commit/e3c37d8ebf9dbbf210fde4a5fb28eb1f2a492a34 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1466: Vim9: cannot index or slice a variable with type "any"zeertzjq2023-05-04
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Vim9: cannot index or slice a variable with type "any". Solution: Add runtime index and slice. https://github.com/vim/vim/commit/cc673e746ab98566556ff964d7a76f2fb46d7f84 Omit E1024 and E1062: Vim9 script only. Omit string_slice() and char_idx2byte(): Vim9 script only. Remove the first tv_is_luafunc() check because it always returns false. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1463: Vim9: list slice not supported yetzeertzjq2023-05-04
| | | | | | | | | | | | | | | | | | Problem: Vim9: list slice not supported yet. Solution: Add support for list slicing. https://github.com/vim/vim/commit/ed5918771fcf9877d8445e74c62ab1ce6b8e28c1 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.0987: Vim9: cannot assign to [var; var]zeertzjq2023-05-04
| | | | | | | | | | | | | | | | | | Problem: Vim9: cannot assign to [var; var]. Solution: Assign rest of items to a list. https://github.com/vim/vim/commit/9af78769eeae0318e07aa8b6af4d6e2244481ca7 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * refactor: uncrustifydundargoc2023-04-26
| | | | | | | | Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`.
| * fix(timer): allow timer_info() to get info about current timerzeertzjq2023-04-25
| |
| * vim-patch:9.0.0335: checks for Dictionary argument often give a vague error ↵zeertzjq2023-04-25
| | | | | | | | | | | | | | | | | | | | | | | | (#23309) Problem: Checks for Dictionary argument often give a vague error message. Solution: Give a useful error message. (Yegappan Lakshmanan, closes vim/vim#11009) https://github.com/vim/vim/commit/04c4c5746e15884768d2cb41370c3276a196cd4c Cherry-pick removal of E922 from docs from patch 9.0.1403. Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * refactor(eval): use tv_list_append_allocated_string()zeertzjq2023-04-19
| |
| * vim-patch:8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'zeertzjq2023-04-17
| | | | | | | | | | | | | | | | | | Problem: Cannot use an import in the "expr" part of 'spellsuggest'. Solution: Set the script context when evaluating "expr" of 'spellsuggest'. https://github.com/vim/vim/commit/2a7aa834583dea157eccf3e69827d2ff1d9fe9c7 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.4193: cannot use an import in 'charconvert'zeertzjq2023-04-17
| | | | | | | | | | | | | | | | | | | | Problem: Cannot use an import in 'charconvert'. Solution: Set the script context when evaluating 'charconvert'. Also expand script-local functions in 'charconvert'. https://github.com/vim/vim/commit/f4e88f2152c5975a6f4cfa7ccd745575fe4d1c78 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.4186: cannot use an import in 'patchexpr'zeertzjq2023-04-17
| | | | | | | | | | | | | | | | | | | | Problem: Cannot use an import in 'patchexpr'. Solution: Set the script context when evaluating 'patchexpr'. Do not require 'patchexpr' to return a bool, it was ignored anyway. https://github.com/vim/vim/commit/36c2add7f82bc5dbbfc45db31953ef9633c635b3 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.4182: memory leak when evaluating 'diffexpr'zeertzjq2023-04-17
| | | | | | | | | | | | | | | | | | Problem: Memory leak when evaluating 'diffexpr'. Solution: Use free_tv() instead of clear_tv(). https://github.com/vim/vim/commit/39b8944539a9cde553fe709e535fdfd37d0f9307 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.4181: Vim9: cannot use an import in 'diffexpr'zeertzjq2023-04-17
| | | | | | | | | | | | | | | | | | | | Problem: Vim9: cannot use an import in 'diffexpr'. Solution: Set the script context when evaluating 'diffexpr'. Do not require 'diffexpr' to return a bool, it was ignored anyway. https://github.com/vim/vim/commit/7b29f6a3949743914f08410b6f6bd6237c2f2038 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.1145: invalid memory access with recursive substitute ↵zeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | | | expression (#23132) Problem: Invalid memory access with recursive substitute expression. Solution: Check the return value of vim_regsub(). https://github.com/vim/vim/commit/3ac1d97a1d9353490493d30088256360435f7731 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.0398: members of funccall_T are inconsistently named (#23123)zeertzjq2023-04-16
| | | | | | | | | | | | | | | | Problem: Members of funccall_T are inconsistently named. Solution: Use the "fc_" prefix for all members. https://github.com/vim/vim/commit/ca16c60f337ed33d5dd66a6e90aaf95b619c5e47 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.3783: confusing error for using a variable as a functionzeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | | | Problem: Confusing error for using a variable as a function. Solution: If a function is not found but there is a variable, give a more useful error. (issue vim/vim#9310) https://github.com/vim/vim/commit/2ef9156b4284e4a52613c36e3d4667245273a28d Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.2978: warning for uninitialized variablezeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | Problem: Warning for uninitialized variable. Solution: Set return value to FAIL. https://github.com/vim/vim/commit/744aecf8777e86fac6d30f072e90e2de353b8ea1 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.2977: crash when using a null function referencezeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | Problem: Crash when using a null function reference. (Naohiro Ono) Solution: Check for an invalid function name. (closes vim/vim#8367) https://github.com/vim/vim/commit/22db0d549f64aa3d8a6e366b70eb8d7e66933b82 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.2848: crash whn calling partialzeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | Problem: Crash whn calling partial. Solution: Check for NULL pointer. (Dominique Pellé, closes vim/vim#8202) https://github.com/vim/vim/commit/fe8ebdbe5c4e116311c0c0d5937b89ded5c92d01 Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
| * refactor: deprecate checkhealth functionsdundargoc2023-04-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following functions are deprecated and will be removed in Nvim v0.11: - health#report_start() - health#report_info() - health#report_ok() - health#report_warn() - health#report_error() - vim.health.report_start() - vim.health.report_info() - vim.health.report_ok() - vim.health.report_warn() - vim.health.report_error() Users should instead use these: - vim.health.start() - vim.health.info() - vim.health.ok() - vim.health.warn() - vim.health.error()
| * vim-patch:9.0.0104: going beyond allocated memory when evaluating string ↵zeertzjq2023-04-15
| | | | | | | | | | | | | | | | | | | | | | constant Problem: Going beyond allocated memory when evaluating string constant. Solution: Properly skip over <Key> form. https://github.com/vim/vim/commit/1e56bda9048a9625bce6e660938c834c5c15b07d Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.4934: string interpolation fails when not evaluatingzeertzjq2023-04-15
| | | | | | | | | | | | | | | | | | Problem: String interpolation fails when not evaluating. Solution: Skip the expression when not evaluating. (closes vim/vim#10398) https://github.com/vim/vim/commit/70c41241c2701f26a99085e433925a206ca265a3 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.4930: interpolated string expression requires escapingzeertzjq2023-04-15
| | | | | | | | | | | | | | | | | | Problem: Interpolated string expression requires escaping. Solution: Do not require escaping in the expression. https://github.com/vim/vim/commit/0abc2871c105882ed1c1effb9a7757fad8a395bd Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.4883: string interpolation only works in heredoczeertzjq2023-04-15
| | | | | | | | | | | | | | | | | | | | | | | | Problem: String interpolation only works in heredoc. Solution: Support interpolated strings. Use syntax for heredoc consistent with strings, similar to C#. (closes vim/vim#10327) https://github.com/vim/vim/commit/2eaef106e4a7fc9dc74a7e672b5f550ec1f9786e Cherry-pick Test_Debugger_breakadd_expr() from Vim. Co-authored-by: LemonBoy <thatlemon@gmail.com>
| * vim-patch:8.2.1378: cannot put space between function name and parenzeertzjq2023-04-15
| | | | | | | | | | | | | | | | | | | | | | Problem: Cannot put space between function name and paren. Solution: Allow this for backwards compatibility. https://github.com/vim/vim/commit/bbd3e3c357487f7a5bdc704a819f63a7dd0dd66e This fixes a regression from patch 8.2.1365, which isn't ported yet. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.3329: v_lock not set when getting value of environment variablezeertzjq2023-04-15
| | | | | | | | | | | | | | | | | | Problem: v_lock not set when getting value of environment variable. Solution: Set v_lock to zero. https://github.com/vim/vim/commit/16e63e6d353c8b7337470644ceac02dc5e569db9 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1014: using "name" for a string result is confusingzeertzjq2023-04-15
| | | | | | | | | | | | | | | | | | Problem: Using "name" for a string result is confusing. Solution: Rename to "end". https://github.com/vim/vim/commit/1e0b7b11db61bd906266d3174fee0bbaf20a101f Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.0634: crash with null partial and blobzeertzjq2023-04-15
| | | | | | | | | | | | | | | | | | | | Problem: Crash with null partial and blob. Solution: Check for NULL pointer. Add more tests. (Yegappan Lakshmanan, closes vim/vim#5984) https://github.com/vim/vim/commit/92b83ccfda7a1d654ccaaf161a9c8a8e01fbcf76 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.0633: crash when using null partial in filter()zeertzjq2023-04-15
| | | | | | | | | | | | | | | | | | Problem: Crash when using null partial in filter(). Solution: Fix crash. Add more tests. (Yegappan Lakshmanan, closes vim/vim#5976) https://github.com/vim/vim/commit/9d8d0b5c644ea53364d04403740b3f23e57c1497 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1111: inconsistent naming of get_list_tv() and eval_dict() ↵zeertzjq2023-04-14
| | | | | | | | | | | | | | | | | | | | | | (#23086) Problem: Inconsistent naming of get_list_tv() and eval_dict(). Solution: Rename get_list_tv() to eval_list(). Similarly for eval_number(), eval_string(), eval_lit_string() and a few others. https://github.com/vim/vim/commit/9a78e6df17033223ebdf499f2b02b2538601c52d Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.1452: code using EVAL_CONSTANT is dead, it is never setzeertzjq2023-04-14
| | | | | | | | | | | | | | Problem: Code using EVAL_CONSTANT is dead, it is never set. Solution: Remove EVAL_CONSTANT. (closes vim/vim#12252) https://github.com/vim/vim/commit/b7f6f93475a3ad5c590a09a2577fd51590bea9e1
| * vim-patch:8.2.1794: no falsy Coalescing operatorzeertzjq2023-04-14
| | | | | | | | | | | | | | | | | | | | | | | | Problem: No falsy Coalescing operator. Solution: Add the "??" operator. Fix mistake with function argument count. https://github.com/vim/vim/commit/92f26c256e06277ff2ec4ce7adea1eb58c85abe0 Cherry-pick tv2bool() into eval/typval.c. Cherry-pick *??* tag from Vim runtime. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1512: failure after trinary expression failszeertzjq2023-04-14
| | | | | | | | | | | | | | | | | | Problem: Failure after trinary expression fails. Solution: Restore eval_flags. (Yasuhiro Matsumoto, closes vim/vim#6776) https://github.com/vim/vim/commit/69e44552c567ff25b363ba0790ad3d43fa0397a7 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1189: Vim9: line continuation in lambda doesn't always workzeertzjq2023-04-14
| | | | | | | | | | | | | | | | | | Problem: Vim9: line continuation in lambda doesn't always work. Solution: Do not use a local evalarg unless there isn't one. (closes vim/vim#6439) https://github.com/vim/vim/commit/8af81d656a4c501611f6211b6379ea9dd650c545 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.3216: Vim9: crash when using variable in a loop at script levelzeertzjq2023-04-14
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Vim9: crash when using variable in a loop at script level. Solution: Do not clear the variable if a function was defined. Do not create a new entry in sn_var_vals every time. (closes vim/vim#8628) https://github.com/vim/vim/commit/2eb6fc3b52148f961e804ec2be361d531ff770d8 Omit eval_cstack: Vim9 script only. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1203: unused assignments in expression evaluationzeertzjq2023-04-14
| | | | | | | | | | | | | | | | | | Problem: Unused assignments in expression evaluation. Solution: Move declarations and assignments to inner blocks where possible. https://github.com/vim/vim/commit/3ac9c4701a5f1e39303ca2885956db92215966db Co-authored-by: Bram Moolenaar <Bram@vim.org>