0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 8.2.1392: Vim9: line number incorrect after skipping over comment lines

Problem:    Vim9: error line number incorrect after skipping over comment
            lines.
Solution:   Insert empty lines for skipped lines.
This commit is contained in:
Bram Moolenaar
2020-08-08 14:26:31 +02:00
parent fa211f3c6d
commit bf8feb5aeb
3 changed files with 55 additions and 0 deletions

View File

@@ -984,6 +984,47 @@ func DelMe()
echo 'DelMe'
endfunc
def Test_error_reporting()
# comment lines at the start of the function
let lines =<< trim END
" comment
def Func()
# comment
# comment
invalid
enddef
defcompile
END
call writefile(lines, 'Xdef')
try
source Xdef
catch /E476:/
assert_match('Invalid command: invalid', v:exception)
assert_match(', line 3$', v:throwpoint)
endtry
# comment lines after the start of the function
lines =<< trim END
" comment
def Func()
let x = 1234
# comment
# comment
invalid
enddef
defcompile
END
call writefile(lines, 'Xdef')
try
source Xdef
catch /E476:/
assert_match('Invalid command: invalid', v:exception)
assert_match(', line 4$', v:throwpoint)
endtry
call delete('Xdef')
enddef
def Test_deleted_function()
CheckDefExecFailure([
'let RefMe: func = function("g:DelMe")',