comparison src/eval.c @ 21642:5ae89c8633ae v8.2.1371

patch 8.2.1371: Vim9: no error for missing white space around operator Commit: https://github.com/vim/vim/commit/3c1c9fd94bc80871119a8519f3b881595082a6c0 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 5 12:32:38 2020 +0200 patch 8.2.1371: Vim9: no error for missing white space around operator Problem: Vim9: no error for missing white space around operator. Solution: Check for white space around && and ||.
author Bram Moolenaar <Bram@vim.org>
date Wed, 05 Aug 2020 12:45:03 +0200
parents dcfcb6163f3d
children 7d3ba70a03f1
comparison
equal deleted inserted replaced
21641:20b0520f1174 21642:5ae89c8633ae
2240 while (p[0] == '|' && p[1] == '|') 2240 while (p[0] == '|' && p[1] == '|')
2241 { 2241 {
2242 if (getnext) 2242 if (getnext)
2243 *arg = eval_next_line(evalarg_used); 2243 *arg = eval_next_line(evalarg_used);
2244 else 2244 else
2245 {
2246 if (evaluate && in_vim9script() && !VIM_ISWHITE(p[-1]))
2247 {
2248 error_white_both(p, 2);
2249 clear_tv(rettv);
2250 return FAIL;
2251 }
2245 *arg = p; 2252 *arg = p;
2253 }
2246 2254
2247 /* 2255 /*
2248 * Get the second variable. 2256 * Get the second variable.
2249 */ 2257 */
2258 if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[2]))
2259 {
2260 error_white_both(p, 2);
2261 clear_tv(rettv);
2262 return FAIL;
2263 }
2250 *arg = skipwhite_and_linebreak(*arg + 2, evalarg_used); 2264 *arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
2251 evalarg_used->eval_flags = !result ? orig_flags 2265 evalarg_used->eval_flags = !result ? orig_flags
2252 : orig_flags & ~EVAL_EVALUATE; 2266 : orig_flags & ~EVAL_EVALUATE;
2253 if (eval3(arg, &var2, evalarg_used) == FAIL) 2267 if (eval3(arg, &var2, evalarg_used) == FAIL)
2254 return FAIL; 2268 return FAIL;
2357 while (p[0] == '&' && p[1] == '&') 2371 while (p[0] == '&' && p[1] == '&')
2358 { 2372 {
2359 if (getnext) 2373 if (getnext)
2360 *arg = eval_next_line(evalarg_used); 2374 *arg = eval_next_line(evalarg_used);
2361 else 2375 else
2376 {
2377 if (evaluate && in_vim9script() && !VIM_ISWHITE(p[-1]))
2378 {
2379 error_white_both(p, 2);
2380 clear_tv(rettv);
2381 return FAIL;
2382 }
2362 *arg = p; 2383 *arg = p;
2384 }
2363 2385
2364 /* 2386 /*
2365 * Get the second variable. 2387 * Get the second variable.
2366 */ 2388 */
2389 if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[2]))
2390 {
2391 error_white_both(p, 2);
2392 clear_tv(rettv);
2393 return FAIL;
2394 }
2367 *arg = skipwhite_and_linebreak(*arg + 2, evalarg_used); 2395 *arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
2368 evalarg_used->eval_flags = result ? orig_flags 2396 evalarg_used->eval_flags = result ? orig_flags
2369 : orig_flags & ~EVAL_EVALUATE; 2397 : orig_flags & ~EVAL_EVALUATE;
2370 if (eval4(arg, &var2, evalarg_used) == FAIL) 2398 if (eval4(arg, &var2, evalarg_used) == FAIL)
2371 return FAIL; 2399 return FAIL;