diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-06-13 19:00:10 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-06-13 19:00:10 +0200 |
commit | 34db91f7a47b7bd4aabf1e1dfbaa8a08278bf78d (patch) | |
tree | 116cb78d7fe2603f6213f355ad35c7ccbd3ebcd6 /src/evalvars.c | |
parent | c82a5b5da5eab15bc35115545b639fb590272ad7 (diff) |
patch 8.2.0973: Vim9: type is not checked when assigning to a script variablev8.2.0973
Problem: Vim9: type is not checked when assigning to a script variable.
Solution: Check the type.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index 8a7162c99c..31cd01d25b 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -2883,12 +2883,17 @@ set_var_const( || var_check_lock(di->di_tv.v_lock, name, FALSE)) return; - if ((flags & LET_NO_COMMAND) == 0 - && is_script_local - && current_sctx.sc_version == SCRIPT_VERSION_VIM9) + if (is_script_local + && current_sctx.sc_version == SCRIPT_VERSION_VIM9) { - semsg(_("E1041: Redefining script item %s"), name); - return; + if ((flags & LET_NO_COMMAND) == 0) + { + semsg(_("E1041: Redefining script item %s"), name); + return; + } + + // check the type + check_script_var_type(&di->di_tv, tv, name); } } else |