Patch 8.2.3865

5 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 21, 2021, 4:43:31 AM12/21/21
to vim...@googlegroups.com

Patch 8.2.3865
Problem: Vim9: compiler complains about using "try" as a struct member.
Solution: Rename "try" to "tryref".
Files: src/vim9.h, src/vim9cmds.c, src/vim9execute.c, src/vim9instr.c


*** ../vim-8.2.3864/src/vim9.h 2021-12-20 15:03:23.251346520 +0000
--- src/vim9.h 2021-12-21 09:39:49.450413068 +0000
***************
*** 112,118 ****
// loop
ISN_FOR, // get next item from a list, uses isn_arg.forloop

! ISN_TRY, // add entry to ec_trystack, uses isn_arg.try
ISN_THROW, // pop value of stack, store in v:exception
ISN_PUSHEXC, // push v:exception
ISN_CATCH, // drop v:exception
--- 112,118 ----
// loop
ISN_FOR, // get next item from a list, uses isn_arg.forloop

! ISN_TRY, // add entry to ec_trystack, uses isn_arg.tryref
ISN_THROW, // pop value of stack, store in v:exception
ISN_PUSHEXC, // push v:exception
ISN_CATCH, // drop v:exception
***************
*** 429,435 ****
jump_T jump;
jumparg_T jumparg;
forloop_T forloop;
! try_T try;
trycont_T trycont;
cbfunc_T bfunc;
cdfunc_T dfunc;
--- 429,435 ----
jump_T jump;
jumparg_T jumparg;
forloop_T forloop;
! try_T tryref;
trycont_T trycont;
cbfunc_T bfunc;
cdfunc_T dfunc;
*** ../vim-8.2.3864/src/vim9cmds.c 2021-12-20 15:03:23.251346520 +0000
--- src/vim9cmds.c 2021-12-21 09:37:06.382526965 +0000
***************
*** 1290,1297 ****
try_scope->se_u.se_try.ts_try_label = instr->ga_len;
if ((isn = generate_instr(cctx, ISN_TRY)) == NULL)
return NULL;
! isn->isn_arg.try.try_ref = ALLOC_CLEAR_ONE(tryref_T);
! if (isn->isn_arg.try.try_ref == NULL)
return NULL;
}

--- 1290,1297 ----
try_scope->se_u.se_try.ts_try_label = instr->ga_len;
if ((isn = generate_instr(cctx, ISN_TRY)) == NULL)
return NULL;
! isn->isn_arg.tryref.try_ref = ALLOC_CLEAR_ONE(tryref_T);
! if (isn->isn_arg.tryref.try_ref == NULL)
return NULL;
}

***************
*** 1352,1359 ****

// 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;
! if (isn->isn_arg.try.try_ref->try_catch == 0)
! isn->isn_arg.try.try_ref->try_catch = instr->ga_len;
if (scope->se_u.se_try.ts_catch_label != 0)
{
// Previous catch without match jumps here
--- 1352,1359 ----

// 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;
! if (isn->isn_arg.tryref.try_ref->try_catch == 0)
! isn->isn_arg.tryref.try_ref->try_catch = instr->ga_len;
if (scope->se_u.se_try.ts_catch_label != 0)
{
// Previous catch without match jumps here
***************
*** 1452,1458 ****
{
// 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;
! if (isn->isn_arg.try.try_ref->try_finally != 0)
{
emsg(_(e_finally_dup));
return NULL;
--- 1452,1458 ----
{
// 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;
! if (isn->isn_arg.tryref.try_ref->try_finally != 0)
{
emsg(_(e_finally_dup));
return NULL;
***************
*** 1479,1487 ****
this_instr, cctx);

// If there is no :catch then an exception jumps to :finally.
! if (isn->isn_arg.try.try_ref->try_catch == 0)
! isn->isn_arg.try.try_ref->try_catch = this_instr;
! isn->isn_arg.try.try_ref->try_finally = this_instr;
if (scope->se_u.se_try.ts_catch_label != 0)
{
// Previous catch without match jumps here
--- 1479,1487 ----
this_instr, cctx);

// If there is no :catch then an exception jumps to :finally.
! if (isn->isn_arg.tryref.try_ref->try_catch == 0)
! isn->isn_arg.tryref.try_ref->try_catch = this_instr;
! isn->isn_arg.tryref.try_ref->try_finally = this_instr;
if (scope->se_u.se_try.ts_catch_label != 0)
{
// Previous catch without match jumps here
***************
*** 1528,1535 ****
try_isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label;
if (cctx->ctx_skip != SKIP_YES)
{
! if (try_isn->isn_arg.try.try_ref->try_catch == 0
! && try_isn->isn_arg.try.try_ref->try_finally == 0)
{
emsg(_(e_missing_catch_or_finally));
return NULL;
--- 1528,1535 ----
try_isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label;
if (cctx->ctx_skip != SKIP_YES)
{
! if (try_isn->isn_arg.tryref.try_ref->try_catch == 0
! && try_isn->isn_arg.tryref.try_ref->try_finally == 0)
{
emsg(_(e_missing_catch_or_finally));
return NULL;
***************
*** 1564,1570 ****
{
// End :catch or :finally scope: set instruction index in ISN_TRY
// instruction
! try_isn->isn_arg.try.try_ref->try_endtry = instr->ga_len;
if (cctx->ctx_skip != SKIP_YES
&& generate_instr(cctx, ISN_ENDTRY) == NULL)
return NULL;
--- 1564,1570 ----
{
// End :catch or :finally scope: set instruction index in ISN_TRY
// instruction
! try_isn->isn_arg.tryref.try_ref->try_endtry = instr->ga_len;
if (cctx->ctx_skip != SKIP_YES
&& generate_instr(cctx, ISN_ENDTRY) == NULL)
return NULL;
*** ../vim-8.2.3864/src/vim9execute.c 2021-12-20 15:03:23.251346520 +0000
--- src/vim9execute.c 2021-12-21 09:39:21.218438242 +0000
***************
*** 3517,3527 ****
trycmd->tcd_frame_idx = ectx->ec_frame_idx;
trycmd->tcd_stack_len = ectx->ec_stack.ga_len;
trycmd->tcd_catch_idx =
! iptr->isn_arg.try.try_ref->try_catch;
trycmd->tcd_finally_idx =
! iptr->isn_arg.try.try_ref->try_finally;
trycmd->tcd_endtry_idx =
! iptr->isn_arg.try.try_ref->try_endtry;
}
break;

--- 3517,3527 ----
trycmd->tcd_frame_idx = ectx->ec_frame_idx;
trycmd->tcd_stack_len = ectx->ec_stack.ga_len;
trycmd->tcd_catch_idx =
! iptr->isn_arg.tryref.try_ref->try_catch;
trycmd->tcd_finally_idx =
! iptr->isn_arg.tryref.try_ref->try_finally;
trycmd->tcd_endtry_idx =
! iptr->isn_arg.tryref.try_ref->try_endtry;
}
break;

***************
*** 5670,5676 ****

case ISN_TRY:
{
! try_T *try = &iptr->isn_arg.try;

if (try->try_ref->try_finally == 0)
smsg("%s%4d TRY catch -> %d, endtry -> %d",
--- 5670,5676 ----

case ISN_TRY:
{
! try_T *try = &iptr->isn_arg.tryref;

if (try->try_ref->try_finally == 0)
smsg("%s%4d TRY catch -> %d, endtry -> %d",
*** ../vim-8.2.3864/src/vim9instr.c 2021-12-20 15:03:23.247346527 +0000
--- src/vim9instr.c 2021-12-21 09:39:31.874428976 +0000
***************
*** 2088,2094 ****
break;

case ISN_TRY:
! vim_free(isn->isn_arg.try.try_ref);
break;

case ISN_CEXPR_CORE:
--- 2088,2094 ----
break;

case ISN_TRY:
! vim_free(isn->isn_arg.tryref.try_ref);
break;

case ISN_CEXPR_CORE:
*** ../vim-8.2.3864/src/version.c 2021-12-21 09:11:45.629393263 +0000
--- src/version.c 2021-12-21 09:41:31.338306182 +0000
***************
*** 751,752 ****
--- 751,754 ----
{ /* Add new patch number below this line */
+ /**/
+ 3865,
/**/

--
From "know your smileys":
:-H Is missing teeth

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages