To: vim_dev@googlegroups.com Subject: Patch 8.2.2453 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2453 Problem: Vim9: a variable name with "->" in the next line doesn't work. Solution: Recognize a variable name by itself. (closes #7770) Files: src/ex_docmd.c, src/testdir/test_vim9_cmd.vim *** ../vim-8.2.2452/src/ex_docmd.c 2021-01-26 19:32:49.743415285 +0100 --- src/ex_docmd.c 2021-02-02 21:28:04.675568831 +0100 *************** *** 3424,3429 **** --- 3424,3439 ---- return eap->cmd; } } + + // If it is an ID it might be a variable with an operator on the next + // line, if the variable exists it can't be an Ex command. + if (p > eap->cmd && ends_excmd(*skipwhite(p)) + && (lookup(eap->cmd, p - eap->cmd, NULL, cctx) == OK + || (ASCII_ISALPHA(eap->cmd[0]) && eap->cmd[1] == ':'))) + { + eap->cmdidx = CMD_eval; + return eap->cmd; + } } #endif *** ../vim-8.2.2452/src/testdir/test_vim9_cmd.vim 2021-01-23 15:14:57.308269451 +0100 --- src/testdir/test_vim9_cmd.vim 2021-02-02 21:31:55.738842181 +0100 *************** *** 328,333 **** --- 328,356 ---- assert_equal([1, 2, 3], res) END CheckScriptSuccess(lines) + + lines =<< trim END + new + var name = [1, 2] + name + ->copy() + ->setline(1) + assert_equal(['1', '2'], getline(1, 2)) + bwipe! + END + CheckDefAndScriptSuccess(lines) + + lines =<< trim END + new + g:shortlist + ->copy() + ->setline(1) + assert_equal(['1', '2'], getline(1, 2)) + bwipe! + END + g:shortlist = [1, 2] + CheckDefAndScriptSuccess(lines) + unlet g:shortlist enddef def Test_method_call_whitespace() *** ../vim-8.2.2452/src/version.c 2021-02-02 21:09:57.966971269 +0100 --- src/version.c 2021-02-02 21:32:24.670751171 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2453, /**/ -- DINGO: Wicked wicked Zoot ... she is a bad person and she must pay the penalty. And here in Castle Anthrax, we have but one punishment ... you must tie her down on a bed ... and spank her. Come! GIRLS: A spanking! A spanking! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///