Mercurial > vim
comparison src/vim9compile.c @ 24154:6e8f49a4a193 v8.2.2618
patch 8.2.2618: Vim9: cannot use a normal list name to store function refs
Commit: https://github.com/vim/vim/commit/3f32788000258aabe078b426e3d71962bee9d2d1
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 17 20:56:38 2021 +0100
patch 8.2.2618: Vim9: cannot use a normal list name to store function refs
Problem: Vim9: cannot use a normal list name to store function refs.
Solution: Allow a lower case name if it is indexed.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 17 Mar 2021 21:00:04 +0100 |
parents | c308076e225e |
children | 93e69703a290 |
comparison
equal
deleted
inserted
replaced
24153:a5c2a882f07b | 24154:6e8f49a4a193 |
---|---|
5830 { | 5830 { |
5831 semsg(_(e_unknown_variable_str), lhs->lhs_name); | 5831 semsg(_(e_unknown_variable_str), lhs->lhs_name); |
5832 return FAIL; | 5832 return FAIL; |
5833 } | 5833 } |
5834 | 5834 |
5835 // new local variable | 5835 // Check the name is valid for a funcref. |
5836 if ((lhs->lhs_type->tt_type == VAR_FUNC | 5836 if ((lhs->lhs_type->tt_type == VAR_FUNC |
5837 || lhs->lhs_type->tt_type == VAR_PARTIAL) | 5837 || lhs->lhs_type->tt_type == VAR_PARTIAL) |
5838 && var_wrong_func_name(lhs->lhs_name, TRUE)) | 5838 && var_wrong_func_name(lhs->lhs_name, TRUE)) |
5839 return FAIL; | 5839 return FAIL; |
5840 | |
5841 // New local variable. | |
5840 lhs->lhs_lvar = reserve_local(cctx, var_start, lhs->lhs_varlen, | 5842 lhs->lhs_lvar = reserve_local(cctx, var_start, lhs->lhs_varlen, |
5841 cmdidx == CMD_final || cmdidx == CMD_const, lhs->lhs_type); | 5843 cmdidx == CMD_final || cmdidx == CMD_const, lhs->lhs_type); |
5842 if (lhs->lhs_lvar == NULL) | 5844 if (lhs->lhs_lvar == NULL) |
5843 return FAIL; | 5845 return FAIL; |
5844 lhs->lhs_new_local = TRUE; | 5846 lhs->lhs_new_local = TRUE; |
6273 : ((type_T **)stack->ga_data)[stack->ga_len - 1]; | 6275 : ((type_T **)stack->ga_data)[stack->ga_len - 1]; |
6274 if (lhs.lhs_lvar != NULL && (is_decl || !lhs.lhs_has_type)) | 6276 if (lhs.lhs_lvar != NULL && (is_decl || !lhs.lhs_has_type)) |
6275 { | 6277 { |
6276 if ((rhs_type->tt_type == VAR_FUNC | 6278 if ((rhs_type->tt_type == VAR_FUNC |
6277 || rhs_type->tt_type == VAR_PARTIAL) | 6279 || rhs_type->tt_type == VAR_PARTIAL) |
6280 && !lhs.lhs_has_index | |
6278 && var_wrong_func_name(lhs.lhs_name, TRUE)) | 6281 && var_wrong_func_name(lhs.lhs_name, TRUE)) |
6279 goto theend; | 6282 goto theend; |
6280 | 6283 |
6281 if (lhs.lhs_new_local && !lhs.lhs_has_type) | 6284 if (lhs.lhs_new_local && !lhs.lhs_has_type) |
6282 { | 6285 { |