0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.2.3865: Vim9: compiler complains about using "try" as a struct member

Problem:    Vim9: compiler complains about using "try" as a struct member.
Solution:   Rename "try" to "tryref".
This commit is contained in:
Bram Moolenaar
2021-12-21 09:42:09 +00:00
parent 6f79e614b2
commit 0d807107b6
5 changed files with 20 additions and 18 deletions

View File

@@ -749,6 +749,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 */
/**/
3865,
/**/ /**/
3864, 3864,
/**/ /**/

View File

@@ -112,7 +112,7 @@ typedef enum {
// loop // loop
ISN_FOR, // get next item from a list, uses isn_arg.forloop ISN_FOR, // get next item from a list, uses isn_arg.forloop
ISN_TRY, // add entry to ec_trystack, uses isn_arg.try ISN_TRY, // add entry to ec_trystack, uses isn_arg.tryref
ISN_THROW, // pop value of stack, store in v:exception ISN_THROW, // pop value of stack, store in v:exception
ISN_PUSHEXC, // push v:exception ISN_PUSHEXC, // push v:exception
ISN_CATCH, // drop v:exception ISN_CATCH, // drop v:exception
@@ -429,7 +429,7 @@ struct isn_S {
jump_T jump; jump_T jump;
jumparg_T jumparg; jumparg_T jumparg;
forloop_T forloop; forloop_T forloop;
try_T try; try_T tryref;
trycont_T trycont; trycont_T trycont;
cbfunc_T bfunc; cbfunc_T bfunc;
cdfunc_T dfunc; cdfunc_T dfunc;

View File

@@ -1290,8 +1290,8 @@ compile_try(char_u *arg, cctx_T *cctx)
try_scope->se_u.se_try.ts_try_label = instr->ga_len; try_scope->se_u.se_try.ts_try_label = instr->ga_len;
if ((isn = generate_instr(cctx, ISN_TRY)) == NULL) if ((isn = generate_instr(cctx, ISN_TRY)) == NULL)
return NULL; return NULL;
isn->isn_arg.try.try_ref = ALLOC_CLEAR_ONE(tryref_T); isn->isn_arg.tryref.try_ref = ALLOC_CLEAR_ONE(tryref_T);
if (isn->isn_arg.try.try_ref == NULL) if (isn->isn_arg.tryref.try_ref == NULL)
return NULL; return NULL;
} }
@@ -1352,8 +1352,8 @@ compile_catch(char_u *arg, cctx_T *cctx UNUSED)
// End :try or :catch scope: set value in ISN_TRY instruction // End :try or :catch scope: set value in ISN_TRY instruction
isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label; isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label;
if (isn->isn_arg.try.try_ref->try_catch == 0) if (isn->isn_arg.tryref.try_ref->try_catch == 0)
isn->isn_arg.try.try_ref->try_catch = instr->ga_len; isn->isn_arg.tryref.try_ref->try_catch = instr->ga_len;
if (scope->se_u.se_try.ts_catch_label != 0) if (scope->se_u.se_try.ts_catch_label != 0)
{ {
// Previous catch without match jumps here // Previous catch without match jumps here
@@ -1452,7 +1452,7 @@ compile_finally(char_u *arg, cctx_T *cctx)
{ {
// End :catch or :finally scope: set value in ISN_TRY instruction // End :catch or :finally scope: set value in ISN_TRY instruction
isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label; isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label;
if (isn->isn_arg.try.try_ref->try_finally != 0) if (isn->isn_arg.tryref.try_ref->try_finally != 0)
{ {
emsg(_(e_finally_dup)); emsg(_(e_finally_dup));
return NULL; return NULL;
@@ -1479,9 +1479,9 @@ compile_finally(char_u *arg, cctx_T *cctx)
this_instr, cctx); this_instr, cctx);
// If there is no :catch then an exception jumps to :finally. // If there is no :catch then an exception jumps to :finally.
if (isn->isn_arg.try.try_ref->try_catch == 0) if (isn->isn_arg.tryref.try_ref->try_catch == 0)
isn->isn_arg.try.try_ref->try_catch = this_instr; isn->isn_arg.tryref.try_ref->try_catch = this_instr;
isn->isn_arg.try.try_ref->try_finally = this_instr; isn->isn_arg.tryref.try_ref->try_finally = this_instr;
if (scope->se_u.se_try.ts_catch_label != 0) if (scope->se_u.se_try.ts_catch_label != 0)
{ {
// Previous catch without match jumps here // Previous catch without match jumps here
@@ -1528,8 +1528,8 @@ compile_endtry(char_u *arg, cctx_T *cctx)
try_isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label; try_isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label;
if (cctx->ctx_skip != SKIP_YES) if (cctx->ctx_skip != SKIP_YES)
{ {
if (try_isn->isn_arg.try.try_ref->try_catch == 0 if (try_isn->isn_arg.tryref.try_ref->try_catch == 0
&& try_isn->isn_arg.try.try_ref->try_finally == 0) && try_isn->isn_arg.tryref.try_ref->try_finally == 0)
{ {
emsg(_(e_missing_catch_or_finally)); emsg(_(e_missing_catch_or_finally));
return NULL; return NULL;
@@ -1564,7 +1564,7 @@ compile_endtry(char_u *arg, cctx_T *cctx)
{ {
// End :catch or :finally scope: set instruction index in ISN_TRY // End :catch or :finally scope: set instruction index in ISN_TRY
// instruction // instruction
try_isn->isn_arg.try.try_ref->try_endtry = instr->ga_len; try_isn->isn_arg.tryref.try_ref->try_endtry = instr->ga_len;
if (cctx->ctx_skip != SKIP_YES if (cctx->ctx_skip != SKIP_YES
&& generate_instr(cctx, ISN_ENDTRY) == NULL) && generate_instr(cctx, ISN_ENDTRY) == NULL)
return NULL; return NULL;

View File

@@ -3517,11 +3517,11 @@ exec_instructions(ectx_T *ectx)
trycmd->tcd_frame_idx = ectx->ec_frame_idx; trycmd->tcd_frame_idx = ectx->ec_frame_idx;
trycmd->tcd_stack_len = ectx->ec_stack.ga_len; trycmd->tcd_stack_len = ectx->ec_stack.ga_len;
trycmd->tcd_catch_idx = trycmd->tcd_catch_idx =
iptr->isn_arg.try.try_ref->try_catch; iptr->isn_arg.tryref.try_ref->try_catch;
trycmd->tcd_finally_idx = trycmd->tcd_finally_idx =
iptr->isn_arg.try.try_ref->try_finally; iptr->isn_arg.tryref.try_ref->try_finally;
trycmd->tcd_endtry_idx = trycmd->tcd_endtry_idx =
iptr->isn_arg.try.try_ref->try_endtry; iptr->isn_arg.tryref.try_ref->try_endtry;
} }
break; break;
@@ -5670,7 +5670,7 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
case ISN_TRY: case ISN_TRY:
{ {
try_T *try = &iptr->isn_arg.try; try_T *try = &iptr->isn_arg.tryref;
if (try->try_ref->try_finally == 0) if (try->try_ref->try_finally == 0)
smsg("%s%4d TRY catch -> %d, endtry -> %d", smsg("%s%4d TRY catch -> %d, endtry -> %d",

View File

@@ -2088,7 +2088,7 @@ delete_instr(isn_T *isn)
break; break;
case ISN_TRY: case ISN_TRY:
vim_free(isn->isn_arg.try.try_ref); vim_free(isn->isn_arg.tryref.try_ref);
break; break;
case ISN_CEXPR_CORE: case ISN_CEXPR_CORE: