Problem: Vim9: skipping over expression doesn't handle line breaks.
Solution: Pass evalarg to skip_expr(). (closes #7157)
* Return FAIL for an error, OK otherwise.
*/
int
-skip_expr(char_u **pp)
+skip_expr(char_u **pp, evalarg_T *evalarg)
{
typval_T rettv;
*pp = skipwhite(*pp);
- return eval1(pp, &rettv, NULL);
+ return eval1(pp, &rettv, evalarg);
}
/*
struct dbg_stuff debug_saved; // saved things for debug mode
int initial_trylevel;
msglist_T **saved_msg_list = NULL;
- msglist_T *private_msg_list;
+ msglist_T *private_msg_list = NULL;
// "fgetline" and "cookie" passed to do_one_cmd()
char_u *(*cmd_getline)(int, void *, int, getline_opt_T);
// BufWritePost autocommands are executed after a write error.
saved_msg_list = msg_list;
msg_list = &private_msg_list;
- private_msg_list = NULL;
#endif
// It's possible to create an endless loop with ":execute", catch that
// When followed by "=" or "+=" then it is an assignment.
++emsg_silent;
- if (skip_expr(&after) == OK
+ if (skip_expr(&after, NULL) == OK
&& (*after == '='
|| (*after != NUL && after[1] == '=')))
eap->cmdidx = CMD_var;
if (p[0] == '`' && p[1] == '=')
{
p += 2;
- (void)skip_expr(&p);
+ (void)skip_expr(&p, NULL);
if (*p == '`')
++p;
continue;
else if (p[0] == '`' && p[1] == '=' && (eap->argt & EX_XFILE))
{
p += 2;
- (void)skip_expr(&p);
+ (void)skip_expr(&p, NULL);
}
#endif
var = src;
src += 2;
- (void)skip_expr(&src);
+ (void)skip_expr(&src, NULL);
if (*src == '`')
++src;
len = src - var;
int eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv);
int eval_expr_to_bool(typval_T *expr, int *error);
char_u *eval_to_string_skip(char_u *arg, exarg_T *eap, int skip);
-int skip_expr(char_u **pp);
+int skip_expr(char_u **pp, evalarg_T *evalarg);
int skip_expr_concatenate(char_u **arg, char_u **start, char_u **end, evalarg_T *evalarg);
char_u *eval_to_string(char_u *arg, int convert);
char_u *eval_to_string_safe(char_u *arg, int use_sandbox);
CheckScriptSuccess(lines)
enddef
+def Test_skipped_expr_linebreak()
+ if 0
+ var x = []
+ ->map({ -> 0})
+ endif
+enddef
+
def Test_dict_member()
var test: dict<list<number>> = {'data': [3, 1, 2]}
test.data->sort()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1891,
/**/
1890,
/**/
// Ignore all kinds of errors when not producing code.
if (cctx->ctx_skip == SKIP_YES)
{
- skip_expr(arg);
+ evalarg_T evalarg;
+
+ CLEAR_FIELD(evalarg);
+ evalarg.eval_cctx = cctx;
+ skip_expr(arg, &evalarg);
return OK;
}