Patch 8.2.2771
Problem:    Vim9: assignment not recognized if declaration was skipped.
Solution:   Also recognized an assignment if the variable does not exist.
            (closes #8108)
Files:      src/ex_docmd.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.2770/src/ex_docmd.c      2021-04-12 21:20:58.638708968 +0200
--- src/ex_docmd.c      2021-04-15 22:07:53.070967175 +0200
***************
*** 3483,3489 ****
  
            // Recognize an assignment if we recognize the variable name:
            // "g:var = expr"
!           // "var = expr"  where "var" is a variable name.
            if (*eap->cmd == '@')
                p = eap->cmd + 2;
            oplen = assignment_len(skipwhite(p), &heredoc);
--- 3483,3490 ----
  
            // Recognize an assignment if we recognize the variable name:
            // "g:var = expr"
!           // "var = expr"  where "var" is a variable name or we are skipping
!           // (variable declaration might have been skipped).
            if (*eap->cmd == '@')
                p = eap->cmd + 2;
            oplen = assignment_len(skipwhite(p), &heredoc);
***************
*** 3493,3498 ****
--- 3494,3500 ----
                        || *eap->cmd == '&'
                        || *eap->cmd == '$'
                        || *eap->cmd == '@'
+                       || eap->skip
                        || lookup(eap->cmd, p - eap->cmd, TRUE, cctx) == OK)
                {
                    eap->cmdidx = CMD_var;
*** ../vim-8.2.2770/src/testdir/test_vim9_assign.vim    2021-04-10 
22:35:40.487360271 +0200
--- src/testdir/test_vim9_assign.vim    2021-04-15 22:11:46.482441220 +0200
***************
*** 249,254 ****
--- 249,266 ----
    END
  enddef
  
+ def Test_skipped_assignment()
+   var lines =<< trim END
+       for x in []
+         var i: number = 1
+         while false
+           i += 1
+         endwhile
+       endfor
+   END
+   CheckDefAndScriptSuccess(lines)
+ enddef
+ 
  def Test_assign_unpack()
    var lines =<< trim END
      var v1: number
*** ../vim-8.2.2770/src/version.c       2021-04-15 21:48:29.023181466 +0200
--- src/version.c       2021-04-15 22:09:14.730796318 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2771,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
102. When filling out your driver's license application, you give
     your IP address.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202104152014.13FKE8Ex156627%40masaka.moolenaar.net.

Raspunde prin e-mail lui