Commit Graph

15 Commits

Author SHA1 Message Date
zeertzjq
ee89ba1d75
vim-patch:9.1.0182: Can define function with invalid name inside 'formatexpr' (#27883)
Problem:  Can define function with invalid name inside 'formatexpr'.
Solution: Use goto instead of checking for did_emsg later.
          (zeertzjq)

closes: vim/vim#14209

6a04bf5ee5
2024-03-16 17:26:14 +08:00
zeertzjq
9971bea6f1
vim-patch:9.0.2059: outstanding exceptions may be skipped (#25736)
Problem:  outstanding exceptions may be skipped
Solution: When restoring exception state, process remaining outstanding
          exceptions

closes: vim/vim#13386

0ab500dede

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-21 18:46:52 +08:00
zeertzjq
a096165977
vim-patch:9.0.2050: Vim9: crash with deferred function call and exception (#25715)
Problem:  Vim9: crash with deferred function call and exception
Solution: Save and restore exception state

Crash when a deferred function is called after an exception and another
exception is thrown

closes: vim/vim#13376
closes: vim/vim#13377

c59c1e0d88

The change in check_due_timer() is N/A as Nvim calls timer callbacks on
the main loop.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-19 18:34:48 +08:00
zeertzjq
9e3640a779 vim-patch:9.0.2044: Vim9: exceptions confuse defered functions
Problem:  Vim9: exceptions confuse defered functions
Solution: save and restore exception state when calling defered
          functions

closes: vim/vim#13364
closes: vim/vim#13372

0672595fd5

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-18 18:29:47 +08:00
zeertzjq
0d7bed34a2
vim-patch:9.0.1470: deferred functions invoked in unexpected order (#23199)
Problem:    Deferred functions invoked in unexpected order when using :qa and
            autocommands.
Solution:   Call deferred functions for the current funccal before using the
            stack. (closes vim/vim#12278)

1be4b81bfb
2023-04-19 22:09:48 +08:00
zeertzjq
a0c982671e vim-patch:9.0.1469: deferred functions not called from autocommands
Problem:    Deferred functions not called from autocommands.
Solution:   Also go through the funccal_stack. (closes vim/vim#12267)

960cf9119e
2023-04-19 08:09:46 +08:00
zeertzjq
a11849abdf vim-patch:9.0.1468: recursively calling :defer function if it does :qa
Problem:    Recursively calling :defer function if it does :qa in a compiled
            function.
Solution:   Clear the defer entry before calling the function. (closes vim/vim#12271)

a1f2b5ddc6
2023-04-19 08:09:46 +08:00
zeertzjq
8e0ad6e261 vim-patch:9.0.1462: recursively calling :defer function if it does :qa
Problem:    Recursively calling :defer function if it does :qa.
Solution:   Clear the defer entry before calling the function. (closes vim/vim#12266)

42994bf678

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 08:09:46 +08:00
zeertzjq
7a3f86481e vim-patch:9.0.0419: the :defer command does not check the function arguments
Problem:    The :defer command does not check the function argument count and
            types.
Solution:   Check the function arguments when adding a deferred function.

169003289f

Cherry-pick check_internal_func() from Vim, but use EvalFuncDef pointer
as first argument.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-17 09:38:09 +08:00
zeertzjq
6bfba3660c vim-patch:9.0.0406: deferred functions not invoked when partial func exits
Problem:    Deferred functions not invoked when partial func exits.
Solution:   Create a funccall_T when calling a :def function.

9667b2c888

The remove_funccal() function is currently unused, but it will be used
in patch 9.0.0618.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-17 09:08:08 +08:00
zeertzjq
7b05ddbb72 vim-patch:9.0.0397: :defer not tested with exceptions and ":qa!"
Problem:    :defer not tested with exceptions and ":qa!".
Solution:   Test :defer works when exceptions are thrown and when ":qa!" is
            used.  Invoke the deferred calls on exit.

58779858fb

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:41 +08:00
zeertzjq
335bef0c21 vim-patch:9.0.0390: cannot use a partial with :defer
Problem:    Cannot use a partial with :defer.
Solution:   Add the partial arguments before the other arguments.  Disallow
            using a dictionary.

86d87256c4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:41 +08:00
zeertzjq
b75634e55e vim-patch:9.0.0370: cleaning up afterwards can make a function messy
Problem:    Cleaning up afterwards can make a function messy.
Solution:   Add the :defer command.

1d84f7608f

Omit EX_EXPR_ARG: Vim9 script only.
Make :def throw E319 to avoid confusing behavior.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:40 +08:00
zeertzjq
6adfd24a06
vim-patch:8.2.4716: memory allocation failure not tested when defining a function (#23117)
Problem:    Memory allocation failure not tested when defining a function.
Solution:   Add a test. (Yegappan Lakshmanan, closes vim/vim#10127)

7c7e19cf50

test_alloc_fail() is N/A.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-16 08:26:42 +08:00
dundargoc
af23d17388
test: move oldtests to test directory (#22536)
The new oldtest directory is in test/old/testdir. The reason for this is
that many tests have hardcoded the parent directory name to be
'testdir'.
2023-03-07 11:13:04 +08:00