mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.3709: Vim9: backtick expression expanded when not desired
Problem: Vim9: backtick expression expanded when not desired. Solution: Only expand a backtick expression for commands that expand their argument. Remove a few outdated TODO comments.
This commit is contained in:
@@ -206,6 +206,15 @@ def Test_folddo_backtick_expansion()
|
|||||||
folddoclose edit `=name`
|
folddoclose edit `=name`
|
||||||
assert_equal('xxx', bufname())
|
assert_equal('xxx', bufname())
|
||||||
bwipe!
|
bwipe!
|
||||||
|
|
||||||
|
var lines =<< trim END
|
||||||
|
g:val = 'value'
|
||||||
|
def Test()
|
||||||
|
folddoopen echo `=g:val`
|
||||||
|
enddef
|
||||||
|
call Test()
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E15: Invalid expression: "`=g:val`"')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_hardcopy_wildcards()
|
def Test_hardcopy_wildcards()
|
||||||
|
@@ -753,6 +753,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 */
|
||||||
|
/**/
|
||||||
|
3709,
|
||||||
/**/
|
/**/
|
||||||
3708,
|
3708,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -7898,8 +7898,7 @@ compile_elseif(char_u *arg, cctx_T *cctx)
|
|||||||
int error = FALSE;
|
int error = FALSE;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
// The expression results in a constant.
|
// The expression result is a constant.
|
||||||
// TODO: how about nesting?
|
|
||||||
v = tv_get_bool_chk(&ppconst.pp_tv[0], &error);
|
v = tv_get_bool_chk(&ppconst.pp_tv[0], &error);
|
||||||
if (error)
|
if (error)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -8171,7 +8170,6 @@ compile_for(char_u *arg_start, cctx_T *cctx)
|
|||||||
item_type = vartype->tt_member;
|
item_type = vartype->tt_member;
|
||||||
else if (vartype->tt_member->tt_type == VAR_LIST
|
else if (vartype->tt_member->tt_type == VAR_LIST
|
||||||
&& vartype->tt_member->tt_member->tt_type != VAR_ANY)
|
&& vartype->tt_member->tt_member->tt_type != VAR_ANY)
|
||||||
// TODO: should get the type for each lhs
|
|
||||||
item_type = vartype->tt_member->tt_member;
|
item_type = vartype->tt_member->tt_member;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8224,7 +8222,7 @@ compile_for(char_u *arg_start, cctx_T *cctx)
|
|||||||
lhs_type = parse_type(&p, cctx->ctx_type_list, TRUE);
|
lhs_type = parse_type(&p, cctx->ctx_type_list, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: script var not supported?
|
// Script var is not supported.
|
||||||
if (get_var_dest(name, &dest, CMD_for, &opt_flags,
|
if (get_var_dest(name, &dest, CMD_for, &opt_flags,
|
||||||
&vimvaridx, &type, cctx) == FAIL)
|
&vimvaridx, &type, cctx) == FAIL)
|
||||||
goto failed;
|
goto failed;
|
||||||
@@ -8771,21 +8769,21 @@ compile_finally(char_u *arg, cctx_T *cctx)
|
|||||||
#ifdef FEAT_PROFILE
|
#ifdef FEAT_PROFILE
|
||||||
if (cctx->ctx_compile_type == CT_PROFILE
|
if (cctx->ctx_compile_type == CT_PROFILE
|
||||||
&& ((isn_T *)instr->ga_data)[this_instr - 1]
|
&& ((isn_T *)instr->ga_data)[this_instr - 1]
|
||||||
.isn_type == ISN_PROF_START)
|
.isn_type == ISN_PROF_START)
|
||||||
{
|
{
|
||||||
// jump to the profile start of the "finally"
|
// jump to the profile start of the "finally"
|
||||||
--this_instr;
|
--this_instr;
|
||||||
|
|
||||||
// jump to the profile end above it
|
// jump to the profile end above it
|
||||||
if (this_instr > 0 && ((isn_T *)instr->ga_data)[this_instr - 1]
|
if (this_instr > 0 && ((isn_T *)instr->ga_data)[this_instr - 1]
|
||||||
.isn_type == ISN_PROF_END)
|
.isn_type == ISN_PROF_END)
|
||||||
--this_instr;
|
--this_instr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fill in the "end" label in jumps at the end of the blocks.
|
// Fill in the "end" label in jumps at the end of the blocks.
|
||||||
compile_fill_jump_to_end(&scope->se_u.se_try.ts_end_label,
|
compile_fill_jump_to_end(&scope->se_u.se_try.ts_end_label,
|
||||||
this_instr, cctx);
|
this_instr, cctx);
|
||||||
|
|
||||||
// If there is no :catch then an exception jumps to :finally.
|
// If there is no :catch then an exception jumps to :finally.
|
||||||
if (isn->isn_arg.try.try_ref->try_catch == 0)
|
if (isn->isn_arg.try.try_ref->try_catch == 0)
|
||||||
@@ -8800,8 +8798,6 @@ compile_finally(char_u *arg, cctx_T *cctx)
|
|||||||
}
|
}
|
||||||
if (generate_instr(cctx, ISN_FINALLY) == NULL)
|
if (generate_instr(cctx, ISN_FINALLY) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// TODO: set index in ts_finally_label jumps
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
@@ -9184,9 +9180,17 @@ compile_exec(char_u *line_arg, exarg_T *eap, cctx_T *cctx)
|
|||||||
|
|
||||||
if (eap->cmdidx == CMD_folddoopen || eap->cmdidx == CMD_folddoclosed)
|
if (eap->cmdidx == CMD_folddoopen || eap->cmdidx == CMD_folddoclosed)
|
||||||
{
|
{
|
||||||
// TODO: should only expand when appropriate for the command
|
exarg_T nea;
|
||||||
eap->arg = skiptowhite(eap->arg);
|
|
||||||
has_expr = TRUE;
|
CLEAR_FIELD(nea);
|
||||||
|
nea.cmd = eap->arg;
|
||||||
|
p = find_ex_command(&nea, NULL, lookup_scriptitem, NULL);
|
||||||
|
if (nea.cmdidx <= CMD_SIZE)
|
||||||
|
{
|
||||||
|
has_expr = excmd_get_argt(nea.cmdidx) & (EX_XFILE | EX_EXPAND);
|
||||||
|
if (has_expr)
|
||||||
|
eap->arg = skiptowhite(eap->arg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_expr && (p = (char_u *)strstr((char *)eap->arg, "`=")) != NULL)
|
if (has_expr && (p = (char_u *)strstr((char *)eap->arg, "`=")) != NULL)
|
||||||
|
Reference in New Issue
Block a user