mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.1329: Vim9: cannot define global function inside :def function
Problem: Vim9: cannot define global function inside :def function. Solution: Assign to global variable instead of local. (closes #6584)
This commit is contained in:
@@ -723,7 +723,10 @@ call_def_function(
|
||||
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
|
||||
+ ufunc->uf_dfunc_idx;
|
||||
if (dfunc->df_instr == NULL)
|
||||
{
|
||||
iemsg("using call_def_function() on not compiled function");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
CLEAR_FIELD(ectx);
|
||||
@@ -1726,6 +1729,15 @@ call_def_function(
|
||||
}
|
||||
break;
|
||||
|
||||
// Create a global function from a lambda.
|
||||
case ISN_NEWFUNC:
|
||||
{
|
||||
newfunc_T *newfunc = &iptr->isn_arg.newfunc;
|
||||
|
||||
copy_func(newfunc->nf_lambda, newfunc->nf_global);
|
||||
}
|
||||
break;
|
||||
|
||||
// jump if a condition is met
|
||||
case ISN_JUMP:
|
||||
{
|
||||
@@ -2912,6 +2924,15 @@ ex_disassemble(exarg_T *eap)
|
||||
}
|
||||
break;
|
||||
|
||||
case ISN_NEWFUNC:
|
||||
{
|
||||
newfunc_T *newfunc = &iptr->isn_arg.newfunc;
|
||||
|
||||
smsg("%4d NEWFUNC %s %s", current,
|
||||
newfunc->nf_lambda, newfunc->nf_global);
|
||||
}
|
||||
break;
|
||||
|
||||
case ISN_JUMP:
|
||||
{
|
||||
char *when = "?";
|
||||
|
Reference in New Issue
Block a user