mirror of
https://github.com/vim/vim.git
synced 2025-11-09 10:37:17 -05:00
patch 9.0.1944: Vim9: function instruction pointer invalidated
Problem: Vim9: function instruction pointer invalidated Solution: Use the funcref index instead of the instruction pointer closes: #13178 closes: #13196 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
committed by
Christian Brabandt
parent
91adcbdcc1
commit
a76fbe6e00
@@ -4636,6 +4636,56 @@ def Test_free_type_before_use()
|
||||
v9.CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
" The following complicated script used to cause an internal error (E340)
|
||||
" because the funcref instruction memory was referenced after the instruction
|
||||
" memory was reallocated (Github issue #13178)
|
||||
def Test_refer_funcref_instr_after_realloc()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
def A(d: bool)
|
||||
var e = abs(0)
|
||||
var f = &emoji
|
||||
&emoji = true
|
||||
if ['', '', '']->index('xxx') == 0
|
||||
eval 0 + 0
|
||||
endif
|
||||
if &filetype == 'xxx'
|
||||
var g = abs(0)
|
||||
while g > 0
|
||||
if getline(g) == ''
|
||||
break
|
||||
endif
|
||||
--g
|
||||
endwhile
|
||||
if g == 0
|
||||
return
|
||||
endif
|
||||
if d
|
||||
feedkeys($'{g}G')
|
||||
g = abs(0)
|
||||
endif
|
||||
var h = abs(0)
|
||||
var i = abs(0)
|
||||
var j = abs(0)
|
||||
while j < 0
|
||||
if abs(0) < h && getline(j) != ''
|
||||
break
|
||||
endif
|
||||
++j
|
||||
endwhile
|
||||
feedkeys($'{g}G{j}G')
|
||||
return
|
||||
endif
|
||||
def B()
|
||||
enddef
|
||||
def C()
|
||||
enddef
|
||||
enddef
|
||||
A(false)
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
" Keep this last, it messes up highlighting.
|
||||
def Test_substitute_cmd()
|
||||
new
|
||||
|
||||
Reference in New Issue
Block a user