diff src/vim9compile.c @ 23187:013aa8e2be8c v8.2.2139

patch 8.2.2139: Vim9: unreachable code in assignment Commit: https://github.com/vim/vim/commit/acbae18df528b6aee72ecfd66e344dc8be7b3775 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 13 18:44:43 2020 +0100 patch 8.2.2139: Vim9: unreachable code in assignment Problem: Vim9: unreachable code in assignment. Solution: Don't check "new_local" when "has_index" is set. Add test for wrong type of list index.
author Bram Moolenaar <Bram@vim.org>
date Sun, 13 Dec 2020 18:45:16 +0100
parents 4d5d12138b36
children 75f35ae990ac
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5856,8 +5856,6 @@ compile_assignment(char_u *arg, exarg_T 
 	    int r;
 
 	    // Compile the "idx" in "var[idx]" or "key" in "var.key".
-	    if (new_local)
-		--cctx->ctx_locals.ga_len;
 	    p = var_start + varlen;
 	    if (*p == '[')
 	    {
@@ -5877,8 +5875,6 @@ compile_assignment(char_u *arg, exarg_T 
 
 		r = generate_PUSHS(cctx, key);
 	    }
-	    if (new_local)
-		++cctx->ctx_locals.ga_len;
 	    if (r == FAIL)
 		goto theend;