diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-26 17:20:53 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-26 17:20:53 +0200 |
commit | 373863ed48c02b5df52574aa7d50aeecb1037d40 (patch) | |
tree | b8ac35b8b7d37267bfdfc2016375ba7c7e12602d | |
parent | d47f50b3312af2b8baf37505b7a589daf3f7d942 (diff) | |
download | vim-git-8.2.1746.tar.gz |
patch 8.2.1746: Vim9: cannot use "fina" for "finally"v8.2.1746
Problem: Vim9: Cannot use "fina" for "finally". (Naruhiko Nishino)
Solution: Specifically check for "fina". (closes #7020)
-rw-r--r-- | src/ex_docmd.c | 4 | ||||
-rw-r--r-- | src/testdir/test_trycatch.vim | 7 | ||||
-rw-r--r-- | src/testdir/test_vim9_script.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 12 insertions, 5 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index a7542f35b..bb504ffd6 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -3420,6 +3420,10 @@ find_ex_command( eap->cmdidx = CMD_SIZE; } + // ":fina" means ":finally" for backwards compatibility. + if (eap->cmdidx == CMD_final && p - eap->cmd == 4) + eap->cmdidx = CMD_finally; + return p; } diff --git a/src/testdir/test_trycatch.vim b/src/testdir/test_trycatch.vim index 1f1681f2d..9f670f7ae 100644 --- a/src/testdir/test_trycatch.vim +++ b/src/testdir/test_trycatch.vim @@ -37,7 +37,7 @@ func T25_F() if loops == 2 try Xpath 'f' . loops - finally + final Xpath 'g' . loops endtry endif @@ -49,19 +49,20 @@ func T25_F() Xpath 'i' endfunc +" Also try using "fina" and "final" and "finall" as abbraviations. func T25_G() if 1 try Xpath 'A' call T25_F() Xpath 'B' - finally + fina Xpath 'C' endtry else try Xpath 'D' - finally + finall Xpath 'E' endtry endif diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index 2f82b8dd3..0feb9fad4 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -316,7 +316,7 @@ def Test_try_catch() endtry catch /wrong/ add(l, 'caught') - finally + fina add(l, 'finally') endtry assert_equal(['1', 'caught', 'finally'], l) @@ -526,7 +526,7 @@ enddef def ReturnFinally(): string try return 'intry' - finally + finall g:in_finally = 'finally' endtry return 'end' diff --git a/src/version.c b/src/version.c index bd5d60745..49ce61cab 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 */ /**/ + 1746, +/**/ 1745, /**/ 1744, |