Mercurial > vim
comparison src/evalvars.c @ 21691:f41c646cb8b9 v8.2.1395
patch 8.2.1395: Vim9: no error if declaring a funcref with lower case letter
Commit: https://github.com/vim/vim/commit/98b4f145eb89405021e23a4a37db51d60a75a1d0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 8 15:46:01 2020 +0200
patch 8.2.1395: Vim9: no error if declaring a funcref with lower case letter
Problem: Vim9: no error if declaring a funcref with a lower case letter.
Solution: Check the name after the type is inferred. Fix confusing name.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 08 Aug 2020 16:00:04 +0200 |
parents | 3c6c52fbc8ea |
children | f84625b961a8 |
comparison
equal
deleted
inserted
replaced
21690:0d43ab8ae99d | 21691:f41c646cb8b9 |
---|---|
2926 // Search in parent scope which is possible to reference from lambda | 2926 // Search in parent scope which is possible to reference from lambda |
2927 if (di == NULL) | 2927 if (di == NULL) |
2928 di = find_var_in_scoped_ht(name, TRUE); | 2928 di = find_var_in_scoped_ht(name, TRUE); |
2929 | 2929 |
2930 if ((tv->v_type == VAR_FUNC || tv->v_type == VAR_PARTIAL) | 2930 if ((tv->v_type == VAR_FUNC || tv->v_type == VAR_PARTIAL) |
2931 && var_check_func_name(name, di == NULL)) | 2931 && var_wrong_func_name(name, di == NULL)) |
2932 return; | 2932 return; |
2933 | 2933 |
2934 if (di != NULL) | 2934 if (di != NULL) |
2935 { | 2935 { |
2936 if ((di->di_flags & DI_FLAGS_RELOAD) == 0) | 2936 if ((di->di_flags & DI_FLAGS_RELOAD) == 0) |
3112 /* | 3112 /* |
3113 * Check if a funcref is assigned to a valid variable name. | 3113 * Check if a funcref is assigned to a valid variable name. |
3114 * Return TRUE and give an error if not. | 3114 * Return TRUE and give an error if not. |
3115 */ | 3115 */ |
3116 int | 3116 int |
3117 var_check_func_name( | 3117 var_wrong_func_name( |
3118 char_u *name, // points to start of variable name | 3118 char_u *name, // points to start of variable name |
3119 int new_var) // TRUE when creating the variable | 3119 int new_var) // TRUE when creating the variable |
3120 { | 3120 { |
3121 // Allow for w: b: s: and t:. | 3121 // Allow for w: b: s: and t:. |
3122 if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':') | 3122 if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':') |