To: vim_dev@googlegroups.com Subject: Patch 8.2.4886 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4886 Problem: Vim9: redir in skipped block seen as assignment. Solution: Check for valid assignment. Files: src/ex_docmd.c, src/testdir/test_vim9_assign.vim *** ../vim-8.2.4885/src/ex_docmd.c 2022-04-28 19:09:00.043208617 +0100 --- src/ex_docmd.c 2022-05-06 14:28:22.565244683 +0100 *************** *** 3683,3688 **** --- 3683,3689 ---- // "&opt = expr" // "var = expr" where "var" is a variable name or we are skipping // (variable declaration might have been skipped). + // Not "redir => var" (when skipping). oplen = assignment_len(skipwhite(p), &heredoc); if (oplen > 0) { *************** *** 3690,3696 **** || *eap->cmd == '&' || *eap->cmd == '$' || *eap->cmd == '@' ! || eap->skip || lookup(eap->cmd, p - eap->cmd, TRUE, cctx) == OK) { eap->cmdidx = CMD_var; --- 3691,3698 ---- || *eap->cmd == '&' || *eap->cmd == '$' || *eap->cmd == '@' ! || (eap->skip && IS_WHITE_OR_NUL( ! *(skipwhite(p) + oplen))) || lookup(eap->cmd, p - eap->cmd, TRUE, cctx) == OK) { eap->cmdidx = CMD_var; *** ../vim-8.2.4885/src/testdir/test_vim9_assign.vim 2022-05-06 13:14:43.793076613 +0100 --- src/testdir/test_vim9_assign.vim 2022-05-06 14:27:57.693265145 +0100 *************** *** 739,744 **** --- 739,752 ---- v9.CheckDefAndScriptSuccess(lines) enddef + def Test_redir_is_not_assign() + if false + redir => res + echo var_job + redir END + endif + enddef + def Test_extend_list() # using uninitialized list assigns empty list var lines =<< trim END *** ../vim-8.2.4885/src/version.c 2022-05-06 13:37:39.319678657 +0100 --- src/version.c 2022-05-06 14:17:37.201727717 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4886, /**/ -- FIXME and XXX are two common keywords used to mark broken or incomplete code not only since XXX as a sex reference would grab everybody's attention but simply due to the fact that Vim would highlight these words. -- Hendrik Scholz /// 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 ///