mirror of
https://github.com/vim/vim.git
synced 2025-11-08 10:27:32 -05:00
patch 9.0.0742: reading past end of the line when compiling a function
Problem: Reading past end of the line when compiling a function with
errors.
Solution: Do not return an invalid pointer. Fix skipping redirection.
This commit is contained in:
@@ -2136,15 +2136,66 @@ enddef
|
||||
|
||||
def Test_skipped_redir()
|
||||
var lines =<< trim END
|
||||
def T()
|
||||
def Tredir()
|
||||
if 0
|
||||
redir =>l[0]
|
||||
redir => l[0]
|
||||
redir END
|
||||
endif
|
||||
enddef
|
||||
defcompile
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
delfunc g:Tredir
|
||||
|
||||
lines =<< trim END
|
||||
def Tredir()
|
||||
if 0
|
||||
redir => l[0]
|
||||
endif
|
||||
echo 'executed'
|
||||
if 0
|
||||
redir END
|
||||
endif
|
||||
enddef
|
||||
defcompile
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
delfunc g:Tredir
|
||||
|
||||
lines =<< trim END
|
||||
def Tredir()
|
||||
var l = ['']
|
||||
if 1
|
||||
redir => l[0]
|
||||
endif
|
||||
echo 'executed'
|
||||
if 0
|
||||
redir END
|
||||
else
|
||||
redir END
|
||||
endif
|
||||
enddef
|
||||
defcompile
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
delfunc g:Tredir
|
||||
|
||||
lines =<< trim END
|
||||
let doit = 1
|
||||
def Tredir()
|
||||
var l = ['']
|
||||
if g:doit
|
||||
redir => l[0]
|
||||
endif
|
||||
echo 'executed'
|
||||
if g:doit
|
||||
redir END
|
||||
endif
|
||||
enddef
|
||||
defcompile
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
delfunc g:Tredir
|
||||
enddef
|
||||
|
||||
def Test_for_loop()
|
||||
|
||||
Reference in New Issue
Block a user