mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.0.1164: evaluating string expression advances function line
Problem: Evaluating string expression advances function line. Solution: Disable function lines while parsing a string expression. (Hirohito Higashi, closes #11796)
This commit is contained in:
parent
dda3053121
commit
01c5f2addf
@ -3700,6 +3700,17 @@ def Test_expr9_method_call_linebreak()
|
|||||||
assert_equal('', v:errmsg)
|
assert_equal('', v:errmsg)
|
||||||
END
|
END
|
||||||
v9.CheckScriptSuccess(lines)
|
v9.CheckScriptSuccess(lines)
|
||||||
|
|
||||||
|
# this was skipping over the expression without an error
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def Test(s: string): string
|
||||||
|
return substitute(s, 'A', '\=toupper("x")', 'g')
|
||||||
|
->tolower()
|
||||||
|
enddef
|
||||||
|
assert_equal('xbcd', Test('ABCD'))
|
||||||
|
END
|
||||||
|
v9.CheckScriptSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_expr9_method_call_import()
|
def Test_expr9_method_call_import()
|
||||||
|
@ -695,6 +695,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 */
|
||||||
|
/**/
|
||||||
|
1164,
|
||||||
/**/
|
/**/
|
||||||
1163,
|
1163,
|
||||||
/**/
|
/**/
|
||||||
|
@ -733,7 +733,15 @@ compile_string(isn_T *isn, cctx_T *cctx, int str_offset)
|
|||||||
cctx->ctx_instr.ga_len = 0;
|
cctx->ctx_instr.ga_len = 0;
|
||||||
cctx->ctx_instr.ga_maxlen = 0;
|
cctx->ctx_instr.ga_maxlen = 0;
|
||||||
cctx->ctx_instr.ga_data = NULL;
|
cctx->ctx_instr.ga_data = NULL;
|
||||||
|
|
||||||
|
// avoid peeking a next line
|
||||||
|
int galen_save = cctx->ctx_ufunc->uf_lines.ga_len;
|
||||||
|
cctx->ctx_ufunc->uf_lines.ga_len = 0;
|
||||||
|
|
||||||
expr_res = compile_expr0(&s, cctx);
|
expr_res = compile_expr0(&s, cctx);
|
||||||
|
|
||||||
|
cctx->ctx_ufunc->uf_lines.ga_len = galen_save;
|
||||||
|
|
||||||
s = skipwhite(s);
|
s = skipwhite(s);
|
||||||
trailing_error = *s != NUL;
|
trailing_error = *s != NUL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user