comparison src/evalvars.c @ 24264:db5eaad456cc v8.2.2673

patch 8.2.2673: Vim9: script-local funcref can have lower case name Commit: https://github.com/vim/vim/commit/3215466af9abfc9fbbfba81d166d625176993486 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 28 21:14:06 2021 +0200 patch 8.2.2673: Vim9: script-local funcref can have lower case name Problem: Vim9: script-local funcref can have lower case name. Solution: Require an upper case name.
author Bram Moolenaar <Bram@vim.org>
date Sun, 28 Mar 2021 21:15:02 +0200
parents e5cd25f7ffcd
children e3dbf2e58c6a
comparison
equal deleted inserted replaced
24263:7a463b5a2316 24264:db5eaad456cc
3451 int 3451 int
3452 var_wrong_func_name( 3452 var_wrong_func_name(
3453 char_u *name, // points to start of variable name 3453 char_u *name, // points to start of variable name
3454 int new_var) // TRUE when creating the variable 3454 int new_var) // TRUE when creating the variable
3455 { 3455 {
3456 // Allow for w: b: s: and t:. 3456 // Allow for w: b: s: and t:. In Vim9 script s: is not allowed, because
3457 if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':') 3457 // the name can be used without the s: prefix.
3458 if (!((vim_strchr((char_u *)"wbt", name[0]) != NULL
3459 || (!in_vim9script() && name[0] == 's')) && name[1] == ':')
3458 && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') 3460 && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':')
3459 ? name[2] : name[0])) 3461 ? name[2] : name[0]))
3460 { 3462 {
3461 semsg(_("E704: Funcref variable name must start with a capital: %s"), 3463 semsg(_("E704: Funcref variable name must start with a capital: %s"),
3462 name); 3464 name);