0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.0732: Vim9: storing value in dict messes up stack

Problem:    Vim9: storing value in dict messes up stack.
Solution:   Correct item count of stack.
This commit is contained in:
Bram Moolenaar
2020-05-10 21:47:43 +02:00
parent 7e5bd91dc9
commit f163bd5e41
3 changed files with 16 additions and 0 deletions

View File

@@ -54,6 +54,12 @@ def Test_assign_list()
assert_equal('asdf', l[1]) assert_equal('asdf', l[1])
assert_equal('asdf', l[-1]) assert_equal('asdf', l[-1])
assert_equal('value', l[-2]) 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 enddef
def Test_assign_dict() def Test_assign_dict()
@@ -64,6 +70,12 @@ def Test_assign_dict()
d[123] = 'qwerty' d[123] = 'qwerty'
assert_equal('qwerty', d[123]) assert_equal('qwerty', d[123])
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 enddef

View File

@@ -746,6 +746,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
732,
/**/ /**/
731, 731,
/**/ /**/

View File

@@ -1286,6 +1286,7 @@ call_def_function(
} }
clear_tv(tv_idx); clear_tv(tv_idx);
clear_tv(tv_list); clear_tv(tv_list);
ectx.ec_stack.ga_len -= 3;
} }
break; break;
@@ -1319,6 +1320,7 @@ call_def_function(
} }
clear_tv(tv_key); clear_tv(tv_key);
clear_tv(tv_dict); clear_tv(tv_dict);
ectx.ec_stack.ga_len -= 3;
} }
break; break;