diff src/ex_docmd.c @ 24462:7c4f50c02e18 v8.2.2771

patch 8.2.2771: Vim9: assignment not recognized if declaration was skipped Commit: https://github.com/vim/vim/commit/aa1959bd5e82350bb4a82d9a5188c29d70706ec4 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 15 22:13:39 2021 +0200 patch 8.2.2771: Vim9: assignment not recognized if declaration was skipped Problem: Vim9: assignment not recognized if declaration was skipped. Solution: Also recognized an assignment if the variable does not exist. (closes #8108)
author Bram Moolenaar <Bram@vim.org>
date Thu, 15 Apr 2021 22:15:03 +0200
parents 602e528a8e43
children 3bfec39ce31c
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3483,7 +3483,8 @@ find_ex_command(
 
 	    // Recognize an assignment if we recognize the variable name:
 	    // "g:var = expr"
-	    // "var = expr"  where "var" is a variable name.
+	    // "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,6 +3494,7 @@ find_ex_command(
 			|| *eap->cmd == '&'
 			|| *eap->cmd == '$'
 			|| *eap->cmd == '@'
+			|| eap->skip
 			|| lookup(eap->cmd, p - eap->cmd, TRUE, cctx) == OK)
 		{
 		    eap->cmdidx = CMD_var;