Mercurial > vim
comparison src/evalvars.c @ 24281:243985ba92b5 v8.2.2681
patch 8.2.2681: Vim9: test fails for redeclaring script variable
Commit: https://github.com/vim/vim/commit/12be734faffe1da04dfa9098e73abaa864204bc5
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 31 21:47:33 2021 +0200
patch 8.2.2681: Vim9: test fails for redeclaring script variable
Problem: Vim9: test fails for redeclaring script variable.
Solution: It's OK to assign to an existing script variable in legacy.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 31 Mar 2021 22:00:03 +0200 |
parents | e3dbf2e58c6a |
children | 96e0b898d5b4 |
comparison
equal
deleted
inserted
replaced
24280:8ab83d4f5d2e | 24281:243985ba92b5 |
---|---|
3217 { | 3217 { |
3218 emsg(_(e_cannot_mod)); | 3218 emsg(_(e_cannot_mod)); |
3219 goto failed; | 3219 goto failed; |
3220 } | 3220 } |
3221 | 3221 |
3222 if (is_script_local && vim9script | |
3223 && (flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0) | |
3224 { | |
3225 semsg(_(e_redefining_script_item_str), name); | |
3226 goto failed; | |
3227 } | |
3228 | |
3222 if (var_in_vim9script) | 3229 if (var_in_vim9script) |
3223 { | 3230 { |
3224 where_T where; | 3231 where_T where; |
3225 | |
3226 if ((flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0) | |
3227 { | |
3228 semsg(_(e_redefining_script_item_str), name); | |
3229 goto failed; | |
3230 } | |
3231 | 3232 |
3232 // check the type and adjust to bool if needed | 3233 // check the type and adjust to bool if needed |
3233 where.wt_index = var_idx; | 3234 where.wt_index = var_idx; |
3234 where.wt_variable = TRUE; | 3235 where.wt_variable = TRUE; |
3235 if (check_script_var_type(&di->di_tv, tv, name, where) == FAIL) | 3236 if (check_script_var_type(&di->di_tv, tv, name, where) == FAIL) |