summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-19 20:23:11 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-19 20:23:11 +0100
commitfd1823e0b783c31a5022c7a4d31c34d84ff0a744 (patch)
treefa080e914deb8d16eb6596f457c7c90fc187b76b /src/vim9compile.c
parent401d9ffb5a8a40102c000c2d2614aa043f541f90 (diff)
downloadvim-git-fd1823e0b783c31a5022c7a4d31c34d84ff0a744.tar.gz
patch 8.2.0283: Vim9: failing to load script var not testedv8.2.0283
Problem: Vim9: failing to load script var not tested. Solution: Add more tests. Fix using s: in old script.
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 8614943fd..7fe27642a 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1513,9 +1513,9 @@ compile_load_scriptvar(cctx_T *cctx, char_u *name)
int idx = get_script_item_idx(current_sctx.sc_sid, name, FALSE);
imported_T *import;
- if (idx == -1)
+ if (idx == -1 || si->sn_version != SCRIPT_VERSION_VIM9)
{
- // variable exists but is not in sn_var_vals: old style script.
+ // variable is not in sn_var_vals: old style script.
return generate_OLDSCRIPT(cctx, ISN_LOADS, name, current_sctx.sc_sid,
&t_any);
}
@@ -1627,7 +1627,9 @@ compile_load(char_u **arg, char_u *end, cctx_T *cctx, int error)
|| (len == 5 && STRNCMP("false", *arg, 5) == 0))
res = generate_PUSHBOOL(cctx, **arg == 't'
? VVAL_TRUE : VVAL_FALSE);
- else
+ else if (SCRIPT_ITEM(current_sctx.sc_sid)->sn_version
+ == SCRIPT_VERSION_VIM9)
+ // in Vim9 script "var" can be script-local.
res = compile_load_scriptvar(cctx, name);
}
}