comparison src/testdir/test_vim9_script.vim @ 20899:e76bddcf3341 v8.2.1001

patch 8.2.1001: Vim9: crash with nested "if" and assignment Commit: https://github.com/vim/vim/commit/72abcf42d4b28719863c3bdf72b4c05d147a7d83 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 18 18:26:24 2020 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Thu, 18 Jun 2020 18:30:03 +0200
parents b70555af8908
children a3853794a768
comparison
equal deleted inserted replaced
20898:d3cd1a4d18e2 20899:e76bddcf3341
1160 call CheckDefFailure(["if 'aaa' == 'bbb"], 'E115:') 1160 call CheckDefFailure(["if 'aaa' == 'bbb"], 'E115:')
1161 call CheckDefFailure(["if has('aaa'"], 'E110:') 1161 call CheckDefFailure(["if has('aaa'"], 'E110:')
1162 call CheckDefFailure(["if has('aaa') ? true false"], 'E109:') 1162 call CheckDefFailure(["if has('aaa') ? true false"], 'E109:')
1163 enddef 1163 enddef
1164 1164
1165 def RunNested(i: number): number
1166 let x: number = 0
1167 if i % 2
1168 if 1
1169 " comment
1170 else
1171 " comment
1172 endif
1173 x += 1
1174 else
1175 x += 1000
1176 endif
1177 return x
1178 enddef
1179
1180 def Test_nested_if()
1181 assert_equal(1, RunNested(1))
1182 assert_equal(1000, RunNested(2))
1183 enddef
1184
1165 def Test_execute_cmd() 1185 def Test_execute_cmd()
1166 new 1186 new
1167 setline(1, 'default') 1187 setline(1, 'default')
1168 execute 'call setline(1, "execute-string")' 1188 execute 'call setline(1, "execute-string")'
1169 assert_equal('execute-string', getline(1)) 1189 assert_equal('execute-string', getline(1))