Mercurial > vim
comparison src/eval.c @ 30249:c0f0118b6790 v9.0.0460
patch 9.0.0460: loop variable can't be found
Commit: https://github.com/vim/vim/commit/766ae5b252eaa6ee2bff70f1913d1cbfb51101bd
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 14 00:30:51 2022 +0100
patch 9.0.0460: loop variable can't be found
Problem: Loop variable can't be found.
Solution: Adjust block_id of the loop variable each round.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 14 Sep 2022 01:45:04 +0200 |
parents | e0cb5fb44859 |
children | 5c181bb6c855 |
comparison
equal
deleted
inserted
replaced
30248:025e37804c32 | 30249:c0f0118b6790 |
---|---|
26 * When recursively copying lists and dicts we need to remember which ones we | 26 * When recursively copying lists and dicts we need to remember which ones we |
27 * have done to avoid endless recursiveness. This unique ID is used for that. | 27 * have done to avoid endless recursiveness. This unique ID is used for that. |
28 * The last bit is used for previous_funccal, ignored when comparing. | 28 * The last bit is used for previous_funccal, ignored when comparing. |
29 */ | 29 */ |
30 static int current_copyID = 0; | 30 static int current_copyID = 0; |
31 | |
32 /* | |
33 * Info used by a ":for" loop. | |
34 */ | |
35 typedef struct | |
36 { | |
37 int fi_semicolon; // TRUE if ending in '; var]' | |
38 int fi_varcount; // nr of variables in the list | |
39 int fi_break_count; // nr of line breaks encountered | |
40 listwatch_T fi_lw; // keep an eye on the item used. | |
41 list_T *fi_list; // list being used | |
42 int fi_bi; // index of blob | |
43 blob_T *fi_blob; // blob being used | |
44 char_u *fi_string; // copy of string being used | |
45 int fi_byte_idx; // byte index in fi_string | |
46 } forinfo_T; | |
47 | 31 |
48 static int eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg); | 32 static int eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg); |
49 static int eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg); | 33 static int eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg); |
50 static int eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg); | 34 static int eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg); |
51 static int eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg); | 35 static int eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg); |
1912 int result; | 1896 int result; |
1913 int flag = ASSIGN_FOR_LOOP | (in_vim9script() | 1897 int flag = ASSIGN_FOR_LOOP | (in_vim9script() |
1914 ? (ASSIGN_FINAL | 1898 ? (ASSIGN_FINAL |
1915 // first round: error if variable exists | 1899 // first round: error if variable exists |
1916 | (fi->fi_bi == 0 ? 0 : ASSIGN_DECL) | 1900 | (fi->fi_bi == 0 ? 0 : ASSIGN_DECL) |
1917 | ASSIGN_NO_MEMBER_TYPE) | 1901 | ASSIGN_NO_MEMBER_TYPE |
1902 | ASSIGN_UPDATE_BLOCK_ID) | |
1918 : 0); | 1903 : 0); |
1919 listitem_T *item; | 1904 listitem_T *item; |
1920 int skip_assign = in_vim9script() && arg[0] == '_' | 1905 int skip_assign = in_vim9script() && arg[0] == '_' |
1921 && !eval_isnamec(arg[1]); | 1906 && !eval_isnamec(arg[1]); |
1922 | 1907 |