diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-03-14 12:13:33 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-03-14 12:13:33 +0100 |
commit | 2e34c34be1393027a761ecbccd8f267d52ca7bc1 (patch) | |
tree | 05c7e4c7269d18793d3fe3a2b35c546819993f7e /src/vim9execute.c | |
parent | 6bce5856b5fc4d4eb8f75298382251ecda659ac3 (diff) | |
download | vim-git-2e34c34be1393027a761ecbccd8f267d52ca7bc1.tar.gz |
patch 8.2.2602: Vim9: continue doesn't work if :while is very first commandv8.2.2602
Problem: Vim9: continue doesn't work if :while is very first command.
(Yegappan Lakshmanan)
Solution: Add one to the continue instruction index.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r-- | src/vim9execute.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c index f8470f5c7..b2c28a31b 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -30,7 +30,7 @@ typedef struct { int tcd_finally_idx; // instruction of the :finally block or zero int tcd_endtry_idx; // instruction of the :endtry int tcd_caught; // catch block entered - int tcd_cont; // :continue encountered, jump here + int tcd_cont; // :continue encountered, jump here (minus one) int tcd_return; // when TRUE return from end of :finally } trycmd_T; @@ -2757,7 +2757,9 @@ call_def_function( { trycmd = ((trycmd_T *)trystack->ga_data) + trystack->ga_len - i; - trycmd->tcd_cont = iidx; + // Add one to tcd_cont to be able to jump to + // instruction with index zero. + trycmd->tcd_cont = iidx + 1; iidx = trycmd->tcd_finally_idx == 0 ? trycmd->tcd_endtry_idx : trycmd->tcd_finally_idx; } @@ -2811,7 +2813,7 @@ call_def_function( if (trycmd->tcd_cont != 0) // handling :continue: jump to outer try block or // start of the loop - ectx.ec_iidx = trycmd->tcd_cont; + ectx.ec_iidx = trycmd->tcd_cont - 1; } } break; |