Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
23186:00583b0bedd5 | 23187:013aa8e2be8c |
---|---|
5854 if (has_index) | 5854 if (has_index) |
5855 { | 5855 { |
5856 int r; | 5856 int r; |
5857 | 5857 |
5858 // Compile the "idx" in "var[idx]" or "key" in "var.key". | 5858 // Compile the "idx" in "var[idx]" or "key" in "var.key". |
5859 if (new_local) | |
5860 --cctx->ctx_locals.ga_len; | |
5861 p = var_start + varlen; | 5859 p = var_start + varlen; |
5862 if (*p == '[') | 5860 if (*p == '[') |
5863 { | 5861 { |
5864 p = skipwhite(p + 1); | 5862 p = skipwhite(p + 1); |
5865 r = compile_expr0(&p, cctx); | 5863 r = compile_expr0(&p, cctx); |
5875 char_u *key_end = to_name_end(p + 1, TRUE); | 5873 char_u *key_end = to_name_end(p + 1, TRUE); |
5876 char_u *key = vim_strnsave(p + 1, key_end - p - 1); | 5874 char_u *key = vim_strnsave(p + 1, key_end - p - 1); |
5877 | 5875 |
5878 r = generate_PUSHS(cctx, key); | 5876 r = generate_PUSHS(cctx, key); |
5879 } | 5877 } |
5880 if (new_local) | |
5881 ++cctx->ctx_locals.ga_len; | |
5882 if (r == FAIL) | 5878 if (r == FAIL) |
5883 goto theend; | 5879 goto theend; |
5884 | 5880 |
5885 if (type == &t_any) | 5881 if (type == &t_any) |
5886 { | 5882 { |