diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-22 17:51:06 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-22 17:51:06 +0100 |
commit | b3005ce191d27fd2f234df4969d5b58fda9c1940 (patch) | |
tree | 9b58353dd5d5f5db8ca87597dcd67cec2c498cf5 | |
parent | 9b6344613eecfcf77c510d7b63fcc4b7b51aefbc (diff) |
patch 8.2.2390: Vim9: using positive offset is unexpectedv8.2.2390
Problem: Vim9: using positive offset is unexpected.
Solution: Use int8_T instead of char. (James McCoy)
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9.h | 4 | ||||
-rw-r--r-- | src/vim9compile.c | 6 | ||||
-rw-r--r-- | src/vim9execute.c | 6 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/version.c b/src/version.c index 568756b85f..722c8332fc 100644 --- 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 */ /**/ + 2390, +/**/ 2389, /**/ 2388, diff --git a/src/vim9.h b/src/vim9.h index e6c4087c61..8d4faa3d11 100644 --- a/src/vim9.h +++ b/src/vim9.h @@ -224,8 +224,8 @@ typedef struct { // arguments to ISN_CHECKTYPE typedef struct { type_T *ct_type; - char ct_off; // offset in stack (positive), 1 is bottom - char ct_arg_idx; // argument index or zero + int8_T ct_off; // offset in stack, -1 is bottom + int8_T ct_arg_idx; // argument index or zero } checktype_T; // arguments to ISN_STORENR diff --git a/src/vim9compile.c b/src/vim9compile.c index 2fad4ac34b..ae5cb12f3f 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -826,10 +826,8 @@ generate_TYPECHECK( if ((isn = generate_instr(cctx, ISN_CHECKTYPE)) == NULL) return FAIL; isn->isn_arg.type.ct_type = alloc_type(expected); - // Use the negated offset so that it's always positive. Some systems don't - // support negative numbers for "char". - isn->isn_arg.type.ct_off = (char)-offset; - isn->isn_arg.type.ct_arg_idx = argidx; + isn->isn_arg.type.ct_off = (int8_T)offset; + isn->isn_arg.type.ct_arg_idx = (int8_T)argidx; // type becomes expected ((type_T **)stack->ga_data)[stack->ga_len + offset] = expected; diff --git a/src/vim9execute.c b/src/vim9execute.c index b5f4be34e3..21f7bb24ff 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -3240,7 +3240,7 @@ call_def_function( { 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; if (check_typval_type(ct->ct_type, tv, ct->ct_arg_idx) == FAIL) @@ -4242,11 +4242,11 @@ ex_disassemble(exarg_T *eap) if (ct->ct_arg_idx == 0) smsg("%4d CHECKTYPE %s stack[%d]", current, type_name(ct->ct_type, &tofree), - -(int)ct->ct_off); + (int)ct->ct_off); else smsg("%4d CHECKTYPE %s stack[%d] arg %d", current, type_name(ct->ct_type, &tofree), - -(int)ct->ct_off, + (int)ct->ct_off, (int)ct->ct_arg_idx); vim_free(tofree); break; |