0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.1001: Vim9: crash with nested "if" and assignment

Problem:    Vim9: crash with nested "if" and assignment.
Solution:   Skip more of the assignment.  Do not set ctx_skip when code is
            reachable.
This commit is contained in:
Bram Moolenaar
2020-06-18 18:26:24 +02:00
parent 158ea175a9
commit 72abcf42d4
3 changed files with 72 additions and 39 deletions

View File

@@ -1162,6 +1162,26 @@ def Test_if_const_expr_fails()
call CheckDefFailure(["if has('aaa') ? true false"], 'E109:')
enddef
def RunNested(i: number): number
let x: number = 0
if i % 2
if 1
" comment
else
" comment
endif
x += 1
else
x += 1000
endif
return x
enddef
def Test_nested_if()
assert_equal(1, RunNested(1))
assert_equal(1000, RunNested(2))
enddef
def Test_execute_cmd()
new
setline(1, 'default')