mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.5018: Vim9: some code is not covered by tests
Problem: Vim9: some code is not covered by tests. Solution: Delete dead code.
This commit is contained in:
parent
8be36eecdc
commit
c3caa7f788
@ -32,7 +32,7 @@ int generate_STORE(cctx_T *cctx, isntype_T isn_type, int idx, char_u *name);
|
|||||||
int generate_STORENR(cctx_T *cctx, int idx, varnumber_T value);
|
int generate_STORENR(cctx_T *cctx, int idx, varnumber_T value);
|
||||||
int generate_LOAD(cctx_T *cctx, isntype_T isn_type, int idx, char_u *name, type_T *type);
|
int generate_LOAD(cctx_T *cctx, isntype_T isn_type, int idx, char_u *name, type_T *type);
|
||||||
int generate_LOADOUTER(cctx_T *cctx, int idx, int nesting, type_T *type);
|
int generate_LOADOUTER(cctx_T *cctx, int idx, int nesting, type_T *type);
|
||||||
int generate_LOADV(cctx_T *cctx, char_u *name, int error);
|
int generate_LOADV(cctx_T *cctx, char_u *name);
|
||||||
int generate_UNLET(cctx_T *cctx, isntype_T isn_type, char_u *name, int forceit);
|
int generate_UNLET(cctx_T *cctx, isntype_T isn_type, char_u *name, int forceit);
|
||||||
int generate_LOCKCONST(cctx_T *cctx);
|
int generate_LOCKCONST(cctx_T *cctx);
|
||||||
int generate_OLDSCRIPT(cctx_T *cctx, isntype_T isn_type, char_u *name, int sid, type_T *type);
|
int generate_OLDSCRIPT(cctx_T *cctx, isntype_T isn_type, char_u *name, int sid, type_T *type);
|
||||||
|
@ -734,6 +734,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 */
|
||||||
|
/**/
|
||||||
|
5018,
|
||||||
/**/
|
/**/
|
||||||
5017,
|
5017,
|
||||||
/**/
|
/**/
|
||||||
|
@ -1151,7 +1151,7 @@ generate_loadvar(
|
|||||||
generate_LOAD(cctx, ISN_LOADREG, name[1], NULL, &t_string);
|
generate_LOAD(cctx, ISN_LOADREG, name[1], NULL, &t_string);
|
||||||
break;
|
break;
|
||||||
case dest_vimvar:
|
case dest_vimvar:
|
||||||
generate_LOADV(cctx, name + 2, TRUE);
|
generate_LOADV(cctx, name + 2);
|
||||||
break;
|
break;
|
||||||
case dest_local:
|
case dest_local:
|
||||||
if (lvar->lv_from_outer > 0)
|
if (lvar->lv_from_outer > 0)
|
||||||
|
@ -442,7 +442,7 @@ compile_load(
|
|||||||
|
|
||||||
switch (**arg)
|
switch (**arg)
|
||||||
{
|
{
|
||||||
case 'v': res = generate_LOADV(cctx, name, error);
|
case 'v': res = generate_LOADV(cctx, name);
|
||||||
break;
|
break;
|
||||||
case 's': if (current_script_is_vim9())
|
case 's': if (current_script_is_vim9())
|
||||||
{
|
{
|
||||||
|
221
src/vim9instr.c
221
src/vim9instr.c
@ -355,11 +355,6 @@ get_compare_isn(
|
|||||||
vartype_T vartype1 = tv1 != NULL ? tv1->v_type : type1->tt_type;
|
vartype_T vartype1 = tv1 != NULL ? tv1->v_type : type1->tt_type;
|
||||||
vartype_T vartype2 = tv2 != NULL ? tv2->v_type : type2->tt_type;
|
vartype_T vartype2 = tv2 != NULL ? tv2->v_type : type2->tt_type;
|
||||||
|
|
||||||
if (vartype1 == VAR_UNKNOWN)
|
|
||||||
vartype1 = VAR_ANY;
|
|
||||||
if (vartype2 == VAR_UNKNOWN)
|
|
||||||
vartype2 = VAR_ANY;
|
|
||||||
|
|
||||||
if (vartype1 == vartype2)
|
if (vartype1 == vartype2)
|
||||||
{
|
{
|
||||||
switch (vartype1)
|
switch (vartype1)
|
||||||
@ -462,11 +457,8 @@ generate_COMPARE(cctx_T *cctx, exprtype_T exprtype, int ic)
|
|||||||
isn->isn_arg.op.op_ic = ic;
|
isn->isn_arg.op.op_ic = ic;
|
||||||
|
|
||||||
// takes two arguments, puts one bool back
|
// takes two arguments, puts one bool back
|
||||||
if (stack->ga_len >= 2)
|
--stack->ga_len;
|
||||||
{
|
set_type_on_stack(cctx, &t_bool, 0);
|
||||||
--stack->ga_len;
|
|
||||||
set_type_on_stack(cctx, &t_bool, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -485,9 +477,6 @@ generate_CONCAT(cctx_T *cctx, int count)
|
|||||||
|
|
||||||
RETURN_OK_IF_SKIP(cctx);
|
RETURN_OK_IF_SKIP(cctx);
|
||||||
|
|
||||||
if (count < 1)
|
|
||||||
return FAIL;
|
|
||||||
|
|
||||||
if ((isn = generate_instr(cctx, ISN_CONCAT)) == NULL)
|
if ((isn = generate_instr(cctx, ISN_CONCAT)) == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
isn->isn_arg.number = count;
|
isn->isn_arg.number = count;
|
||||||
@ -578,80 +567,74 @@ generate_SETTYPE(
|
|||||||
/*
|
/*
|
||||||
* Generate a PUSH instruction for "tv".
|
* Generate a PUSH instruction for "tv".
|
||||||
* "tv" will be consumed or cleared.
|
* "tv" will be consumed or cleared.
|
||||||
* Nothing happens if "tv" is NULL or of type VAR_UNKNOWN;
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
generate_tv_PUSH(cctx_T *cctx, typval_T *tv)
|
generate_tv_PUSH(cctx_T *cctx, typval_T *tv)
|
||||||
{
|
{
|
||||||
if (tv != NULL)
|
switch (tv->v_type)
|
||||||
{
|
{
|
||||||
switch (tv->v_type)
|
case VAR_BOOL:
|
||||||
{
|
generate_PUSHBOOL(cctx, tv->vval.v_number);
|
||||||
case VAR_UNKNOWN:
|
break;
|
||||||
break;
|
case VAR_SPECIAL:
|
||||||
case VAR_BOOL:
|
generate_PUSHSPEC(cctx, tv->vval.v_number);
|
||||||
generate_PUSHBOOL(cctx, tv->vval.v_number);
|
break;
|
||||||
break;
|
case VAR_NUMBER:
|
||||||
case VAR_SPECIAL:
|
generate_PUSHNR(cctx, tv->vval.v_number);
|
||||||
generate_PUSHSPEC(cctx, tv->vval.v_number);
|
break;
|
||||||
break;
|
|
||||||
case VAR_NUMBER:
|
|
||||||
generate_PUSHNR(cctx, tv->vval.v_number);
|
|
||||||
break;
|
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
case VAR_FLOAT:
|
case VAR_FLOAT:
|
||||||
generate_PUSHF(cctx, tv->vval.v_float);
|
generate_PUSHF(cctx, tv->vval.v_float);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case VAR_BLOB:
|
case VAR_BLOB:
|
||||||
generate_PUSHBLOB(cctx, tv->vval.v_blob);
|
generate_PUSHBLOB(cctx, tv->vval.v_blob);
|
||||||
tv->vval.v_blob = NULL;
|
tv->vval.v_blob = NULL;
|
||||||
break;
|
break;
|
||||||
case VAR_LIST:
|
case VAR_LIST:
|
||||||
if (tv->vval.v_list != NULL)
|
if (tv->vval.v_list != NULL)
|
||||||
iemsg("non-empty list constant not supported");
|
iemsg("non-empty list constant not supported");
|
||||||
generate_NEWLIST(cctx, 0, TRUE);
|
generate_NEWLIST(cctx, 0, TRUE);
|
||||||
break;
|
break;
|
||||||
case VAR_DICT:
|
case VAR_DICT:
|
||||||
if (tv->vval.v_dict != NULL)
|
if (tv->vval.v_dict != NULL)
|
||||||
iemsg("non-empty dict constant not supported");
|
iemsg("non-empty dict constant not supported");
|
||||||
generate_NEWDICT(cctx, 0, TRUE);
|
generate_NEWDICT(cctx, 0, TRUE);
|
||||||
break;
|
break;
|
||||||
#ifdef FEAT_JOB_CHANNEL
|
#ifdef FEAT_JOB_CHANNEL
|
||||||
case VAR_JOB:
|
case VAR_JOB:
|
||||||
if (tv->vval.v_job != NULL)
|
if (tv->vval.v_job != NULL)
|
||||||
iemsg("non-null job constant not supported");
|
iemsg("non-null job constant not supported");
|
||||||
generate_PUSHJOB(cctx);
|
generate_PUSHJOB(cctx);
|
||||||
break;
|
break;
|
||||||
case VAR_CHANNEL:
|
case VAR_CHANNEL:
|
||||||
if (tv->vval.v_channel != NULL)
|
if (tv->vval.v_channel != NULL)
|
||||||
iemsg("non-null channel constant not supported");
|
iemsg("non-null channel constant not supported");
|
||||||
generate_PUSHCHANNEL(cctx);
|
generate_PUSHCHANNEL(cctx);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case VAR_FUNC:
|
case VAR_FUNC:
|
||||||
if (tv->vval.v_string != NULL)
|
if (tv->vval.v_string != NULL)
|
||||||
iemsg("non-null function constant not supported");
|
iemsg("non-null function constant not supported");
|
||||||
generate_PUSHFUNC(cctx, NULL, &t_func_unknown);
|
generate_PUSHFUNC(cctx, NULL, &t_func_unknown);
|
||||||
break;
|
break;
|
||||||
case VAR_PARTIAL:
|
case VAR_PARTIAL:
|
||||||
if (tv->vval.v_partial != NULL)
|
if (tv->vval.v_partial != NULL)
|
||||||
iemsg("non-null partial constant not supported");
|
iemsg("non-null partial constant not supported");
|
||||||
if (generate_instr_type(cctx, ISN_NEWPARTIAL, &t_func_unknown)
|
if (generate_instr_type(cctx, ISN_NEWPARTIAL, &t_func_unknown)
|
||||||
== NULL)
|
== NULL)
|
||||||
return FAIL;
|
|
||||||
break;
|
|
||||||
case VAR_STRING:
|
|
||||||
generate_PUSHS(cctx, &tv->vval.v_string);
|
|
||||||
tv->vval.v_string = NULL;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
iemsg("constant type not supported");
|
|
||||||
clear_tv(tv);
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
break;
|
||||||
tv->v_type = VAR_UNKNOWN;
|
case VAR_STRING:
|
||||||
|
generate_PUSHS(cctx, &tv->vval.v_string);
|
||||||
|
tv->vval.v_string = NULL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
siemsg("constant type %d not supported", tv->v_type);
|
||||||
|
clear_tv(tv);
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
tv->v_type = VAR_UNKNOWN;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,22 +718,21 @@ generate_PUSHF(cctx_T *cctx, float_T fnumber)
|
|||||||
generate_PUSHS(cctx_T *cctx, char_u **str)
|
generate_PUSHS(cctx_T *cctx, char_u **str)
|
||||||
{
|
{
|
||||||
isn_T *isn;
|
isn_T *isn;
|
||||||
|
int ret = OK;
|
||||||
|
|
||||||
if (cctx->ctx_skip == SKIP_YES)
|
if (cctx->ctx_skip != SKIP_YES)
|
||||||
{
|
{
|
||||||
if (str != NULL)
|
if ((isn = generate_instr_type(cctx, ISN_PUSHS, &t_string)) == NULL)
|
||||||
VIM_CLEAR(*str);
|
ret = FAIL;
|
||||||
return OK;
|
else
|
||||||
|
{
|
||||||
|
isn->isn_arg.string = str == NULL ? NULL : *str;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((isn = generate_instr_type(cctx, ISN_PUSHS, &t_string)) == NULL)
|
if (str != NULL)
|
||||||
{
|
VIM_CLEAR(*str);
|
||||||
if (str != NULL)
|
return ret;
|
||||||
VIM_CLEAR(*str);
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
isn->isn_arg.string = str == NULL ? NULL : *str;
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -864,6 +846,7 @@ generate_AUTOLOAD(cctx_T *cctx, char_u *name, type_T *type)
|
|||||||
* Generate an ISN_GETITEM instruction with "index".
|
* Generate an ISN_GETITEM instruction with "index".
|
||||||
* "with_op" is TRUE for "+=" and other operators, the stack has the current
|
* "with_op" is TRUE for "+=" and other operators, the stack has the current
|
||||||
* value below the list with values.
|
* value below the list with values.
|
||||||
|
* Caller must check the type is a list.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
generate_GETITEM(cctx_T *cctx, int index, int with_op)
|
generate_GETITEM(cctx_T *cctx, int index, int with_op)
|
||||||
@ -874,12 +857,6 @@ generate_GETITEM(cctx_T *cctx, int index, int with_op)
|
|||||||
|
|
||||||
RETURN_OK_IF_SKIP(cctx);
|
RETURN_OK_IF_SKIP(cctx);
|
||||||
|
|
||||||
if (type->tt_type != VAR_LIST)
|
|
||||||
{
|
|
||||||
// cannot happen, caller has checked the type
|
|
||||||
emsg(_(e_list_required));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
item_type = type->tt_member;
|
item_type = type->tt_member;
|
||||||
if ((isn = generate_instr(cctx, ISN_GETITEM)) == NULL)
|
if ((isn = generate_instr(cctx, ISN_GETITEM)) == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -1048,8 +1025,7 @@ generate_LOADOUTER(
|
|||||||
int
|
int
|
||||||
generate_LOADV(
|
generate_LOADV(
|
||||||
cctx_T *cctx,
|
cctx_T *cctx,
|
||||||
char_u *name,
|
char_u *name)
|
||||||
int error)
|
|
||||||
{
|
{
|
||||||
int di_flags;
|
int di_flags;
|
||||||
int vidx = find_vim_var(name, &di_flags);
|
int vidx = find_vim_var(name, &di_flags);
|
||||||
@ -1058,8 +1034,7 @@ generate_LOADV(
|
|||||||
RETURN_OK_IF_SKIP(cctx);
|
RETURN_OK_IF_SKIP(cctx);
|
||||||
if (vidx < 0)
|
if (vidx < 0)
|
||||||
{
|
{
|
||||||
if (error)
|
semsg(_(e_variable_not_found_str), name);
|
||||||
semsg(_(e_variable_not_found_str), name);
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
type = get_vim_var_type(vidx, cctx->ctx_type_list);
|
type = get_vim_var_type(vidx, cctx->ctx_type_list);
|
||||||
@ -1258,23 +1233,22 @@ generate_FUNCREF(cctx_T *cctx, ufunc_T *ufunc, isn_T **isnp)
|
|||||||
generate_NEWFUNC(cctx_T *cctx, char_u *lambda_name, char_u *func_name)
|
generate_NEWFUNC(cctx_T *cctx, char_u *lambda_name, char_u *func_name)
|
||||||
{
|
{
|
||||||
isn_T *isn;
|
isn_T *isn;
|
||||||
|
int ret = OK;
|
||||||
|
|
||||||
if (cctx->ctx_skip == SKIP_YES)
|
if (cctx->ctx_skip != SKIP_YES)
|
||||||
{
|
{
|
||||||
vim_free(lambda_name);
|
if ((isn = generate_instr(cctx, ISN_NEWFUNC)) == NULL)
|
||||||
vim_free(func_name);
|
ret = FAIL;
|
||||||
return OK;
|
else
|
||||||
|
{
|
||||||
|
isn->isn_arg.newfunc.nf_lambda = lambda_name;
|
||||||
|
isn->isn_arg.newfunc.nf_global = func_name;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((isn = generate_instr(cctx, ISN_NEWFUNC)) == NULL)
|
vim_free(lambda_name);
|
||||||
{
|
vim_free(func_name);
|
||||||
vim_free(lambda_name);
|
return ret;
|
||||||
vim_free(func_name);
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
isn->isn_arg.newfunc.nf_lambda = lambda_name;
|
|
||||||
isn->isn_arg.newfunc.nf_global = func_name;
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1827,19 +1801,20 @@ generate_EXEC_copy(cctx_T *cctx, isntype_T isntype, char_u *line)
|
|||||||
generate_EXEC(cctx_T *cctx, isntype_T isntype, char_u *str)
|
generate_EXEC(cctx_T *cctx, isntype_T isntype, char_u *str)
|
||||||
{
|
{
|
||||||
isn_T *isn;
|
isn_T *isn;
|
||||||
|
int ret = OK;
|
||||||
|
|
||||||
if (cctx->ctx_skip == SKIP_YES)
|
if (cctx->ctx_skip != SKIP_YES)
|
||||||
{
|
{
|
||||||
vim_free(str);
|
if ((isn = generate_instr(cctx, isntype)) == NULL)
|
||||||
return OK;
|
ret = FAIL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isn->isn_arg.string = str;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((isn = generate_instr(cctx, isntype)) == NULL)
|
vim_free(str);
|
||||||
{
|
return ret;
|
||||||
vim_free(str);
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
isn->isn_arg.string = str;
|
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user