Problem: Evaluating string expression advances function line.
Solution: Disable function lines while parsing a string expression.
(Hirohito Higashi, closes #11796)
assert_equal('', v:errmsg)
END
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
def Test_expr9_method_call_import()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1164,
/**/
1163,
/**/
cctx->ctx_instr.ga_len = 0;
cctx->ctx_instr.ga_maxlen = 0;
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);
+
+ cctx->ctx_ufunc->uf_lines.ga_len = galen_save;
+
s = skipwhite(s);
trailing_error = *s != NUL;