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.
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 2fa88e8..d4cd602 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -1162,6 +1162,26 @@
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')