comparison src/vim9cmds.c @ 30584:ee039a6049ff v9.0.0627

patch 9.0.0627: "const" and "final" both make the type a constant Commit: https://github.com/vim/vim/commit/6586a015144f15a979d573a79d91e700e4b3009f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 30 11:04:50 2022 +0100 patch 9.0.0627: "const" and "final" both make the type a constant Problem: "const" and "final" both make the type a constant. (Daniel Steinberg) Solution: Only have "const" make the type a constant.
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Sep 2022 12:15:04 +0200
parents fc0830246f49
children d914a3812d5b
comparison
equal deleted inserted replaced
30583:fc88f4597670 30584:ee039a6049ff
879 ++scope->se_loop_depth; 879 ++scope->se_loop_depth;
880 forscope = &scope->se_u.se_for; 880 forscope = &scope->se_u.se_for;
881 881
882 // Reserve a variable to store the loop iteration counter and initialize it 882 // Reserve a variable to store the loop iteration counter and initialize it
883 // to -1. 883 // to -1.
884 loop_lvar = reserve_local(cctx, (char_u *)"", 0, FALSE, &t_number); 884 loop_lvar = reserve_local(cctx, (char_u *)"", 0, ASSIGN_VAR, &t_number);
885 if (loop_lvar == NULL) 885 if (loop_lvar == NULL)
886 { 886 {
887 drop_scope(cctx); 887 drop_scope(cctx);
888 return NULL; // out of memory 888 return NULL; // out of memory
889 } 889 }
892 generate_STORENR(cctx, loop_lvar_idx, -1); 892 generate_STORENR(cctx, loop_lvar_idx, -1);
893 893
894 // Reserve a variable to store ec_funcrefs.ga_len, used in ISN_ENDLOOP. 894 // Reserve a variable to store ec_funcrefs.ga_len, used in ISN_ENDLOOP.
895 // The variable index is always the loop var index plus one. 895 // The variable index is always the loop var index plus one.
896 // It is not used when no closures are encountered, we don't know yet. 896 // It is not used when no closures are encountered, we don't know yet.
897 funcref_lvar = reserve_local(cctx, (char_u *)"", 0, FALSE, &t_number); 897 funcref_lvar = reserve_local(cctx, (char_u *)"", 0, ASSIGN_VAR, &t_number);
898 if (funcref_lvar == NULL) 898 if (funcref_lvar == NULL)
899 { 899 {
900 drop_scope(cctx); 900 drop_scope(cctx);
901 return NULL; // out of memory 901 return NULL; // out of memory
902 } 902 }
1048 lhs_type = item_type; 1048 lhs_type = item_type;
1049 else if (item_type != &t_unknown 1049 else if (item_type != &t_unknown
1050 && need_type_where(item_type, lhs_type, -1, 1050 && need_type_where(item_type, lhs_type, -1,
1051 where, cctx, FALSE, FALSE) == FAIL) 1051 where, cctx, FALSE, FALSE) == FAIL)
1052 goto failed; 1052 goto failed;
1053 var_lvar = reserve_local(cctx, arg, varlen, TRUE, lhs_type); 1053 var_lvar = reserve_local(cctx, arg, varlen, ASSIGN_CONST,
1054 lhs_type);
1054 if (var_lvar == NULL) 1055 if (var_lvar == NULL)
1055 // out of memory or used as an argument 1056 // out of memory or used as an argument
1056 goto failed; 1057 goto failed;
1057 1058
1058 if (semicolon && idx == var_count - 1) 1059 if (semicolon && idx == var_count - 1)
1180 // "endwhile" jumps back here, one before when profiling or using cmdmods 1181 // "endwhile" jumps back here, one before when profiling or using cmdmods
1181 whilescope->ws_top_label = current_instr_idx(cctx); 1182 whilescope->ws_top_label = current_instr_idx(cctx);
1182 1183
1183 // Reserve a variable to store ec_funcrefs.ga_len, used in ISN_ENDLOOP. 1184 // Reserve a variable to store ec_funcrefs.ga_len, used in ISN_ENDLOOP.
1184 // It is not used when no closures are encountered, we don't know yet. 1185 // It is not used when no closures are encountered, we don't know yet.
1185 funcref_lvar = reserve_local(cctx, (char_u *)"", 0, FALSE, &t_number); 1186 funcref_lvar = reserve_local(cctx, (char_u *)"", 0, ASSIGN_VAR, &t_number);
1186 if (funcref_lvar == NULL) 1187 if (funcref_lvar == NULL)
1187 { 1188 {
1188 drop_scope(cctx); 1189 drop_scope(cctx);
1189 return NULL; // out of memory 1190 return NULL; // out of memory
1190 } 1191 }