comparison src/eval.c @ 21425:a6c316ef161a v8.2.1263

patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script Commit: https://github.com/vim/vim/commit/c71f36a889897aca4ac2ad3828926e3801728336 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jul 21 21:31:00 2020 +0200 patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script Problem: Vim9: comperators use 'ignorecase' in Vim9 script. Solution: Ignore 'ignorecase'. Use true and false instead of 1 and 0. (closes #6497)
author Bram Moolenaar <Bram@vim.org>
date Tue, 21 Jul 2020 21:45:06 +0200
parents 54a304e4dc57
children 66386ca8a69f
comparison
equal deleted inserted replaced
21424:8835316c02ba 21425:a6c316ef161a
2411 * Return OK or FAIL. 2411 * Return OK or FAIL.
2412 */ 2412 */
2413 static int 2413 static int
2414 eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg) 2414 eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
2415 { 2415 {
2416 typval_T var2;
2417 char_u *p; 2416 char_u *p;
2418 int getnext; 2417 int getnext;
2419 int i; 2418 int i;
2420 exptype_T type = EXPR_UNKNOWN; 2419 exptype_T type = EXPR_UNKNOWN;
2421 int len = 2; 2420 int len = 2;
2422 int ic;
2423 2421
2424 /* 2422 /*
2425 * Get the first variable. 2423 * Get the first variable.
2426 */ 2424 */
2427 if (eval5(arg, rettv, evalarg) == FAIL) 2425 if (eval5(arg, rettv, evalarg) == FAIL)
2470 /* 2468 /*
2471 * If there is a comparative operator, use it. 2469 * If there is a comparative operator, use it.
2472 */ 2470 */
2473 if (type != EXPR_UNKNOWN) 2471 if (type != EXPR_UNKNOWN)
2474 { 2472 {
2473 typval_T var2;
2474 int ic;
2475 int vim9script = in_vim9script();
2476
2475 if (getnext) 2477 if (getnext)
2476 *arg = eval_next_line(evalarg); 2478 *arg = eval_next_line(evalarg);
2477 2479
2478 // extra question mark appended: ignore case 2480 // extra question mark appended: ignore case
2479 if (p[len] == '?') 2481 if (p[len] == '?')
2485 else if (p[len] == '#') 2487 else if (p[len] == '#')
2486 { 2488 {
2487 ic = FALSE; 2489 ic = FALSE;
2488 ++len; 2490 ++len;
2489 } 2491 }
2490 // nothing appended: use 'ignorecase' 2492 // nothing appended: use 'ignorecase' if not in Vim script
2491 else 2493 else
2492 ic = p_ic; 2494 ic = vim9script ? FALSE : p_ic;
2493 2495
2494 /* 2496 /*
2495 * Get the second variable. 2497 * Get the second variable.
2496 */ 2498 */
2497 *arg = skipwhite_and_linebreak(p + len, evalarg); 2499 *arg = skipwhite_and_linebreak(p + len, evalarg);
2502 } 2504 }
2503 if (evalarg != NULL && (evalarg->eval_flags & EVAL_EVALUATE)) 2505 if (evalarg != NULL && (evalarg->eval_flags & EVAL_EVALUATE))
2504 { 2506 {
2505 int ret; 2507 int ret;
2506 2508
2507 if (in_vim9script() && check_compare_types( 2509 if (vim9script && check_compare_types(type, rettv, &var2) == FAIL)
2508 type, rettv, &var2) == FAIL)
2509 { 2510 {
2510 ret = FAIL; 2511 ret = FAIL;
2511 clear_tv(rettv); 2512 clear_tv(rettv);
2512 } 2513 }
2513 else 2514 else