1
0
forked from aniani/vim

patch 8.2.3924: Vim9: no error if something follows :enddef

Problem:    Vim9: no error if something follows :enddef in a nested function.
Solution:   Give an error.  Move common code to a function.
This commit is contained in:
Bram Moolenaar
2021-12-28 17:55:26 +00:00
parent 4bf1006cae
commit 7473a84cf9
5 changed files with 56 additions and 22 deletions

View File

@@ -1686,7 +1686,7 @@ def Test_nested_function_with_nextcmd()
# Compile all functions
defcompile
END
CheckScriptFailure(lines, 'E476: Invalid command: AAAAA')
CheckScriptFailure(lines, 'E1173: Text found after enddef: BBBB')
enddef
def Test_nested_function_with_args_split()
@@ -1703,8 +1703,17 @@ def Test_nested_function_with_args_split()
# Compile all functions
defcompile
END
# FIXME: this should fail on the BBBB
CheckScriptSuccess(lines)
CheckScriptFailure(lines, 'E1173: Text found after enddef: BBBB')
lines =<< trim END
vim9script
def FirstFunction()
func SecondFunction()
endfunc|BBBB
enddef
defcompile
END
CheckScriptFailure(lines, 'E1173: Text found after endfunction: BBBB')
enddef
def Test_return_type_wrong()