comparison src/eval.c @ 21443:66386ca8a69f v8.2.1272

patch 8.2.1272: Vim9: type not checked if declaration also assigns value Commit: https://github.com/vim/vim/commit/4cdb13ce81309b62b636f2c614241959174d3fef Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 22 21:45:14 2020 +0200 patch 8.2.1272: Vim9: type not checked if declaration also assigns value Problem: Vim9: type not checked if declaration also assigns value. Solution: Check the type. (issue https://github.com/vim/vim/issues/6507)
author Bram Moolenaar <Bram@vim.org>
date Wed, 22 Jul 2020 22:00:04 +0200
parents a6c316ef161a
children 369cde0d5771
comparison
equal deleted inserted replaced
21442:0c134036ff70 21443:66386ca8a69f
1268 set_var(lp->ll_name, &tv, FALSE); 1268 set_var(lp->ll_name, &tv, FALSE);
1269 clear_tv(&tv); 1269 clear_tv(&tv);
1270 } 1270 }
1271 } 1271 }
1272 else 1272 else
1273 {
1274 if (lp->ll_type != NULL
1275 && check_typval_type(lp->ll_type, rettv) == FAIL)
1276 return;
1273 set_var_const(lp->ll_name, lp->ll_type, rettv, copy, flags); 1277 set_var_const(lp->ll_name, lp->ll_type, rettv, copy, flags);
1278 }
1274 *endp = cc; 1279 *endp = cc;
1275 } 1280 }
1276 else if (var_check_lock(lp->ll_newkey == NULL 1281 else if (var_check_lock(lp->ll_newkey == NULL
1277 ? lp->ll_tv->v_lock 1282 ? lp->ll_tv->v_lock
1278 : lp->ll_tv->vval.v_dict->dv_lock, lp->ll_name, FALSE)) 1283 : lp->ll_tv->vval.v_dict->dv_lock, lp->ll_name, FALSE))