Mercurial > vim
changeset 23553:5c094273c015 v8.2.2319
patch 8.2.2319: "exptype_T" can be read as "expected type"
Commit: https://github.com/vim/vim/commit/657137ca487c60d63989236115115161def270a5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 9 15:45:23 2021 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 09 Jan 2021 16:00:04 +0100 |
parents | 4c3639333c84 |
children | c43e824fd305 |
files | src/eval.c src/proto/typval.pro src/proto/vim9compile.pro src/structs.h src/typval.c src/version.c src/vim9.h src/vim9compile.c src/vim9execute.c |
diffstat | 9 files changed, 26 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -2655,7 +2655,7 @@ eval4(char_u **arg, typval_T *rettv, eva { char_u *p; int getnext; - exptype_T type = EXPR_UNKNOWN; + exprtype_T type = EXPR_UNKNOWN; int len = 2; int type_is = FALSE;
--- a/src/proto/typval.pro +++ b/src/proto/typval.pro @@ -18,7 +18,7 @@ char_u *tv_get_string_buf_chk(typval_T * char_u *tv_stringify(typval_T *varp, char_u *buf); int tv_check_lock(typval_T *tv, char_u *name, int use_gettext); void copy_tv(typval_T *from, typval_T *to); -int typval_compare(typval_T *typ1, typval_T *typ2, exptype_T type, int ic); +int typval_compare(typval_T *typ1, typval_T *typ2, exprtype_T type, int ic); char_u *typval_tostring(typval_T *arg); int tv_islocked(typval_T *tv); int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive);
--- a/src/proto/vim9compile.pro +++ b/src/proto/vim9compile.pro @@ -1,6 +1,6 @@ /* vim9compile.c */ int check_defined(char_u *p, size_t len, cctx_T *cctx); -int check_compare_types(exptype_T type, typval_T *tv1, typval_T *tv2); +int check_compare_types(exprtype_T type, typval_T *tv1, typval_T *tv2); int use_typecheck(type_T *actual, type_T *expected); int get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx); imported_T *find_imported(char_u *name, size_t len, cctx_T *cctx); @@ -9,7 +9,7 @@ char_u *peek_next_line_from_context(cctx char_u *next_line_from_context(cctx_T *cctx, int skip_comment); char_u *to_name_end(char_u *arg, int use_namespace); char_u *to_name_const_end(char_u *arg); -exptype_T get_compare_type(char_u *p, int *len, int *type_is); +exprtype_T get_compare_type(char_u *p, int *len, int *type_is); void error_white_both(char_u *op, int len); int assignment_len(char_u *p, int *heredoc); void vim9_declare_error(char_u *name);
--- a/src/structs.h +++ b/src/structs.h @@ -4029,7 +4029,7 @@ typedef enum EXPR_MULT, // * EXPR_DIV, // / EXPR_REM, // % -} exptype_T; +} exprtype_T; /* * Structure used for reading in json_decode().
--- a/src/typval.c +++ b/src/typval.c @@ -649,7 +649,7 @@ copy_tv(typval_T *from, typval_T *to) typval_compare( typval_T *typ1, // first operand typval_T *typ2, // second operand - exptype_T type, // operator + exprtype_T type, // operator int ic) // ignore case { int i;
--- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2319, +/**/ 2318, /**/ 2317,
--- a/src/vim9.h +++ b/src/vim9.h @@ -105,12 +105,12 @@ typedef enum { ISN_ADDLIST, // add two lists ISN_ADDBLOB, // add two blobs - // operation with two arguments; isn_arg.op.op_type is exptype_T + // operation with two arguments; isn_arg.op.op_type is exprtype_T ISN_OPNR, ISN_OPFLOAT, ISN_OPANY, - // comparative operations; isn_arg.op.op_type is exptype_T, op_ic used + // comparative operations; isn_arg.op.op_type is exprtype_T, op_ic used ISN_COMPAREBOOL, ISN_COMPARESPECIAL, ISN_COMPARENR, @@ -217,7 +217,7 @@ typedef struct { // arguments to ISN_OPNR, ISN_OPFLOAT, etc. typedef struct { - exptype_T op_type; + exprtype_T op_type; int op_ic; // TRUE with '#', FALSE with '?', else MAYBE } opexpr_T;
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -669,7 +669,7 @@ generate_two_op(cctx_T *cctx, char_u *op * Return ISN_DROP when failed. */ static isntype_T -get_compare_isn(exptype_T exptype, vartype_T type1, vartype_T type2) +get_compare_isn(exprtype_T exprtype, vartype_T type1, vartype_T type2) { isntype_T isntype = ISN_DROP; @@ -699,22 +699,22 @@ get_compare_isn(exptype_T exptype, varty && (type2 == VAR_NUMBER || type2 ==VAR_FLOAT))) isntype = ISN_COMPAREANY; - if ((exptype == EXPR_IS || exptype == EXPR_ISNOT) + if ((exprtype == EXPR_IS || exprtype == EXPR_ISNOT) && (isntype == ISN_COMPAREBOOL || isntype == ISN_COMPARESPECIAL || isntype == ISN_COMPARENR || isntype == ISN_COMPAREFLOAT)) { semsg(_(e_cannot_use_str_with_str), - exptype == EXPR_IS ? "is" : "isnot" , vartype_name(type1)); + exprtype == EXPR_IS ? "is" : "isnot" , vartype_name(type1)); return ISN_DROP; } if (isntype == ISN_DROP - || ((exptype != EXPR_EQUAL && exptype != EXPR_NEQUAL + || ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL && (type1 == VAR_BOOL || type1 == VAR_SPECIAL || type2 == VAR_BOOL || type2 == VAR_SPECIAL))) - || ((exptype != EXPR_EQUAL && exptype != EXPR_NEQUAL - && exptype != EXPR_IS && exptype != EXPR_ISNOT + || ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL + && exprtype != EXPR_IS && exprtype != EXPR_ISNOT && (type1 == VAR_BLOB || type2 == VAR_BLOB || type1 == VAR_LIST || type2 == VAR_LIST)))) { @@ -726,7 +726,7 @@ get_compare_isn(exptype_T exptype, varty } int -check_compare_types(exptype_T type, typval_T *tv1, typval_T *tv2) +check_compare_types(exprtype_T type, typval_T *tv1, typval_T *tv2) { if (get_compare_isn(type, tv1->v_type, tv2->v_type) == ISN_DROP) return FAIL; @@ -737,7 +737,7 @@ check_compare_types(exptype_T type, typv * Generate an ISN_COMPARE* instruction with a boolean result. */ static int -generate_COMPARE(cctx_T *cctx, exptype_T exptype, int ic) +generate_COMPARE(cctx_T *cctx, exprtype_T exprtype, int ic) { isntype_T isntype; isn_T *isn; @@ -752,13 +752,13 @@ generate_COMPARE(cctx_T *cctx, exptype_T // checking. type1 = ((type_T **)stack->ga_data)[stack->ga_len - 2]->tt_type; type2 = ((type_T **)stack->ga_data)[stack->ga_len - 1]->tt_type; - isntype = get_compare_isn(exptype, type1, type2); + isntype = get_compare_isn(exprtype, type1, type2); if (isntype == ISN_DROP) return FAIL; if ((isn = generate_instr(cctx, isntype)) == NULL) return FAIL; - isn->isn_arg.op.op_type = exptype; + isn->isn_arg.op.op_type = exprtype; isn->isn_arg.op.op_ic = ic; // takes two arguments, puts one bool back @@ -3348,10 +3348,10 @@ get_vim_constant(char_u **arg, typval_T } } - exptype_T + exprtype_T get_compare_type(char_u *p, int *len, int *type_is) { - exptype_T type = EXPR_UNKNOWN; + exprtype_T type = EXPR_UNKNOWN; int i; switch (p[0]) @@ -4346,7 +4346,7 @@ compile_expr5(char_u **arg, cctx_T *cctx static int compile_expr4(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) { - exptype_T type = EXPR_UNKNOWN; + exprtype_T type = EXPR_UNKNOWN; char_u *p; char_u *next; int len = 2;
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -2725,11 +2725,11 @@ call_def_function( { typval_T *tv1 = STACK_TV_BOT(-2); typval_T *tv2 = STACK_TV_BOT(-1); - exptype_T exptype = iptr->isn_arg.op.op_type; + exprtype_T exprtype = iptr->isn_arg.op.op_type; int ic = iptr->isn_arg.op.op_ic; SOURCING_LNUM = iptr->isn_lnum; - typval_compare(tv1, tv2, exptype, ic); + typval_compare(tv1, tv2, exprtype, ic); clear_tv(tv2); --ectx.ec_stack.ga_len; }