forked from aniani/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.
This commit is contained in:
@@ -2655,7 +2655,7 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
|||||||
{
|
{
|
||||||
char_u *p;
|
char_u *p;
|
||||||
int getnext;
|
int getnext;
|
||||||
exptype_T type = EXPR_UNKNOWN;
|
exprtype_T type = EXPR_UNKNOWN;
|
||||||
int len = 2;
|
int len = 2;
|
||||||
int type_is = FALSE;
|
int type_is = FALSE;
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ char_u *tv_get_string_buf_chk(typval_T *varp, char_u *buf);
|
|||||||
char_u *tv_stringify(typval_T *varp, char_u *buf);
|
char_u *tv_stringify(typval_T *varp, char_u *buf);
|
||||||
int tv_check_lock(typval_T *tv, char_u *name, int use_gettext);
|
int tv_check_lock(typval_T *tv, char_u *name, int use_gettext);
|
||||||
void copy_tv(typval_T *from, typval_T *to);
|
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);
|
char_u *typval_tostring(typval_T *arg);
|
||||||
int tv_islocked(typval_T *tv);
|
int tv_islocked(typval_T *tv);
|
||||||
int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive);
|
int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* vim9compile.c */
|
/* vim9compile.c */
|
||||||
int check_defined(char_u *p, size_t len, cctx_T *cctx);
|
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 use_typecheck(type_T *actual, type_T *expected);
|
||||||
int get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx);
|
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);
|
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_T *cctx);
|
|||||||
char_u *next_line_from_context(cctx_T *cctx, int skip_comment);
|
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_end(char_u *arg, int use_namespace);
|
||||||
char_u *to_name_const_end(char_u *arg);
|
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);
|
void error_white_both(char_u *op, int len);
|
||||||
int assignment_len(char_u *p, int *heredoc);
|
int assignment_len(char_u *p, int *heredoc);
|
||||||
void vim9_declare_error(char_u *name);
|
void vim9_declare_error(char_u *name);
|
||||||
|
@@ -4029,7 +4029,7 @@ typedef enum
|
|||||||
EXPR_MULT, // *
|
EXPR_MULT, // *
|
||||||
EXPR_DIV, // /
|
EXPR_DIV, // /
|
||||||
EXPR_REM, // %
|
EXPR_REM, // %
|
||||||
} exptype_T;
|
} exprtype_T;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure used for reading in json_decode().
|
* Structure used for reading in json_decode().
|
||||||
|
@@ -649,7 +649,7 @@ copy_tv(typval_T *from, typval_T *to)
|
|||||||
typval_compare(
|
typval_compare(
|
||||||
typval_T *typ1, // first operand
|
typval_T *typ1, // first operand
|
||||||
typval_T *typ2, // second operand
|
typval_T *typ2, // second operand
|
||||||
exptype_T type, // operator
|
exprtype_T type, // operator
|
||||||
int ic) // ignore case
|
int ic) // ignore case
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2319,
|
||||||
/**/
|
/**/
|
||||||
2318,
|
2318,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -105,12 +105,12 @@ typedef enum {
|
|||||||
ISN_ADDLIST, // add two lists
|
ISN_ADDLIST, // add two lists
|
||||||
ISN_ADDBLOB, // add two blobs
|
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_OPNR,
|
||||||
ISN_OPFLOAT,
|
ISN_OPFLOAT,
|
||||||
ISN_OPANY,
|
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_COMPAREBOOL,
|
||||||
ISN_COMPARESPECIAL,
|
ISN_COMPARESPECIAL,
|
||||||
ISN_COMPARENR,
|
ISN_COMPARENR,
|
||||||
@@ -217,7 +217,7 @@ typedef struct {
|
|||||||
|
|
||||||
// arguments to ISN_OPNR, ISN_OPFLOAT, etc.
|
// arguments to ISN_OPNR, ISN_OPFLOAT, etc.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
exptype_T op_type;
|
exprtype_T op_type;
|
||||||
int op_ic; // TRUE with '#', FALSE with '?', else MAYBE
|
int op_ic; // TRUE with '#', FALSE with '?', else MAYBE
|
||||||
} opexpr_T;
|
} opexpr_T;
|
||||||
|
|
||||||
|
@@ -669,7 +669,7 @@ generate_two_op(cctx_T *cctx, char_u *op)
|
|||||||
* Return ISN_DROP when failed.
|
* Return ISN_DROP when failed.
|
||||||
*/
|
*/
|
||||||
static isntype_T
|
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;
|
isntype_T isntype = ISN_DROP;
|
||||||
|
|
||||||
@@ -699,22 +699,22 @@ get_compare_isn(exptype_T exptype, vartype_T type1, vartype_T type2)
|
|||||||
&& (type2 == VAR_NUMBER || type2 ==VAR_FLOAT)))
|
&& (type2 == VAR_NUMBER || type2 ==VAR_FLOAT)))
|
||||||
isntype = ISN_COMPAREANY;
|
isntype = ISN_COMPAREANY;
|
||||||
|
|
||||||
if ((exptype == EXPR_IS || exptype == EXPR_ISNOT)
|
if ((exprtype == EXPR_IS || exprtype == EXPR_ISNOT)
|
||||||
&& (isntype == ISN_COMPAREBOOL
|
&& (isntype == ISN_COMPAREBOOL
|
||||||
|| isntype == ISN_COMPARESPECIAL
|
|| isntype == ISN_COMPARESPECIAL
|
||||||
|| isntype == ISN_COMPARENR
|
|| isntype == ISN_COMPARENR
|
||||||
|| isntype == ISN_COMPAREFLOAT))
|
|| isntype == ISN_COMPAREFLOAT))
|
||||||
{
|
{
|
||||||
semsg(_(e_cannot_use_str_with_str),
|
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;
|
return ISN_DROP;
|
||||||
}
|
}
|
||||||
if (isntype == ISN_DROP
|
if (isntype == ISN_DROP
|
||||||
|| ((exptype != EXPR_EQUAL && exptype != EXPR_NEQUAL
|
|| ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL
|
||||||
&& (type1 == VAR_BOOL || type1 == VAR_SPECIAL
|
&& (type1 == VAR_BOOL || type1 == VAR_SPECIAL
|
||||||
|| type2 == VAR_BOOL || type2 == VAR_SPECIAL)))
|
|| type2 == VAR_BOOL || type2 == VAR_SPECIAL)))
|
||||||
|| ((exptype != EXPR_EQUAL && exptype != EXPR_NEQUAL
|
|| ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL
|
||||||
&& exptype != EXPR_IS && exptype != EXPR_ISNOT
|
&& exprtype != EXPR_IS && exprtype != EXPR_ISNOT
|
||||||
&& (type1 == VAR_BLOB || type2 == VAR_BLOB
|
&& (type1 == VAR_BLOB || type2 == VAR_BLOB
|
||||||
|| type1 == VAR_LIST || type2 == VAR_LIST))))
|
|| type1 == VAR_LIST || type2 == VAR_LIST))))
|
||||||
{
|
{
|
||||||
@@ -726,7 +726,7 @@ get_compare_isn(exptype_T exptype, vartype_T type1, vartype_T type2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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)
|
if (get_compare_isn(type, tv1->v_type, tv2->v_type) == ISN_DROP)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@@ -737,7 +737,7 @@ check_compare_types(exptype_T type, typval_T *tv1, typval_T *tv2)
|
|||||||
* Generate an ISN_COMPARE* instruction with a boolean result.
|
* Generate an ISN_COMPARE* instruction with a boolean result.
|
||||||
*/
|
*/
|
||||||
static int
|
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;
|
isntype_T isntype;
|
||||||
isn_T *isn;
|
isn_T *isn;
|
||||||
@@ -752,13 +752,13 @@ generate_COMPARE(cctx_T *cctx, exptype_T exptype, int ic)
|
|||||||
// checking.
|
// checking.
|
||||||
type1 = ((type_T **)stack->ga_data)[stack->ga_len - 2]->tt_type;
|
type1 = ((type_T **)stack->ga_data)[stack->ga_len - 2]->tt_type;
|
||||||
type2 = ((type_T **)stack->ga_data)[stack->ga_len - 1]->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)
|
if (isntype == ISN_DROP)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
if ((isn = generate_instr(cctx, isntype)) == NULL)
|
if ((isn = generate_instr(cctx, isntype)) == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
isn->isn_arg.op.op_type = exptype;
|
isn->isn_arg.op.op_type = exprtype;
|
||||||
isn->isn_arg.op.op_ic = ic;
|
isn->isn_arg.op.op_ic = ic;
|
||||||
|
|
||||||
// takes two arguments, puts one bool back
|
// takes two arguments, puts one bool back
|
||||||
@@ -3348,10 +3348,10 @@ get_vim_constant(char_u **arg, typval_T *rettv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exptype_T
|
exprtype_T
|
||||||
get_compare_type(char_u *p, int *len, int *type_is)
|
get_compare_type(char_u *p, int *len, int *type_is)
|
||||||
{
|
{
|
||||||
exptype_T type = EXPR_UNKNOWN;
|
exprtype_T type = EXPR_UNKNOWN;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (p[0])
|
switch (p[0])
|
||||||
@@ -4346,7 +4346,7 @@ compile_expr5(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
|
|||||||
static int
|
static int
|
||||||
compile_expr4(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
|
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 *p;
|
||||||
char_u *next;
|
char_u *next;
|
||||||
int len = 2;
|
int len = 2;
|
||||||
|
@@ -2725,11 +2725,11 @@ call_def_function(
|
|||||||
{
|
{
|
||||||
typval_T *tv1 = STACK_TV_BOT(-2);
|
typval_T *tv1 = STACK_TV_BOT(-2);
|
||||||
typval_T *tv2 = STACK_TV_BOT(-1);
|
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;
|
int ic = iptr->isn_arg.op.op_ic;
|
||||||
|
|
||||||
SOURCING_LNUM = iptr->isn_lnum;
|
SOURCING_LNUM = iptr->isn_lnum;
|
||||||
typval_compare(tv1, tv2, exptype, ic);
|
typval_compare(tv1, tv2, exprtype, ic);
|
||||||
clear_tv(tv2);
|
clear_tv(tv2);
|
||||||
--ectx.ec_stack.ga_len;
|
--ectx.ec_stack.ga_len;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user