Mercurial > vim
comparison src/userfunc.c @ 24988:494112d2aa93 v8.2.3031
patch 8.2.3031: no error if a function name starts with an underscore
Commit: https://github.com/vim/vim/commit/22f17a29cd0b0cc3107dc6cd1d96c62eee52a7d9
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 21 20:48:58 2021 +0200
patch 8.2.3031: no error if a function name starts with an underscore
Problem: No error if a function name starts with an underscore. (Naohiro
Ono)
Solution: In Vim9 script disallow a function name starting with an
underscore, as is mentioned in the help. (closes #8414)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 21 Jun 2021 21:00:03 +0200 |
parents | e61a2085c89b |
children | efdb9608cc11 |
comparison
equal
deleted
inserted
replaced
24987:5a15a7f25ff2 | 24988:494112d2aa93 |
---|---|
3593 extra = 3 + (int)STRLEN(sid_buf); | 3593 extra = 3 + (int)STRLEN(sid_buf); |
3594 else | 3594 else |
3595 lead += (int)STRLEN(sid_buf); | 3595 lead += (int)STRLEN(sid_buf); |
3596 } | 3596 } |
3597 } | 3597 } |
3598 else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len)) | 3598 else if (!(flags & TFN_INT) && (builtin_function(lv.ll_name, len) |
3599 || (in_vim9script() && *lv.ll_name == '_'))) | |
3599 { | 3600 { |
3600 semsg(_("E128: Function name must start with a capital or \"s:\": %s"), | 3601 semsg(_("E128: Function name must start with a capital or \"s:\": %s"), |
3601 start); | 3602 start); |
3602 goto theend; | 3603 goto theend; |
3603 } | 3604 } |