To: vim_dev@googlegroups.com Subject: Patch 8.2.2618 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2618 Problem: Vim9: cannot use a normal list name to store function refs. Solution: Allow a lower case name if it is indexed. Files: src/vim9compile.c, src/testdir/test_vim9_assign.vim *** ../vim-8.2.2617/src/vim9compile.c 2021-03-17 18:42:04.442869185 +0100 --- src/vim9compile.c 2021-03-17 20:55:38.077197900 +0100 *************** *** 5832,5842 **** return FAIL; } ! // new local variable if ((lhs->lhs_type->tt_type == VAR_FUNC || lhs->lhs_type->tt_type == VAR_PARTIAL) ! && var_wrong_func_name(lhs->lhs_name, TRUE)) return FAIL; lhs->lhs_lvar = reserve_local(cctx, var_start, lhs->lhs_varlen, cmdidx == CMD_final || cmdidx == CMD_const, lhs->lhs_type); if (lhs->lhs_lvar == NULL) --- 5832,5844 ---- return FAIL; } ! // Check the name is valid for a funcref. if ((lhs->lhs_type->tt_type == VAR_FUNC || lhs->lhs_type->tt_type == VAR_PARTIAL) ! && var_wrong_func_name(lhs->lhs_name, TRUE)) return FAIL; + + // New local variable. lhs->lhs_lvar = reserve_local(cctx, var_start, lhs->lhs_varlen, cmdidx == CMD_final || cmdidx == CMD_const, lhs->lhs_type); if (lhs->lhs_lvar == NULL) *************** *** 6275,6280 **** --- 6277,6283 ---- { if ((rhs_type->tt_type == VAR_FUNC || rhs_type->tt_type == VAR_PARTIAL) + && !lhs.lhs_has_index && var_wrong_func_name(lhs.lhs_name, TRUE)) goto theend; *** ../vim-8.2.2617/src/testdir/test_vim9_assign.vim 2021-03-03 17:58:12.009789245 +0100 --- src/testdir/test_vim9_assign.vim 2021-03-17 20:53:52.453409282 +0100 *************** *** 72,77 **** --- 72,84 ---- CheckDefFailure(['var lambda = () => "lambda"'], 'E704:') CheckScriptFailure(['var x = "x"'], 'E1124:') + # lower case name is OK for a list + var lambdaLines =<< trim END + var lambdaList: list = [Test_syntax] + lambdaList[0] = () => "lambda" + END + CheckDefAndScriptSuccess(lambdaLines) + var nr: number = 1234 CheckDefFailure(['var nr: number = "asdf"'], 'E1012:') *** ../vim-8.2.2617/src/version.c 2021-03-17 18:42:04.442869185 +0100 --- src/version.c 2021-03-17 20:56:00.789152157 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2618, /**/ -- EXPERIENCE - experience is a wonderful thing. It enables you to recognise a mistake when you make it again. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///