forked from aniani/vim
patch 8.2.2868: Vim9: when executing compiled expression trylevel is changed
Problem: Vim9: When executing a compiled expression the trylevel at start is changed but not restored. (closes #8214) Solution: Restore the trylevel at start.
This commit is contained in:
@@ -1014,12 +1014,15 @@ def Test_searchpair()
|
|||||||
try
|
try
|
||||||
searchpairpos('(', '', ')', 'nW', '[0]->map("")')
|
searchpairpos('(', '', ')', 'nW', '[0]->map("")')
|
||||||
catch
|
catch
|
||||||
|
g:caught = 'yes'
|
||||||
endtry
|
endtry
|
||||||
enddef
|
enddef
|
||||||
Fail()
|
Fail()
|
||||||
END
|
END
|
||||||
CheckScriptFailure(lines, 'E15:')
|
CheckScriptSuccess(lines)
|
||||||
|
assert_equal('yes', g:caught)
|
||||||
|
|
||||||
|
unlet g:caught
|
||||||
bwipe!
|
bwipe!
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2868,
|
||||||
/**/
|
/**/
|
||||||
2867,
|
2867,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -1291,6 +1291,8 @@ exec_instructions(ectx_T *ectx)
|
|||||||
{
|
{
|
||||||
int breakcheck_count = 0;
|
int breakcheck_count = 0;
|
||||||
typval_T *tv;
|
typval_T *tv;
|
||||||
|
int ret = FAIL;
|
||||||
|
int save_trylevel_at_start = ectx->ec_trylevel_at_start;
|
||||||
|
|
||||||
// Start execution at the first instruction.
|
// Start execution at the first instruction.
|
||||||
ectx->ec_iidx = 0;
|
ectx->ec_iidx = 0;
|
||||||
@@ -1312,7 +1314,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
// Turn CTRL-C into an exception.
|
// Turn CTRL-C into an exception.
|
||||||
got_int = FALSE;
|
got_int = FALSE;
|
||||||
if (throw_exception("Vim:Interrupt", ET_INTERRUPT, NULL) == FAIL)
|
if (throw_exception("Vim:Interrupt", ET_INTERRUPT, NULL) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
did_throw = TRUE;
|
did_throw = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1321,7 +1323,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
// Turn an error message into an exception.
|
// Turn an error message into an exception.
|
||||||
did_emsg = FALSE;
|
did_emsg = FALSE;
|
||||||
if (throw_exception(*msg_list, ET_ERROR, NULL) == FAIL)
|
if (throw_exception(*msg_list, ET_ERROR, NULL) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
did_throw = TRUE;
|
did_throw = TRUE;
|
||||||
*msg_list = NULL;
|
*msg_list = NULL;
|
||||||
}
|
}
|
||||||
@@ -1346,7 +1348,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
// Not inside try or need to return from current functions.
|
// Not inside try or need to return from current functions.
|
||||||
// Push a dummy return value.
|
// Push a dummy return value.
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
tv = STACK_TV_BOT(0);
|
tv = STACK_TV_BOT(0);
|
||||||
tv->v_type = VAR_NUMBER;
|
tv->v_type = VAR_NUMBER;
|
||||||
tv->vval.v_number = 0;
|
tv->vval.v_number = 0;
|
||||||
@@ -1356,12 +1358,12 @@ exec_instructions(ectx_T *ectx)
|
|||||||
// At the toplevel we are done.
|
// At the toplevel we are done.
|
||||||
need_rethrow = TRUE;
|
need_rethrow = TRUE;
|
||||||
if (handle_closure_in_use(ectx, FALSE) == FAIL)
|
if (handle_closure_in_use(ectx, FALSE) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (func_return(ectx) == FAIL)
|
if (func_return(ectx) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1397,7 +1399,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
int save_flags = cmdmod.cmod_flags;
|
int save_flags = cmdmod.cmod_flags;
|
||||||
|
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
tv = STACK_TV_BOT(0);
|
tv = STACK_TV_BOT(0);
|
||||||
init_tv(tv);
|
init_tv(tv);
|
||||||
cmdmod.cmod_flags |= CMOD_LEGACY;
|
cmdmod.cmod_flags |= CMOD_LEGACY;
|
||||||
@@ -1413,7 +1415,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
case ISN_INSTR:
|
case ISN_INSTR:
|
||||||
{
|
{
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
tv = STACK_TV_BOT(0);
|
tv = STACK_TV_BOT(0);
|
||||||
tv->vval.v_instr = ALLOC_ONE(instr_T);
|
tv->vval.v_instr = ALLOC_ONE(instr_T);
|
||||||
if (tv->vval.v_instr == NULL)
|
if (tv->vval.v_instr == NULL)
|
||||||
@@ -1480,7 +1482,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
{
|
{
|
||||||
vim_free(res);
|
vim_free(res);
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
tv = STACK_TV_BOT(0);
|
tv = STACK_TV_BOT(0);
|
||||||
tv->v_type = VAR_STRING;
|
tv->v_type = VAR_STRING;
|
||||||
@@ -1545,7 +1547,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
{
|
{
|
||||||
cmd = alloc(len + 1);
|
cmd = alloc(len + 1);
|
||||||
if (cmd == NULL)
|
if (cmd == NULL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1665,7 +1667,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
// load local variable or argument
|
// load local variable or argument
|
||||||
case ISN_LOAD:
|
case ISN_LOAD:
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
copy_tv(STACK_TV_VAR(iptr->isn_arg.number), STACK_TV_BOT(0));
|
copy_tv(STACK_TV_VAR(iptr->isn_arg.number), STACK_TV_BOT(0));
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
break;
|
break;
|
||||||
@@ -1673,7 +1675,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
// load v: variable
|
// load v: variable
|
||||||
case ISN_LOADV:
|
case ISN_LOADV:
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
copy_tv(get_vim_var_tv(iptr->isn_arg.number), STACK_TV_BOT(0));
|
copy_tv(get_vim_var_tv(iptr->isn_arg.number), STACK_TV_BOT(0));
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
break;
|
break;
|
||||||
@@ -1686,10 +1688,10 @@ exec_instructions(ectx_T *ectx)
|
|||||||
|
|
||||||
sv = get_script_svar(sref, ectx);
|
sv = get_script_svar(sref, ectx);
|
||||||
if (sv == NULL)
|
if (sv == NULL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
allocate_if_null(sv->sv_tv);
|
allocate_if_null(sv->sv_tv);
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
copy_tv(sv->sv_tv, STACK_TV_BOT(0));
|
copy_tv(sv->sv_tv, STACK_TV_BOT(0));
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
}
|
}
|
||||||
@@ -1712,7 +1714,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
copy_tv(&di->di_tv, STACK_TV_BOT(0));
|
copy_tv(&di->di_tv, STACK_TV_BOT(0));
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
}
|
}
|
||||||
@@ -1748,7 +1750,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
namespace = 't';
|
namespace = 't';
|
||||||
break;
|
break;
|
||||||
default: // Cannot reach here
|
default: // Cannot reach here
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
di = find_var_in_ht(ht, 0, iptr->isn_arg.string, TRUE);
|
di = find_var_in_ht(ht, 0, iptr->isn_arg.string, TRUE);
|
||||||
|
|
||||||
@@ -1762,7 +1764,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
copy_tv(&di->di_tv, STACK_TV_BOT(0));
|
copy_tv(&di->di_tv, STACK_TV_BOT(0));
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
}
|
}
|
||||||
@@ -1775,7 +1777,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
char_u *name = iptr->isn_arg.string;
|
char_u *name = iptr->isn_arg.string;
|
||||||
|
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
SOURCING_LNUM = iptr->isn_lnum;
|
SOURCING_LNUM = iptr->isn_lnum;
|
||||||
if (eval_variable(name, (int)STRLEN(name),
|
if (eval_variable(name, (int)STRLEN(name),
|
||||||
STACK_TV_BOT(0), NULL, EVAL_VAR_VERBOSE) == FAIL)
|
STACK_TV_BOT(0), NULL, EVAL_VAR_VERBOSE) == FAIL)
|
||||||
@@ -1799,10 +1801,10 @@ exec_instructions(ectx_T *ectx)
|
|||||||
case ISN_LOADWDICT: d = curwin->w_vars; break;
|
case ISN_LOADWDICT: d = curwin->w_vars; break;
|
||||||
case ISN_LOADTDICT: d = curtab->tp_vars; break;
|
case ISN_LOADTDICT: d = curtab->tp_vars; break;
|
||||||
default: // Cannot reach here
|
default: // Cannot reach here
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
tv = STACK_TV_BOT(0);
|
tv = STACK_TV_BOT(0);
|
||||||
tv->v_type = VAR_DICT;
|
tv->v_type = VAR_DICT;
|
||||||
tv->v_lock = 0;
|
tv->v_lock = 0;
|
||||||
@@ -1821,9 +1823,9 @@ exec_instructions(ectx_T *ectx)
|
|||||||
// This is not expected to fail, name is checked during
|
// This is not expected to fail, name is checked during
|
||||||
// compilation: don't set SOURCING_LNUM.
|
// compilation: don't set SOURCING_LNUM.
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
if (eval_option(&name, &optval, TRUE) == FAIL)
|
if (eval_option(&name, &optval, TRUE) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
*STACK_TV_BOT(0) = optval;
|
*STACK_TV_BOT(0) = optval;
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
}
|
}
|
||||||
@@ -1836,7 +1838,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
char_u *name = iptr->isn_arg.string;
|
char_u *name = iptr->isn_arg.string;
|
||||||
|
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
// name is always valid, checked when compiling
|
// name is always valid, checked when compiling
|
||||||
(void)eval_env_var(&name, &optval, TRUE);
|
(void)eval_env_var(&name, &optval, TRUE);
|
||||||
*STACK_TV_BOT(0) = optval;
|
*STACK_TV_BOT(0) = optval;
|
||||||
@@ -1847,7 +1849,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
// load @register
|
// load @register
|
||||||
case ISN_LOADREG:
|
case ISN_LOADREG:
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
tv = STACK_TV_BOT(0);
|
tv = STACK_TV_BOT(0);
|
||||||
tv->v_type = VAR_STRING;
|
tv->v_type = VAR_STRING;
|
||||||
tv->v_lock = 0;
|
tv->v_lock = 0;
|
||||||
@@ -1899,7 +1901,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
|
|
||||||
sv = get_script_svar(sref, ectx);
|
sv = get_script_svar(sref, ectx);
|
||||||
if (sv == NULL)
|
if (sv == NULL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
--ectx->ec_stack.ga_len;
|
--ectx->ec_stack.ga_len;
|
||||||
|
|
||||||
// "const" and "final" are checked at compile time, locking
|
// "const" and "final" are checked at compile time, locking
|
||||||
@@ -2001,7 +2003,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
ht = &curtab->tp_vars->dv_hashtab;
|
ht = &curtab->tp_vars->dv_hashtab;
|
||||||
break;
|
break;
|
||||||
default: // Cannot reach here
|
default: // Cannot reach here
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
--ectx->ec_stack.ga_len;
|
--ectx->ec_stack.ga_len;
|
||||||
@@ -2106,7 +2108,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
// append to list, only fails when out of memory
|
// append to list, only fails when out of memory
|
||||||
if (list_append_tv(list, tv) == FAIL)
|
if (list_append_tv(list, tv) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
clear_tv(tv);
|
clear_tv(tv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2141,7 +2143,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
// add to dict, only fails when out of memory
|
// add to dict, only fails when out of memory
|
||||||
if (dict_add_tv(dict, (char *)key, tv) == FAIL)
|
if (dict_add_tv(dict, (char *)key, tv) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
clear_tv(tv);
|
clear_tv(tv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2274,7 +2276,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
{
|
{
|
||||||
SOURCING_LNUM = iptr->isn_lnum;
|
SOURCING_LNUM = iptr->isn_lnum;
|
||||||
iemsg("LOADOUTER depth more than scope levels");
|
iemsg("LOADOUTER depth more than scope levels");
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
tv = ((typval_T *)outer->out_stack->ga_data)
|
tv = ((typval_T *)outer->out_stack->ga_data)
|
||||||
+ outer->out_frame_idx + STACK_FRAME_SIZE
|
+ outer->out_frame_idx + STACK_FRAME_SIZE
|
||||||
@@ -2282,7 +2284,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
if (iptr->isn_type == ISN_LOADOUTER)
|
if (iptr->isn_type == ISN_LOADOUTER)
|
||||||
{
|
{
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
copy_tv(tv, STACK_TV_BOT(0));
|
copy_tv(tv, STACK_TV_BOT(0));
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
}
|
}
|
||||||
@@ -2444,7 +2446,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
case ISN_PUSHCHANNEL:
|
case ISN_PUSHCHANNEL:
|
||||||
case ISN_PUSHJOB:
|
case ISN_PUSHJOB:
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
tv = STACK_TV_BOT(0);
|
tv = STACK_TV_BOT(0);
|
||||||
tv->v_lock = 0;
|
tv->v_lock = 0;
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
@@ -2520,7 +2522,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
// for the list header and the items
|
// for the list header and the items
|
||||||
case ISN_NEWLIST:
|
case ISN_NEWLIST:
|
||||||
if (exe_newlist(iptr->isn_arg.number, ectx) == FAIL)
|
if (exe_newlist(iptr->isn_arg.number, ectx) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// create a dict from items on the stack
|
// create a dict from items on the stack
|
||||||
@@ -2533,7 +2535,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
if (dict == NULL)
|
if (dict == NULL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
for (idx = 0; idx < count; ++idx)
|
for (idx = 0; idx < count; ++idx)
|
||||||
{
|
{
|
||||||
// have already checked key type is VAR_STRING
|
// have already checked key type is VAR_STRING
|
||||||
@@ -2554,7 +2556,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
{
|
{
|
||||||
dict_unref(dict);
|
dict_unref(dict);
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
item->di_tv = *STACK_TV_BOT(2 * (idx - count) + 1);
|
item->di_tv = *STACK_TV_BOT(2 * (idx - count) + 1);
|
||||||
item->di_tv.v_lock = 0;
|
item->di_tv.v_lock = 0;
|
||||||
@@ -2562,14 +2564,14 @@ exec_instructions(ectx_T *ectx)
|
|||||||
{
|
{
|
||||||
// can this ever happen?
|
// can this ever happen?
|
||||||
dict_unref(dict);
|
dict_unref(dict);
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
ectx->ec_stack.ga_len -= 2 * count - 1;
|
ectx->ec_stack.ga_len -= 2 * count - 1;
|
||||||
else if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
else if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
else
|
else
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
tv = STACK_TV_BOT(-1);
|
tv = STACK_TV_BOT(-1);
|
||||||
@@ -2651,7 +2653,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
// return from a :def function call
|
// return from a :def function call
|
||||||
case ISN_RETURN_ZERO:
|
case ISN_RETURN_ZERO:
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
tv = STACK_TV_BOT(0);
|
tv = STACK_TV_BOT(0);
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
tv->v_type = VAR_NUMBER;
|
tv->v_type = VAR_NUMBER;
|
||||||
@@ -2690,15 +2692,15 @@ exec_instructions(ectx_T *ectx)
|
|||||||
+ iptr->isn_arg.funcref.fr_func;
|
+ iptr->isn_arg.funcref.fr_func;
|
||||||
|
|
||||||
if (pt == NULL)
|
if (pt == NULL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
{
|
{
|
||||||
vim_free(pt);
|
vim_free(pt);
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
if (fill_partial_and_closure(pt, pt_dfunc->df_ufunc,
|
if (fill_partial_and_closure(pt, pt_dfunc->df_ufunc,
|
||||||
ectx) == FAIL)
|
ectx) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
|
|
||||||
tv = STACK_TV_BOT(0);
|
tv = STACK_TV_BOT(0);
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
@@ -2715,7 +2717,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
|
|
||||||
if (copy_func(newfunc->nf_lambda, newfunc->nf_global,
|
if (copy_func(newfunc->nf_lambda, newfunc->nf_global,
|
||||||
ectx) == FAIL)
|
ectx) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2788,7 +2790,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
STACK_TV_VAR(iptr->isn_arg.forloop.for_idx);
|
STACK_TV_VAR(iptr->isn_arg.forloop.for_idx);
|
||||||
|
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
if (ltv->v_type == VAR_LIST)
|
if (ltv->v_type == VAR_LIST)
|
||||||
{
|
{
|
||||||
list_T *list = ltv->vval.v_list;
|
list_T *list = ltv->vval.v_list;
|
||||||
@@ -2884,7 +2886,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
{
|
{
|
||||||
semsg(_(e_for_loop_on_str_not_supported),
|
semsg(_(e_for_loop_on_str_not_supported),
|
||||||
vartype_name(ltv->v_type));
|
vartype_name(ltv->v_type));
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2895,7 +2897,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
trycmd_T *trycmd = NULL;
|
trycmd_T *trycmd = NULL;
|
||||||
|
|
||||||
if (GA_GROW(&ectx->ec_trystack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_trystack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
trycmd = ((trycmd_T *)ectx->ec_trystack.ga_data)
|
trycmd = ((trycmd_T *)ectx->ec_trystack.ga_data)
|
||||||
+ ectx->ec_trystack.ga_len;
|
+ ectx->ec_trystack.ga_len;
|
||||||
++ectx->ec_trystack.ga_len;
|
++ectx->ec_trystack.ga_len;
|
||||||
@@ -2917,10 +2919,10 @@ exec_instructions(ectx_T *ectx)
|
|||||||
{
|
{
|
||||||
SOURCING_LNUM = iptr->isn_lnum;
|
SOURCING_LNUM = iptr->isn_lnum;
|
||||||
iemsg("Evaluating catch while current_exception is NULL");
|
iemsg("Evaluating catch while current_exception is NULL");
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
tv = STACK_TV_BOT(0);
|
tv = STACK_TV_BOT(0);
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
tv->v_type = VAR_STRING;
|
tv->v_type = VAR_STRING;
|
||||||
@@ -2958,7 +2960,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
{
|
{
|
||||||
siemsg("TRYCONT: expected %d levels, found %d",
|
siemsg("TRYCONT: expected %d levels, found %d",
|
||||||
trycont->tct_levels, trystack->ga_len);
|
trycont->tct_levels, trystack->ga_len);
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
// Make :endtry jump to any outer try block and the last
|
// Make :endtry jump to any outer try block and the last
|
||||||
// :endtry inside the loop to the loop start.
|
// :endtry inside the loop to the loop start.
|
||||||
@@ -3049,7 +3051,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
vim_free(tv->vval.v_string);
|
vim_free(tv->vval.v_string);
|
||||||
SOURCING_LNUM = iptr->isn_lnum;
|
SOURCING_LNUM = iptr->isn_lnum;
|
||||||
emsg(_(e_throw_with_empty_string));
|
emsg(_(e_throw_with_empty_string));
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inside a "catch" we need to first discard the caught
|
// Inside a "catch" we need to first discard the caught
|
||||||
@@ -3072,7 +3074,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
== FAIL)
|
== FAIL)
|
||||||
{
|
{
|
||||||
vim_free(tv->vval.v_string);
|
vim_free(tv->vval.v_string);
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
did_throw = TRUE;
|
did_throw = TRUE;
|
||||||
}
|
}
|
||||||
@@ -3277,7 +3279,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
if (list_append_tv(l, tv2) == FAIL)
|
if (list_append_tv(l, tv2) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
clear_tv(tv2);
|
clear_tv(tv2);
|
||||||
--ectx->ec_stack.ga_len;
|
--ectx->ec_stack.ga_len;
|
||||||
}
|
}
|
||||||
@@ -3577,7 +3579,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
li = list_find(tv->vval.v_list, index);
|
li = list_find(tv->vval.v_list, index);
|
||||||
|
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
copy_tv(&li->li_tv, STACK_TV_BOT(-1));
|
copy_tv(&li->li_tv, STACK_TV_BOT(-1));
|
||||||
|
|
||||||
@@ -3810,7 +3812,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
|
|
||||||
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
++ectx->ec_stack.ga_len;
|
++ectx->ec_stack.ga_len;
|
||||||
tv = STACK_TV_BOT(-1);
|
tv = STACK_TV_BOT(-1);
|
||||||
tv->v_type = VAR_NUMBER;
|
tv->v_type = VAR_NUMBER;
|
||||||
@@ -3912,7 +3914,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
|
|
||||||
CHECK_LIST_MATERIALIZE(l);
|
CHECK_LIST_MATERIALIZE(l);
|
||||||
if (GA_GROW(&ectx->ec_stack, count - 1) == FAIL)
|
if (GA_GROW(&ectx->ec_stack, count - 1) == FAIL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
ectx->ec_stack.ga_len += count - 1;
|
ectx->ec_stack.ga_len += count - 1;
|
||||||
|
|
||||||
// Variable after semicolon gets a list with the remaining
|
// Variable after semicolon gets a list with the remaining
|
||||||
@@ -3923,7 +3925,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
list_alloc_with_items(l->lv_len - count + 1);
|
list_alloc_with_items(l->lv_len - count + 1);
|
||||||
|
|
||||||
if (rem_list == NULL)
|
if (rem_list == NULL)
|
||||||
return FAIL;
|
goto theend;
|
||||||
tv = STACK_TV_BOT(-count);
|
tv = STACK_TV_BOT(-count);
|
||||||
tv->vval.v_list = rem_list;
|
tv->vval.v_list = rem_list;
|
||||||
++rem_list->lv_refcount;
|
++rem_list->lv_refcount;
|
||||||
@@ -4007,7 +4009,7 @@ func_return:
|
|||||||
|
|
||||||
if (func_return(ectx) == FAIL)
|
if (func_return(ectx) == FAIL)
|
||||||
// only fails when out of memory
|
// only fails when out of memory
|
||||||
return FAIL;
|
goto theend;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
on_error:
|
on_error:
|
||||||
@@ -4037,11 +4039,14 @@ on_fatal_error:
|
|||||||
// Jump here for an error that messes up the stack.
|
// Jump here for an error that messes up the stack.
|
||||||
// If we are not inside a try-catch started here, abort execution.
|
// If we are not inside a try-catch started here, abort execution.
|
||||||
if (trylevel <= ectx->ec_trylevel_at_start)
|
if (trylevel <= ectx->ec_trylevel_at_start)
|
||||||
return FAIL;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return OK;
|
ret = OK;
|
||||||
|
theend:
|
||||||
|
ectx->ec_trylevel_at_start = save_trylevel_at_start;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user