0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.3152: Vim9: accessing "s:" results in an error

Problem:    Vim9: accessing "s:" results in an error.
Solution:   Do not try to lookup a script variable for "s:". (closes #8549)
This commit is contained in:
Bram Moolenaar 2021-07-11 20:59:00 +02:00
parent ffcfddc759
commit 11005b078d
3 changed files with 11 additions and 1 deletions

View File

@ -2660,7 +2660,8 @@ eval_variable(
} }
else if (rettv != NULL) else if (rettv != NULL)
{ {
if (ht != NULL && ht == get_script_local_ht()) if (ht != NULL && ht == get_script_local_ht()
&& tv != &SCRIPT_SV(current_sctx.sc_sid)->sv_var.di_tv)
{ {
svar_T *sv = find_typval_in_script(tv); svar_T *sv = find_typval_in_script(tv);

View File

@ -2478,6 +2478,13 @@ def Test_expr7_dict_vim9script()
else else
CheckDefAndScriptFailure(lines, 'E117:', 0) CheckDefAndScriptFailure(lines, 'E117:', 0)
endif endif
lines =<< trim END
vim9script
var x = 99
assert_equal({x: 99}, s:)
END
CheckScriptSuccess(lines)
enddef enddef
def Test_expr7_call_2bool() def Test_expr7_call_2bool()

View File

@ -755,6 +755,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 */
/**/
3152,
/**/ /**/
3151, 3151,
/**/ /**/