diff src/vim9compile.c @ 23450:a8e7acf71fa4 v8.2.2268

patch 8.2.2268: Vim9: list unpack seen as declaration Commit: https://github.com/vim/vim/commit/3862ea3f620f02569c2d816ca9ceeeac3a0ad901 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 1 21:05:55 2021 +0100 patch 8.2.2268: Vim9: list unpack seen as declaration Problem: Vim9: list unpack seen as declaration. Solution: Check for "var". (closes https://github.com/vim/vim/issues/7594)
author Bram Moolenaar <Bram@vim.org>
date Fri, 01 Jan 2021 21:15:04 +0100
parents b1dbbc81a011
children d2b1269c2c68
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5634,6 +5634,11 @@ compile_assignment(char_u *arg, exarg_T 
 		semsg(_(e_cannot_use_operator_on_new_variable), name);
 		goto theend;
 	    }
+	    if (!is_decl)
+	    {
+		semsg(_(e_unknown_variable_str), name);
+		goto theend;
+	    }
 
 	    // new local variable
 	    if ((type->tt_type == VAR_FUNC || type->tt_type == VAR_PARTIAL)
@@ -6140,6 +6145,7 @@ compile_unletlock(char_u *arg, exarg_T *
 	return NULL;
     }
 
+    // TODO: this doesn't work for local variables
     ex_unletlock(eap, p, 0, GLV_NO_AUTOLOAD, compile_unlet, cctx);
     return eap->nextcmd == NULL ? (char_u *)"" : eap->nextcmd;
 }