comparison src/evalvars.c @ 27966:80f398bfc19f v8.2.4508

patch 8.2.4508: Vim9: cannot assign to a global variable on the command line Commit: https://github.com/vim/vim/commit/330a388e18ad6b64c3574c712db675258b0e9878 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 5 11:05:57 2022 +0000 patch 8.2.4508: Vim9: cannot assign to a global variable on the command line Problem: Vim9: cannot assign to a global variable on the command line. Solution: Allow using :vim9cmd for assignment on the command line.
author Bram Moolenaar <Bram@vim.org>
date Sat, 05 Mar 2022 12:15:04 +0100
parents aacc98a38cf3
children 40c6e5f849dc
comparison
equal deleted inserted replaced
27965:735bd3823bb5 27966:80f398bfc19f
752 * etc. 752 * etc.
753 */ 753 */
754 void 754 void
755 ex_var(exarg_T *eap) 755 ex_var(exarg_T *eap)
756 { 756 {
757 char_u *p = eap->cmd;
758
757 if (!in_vim9script()) 759 if (!in_vim9script())
758 { 760 {
759 semsg(_(e_str_cannot_be_used_in_legacy_vim_script), ":var"); 761 semsg(_(e_str_cannot_be_used_in_legacy_vim_script), ":var");
760 return; 762 return;
761 } 763 }
762 if (current_sctx.sc_sid == 0) 764 if (current_sctx.sc_sid == 0 && checkforcmd_noparen(&p, "var", 3))
763 { 765 {
764 emsg(_(e_cannot_declare_variable_on_command_line)); 766 emsg(_(e_cannot_declare_variable_on_command_line));
765 return; 767 return;
766 } 768 }
767 ex_let(eap); 769 ex_let(eap);