Mercurial > vim
comparison src/testdir/test_vim9_assign.vim @ 24984:71b1e2ef0069 v8.2.3029
patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Commit: https://github.com/vim/vim/commit/035bd1c99f2a8eda5ee886adde4f97ea71fb167f
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 21 19:44:11 2021 +0200
patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Problem: Vim9: crash when using operator and list unpack assignment.
(Naohiro Ono)
Solution: Get variable value before operation. (closes #8416)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 21 Jun 2021 19:45:03 +0200 |
parents | d0b6a8d82cef |
children | 91f396f149d5 |
comparison
equal
deleted
inserted
replaced
24983:94f7f4cd68b7 | 24984:71b1e2ef0069 |
---|---|
281 assert_equal(2, v2) | 281 assert_equal(2, v2) |
282 | 282 |
283 [v1, v2; _] = [1, 2, 3, 4, 5] | 283 [v1, v2; _] = [1, 2, 3, 4, 5] |
284 assert_equal(1, v1) | 284 assert_equal(1, v1) |
285 assert_equal(2, v2) | 285 assert_equal(2, v2) |
286 | |
287 var a = 1 | |
288 var b = 3 | |
289 [a, b] += [2, 4] | |
290 assert_equal(3, a) | |
291 assert_equal(7, b) | |
292 | |
293 [a, b] -= [1, 2] | |
294 assert_equal(2, a) | |
295 assert_equal(5, b) | |
296 | |
297 [a, b] *= [3, 2] | |
298 assert_equal(6, a) | |
299 assert_equal(10, b) | |
300 | |
301 [a, b] /= [2, 4] | |
302 assert_equal(3, a) | |
303 assert_equal(2, b) | |
304 | |
305 [a, b] = [17, 15] | |
306 [a, b] %= [5, 3] | |
307 assert_equal(2, a) | |
308 assert_equal(0, b) | |
286 END | 309 END |
287 CheckDefAndScriptSuccess(lines) | 310 CheckDefAndScriptSuccess(lines) |
288 | 311 |
289 lines =<< trim END | 312 lines =<< trim END |
290 var v1: number | 313 var v1: number |