forked from aniani/vim
patch 8.2.2483: Vim9: type error for misformed expression
Problem: Vim9: type error for misformed expression. Solution: Check for end of command before checking type. (closes #7795)
This commit is contained in:
@@ -6701,6 +6701,11 @@ compile_if(char_u *arg, cctx_T *cctx)
|
||||
clear_ppconst(&ppconst);
|
||||
return NULL;
|
||||
}
|
||||
if (!ends_excmd2(arg, skipwhite(p)))
|
||||
{
|
||||
semsg(_(e_trailing_arg), p);
|
||||
return NULL;
|
||||
}
|
||||
if (cctx->ctx_skip == SKIP_YES)
|
||||
clear_ppconst(&ppconst);
|
||||
else if (instr->ga_len == instr_count && ppconst.pp_used == 1)
|
||||
@@ -6825,6 +6830,11 @@ compile_elseif(char_u *arg, cctx_T *cctx)
|
||||
return NULL;
|
||||
}
|
||||
cctx->ctx_skip = save_skip;
|
||||
if (!ends_excmd2(arg, skipwhite(p)))
|
||||
{
|
||||
semsg(_(e_trailing_arg), p);
|
||||
return NULL;
|
||||
}
|
||||
if (scope->se_skip_save == SKIP_YES)
|
||||
clear_ppconst(&ppconst);
|
||||
else if (instr->ga_len == instr_count && ppconst.pp_used == 1)
|
||||
@@ -7237,6 +7247,11 @@ compile_while(char_u *arg, cctx_T *cctx)
|
||||
// compile "expr"
|
||||
if (compile_expr0(&p, cctx) == FAIL)
|
||||
return NULL;
|
||||
if (!ends_excmd2(arg, skipwhite(p)))
|
||||
{
|
||||
semsg(_(e_trailing_arg), p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bool_on_stack(cctx) == FAIL)
|
||||
return FAIL;
|
||||
|
Reference in New Issue
Block a user