Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 26792:30d8377ea1b1 v8.2.3924
patch 8.2.3924: Vim9: no error if something follows :enddef
Commit: https://github.com/vim/vim/commit/7473a84cf935f64ddd4ea7fe7eee0f9c51c50b60
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 28 17:55:26 2021 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 28 Dec 2021 19:00:05 +0100 |
parents | 83b35c75c21a |
children | a6ccb6ec581c |
comparison
equal
deleted
inserted
replaced
26791:43989ce10dd1 | 26792:30d8377ea1b1 |
---|---|
1684 enddef | 1684 enddef |
1685 | 1685 |
1686 # Compile all functions | 1686 # Compile all functions |
1687 defcompile | 1687 defcompile |
1688 END | 1688 END |
1689 CheckScriptFailure(lines, 'E476: Invalid command: AAAAA') | 1689 CheckScriptFailure(lines, 'E1173: Text found after enddef: BBBB') |
1690 enddef | 1690 enddef |
1691 | 1691 |
1692 def Test_nested_function_with_args_split() | 1692 def Test_nested_function_with_args_split() |
1693 var lines =<< trim END | 1693 var lines =<< trim END |
1694 vim9script | 1694 vim9script |
1701 enddef|BBBB | 1701 enddef|BBBB |
1702 enddef | 1702 enddef |
1703 # Compile all functions | 1703 # Compile all functions |
1704 defcompile | 1704 defcompile |
1705 END | 1705 END |
1706 # FIXME: this should fail on the BBBB | 1706 CheckScriptFailure(lines, 'E1173: Text found after enddef: BBBB') |
1707 CheckScriptSuccess(lines) | 1707 |
1708 lines =<< trim END | |
1709 vim9script | |
1710 def FirstFunction() | |
1711 func SecondFunction() | |
1712 endfunc|BBBB | |
1713 enddef | |
1714 defcompile | |
1715 END | |
1716 CheckScriptFailure(lines, 'E1173: Text found after endfunction: BBBB') | |
1708 enddef | 1717 enddef |
1709 | 1718 |
1710 def Test_return_type_wrong() | 1719 def Test_return_type_wrong() |
1711 CheckScriptFailure([ | 1720 CheckScriptFailure([ |
1712 'def Func(): number', | 1721 'def Func(): number', |