comparison src/evalvars.c @ 20842:bacc2ab11810 v8.2.0973

patch 8.2.0973: Vim9: type is not checked when assigning to a script variable Commit: https://github.com/vim/vim/commit/34db91f7a47b7bd4aabf1e1dfbaa8a08278bf78d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 13 19:00:10 2020 +0200 patch 8.2.0973: Vim9: type is not checked when assigning to a script variable Problem: Vim9: type is not checked when assigning to a script variable. Solution: Check the type.
author Bram Moolenaar <Bram@vim.org>
date Sat, 13 Jun 2020 19:15:03 +0200
parents 0600ab7b9f09
children 876e16c48bd1
comparison
equal deleted inserted replaced
20841:f0411e161f00 20842:bacc2ab11810
2881 2881
2882 if (var_check_ro(di->di_flags, name, FALSE) 2882 if (var_check_ro(di->di_flags, name, FALSE)
2883 || var_check_lock(di->di_tv.v_lock, name, FALSE)) 2883 || var_check_lock(di->di_tv.v_lock, name, FALSE))
2884 return; 2884 return;
2885 2885
2886 if ((flags & LET_NO_COMMAND) == 0 2886 if (is_script_local
2887 && is_script_local 2887 && current_sctx.sc_version == SCRIPT_VERSION_VIM9)
2888 && current_sctx.sc_version == SCRIPT_VERSION_VIM9) 2888 {
2889 { 2889 if ((flags & LET_NO_COMMAND) == 0)
2890 semsg(_("E1041: Redefining script item %s"), name); 2890 {
2891 return; 2891 semsg(_("E1041: Redefining script item %s"), name);
2892 return;
2893 }
2894
2895 // check the type
2896 check_script_var_type(&di->di_tv, tv, name);
2892 } 2897 }
2893 } 2898 }
2894 else 2899 else
2895 // can only redefine once 2900 // can only redefine once
2896 di->di_flags &= ~DI_FLAGS_RELOAD; 2901 di->di_flags &= ~DI_FLAGS_RELOAD;