1
0
forked from aniani/vim

patch 8.2.3981: Vim9: debugging a for loop doesn't stop before it starts

Problem:    Vim9: debugging a for loop doesn't stop before it starts.
Solution:   Keep the DEBUG instruction before the expression is evaluated.
            (closes #9456)
This commit is contained in:
Bram Moolenaar
2022-01-02 14:08:18 +00:00
parent b3bd1d39e6
commit 2b4ecc2c31
3 changed files with 61 additions and 16 deletions

View File

@@ -2434,6 +2434,43 @@ def Test_debug_elseif()
res)
enddef
def s:DebugFor()
echo "hello"
for a in [0]
echo a
endfor
enddef
def Test_debug_for()
var res = execute('disass debug s:DebugFor')
assert_match('<SNR>\d*_DebugFor\_s*' ..
'echo "hello"\_s*' ..
'0 DEBUG line 1-1 varcount 0\_s*' ..
'1 PUSHS "hello"\_s*' ..
'2 ECHO 1\_s*' ..
'for a in \[0\]\_s*' ..
'3 DEBUG line 2-2 varcount 0\_s*' ..
'4 STORE -1 in $0\_s*' ..
'5 PUSHNR 0\_s*' ..
'6 NEWLIST size 1\_s*' ..
'7 DEBUG line 2-2 varcount 2\_s*' ..
'8 FOR $0 -> 15\_s*' ..
'9 STORE $1\_s*' ..
'echo a\_s*' ..
'10 DEBUG line 3-3 varcount 2\_s*' ..
'11 LOAD $1\_s*' ..
'12 ECHO 1\_s*' ..
'endfor\_s*' ..
'13 DEBUG line 4-4 varcount 2\_s*' ..
'14 JUMP -> 7\_s*' ..
'15 DROP\_s*' ..
'16 RETURN void*',
res)
enddef
func Legacy() dict
echo 'legacy'
endfunc