mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.4383: Vim9: unused code lines
Problem: Vim9: unused code lines. Solution: Rely on either "cctx" or "cstack" to not be NULL.
This commit is contained in:
@@ -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 */
|
||||||
|
/**/
|
||||||
|
4383,
|
||||||
/**/
|
/**/
|
||||||
4382,
|
4382,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -151,8 +151,7 @@ arg_exists(
|
|||||||
/*
|
/*
|
||||||
* Lookup a script-local variable in the current script, possibly defined in a
|
* Lookup a script-local variable in the current script, possibly defined in a
|
||||||
* block that contains the function "cctx->ctx_ufunc".
|
* block that contains the function "cctx->ctx_ufunc".
|
||||||
* "cctx" is NULL at the script level.
|
* "cctx" is NULL at the script level, "cstack" is NULL in a function.
|
||||||
* "cstack_T" is NULL in a function.
|
|
||||||
* If "len" is <= 0 "name" must be NUL terminated.
|
* If "len" is <= 0 "name" must be NUL terminated.
|
||||||
* Return NULL when not found.
|
* Return NULL when not found.
|
||||||
*/
|
*/
|
||||||
@@ -185,11 +184,9 @@ find_script_var(char_u *name, size_t len, cctx_T *cctx, cstack_T *cstack)
|
|||||||
if (cctx == NULL)
|
if (cctx == NULL)
|
||||||
{
|
{
|
||||||
// Not in a function scope, find variable with block ID equal to or
|
// Not in a function scope, find variable with block ID equal to or
|
||||||
// smaller than the current block id. If "cstack" is not NULL go up
|
// smaller than the current block id. Use "cstack" to go up the block
|
||||||
// the block scopes (more accurate).
|
// scopes.
|
||||||
while (sav != NULL)
|
while (sav != NULL)
|
||||||
{
|
|
||||||
if (cstack != NULL)
|
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
@@ -198,9 +195,6 @@ find_script_var(char_u *name, size_t len, cctx_T *cctx, cstack_T *cstack)
|
|||||||
break;
|
break;
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
else if (sav->sav_block_id <= si->sn_current_block_id)
|
|
||||||
break;
|
|
||||||
sav = sav->sav_next;
|
sav = sav->sav_next;
|
||||||
}
|
}
|
||||||
return sav;
|
return sav;
|
||||||
@@ -236,8 +230,7 @@ script_is_vim9()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Lookup a variable (without s: prefix) in the current script.
|
* Lookup a variable (without s: prefix) in the current script.
|
||||||
* "cctx" is NULL at the script level.
|
* "cctx" is NULL at the script level, "cstack" is NULL in a function.
|
||||||
* "cstack" is NULL in a function.
|
|
||||||
* Returns OK or FAIL.
|
* Returns OK or FAIL.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
@@ -296,7 +289,8 @@ item_exists(char_u *name, size_t len, int cmd UNUSED, cctx_T *cctx)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if "p[len]" is already defined, either in script "import_sid" or in
|
* Check if "p[len]" is already defined, either in script "import_sid" or in
|
||||||
* compilation context "cctx". "cctx" is NULL at the script level.
|
* compilation context "cctx".
|
||||||
|
* "cctx" is NULL at the script level, "cstack" is NULL in a function.
|
||||||
* Does not check the global namespace.
|
* Does not check the global namespace.
|
||||||
* If "is_arg" is TRUE the error message is for an argument name.
|
* If "is_arg" is TRUE the error message is for an argument name.
|
||||||
* Return FAIL and give an error if it defined.
|
* Return FAIL and give an error if it defined.
|
||||||
@@ -507,6 +501,7 @@ check_item_writable(svar_T *sv, int check_writable, char_u *name)
|
|||||||
/*
|
/*
|
||||||
* Find "name" in script-local items of script "sid".
|
* Find "name" in script-local items of script "sid".
|
||||||
* Pass "check_writable" to check_item_writable().
|
* Pass "check_writable" to check_item_writable().
|
||||||
|
* "cctx" is NULL at the script level, "cstack" is NULL in a function.
|
||||||
* Returns the index in "sn_var_vals" if found.
|
* Returns the index in "sn_var_vals" if found.
|
||||||
* If found but not in "sn_var_vals" returns -1.
|
* If found but not in "sn_var_vals" returns -1.
|
||||||
* If not found or the variable is not writable returns -2.
|
* If not found or the variable is not writable returns -2.
|
||||||
|
Reference in New Issue
Block a user