mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.2390: Vim9: using positive offset is unexpected
Problem: Vim9: using positive offset is unexpected. Solution: Use int8_T instead of char. (James McCoy)
This commit is contained in:
@@ -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 */
|
||||||
|
/**/
|
||||||
|
2390,
|
||||||
/**/
|
/**/
|
||||||
2389,
|
2389,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -224,8 +224,8 @@ typedef struct {
|
|||||||
// arguments to ISN_CHECKTYPE
|
// arguments to ISN_CHECKTYPE
|
||||||
typedef struct {
|
typedef struct {
|
||||||
type_T *ct_type;
|
type_T *ct_type;
|
||||||
char ct_off; // offset in stack (positive), 1 is bottom
|
int8_T ct_off; // offset in stack, -1 is bottom
|
||||||
char ct_arg_idx; // argument index or zero
|
int8_T ct_arg_idx; // argument index or zero
|
||||||
} checktype_T;
|
} checktype_T;
|
||||||
|
|
||||||
// arguments to ISN_STORENR
|
// arguments to ISN_STORENR
|
||||||
|
@@ -826,10 +826,8 @@ generate_TYPECHECK(
|
|||||||
if ((isn = generate_instr(cctx, ISN_CHECKTYPE)) == NULL)
|
if ((isn = generate_instr(cctx, ISN_CHECKTYPE)) == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
isn->isn_arg.type.ct_type = alloc_type(expected);
|
isn->isn_arg.type.ct_type = alloc_type(expected);
|
||||||
// Use the negated offset so that it's always positive. Some systems don't
|
isn->isn_arg.type.ct_off = (int8_T)offset;
|
||||||
// support negative numbers for "char".
|
isn->isn_arg.type.ct_arg_idx = (int8_T)argidx;
|
||||||
isn->isn_arg.type.ct_off = (char)-offset;
|
|
||||||
isn->isn_arg.type.ct_arg_idx = argidx;
|
|
||||||
|
|
||||||
// type becomes expected
|
// type becomes expected
|
||||||
((type_T **)stack->ga_data)[stack->ga_len + offset] = expected;
|
((type_T **)stack->ga_data)[stack->ga_len + offset] = expected;
|
||||||
|
@@ -3240,7 +3240,7 @@ call_def_function(
|
|||||||
{
|
{
|
||||||
checktype_T *ct = &iptr->isn_arg.type;
|
checktype_T *ct = &iptr->isn_arg.type;
|
||||||
|
|
||||||
tv = STACK_TV_BOT(-(int)ct->ct_off);
|
tv = STACK_TV_BOT((int)ct->ct_off);
|
||||||
SOURCING_LNUM = iptr->isn_lnum;
|
SOURCING_LNUM = iptr->isn_lnum;
|
||||||
if (check_typval_type(ct->ct_type, tv, ct->ct_arg_idx)
|
if (check_typval_type(ct->ct_type, tv, ct->ct_arg_idx)
|
||||||
== FAIL)
|
== FAIL)
|
||||||
@@ -4242,11 +4242,11 @@ ex_disassemble(exarg_T *eap)
|
|||||||
if (ct->ct_arg_idx == 0)
|
if (ct->ct_arg_idx == 0)
|
||||||
smsg("%4d CHECKTYPE %s stack[%d]", current,
|
smsg("%4d CHECKTYPE %s stack[%d]", current,
|
||||||
type_name(ct->ct_type, &tofree),
|
type_name(ct->ct_type, &tofree),
|
||||||
-(int)ct->ct_off);
|
(int)ct->ct_off);
|
||||||
else
|
else
|
||||||
smsg("%4d CHECKTYPE %s stack[%d] arg %d", current,
|
smsg("%4d CHECKTYPE %s stack[%d] arg %d", current,
|
||||||
type_name(ct->ct_type, &tofree),
|
type_name(ct->ct_type, &tofree),
|
||||||
-(int)ct->ct_off,
|
(int)ct->ct_off,
|
||||||
(int)ct->ct_arg_idx);
|
(int)ct->ct_arg_idx);
|
||||||
vim_free(tofree);
|
vim_free(tofree);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user