@@ -2422,7 +2422,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
24222422 * var1 isnot var2
24232423 *
24242424 * "arg" must point to the first non-white of the expression.
2425- * "arg" is advanced to the next non-white after the recognized expression.
2425+ * "arg" is advanced to just after the recognized expression.
24262426 *
24272427 * Return OK or FAIL.
24282428 */
@@ -2452,9 +2452,17 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
24522452 typval_T var2 ;
24532453 int ic ;
24542454 int vim9script = in_vim9script ();
2455+ int evaluate = evalarg == NULL
2456+ ? 0 : (evalarg -> eval_flags & EVAL_EVALUATE );
24552457
24562458 if (getnext )
24572459 * arg = eval_next_line (evalarg );
2460+ else if (evaluate && vim9script && !VIM_ISWHITE (* * arg ))
2461+ {
2462+ error_white_both (p , len );
2463+ clear_tv (rettv );
2464+ return FAIL ;
2465+ }
24582466
24592467 if (vim9script && type_is && (p [len ] == '?' || p [len ] == '#' ))
24602468 {
@@ -2482,13 +2490,19 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
24822490 /*
24832491 * Get the second variable.
24842492 */
2493+ if (evaluate && vim9script && !IS_WHITE_OR_NUL (p [len ]))
2494+ {
2495+ error_white_both (p , 1 );
2496+ clear_tv (rettv );
2497+ return FAIL ;
2498+ }
24852499 * arg = skipwhite_and_linebreak (p + len , evalarg );
24862500 if (eval5 (arg , & var2 , evalarg ) == FAIL )
24872501 {
24882502 clear_tv (rettv );
24892503 return FAIL ;
24902504 }
2491- if (evalarg != NULL && ( evalarg -> eval_flags & EVAL_EVALUATE ) )
2505+ if (evaluate )
24922506 {
24932507 int ret ;
24942508
@@ -2552,7 +2566,7 @@ eval_addlist(typval_T *tv1, typval_T *tv2)
25522566 * .. string concatenation
25532567 *
25542568 * "arg" must point to the first non-white of the expression.
2555- * "arg" is advanced to the next non-white after the recognized expression.
2569+ * "arg" is advanced to just after the recognized expression.
25562570 *
25572571 * Return OK or FAIL.
25582572 */
@@ -2754,7 +2768,7 @@ eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
27542768 * % number modulo
27552769 *
27562770 * "arg" must point to the first non-white of the expression.
2757- * "arg" is advanced to the next non-white after the recognized expression.
2771+ * "arg" is advanced to just after the recognized expression.
27582772 *
27592773 * Return OK or FAIL.
27602774 */
@@ -2956,7 +2970,7 @@ eval6(
29562970 * trailing ->name() method call
29572971 *
29582972 * "arg" must point to the first non-white of the expression.
2959- * "arg" is advanced to the next non-white after the recognized expression.
2973+ * "arg" is advanced to just after the recognized expression.
29602974 *
29612975 * Return OK or FAIL.
29622976 */
0 commit comments