From 53cbfd02209caee54190aae7f1ff8b407ae4039b Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 9 Apr 2021 21:46:02 -0400 Subject: vim-patch:8.2.0044: expression type is used inconsistently Problem: Expression type is used inconsistently. Solution: Add "ETYPE_IS" and "ETYPE_ISNOT" as separate enum values. Rename "TYPE_" to "ETYPE_" to avoid confusion. https://github.com/vim/vim/commit/07a3db89b8953bd0964895badb3b662f7514bc10 --- src/nvim/eval.c | 140 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 76 insertions(+), 64 deletions(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index b310fd49b0..9f6ddebdd5 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -3417,8 +3417,7 @@ static int eval4(char_u **arg, typval_T *rettv, int evaluate) { typval_T var2; char_u *p; - exptype_T type = TYPE_UNKNOWN; - bool type_is = false; // true for "is" and "isnot" + exptype_T type = ETYPE_UNKNOWN; int len = 2; bool ic; @@ -3430,35 +3429,42 @@ static int eval4(char_u **arg, typval_T *rettv, int evaluate) p = *arg; switch (p[0]) { - case '=': if (p[1] == '=') - type = TYPE_EQUAL; - else if (p[1] == '~') - type = TYPE_MATCH; + case '=': + if (p[1] == '=') { + type = ETYPE_EQUAL; + } else if (p[1] == '~') { + type = ETYPE_MATCH; + } break; - case '!': if (p[1] == '=') - type = TYPE_NEQUAL; - else if (p[1] == '~') - type = TYPE_NOMATCH; + case '!': + if (p[1] == '=') { + type = ETYPE_NEQUAL; + } else if (p[1] == '~') { + type = ETYPE_NOMATCH; + } break; - case '>': if (p[1] != '=') { - type = TYPE_GREATER; + case '>': + if (p[1] != '=') { + type = ETYPE_GREATER; len = 1; - } else - type = TYPE_GEQUAL; + } else { + type = ETYPE_GEQUAL; + } break; - case '<': if (p[1] != '=') { - type = TYPE_SMALLER; + case '<': + if (p[1] != '=') { + type = ETYPE_SMALLER; len = 1; - } else - type = TYPE_SEQUAL; + } else { + type = ETYPE_SEQUAL; + } break; case 'i': if (p[1] == 's') { if (p[2] == 'n' && p[3] == 'o' && p[4] == 't') { len = 5; } if (!isalnum(p[len]) && p[len] != '_') { - type = len == 2 ? TYPE_EQUAL : TYPE_NEQUAL; - type_is = true; + type = len == 2 ? ETYPE_IS : ETYPE_ISNOT; } } break; @@ -3467,7 +3473,7 @@ static int eval4(char_u **arg, typval_T *rettv, int evaluate) /* * If there is a comparative operator, use it. */ - if (type != TYPE_UNKNOWN) { + if (type != ETYPE_UNKNOWN) { // extra question mark appended: ignore case if (p[len] == '?') { ic = true; @@ -3486,7 +3492,7 @@ static int eval4(char_u **arg, typval_T *rettv, int evaluate) return FAIL; } if (evaluate) { - const int ret = typval_compare(rettv, &var2, type, type_is, ic); + const int ret = typval_compare(rettv, &var2, type, ic); tv_clear(&var2); return ret; @@ -10583,26 +10589,26 @@ int typval_compare( typval_T *typ1, // first operand typval_T *typ2, // second operand exptype_T type, // operator - bool type_is, // true for "is" and "isnot" bool ic // ignore case ) FUNC_ATTR_NONNULL_ALL { varnumber_T n1, n2; + const bool type_is = type == ETYPE_IS || type == ETYPE_ISNOT; if (type_is && typ1->v_type != typ2->v_type) { // For "is" a different type always means false, for "notis" // it means true. - n1 = type == TYPE_NEQUAL; + n1 = type == ETYPE_ISNOT; } else if (typ1->v_type == VAR_LIST || typ2->v_type == VAR_LIST) { if (type_is) { n1 = typ1->v_type == typ2->v_type && typ1->vval.v_list == typ2->vval.v_list; - if (type == TYPE_NEQUAL) { + if (type == ETYPE_ISNOT) { n1 = !n1; } } else if (typ1->v_type != typ2->v_type - || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) { + || (type != ETYPE_EQUAL && type != ETYPE_NEQUAL)) { if (typ1->v_type != typ2->v_type) { EMSG(_("E691: Can only compare List with List")); } else { @@ -10613,7 +10619,7 @@ int typval_compare( } else { // Compare two Lists for being equal or unequal. n1 = tv_list_equal(typ1->vval.v_list, typ2->vval.v_list, ic, false); - if (type == TYPE_NEQUAL) { + if (type == ETYPE_NEQUAL) { n1 = !n1; } } @@ -10621,11 +10627,11 @@ int typval_compare( if (type_is) { n1 = typ1->v_type == typ2->v_type && typ1->vval.v_dict == typ2->vval.v_dict; - if (type == TYPE_NEQUAL) { + if (type == ETYPE_ISNOT) { n1 = !n1; } } else if (typ1->v_type != typ2->v_type - || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) { + || (type != ETYPE_EQUAL && type != ETYPE_NEQUAL)) { if (typ1->v_type != typ2->v_type) { EMSG(_("E735: Can only compare Dictionary with Dictionary")); } else { @@ -10636,12 +10642,12 @@ int typval_compare( } else { // Compare two Dictionaries for being equal or unequal. n1 = tv_dict_equal(typ1->vval.v_dict, typ2->vval.v_dict, ic, false); - if (type == TYPE_NEQUAL) { + if (type == ETYPE_NEQUAL) { n1 = !n1; } } } else if (tv_is_func(*typ1) || tv_is_func(*typ2)) { - if (type != TYPE_EQUAL && type != TYPE_NEQUAL) { + if (type != ETYPE_EQUAL && type != ETYPE_NEQUAL) { EMSG(_("E694: Invalid operation for Funcrefs")); tv_clear(typ1); return FAIL; @@ -10663,43 +10669,47 @@ int typval_compare( } else { n1 = tv_equal(typ1, typ2, ic, false); } - if (type == TYPE_NEQUAL) { + if (type == ETYPE_NEQUAL || type == ETYPE_ISNOT) { n1 = !n1; } } else if ((typ1->v_type == VAR_FLOAT || typ2->v_type == VAR_FLOAT) - && type != TYPE_MATCH && type != TYPE_NOMATCH) { + && type != ETYPE_MATCH && type != ETYPE_NOMATCH) { // If one of the two variables is a float, compare as a float. // When using "=~" or "!~", always compare as string. const float_T f1 = tv_get_float(typ1); const float_T f2 = tv_get_float(typ2); n1 = false; switch (type) { - case TYPE_EQUAL: n1 = f1 == f2; break; - case TYPE_NEQUAL: n1 = f1 != f2; break; - case TYPE_GREATER: n1 = f1 > f2; break; - case TYPE_GEQUAL: n1 = f1 >= f2; break; - case TYPE_SMALLER: n1 = f1 < f2; break; - case TYPE_SEQUAL: n1 = f1 <= f2; break; - case TYPE_UNKNOWN: - case TYPE_MATCH: - case TYPE_NOMATCH: break; + case ETYPE_EQUAL: n1 = f1 == f2; break; + case ETYPE_NEQUAL: n1 = f1 != f2; break; + case ETYPE_GREATER: n1 = f1 > f2; break; + case ETYPE_GEQUAL: n1 = f1 >= f2; break; + case ETYPE_SMALLER: n1 = f1 < f2; break; + case ETYPE_SEQUAL: n1 = f1 <= f2; break; + case ETYPE_UNKNOWN: + case ETYPE_IS: + case ETYPE_ISNOT: + case ETYPE_MATCH: + case ETYPE_NOMATCH: break; // avoid gcc warning } } else if ((typ1->v_type == VAR_NUMBER || typ2->v_type == VAR_NUMBER) - && type != TYPE_MATCH && type != TYPE_NOMATCH) { + && type != ETYPE_MATCH && type != ETYPE_NOMATCH) { // If one of the two variables is a number, compare as a number. // When using "=~" or "!~", always compare as string. n1 = tv_get_number(typ1); n2 = tv_get_number(typ2); switch (type) { - case TYPE_EQUAL: n1 = n1 == n2; break; - case TYPE_NEQUAL: n1 = n1 != n2; break; - case TYPE_GREATER: n1 = n1 > n2; break; - case TYPE_GEQUAL: n1 = n1 >= n2; break; - case TYPE_SMALLER: n1 = n1 < n2; break; - case TYPE_SEQUAL: n1 = n1 <= n2; break; - case TYPE_UNKNOWN: - case TYPE_MATCH: - case TYPE_NOMATCH: break; + case ETYPE_EQUAL: n1 = n1 == n2; break; + case ETYPE_NEQUAL: n1 = n1 != n2; break; + case ETYPE_GREATER: n1 = n1 > n2; break; + case ETYPE_GEQUAL: n1 = n1 >= n2; break; + case ETYPE_SMALLER: n1 = n1 < n2; break; + case ETYPE_SEQUAL: n1 = n1 <= n2; break; + case ETYPE_UNKNOWN: + case ETYPE_IS: + case ETYPE_ISNOT: + case ETYPE_MATCH: + case ETYPE_NOMATCH: break; // avoid gcc warning } } else { char buf1[NUMBUFLEN]; @@ -10707,28 +10717,30 @@ int typval_compare( const char *const s1 = tv_get_string_buf(typ1, buf1); const char *const s2 = tv_get_string_buf(typ2, buf2); int i; - if (type != TYPE_MATCH && type != TYPE_NOMATCH) { + if (type != ETYPE_MATCH && type != ETYPE_NOMATCH) { i = mb_strcmp_ic(ic, s1, s2); } else { i = 0; } n1 = false; switch (type) { - case TYPE_EQUAL: n1 = i == 0; break; - case TYPE_NEQUAL: n1 = i != 0; break; - case TYPE_GREATER: n1 = i > 0; break; - case TYPE_GEQUAL: n1 = i >= 0; break; - case TYPE_SMALLER: n1 = i < 0; break; - case TYPE_SEQUAL: n1 = i <= 0; break; - - case TYPE_MATCH: - case TYPE_NOMATCH: + case ETYPE_EQUAL: n1 = i == 0; break; + case ETYPE_NEQUAL: n1 = i != 0; break; + case ETYPE_GREATER: n1 = i > 0; break; + case ETYPE_GEQUAL: n1 = i >= 0; break; + case ETYPE_SMALLER: n1 = i < 0; break; + case ETYPE_SEQUAL: n1 = i <= 0; break; + + case ETYPE_MATCH: + case ETYPE_NOMATCH: n1 = pattern_match((char_u *)s2, (char_u *)s1, ic); - if (type == TYPE_NOMATCH) { + if (type == ETYPE_NOMATCH) { n1 = !n1; } break; - case TYPE_UNKNOWN: break; // Avoid gcc warning. + case ETYPE_IS: + case ETYPE_ISNOT: + case ETYPE_UNKNOWN: break; // avoid gcc warning } } tv_clear(typ1); -- cgit From de16fbcc57e8a1bcd39edeaa987b310e06b03421 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 8 Apr 2021 07:47:53 -0400 Subject: vim-patch:8.2.0045: script test fails Problem: Script test fails. Solution: For numbers "is" and "isnot" work like "==" and "!=". https://github.com/vim/vim/commit/ec57ec692eb228ee061824a190d7c451f029c430 --- src/nvim/eval.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 9f6ddebdd5..8439515a71 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10647,7 +10647,8 @@ int typval_compare( } } } else if (tv_is_func(*typ1) || tv_is_func(*typ2)) { - if (type != ETYPE_EQUAL && type != ETYPE_NEQUAL) { + if (type != ETYPE_EQUAL && type != ETYPE_NEQUAL + && type != ETYPE_IS && type != ETYPE_ISNOT) { EMSG(_("E694: Invalid operation for Funcrefs")); tv_clear(typ1); return FAIL; @@ -10680,15 +10681,15 @@ int typval_compare( const float_T f2 = tv_get_float(typ2); n1 = false; switch (type) { + case ETYPE_IS: case ETYPE_EQUAL: n1 = f1 == f2; break; + case ETYPE_ISNOT: case ETYPE_NEQUAL: n1 = f1 != f2; break; case ETYPE_GREATER: n1 = f1 > f2; break; case ETYPE_GEQUAL: n1 = f1 >= f2; break; case ETYPE_SMALLER: n1 = f1 < f2; break; case ETYPE_SEQUAL: n1 = f1 <= f2; break; case ETYPE_UNKNOWN: - case ETYPE_IS: - case ETYPE_ISNOT: case ETYPE_MATCH: case ETYPE_NOMATCH: break; // avoid gcc warning } @@ -10699,15 +10700,15 @@ int typval_compare( n1 = tv_get_number(typ1); n2 = tv_get_number(typ2); switch (type) { + case ETYPE_IS: case ETYPE_EQUAL: n1 = n1 == n2; break; + case ETYPE_ISNOT: case ETYPE_NEQUAL: n1 = n1 != n2; break; case ETYPE_GREATER: n1 = n1 > n2; break; case ETYPE_GEQUAL: n1 = n1 >= n2; break; case ETYPE_SMALLER: n1 = n1 < n2; break; case ETYPE_SEQUAL: n1 = n1 <= n2; break; case ETYPE_UNKNOWN: - case ETYPE_IS: - case ETYPE_ISNOT: case ETYPE_MATCH: case ETYPE_NOMATCH: break; // avoid gcc warning } @@ -10724,7 +10725,9 @@ int typval_compare( } n1 = false; switch (type) { + case ETYPE_IS: case ETYPE_EQUAL: n1 = i == 0; break; + case ETYPE_ISNOT: case ETYPE_NEQUAL: n1 = i != 0; break; case ETYPE_GREATER: n1 = i > 0; break; case ETYPE_GEQUAL: n1 = i >= 0; break; @@ -10738,8 +10741,6 @@ int typval_compare( n1 = !n1; } break; - case ETYPE_IS: - case ETYPE_ISNOT: case ETYPE_UNKNOWN: break; // avoid gcc warning } } -- cgit From ca214311d23e687b9607ba97d01c9ae361d3743a Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 7 Apr 2021 21:57:40 -0400 Subject: vim-patch:8.2.0069: ETYPE_ is used for two different enums Problem: ETYPE_ is used for two different enums. Solution: Rename one to use EXPR_. https://github.com/vim/vim/commit/87396072c5c468f0c129e4ec7cd944ac897b7752 --- src/nvim/eval.c | 120 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 8439515a71..e6c4775a49 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -3417,7 +3417,7 @@ static int eval4(char_u **arg, typval_T *rettv, int evaluate) { typval_T var2; char_u *p; - exptype_T type = ETYPE_UNKNOWN; + exptype_T type = EXPR_UNKNOWN; int len = 2; bool ic; @@ -3431,32 +3431,32 @@ static int eval4(char_u **arg, typval_T *rettv, int evaluate) switch (p[0]) { case '=': if (p[1] == '=') { - type = ETYPE_EQUAL; + type = EXPR_EQUAL; } else if (p[1] == '~') { - type = ETYPE_MATCH; + type = EXPR_MATCH; } break; case '!': if (p[1] == '=') { - type = ETYPE_NEQUAL; + type = EXPR_NEQUAL; } else if (p[1] == '~') { - type = ETYPE_NOMATCH; + type = EXPR_NOMATCH; } break; case '>': if (p[1] != '=') { - type = ETYPE_GREATER; + type = EXPR_GREATER; len = 1; } else { - type = ETYPE_GEQUAL; + type = EXPR_GEQUAL; } break; case '<': if (p[1] != '=') { - type = ETYPE_SMALLER; + type = EXPR_SMALLER; len = 1; } else { - type = ETYPE_SEQUAL; + type = EXPR_SEQUAL; } break; case 'i': if (p[1] == 's') { @@ -3464,7 +3464,7 @@ static int eval4(char_u **arg, typval_T *rettv, int evaluate) len = 5; } if (!isalnum(p[len]) && p[len] != '_') { - type = len == 2 ? ETYPE_IS : ETYPE_ISNOT; + type = len == 2 ? EXPR_IS : EXPR_ISNOT; } } break; @@ -3473,7 +3473,7 @@ static int eval4(char_u **arg, typval_T *rettv, int evaluate) /* * If there is a comparative operator, use it. */ - if (type != ETYPE_UNKNOWN) { + if (type != EXPR_UNKNOWN) { // extra question mark appended: ignore case if (p[len] == '?') { ic = true; @@ -10594,21 +10594,21 @@ int typval_compare( FUNC_ATTR_NONNULL_ALL { varnumber_T n1, n2; - const bool type_is = type == ETYPE_IS || type == ETYPE_ISNOT; + const bool type_is = type == EXPR_IS || type == EXPR_ISNOT; if (type_is && typ1->v_type != typ2->v_type) { // For "is" a different type always means false, for "notis" // it means true. - n1 = type == ETYPE_ISNOT; + n1 = type == EXPR_ISNOT; } else if (typ1->v_type == VAR_LIST || typ2->v_type == VAR_LIST) { if (type_is) { n1 = typ1->v_type == typ2->v_type && typ1->vval.v_list == typ2->vval.v_list; - if (type == ETYPE_ISNOT) { + if (type == EXPR_ISNOT) { n1 = !n1; } } else if (typ1->v_type != typ2->v_type - || (type != ETYPE_EQUAL && type != ETYPE_NEQUAL)) { + || (type != EXPR_EQUAL && type != EXPR_NEQUAL)) { if (typ1->v_type != typ2->v_type) { EMSG(_("E691: Can only compare List with List")); } else { @@ -10619,7 +10619,7 @@ int typval_compare( } else { // Compare two Lists for being equal or unequal. n1 = tv_list_equal(typ1->vval.v_list, typ2->vval.v_list, ic, false); - if (type == ETYPE_NEQUAL) { + if (type == EXPR_NEQUAL) { n1 = !n1; } } @@ -10627,11 +10627,11 @@ int typval_compare( if (type_is) { n1 = typ1->v_type == typ2->v_type && typ1->vval.v_dict == typ2->vval.v_dict; - if (type == ETYPE_ISNOT) { + if (type == EXPR_ISNOT) { n1 = !n1; } } else if (typ1->v_type != typ2->v_type - || (type != ETYPE_EQUAL && type != ETYPE_NEQUAL)) { + || (type != EXPR_EQUAL && type != EXPR_NEQUAL)) { if (typ1->v_type != typ2->v_type) { EMSG(_("E735: Can only compare Dictionary with Dictionary")); } else { @@ -10642,13 +10642,13 @@ int typval_compare( } else { // Compare two Dictionaries for being equal or unequal. n1 = tv_dict_equal(typ1->vval.v_dict, typ2->vval.v_dict, ic, false); - if (type == ETYPE_NEQUAL) { + if (type == EXPR_NEQUAL) { n1 = !n1; } } } else if (tv_is_func(*typ1) || tv_is_func(*typ2)) { - if (type != ETYPE_EQUAL && type != ETYPE_NEQUAL - && type != ETYPE_IS && type != ETYPE_ISNOT) { + if (type != EXPR_EQUAL && type != EXPR_NEQUAL + && type != EXPR_IS && type != EXPR_ISNOT) { EMSG(_("E694: Invalid operation for Funcrefs")); tv_clear(typ1); return FAIL; @@ -10670,47 +10670,47 @@ int typval_compare( } else { n1 = tv_equal(typ1, typ2, ic, false); } - if (type == ETYPE_NEQUAL || type == ETYPE_ISNOT) { + if (type == EXPR_NEQUAL || type == EXPR_ISNOT) { n1 = !n1; } } else if ((typ1->v_type == VAR_FLOAT || typ2->v_type == VAR_FLOAT) - && type != ETYPE_MATCH && type != ETYPE_NOMATCH) { + && type != EXPR_MATCH && type != EXPR_NOMATCH) { // If one of the two variables is a float, compare as a float. // When using "=~" or "!~", always compare as string. const float_T f1 = tv_get_float(typ1); const float_T f2 = tv_get_float(typ2); n1 = false; switch (type) { - case ETYPE_IS: - case ETYPE_EQUAL: n1 = f1 == f2; break; - case ETYPE_ISNOT: - case ETYPE_NEQUAL: n1 = f1 != f2; break; - case ETYPE_GREATER: n1 = f1 > f2; break; - case ETYPE_GEQUAL: n1 = f1 >= f2; break; - case ETYPE_SMALLER: n1 = f1 < f2; break; - case ETYPE_SEQUAL: n1 = f1 <= f2; break; - case ETYPE_UNKNOWN: - case ETYPE_MATCH: - case ETYPE_NOMATCH: break; // avoid gcc warning + case EXPR_IS: + case EXPR_EQUAL: n1 = f1 == f2; break; + case EXPR_ISNOT: + case EXPR_NEQUAL: n1 = f1 != f2; break; + case EXPR_GREATER: n1 = f1 > f2; break; + case EXPR_GEQUAL: n1 = f1 >= f2; break; + case EXPR_SMALLER: n1 = f1 < f2; break; + case EXPR_SEQUAL: n1 = f1 <= f2; break; + case EXPR_UNKNOWN: + case EXPR_MATCH: + case EXPR_NOMATCH: break; // avoid gcc warning } } else if ((typ1->v_type == VAR_NUMBER || typ2->v_type == VAR_NUMBER) - && type != ETYPE_MATCH && type != ETYPE_NOMATCH) { + && type != EXPR_MATCH && type != EXPR_NOMATCH) { // If one of the two variables is a number, compare as a number. // When using "=~" or "!~", always compare as string. n1 = tv_get_number(typ1); n2 = tv_get_number(typ2); switch (type) { - case ETYPE_IS: - case ETYPE_EQUAL: n1 = n1 == n2; break; - case ETYPE_ISNOT: - case ETYPE_NEQUAL: n1 = n1 != n2; break; - case ETYPE_GREATER: n1 = n1 > n2; break; - case ETYPE_GEQUAL: n1 = n1 >= n2; break; - case ETYPE_SMALLER: n1 = n1 < n2; break; - case ETYPE_SEQUAL: n1 = n1 <= n2; break; - case ETYPE_UNKNOWN: - case ETYPE_MATCH: - case ETYPE_NOMATCH: break; // avoid gcc warning + case EXPR_IS: + case EXPR_EQUAL: n1 = n1 == n2; break; + case EXPR_ISNOT: + case EXPR_NEQUAL: n1 = n1 != n2; break; + case EXPR_GREATER: n1 = n1 > n2; break; + case EXPR_GEQUAL: n1 = n1 >= n2; break; + case EXPR_SMALLER: n1 = n1 < n2; break; + case EXPR_SEQUAL: n1 = n1 <= n2; break; + case EXPR_UNKNOWN: + case EXPR_MATCH: + case EXPR_NOMATCH: break; // avoid gcc warning } } else { char buf1[NUMBUFLEN]; @@ -10718,30 +10718,30 @@ int typval_compare( const char *const s1 = tv_get_string_buf(typ1, buf1); const char *const s2 = tv_get_string_buf(typ2, buf2); int i; - if (type != ETYPE_MATCH && type != ETYPE_NOMATCH) { + if (type != EXPR_MATCH && type != EXPR_NOMATCH) { i = mb_strcmp_ic(ic, s1, s2); } else { i = 0; } n1 = false; switch (type) { - case ETYPE_IS: - case ETYPE_EQUAL: n1 = i == 0; break; - case ETYPE_ISNOT: - case ETYPE_NEQUAL: n1 = i != 0; break; - case ETYPE_GREATER: n1 = i > 0; break; - case ETYPE_GEQUAL: n1 = i >= 0; break; - case ETYPE_SMALLER: n1 = i < 0; break; - case ETYPE_SEQUAL: n1 = i <= 0; break; - - case ETYPE_MATCH: - case ETYPE_NOMATCH: + case EXPR_IS: + case EXPR_EQUAL: n1 = i == 0; break; + case EXPR_ISNOT: + case EXPR_NEQUAL: n1 = i != 0; break; + case EXPR_GREATER: n1 = i > 0; break; + case EXPR_GEQUAL: n1 = i >= 0; break; + case EXPR_SMALLER: n1 = i < 0; break; + case EXPR_SEQUAL: n1 = i <= 0; break; + + case EXPR_MATCH: + case EXPR_NOMATCH: n1 = pattern_match((char_u *)s2, (char_u *)s1, ic); - if (type == ETYPE_NOMATCH) { + if (type == EXPR_NOMATCH) { n1 = !n1; } break; - case ETYPE_UNKNOWN: break; // avoid gcc warning + case EXPR_UNKNOWN: break; // avoid gcc warning } } tv_clear(typ1); -- cgit From b2971ebeedc3b305cde1f1ddf0e56403e8105092 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 11 Apr 2021 11:58:29 -0400 Subject: vim-patch:8.2.2319: "exptype_T" can be read as "expected type" Problem: "exptype_T" can be read as "expected type". Solution: Rename to "exprtype_T", expression type. https://github.com/vim/vim/commit/657137ca487c60d63989236115115161def270a5 Vim9 changes omitted. --- src/nvim/eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index e6c4775a49..05d429c7d5 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -3417,7 +3417,7 @@ static int eval4(char_u **arg, typval_T *rettv, int evaluate) { typval_T var2; char_u *p; - exptype_T type = EXPR_UNKNOWN; + exprtype_T type = EXPR_UNKNOWN; int len = 2; bool ic; @@ -10588,7 +10588,7 @@ bool invoke_prompt_interrupt(void) int typval_compare( typval_T *typ1, // first operand typval_T *typ2, // second operand - exptype_T type, // operator + exprtype_T type, // operator bool ic // ignore case ) FUNC_ATTR_NONNULL_ALL -- cgit