1
0
forked from aniani/vim

patch 8.2.1746: Vim9: cannot use "fina" for "finally"

Problem:    Vim9: Cannot use "fina" for "finally". (Naruhiko Nishino)
Solution:   Specifically check for "fina". (closes #7020)
This commit is contained in:
Bram Moolenaar 2020-09-26 17:20:53 +02:00
parent d47f50b331
commit 373863ed48
4 changed files with 12 additions and 5 deletions

View File

@ -3420,6 +3420,10 @@ find_ex_command(
eap->cmdidx = CMD_SIZE; 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; return p;
} }

View File

@ -37,7 +37,7 @@ func T25_F()
if loops == 2 if loops == 2
try try
Xpath 'f' . loops Xpath 'f' . loops
finally final
Xpath 'g' . loops Xpath 'g' . loops
endtry endtry
endif endif
@ -49,19 +49,20 @@ func T25_F()
Xpath 'i' Xpath 'i'
endfunc endfunc
" Also try using "fina" and "final" and "finall" as abbraviations.
func T25_G() func T25_G()
if 1 if 1
try try
Xpath 'A' Xpath 'A'
call T25_F() call T25_F()
Xpath 'B' Xpath 'B'
finally fina
Xpath 'C' Xpath 'C'
endtry endtry
else else
try try
Xpath 'D' Xpath 'D'
finally finall
Xpath 'E' Xpath 'E'
endtry endtry
endif endif

View File

@ -316,7 +316,7 @@ def Test_try_catch()
endtry endtry
catch /wrong/ catch /wrong/
add(l, 'caught') add(l, 'caught')
finally fina
add(l, 'finally') add(l, 'finally')
endtry endtry
assert_equal(['1', 'caught', 'finally'], l) assert_equal(['1', 'caught', 'finally'], l)
@ -526,7 +526,7 @@ enddef
def ReturnFinally(): string def ReturnFinally(): string
try try
return 'intry' return 'intry'
finally finall
g:in_finally = 'finally' g:in_finally = 'finally'
endtry endtry
return 'end' return 'end'

View File

@ -750,6 +750,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 */
/**/
1746,
/**/ /**/
1745, 1745,
/**/ /**/