Patch 8.2.2319
Problem: "exptype_T" can be read as "expected type".
Solution: Rename to "exprtype_T", expression type.
Files: src/eval.c, src/typval.c, src/proto/typval.pro, src/vim9compile.c,
src/proto/vim9compile.pro, src/vim9execute.c, src/structs.h,
src/vim9.h
*** ../vim-8.2.2318/src/eval.c 2021-01-09 13:20:32.200472552 +0100
--- src/eval.c 2021-01-09 15:39:46.774551889 +0100
***************
*** 2655,2661 ****
{
char_u *p;
int getnext;
! exptype_T type = EXPR_UNKNOWN;
int len = 2;
int type_is = FALSE;
--- 2655,2661 ----
{
char_u *p;
int getnext;
! exprtype_T type = EXPR_UNKNOWN;
int len = 2;
int type_is = FALSE;
*** ../vim-8.2.2318/src/typval.c 2021-01-05 17:50:24.737302359 +0100
--- src/typval.c 2021-01-09 15:39:53.178530561 +0100
***************
*** 649,655 ****
typval_compare(
typval_T *typ1, // first operand
typval_T *typ2, // second operand
! exptype_T type, // operator
int ic) // ignore case
{
int i;
--- 649,655 ----
typval_compare(
typval_T *typ1, // first operand
typval_T *typ2, // second operand
! exprtype_T type, // operator
int ic) // ignore case
{
int i;
*** ../vim-8.2.2318/src/proto/typval.pro 2020-12-12 18:58:36.788284026
+0100
--- src/proto/typval.pro 2021-01-09 15:42:15.742058038 +0100
***************
*** 18,24 ****
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);
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);
--- 18,24 ----
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, 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);
*** ../vim-8.2.2318/src/vim9compile.c 2021-01-08 20:53:05.736404852 +0100
--- src/vim9compile.c 2021-01-09 15:42:59.253914550 +0100
***************
*** 669,675 ****
* Return ISN_DROP when failed.
*/
static isntype_T
! get_compare_isn(exptype_T exptype, vartype_T type1, vartype_T type2)
{
isntype_T isntype = ISN_DROP;
--- 669,675 ----
* Return ISN_DROP when failed.
*/
static isntype_T
! get_compare_isn(exprtype_T exprtype, vartype_T type1, vartype_T type2)
{
isntype_T isntype = ISN_DROP;
***************
*** 699,720 ****
&& (type2 == VAR_NUMBER || type2 ==VAR_FLOAT)))
isntype = ISN_COMPAREANY;
! if ((exptype == EXPR_IS || exptype == 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));
return ISN_DROP;
}
if (isntype == ISN_DROP
! || ((exptype != EXPR_EQUAL && exptype != 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
&& (type1 == VAR_BLOB || type2 == VAR_BLOB
|| type1 == VAR_LIST || type2 == VAR_LIST))))
{
--- 699,720 ----
&& (type2 == VAR_NUMBER || type2 ==VAR_FLOAT)))
isntype = ISN_COMPAREANY;
! 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),
! exprtype == EXPR_IS ? "is" : "isnot" , vartype_name(type1));
return ISN_DROP;
}
if (isntype == ISN_DROP
! || ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL
&& (type1 == VAR_BOOL || type1 == VAR_SPECIAL
|| type2 == VAR_BOOL || type2 == VAR_SPECIAL)))
! || ((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,732 ****
}
int
! check_compare_types(exptype_T type, typval_T *tv1, typval_T *tv2)
{
if (get_compare_isn(type, tv1->v_type, tv2->v_type) == ISN_DROP)
return FAIL;
--- 726,732 ----
}
int
! 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,743 ****
* Generate an ISN_COMPARE* instruction with a boolean result.
*/
static int
! generate_COMPARE(cctx_T *cctx, exptype_T exptype, int ic)
{
isntype_T isntype;
isn_T *isn;
--- 737,743 ----
* Generate an ISN_COMPARE* instruction with a boolean result.
*/
static int
! generate_COMPARE(cctx_T *cctx, exprtype_T exprtype, int ic)
{
isntype_T isntype;
isn_T *isn;
***************
*** 752,764 ****
// 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);
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_ic = ic;
// takes two arguments, puts one bool back
--- 752,764 ----
// 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(exprtype, type1, type2);
if (isntype == ISN_DROP)
return FAIL;
if ((isn = generate_instr(cctx, isntype)) == NULL)
return FAIL;
! isn->isn_arg.op.op_type = exprtype;
isn->isn_arg.op.op_ic = ic;
// takes two arguments, puts one bool back
***************
*** 3348,3357 ****
}
}
! exptype_T
get_compare_type(char_u *p, int *len, int *type_is)
{
! exptype_T type = EXPR_UNKNOWN;
int i;
switch (p[0])
--- 3348,3357 ----
}
}
! exprtype_T
get_compare_type(char_u *p, int *len, int *type_is)
{
! exprtype_T type = EXPR_UNKNOWN;
int i;
switch (p[0])
***************
*** 4346,4352 ****
static int
compile_expr4(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
{
! exptype_T type = EXPR_UNKNOWN;
char_u *p;
char_u *next;
int len = 2;
--- 4346,4352 ----
static int
compile_expr4(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
{
! exprtype_T type = EXPR_UNKNOWN;
char_u *p;
char_u *next;
int len = 2;
*** ../vim-8.2.2318/src/proto/vim9compile.pro 2020-12-28 20:53:17.499051882
+0100
--- src/proto/vim9compile.pro 2021-01-09 15:43:00.769909556 +0100
***************
*** 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 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);
--- 1,6 ----
/* vim9compile.c */
int check_defined(char_u *p, size_t len, cctx_T *cctx);
! 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,15 ****
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);
void error_white_both(char_u *op, int len);
int assignment_len(char_u *p, int *heredoc);
void vim9_declare_error(char_u *name);
--- 9,15 ----
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);
! 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);
*** ../vim-8.2.2318/src/vim9execute.c 2021-01-09 13:20:32.200472552 +0100
--- src/vim9execute.c 2021-01-09 15:41:07.694283070 +0100
***************
*** 2725,2735 ****
{
typval_T *tv1 = STACK_TV_BOT(-2);
typval_T *tv2 = STACK_TV_BOT(-1);
! exptype_T exptype = 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);
clear_tv(tv2);
--ectx.ec_stack.ga_len;
}
--- 2725,2735 ----
{
typval_T *tv1 = STACK_TV_BOT(-2);
typval_T *tv2 = STACK_TV_BOT(-1);
! 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, exprtype, ic);
clear_tv(tv2);
--ectx.ec_stack.ga_len;
}
*** ../vim-8.2.2318/src/structs.h 2021-01-06 21:59:35.174021934 +0100
--- src/structs.h 2021-01-09 15:41:21.934235906 +0100
***************
*** 4029,4035 ****
EXPR_MULT, // *
EXPR_DIV, // /
EXPR_REM, // %
! } exptype_T;
/*
* Structure used for reading in json_decode().
--- 4029,4035 ----
EXPR_MULT, // *
EXPR_DIV, // /
EXPR_REM, // %
! } exprtype_T;
/*
* Structure used for reading in json_decode().
*** ../vim-8.2.2318/src/vim9.h 2021-01-08 20:53:05.732404859 +0100
--- src/vim9.h 2021-01-09 15:41:48.874146775 +0100
***************
*** 105,116 ****
ISN_ADDLIST, // add two lists
ISN_ADDBLOB, // add two blobs
! // operation with two arguments; isn_arg.op.op_type is exptype_T
ISN_OPNR,
ISN_OPFLOAT,
ISN_OPANY,
! // comparative operations; isn_arg.op.op_type is exptype_T, op_ic used
ISN_COMPAREBOOL,
ISN_COMPARESPECIAL,
ISN_COMPARENR,
--- 105,116 ----
ISN_ADDLIST, // add two lists
ISN_ADDBLOB, // add two blobs
! // 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 exprtype_T, op_ic used
ISN_COMPAREBOOL,
ISN_COMPARESPECIAL,
ISN_COMPARENR,
***************
*** 217,223 ****
// arguments to ISN_OPNR, ISN_OPFLOAT, etc.
typedef struct {
! exptype_T op_type;
int op_ic; // TRUE with '#', FALSE with '?', else MAYBE
} opexpr_T;
--- 217,223 ----
// arguments to ISN_OPNR, ISN_OPFLOAT, etc.
typedef struct {
! exprtype_T op_type;
int op_ic; // TRUE with '#', FALSE with '?', else MAYBE
} opexpr_T;
*** ../vim-8.2.2318/src/version.c 2021-01-09 13:20:32.204472540 +0100
--- src/version.c 2021-01-09 15:45:01.809511886 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2319,
/**/
--
hundred-and-one symptoms of being an internet addict:
118. You are on a first-name basis with your ISP's staff.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202101091445.109EjnCg068923%40masaka.moolenaar.net.