Problem: Deferred functions invoked in unexpected order when using :qa and
autocommands.
Solution: Call deferred functions for the current funccal before using the
stack. (closesvim/vim#12278)
1be4b81bfb
Problem: Recursively calling :defer function if it does :qa in a compiled
function.
Solution: Clear the defer entry before calling the function. (closesvim/vim#12271)
a1f2b5ddc6
Problem: Recursively calling :defer function if it does :qa.
Solution: Clear the defer entry before calling the function. (closesvim/vim#12266)
42994bf678
Co-authored-by: Bram Moolenaar <Bram@vim.org>
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>
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>
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>
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>
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>
Problem: Memory allocation failure not tested when defining a function.
Solution: Add a test. (Yegappan Lakshmanan, closesvim/vim#10127)
7c7e19cf50
test_alloc_fail() is N/A.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>