Mercurial > vim
comparison src/userfunc.c @ 33025:1d18c7fe609f v9.0.1804
patch 9.0.1804: Vim9: no support for private object methods
Commit: https://github.com/vim/vim/commit/cd7293bf6c358bb0e183582a2927fc03566d29f6
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Aug 27 19:18:23 2023 +0200
patch 9.0.1804: Vim9: no support for private object methods
Problem: Vim9: no support for private object methods
Solution: Add support for private object/class methods
closes: #12920
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 27 Aug 2023 19:30:05 +0200 |
parents | 695b50472e85 |
children | 256febd1cbf0 |
comparison
equal
deleted
inserted
replaced
33024:e5b8fc37e882 | 33025:1d18c7fe609f |
---|---|
4367 extra = 3 + (int)STRLEN(sid_buf); | 4367 extra = 3 + (int)STRLEN(sid_buf); |
4368 else | 4368 else |
4369 lead += (int)STRLEN(sid_buf); | 4369 lead += (int)STRLEN(sid_buf); |
4370 } | 4370 } |
4371 } | 4371 } |
4372 // The function name must start with an upper case letter (unless it is a | |
4373 // Vim9 class new() function or a Vim9 class private method) | |
4372 else if (!(flags & TFN_INT) | 4374 else if (!(flags & TFN_INT) |
4373 && (builtin_function(lv.ll_name, len) | 4375 && (builtin_function(lv.ll_name, len) |
4374 || (vim9script && *lv.ll_name == '_')) | 4376 || (vim9script && *lv.ll_name == '_')) |
4375 && !((flags & TFN_IN_CLASS) && STRNCMP(lv.ll_name, "new", 3) == 0)) | 4377 && !((flags & TFN_IN_CLASS) |
4378 && (STRNCMP(lv.ll_name, "new", 3) == 0 | |
4379 || (*lv.ll_name == '_')))) | |
4376 { | 4380 { |
4377 semsg(_(vim9script ? e_function_name_must_start_with_capital_str | 4381 semsg(_(vim9script ? e_function_name_must_start_with_capital_str |
4378 : e_function_name_must_start_with_capital_or_s_str), | 4382 : e_function_name_must_start_with_capital_or_s_str), |
4379 start); | 4383 start); |
4380 goto theend; | 4384 goto theend; |