To: vim_dev@googlegroups.com Subject: Patch 8.2.3859 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3859 Problem: Vim9: some code lines not tested. Solution: Add a few specific tests. Files: src/vim9compile.c, src/testdir/test_vim9_cmd.vim, src/errors.h, src/testdir/test_vim9_script.vim *** ../vim-8.2.3858/src/vim9compile.c 2021-12-20 10:55:31.772827340 +0000 --- src/vim9compile.c 2021-12-20 12:09:39.490419990 +0000 *************** *** 8333,8339 **** lhs_type = parse_type(&p, cctx->ctx_type_list, TRUE); } - // Script var is not supported. if (get_var_dest(name, &dest, CMD_for, &opt_flags, &vimvaridx, &type, cctx) == FAIL) goto failed; --- 8333,8338 ---- *************** *** 8351,8367 **** } else { ! if (!valid_varname(arg, (int)varlen, FALSE)) ! goto failed; ! if (lookup_local(arg, varlen, NULL, cctx) == OK) { ! semsg(_(e_variable_already_declared), arg); goto failed; } ! if (STRNCMP(name, "s:", 2) == 0) { ! semsg(_(e_cannot_declare_script_variable_in_function), name); goto failed; } --- 8350,8367 ---- } else { ! // Script var is not supported. ! if (STRNCMP(name, "s:", 2) == 0) { ! emsg(_(e_cannot_use_script_variable_in_for_loop)); goto failed; } ! if (!valid_varname(arg, (int)varlen, FALSE)) ! goto failed; ! if (lookup_local(arg, varlen, NULL, cctx) == OK) { ! semsg(_(e_variable_already_declared), arg); goto failed; } *** ../vim-8.2.3858/src/testdir/test_vim9_cmd.vim 2021-12-20 10:55:31.772827340 +0000 --- src/testdir/test_vim9_cmd.vim 2021-12-20 11:45:40.701986966 +0000 *************** *** 1392,1397 **** --- 1392,1401 ---- s:theList[1] = 44 assert_equal([1, 44, 3], s:theList) + if 0 + lockvar whatever + endif + var d = {a: 1, b: 2} d.a = 3 d.b = 4 *** ../vim-8.2.3858/src/errors.h 2021-12-19 15:17:16.221857770 +0000 --- src/errors.h 2021-12-20 12:09:15.938430343 +0000 *************** *** 850,852 **** --- 850,854 ---- INIT(= N_("E1252: String, List or Blob required for argument %d")); EXTERN char e_string_expected_for_argument_nr[] INIT(= N_("E1253: String expected for argument %d")); + EXTERN char e_cannot_use_script_variable_in_for_loop[] + INIT(= N_("E1254: Cannot use script variable in for loop")); *** ../vim-8.2.3858/src/testdir/test_vim9_script.vim 2021-12-20 10:55:31.772827340 +0000 --- src/testdir/test_vim9_script.vim 2021-12-20 12:21:48.501597753 +0000 *************** *** 2963,2969 **** def Test_for_loop_script_var() # cannot use s:var in a :def function ! CheckDefFailure(['for s:var in range(3)', 'echo 3'], 'E461:') # can use s:var in Vim9 script, with or without s: var lines =<< trim END --- 2963,2969 ---- def Test_for_loop_script_var() # cannot use s:var in a :def function ! CheckDefFailure(['for s:var in range(3)', 'echo 3'], 'E1254:') # can use s:var in Vim9 script, with or without s: var lines =<< trim END *** ../vim-8.2.3858/src/version.c 2021-12-20 10:55:31.772827340 +0000 --- src/version.c 2021-12-20 12:13:01.710275129 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3859, /**/ -- hundred-and-one symptoms of being an internet addict: 88. Every single time you press the 'Get mail' button...it does get new mail. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///