]> granicus.if.org Git - vim/commitdiff
patch 8.2.0732: Vim9: storing value in dict messes up stack v8.2.0732
authorBram Moolenaar <Bram@vim.org>
Sun, 10 May 2020 19:47:43 +0000 (21:47 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 10 May 2020 19:47:43 +0000 (21:47 +0200)
Problem:    Vim9: storing value in dict messes up stack.
Solution:   Correct item count of stack.

src/testdir/test_vim9_cmd.vim
src/version.c
src/vim9execute.c

index 12260c355856886fd5fa18c8f1ccd88d57f840b7..55d756a676b62c9840fd2a8c74245ce5217cce4b 100644 (file)
@@ -54,6 +54,12 @@ def Test_assign_list()
   assert_equal('asdf', l[1])
   assert_equal('asdf', l[-1])
   assert_equal('value', l[-2])
+
+  let nrl: list<number> = []
+  for i in range(5)
+    nrl[i] = i
+  endfor
+  assert_equal([0, 1, 2, 3, 4], nrl)
 enddef
 
 def Test_assign_dict()
@@ -64,6 +70,12 @@ def Test_assign_dict()
   d[123] = 'qwerty'
   assert_equal('qwerty', d[123])
   assert_equal('qwerty', d['123'])
+
+  let nrd: dict<number> = {}
+  for i in range(3)
+    nrd[i] = i
+  endfor
+  assert_equal({'0': 0, '1': 1, '2': 2}, nrd)
 enddef
 
 
index efb3c3187c0cf0099cc6b05ee83b5d6cec640ba3..6a29592c15ad52397e0e02bbeb41842407a88285 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    732,
 /**/
     731,
 /**/
index ba4ae478719d489fba7fac3184358a5676296d20..4356e2a95a58dd3a067540c4b6abf0c2118ab477 100644 (file)
@@ -1286,6 +1286,7 @@ call_def_function(
                    }
                    clear_tv(tv_idx);
                    clear_tv(tv_list);
+                   ectx.ec_stack.ga_len -= 3;
                }
                break;
 
@@ -1319,6 +1320,7 @@ call_def_function(
                    }
                    clear_tv(tv_key);
                    clear_tv(tv_dict);
+                   ectx.ec_stack.ga_len -= 3;
                }
                break;