To: vim_dev@googlegroups.com Subject: Patch 8.2.2745 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2745 (after 8.2.2744) Problem: Vim9: missing part of the argument change. Solution: Add missing changes. Files: src/userfunc.c *** ../vim-8.2.2744/src/userfunc.c 2021-04-09 20:22:57.839301018 +0200 --- src/userfunc.c 2021-04-10 16:36:27.078448805 +0200 *************** *** 55,61 **** /* * Get one function argument. ! * If "argtypes" is not NULL also get the type: "arg: type". * If "types_optional" is TRUE a missing type is OK, use "any". * If "evalarg" is not NULL use it to check for an already declared name. * Return a pointer to after the type. --- 55,61 ---- /* * Get one function argument. ! * If "argtypes" is not NULL also get the type: "arg: type" (:def function). * If "types_optional" is TRUE a missing type is OK, use "any". * If "evalarg" is not NULL use it to check for an already declared name. * Return a pointer to after the type. *************** *** 73,78 **** --- 73,79 ---- { char_u *p = arg; char_u *arg_copy = NULL; + int is_underscore = FALSE; while (ASCII_ISALNUM(*p) || *p == '_') ++p; *************** *** 107,121 **** *p = c; return arg; } ! ! // Check for duplicate argument name. ! for (i = 0; i < newargs->ga_len; ++i) ! if (STRCMP(((char_u **)(newargs->ga_data))[i], arg_copy) == 0) ! { ! semsg(_("E853: Duplicate argument name: %s"), arg_copy); ! vim_free(arg_copy); ! return arg; ! } ((char_u **)(newargs->ga_data))[newargs->ga_len] = arg_copy; newargs->ga_len++; --- 108,123 ---- *p = c; return arg; } ! is_underscore = arg_copy[0] == '_' && arg_copy[1] == NUL; ! if (argtypes != NULL && !is_underscore) ! // Check for duplicate argument name. ! for (i = 0; i < newargs->ga_len; ++i) ! if (STRCMP(((char_u **)(newargs->ga_data))[i], arg_copy) == 0) ! { ! semsg(_("E853: Duplicate argument name: %s"), arg_copy); ! vim_free(arg_copy); ! return arg; ! } ((char_u **)(newargs->ga_data))[newargs->ga_len] = arg_copy; newargs->ga_len++; *************** *** 146,152 **** if (!skip) type = vim_strnsave(type, p - type); } ! else if (*skipwhite(p) != '=' && !types_optional) { semsg(_(e_missing_argument_type_for_str), arg_copy == NULL ? arg : arg_copy); --- 148,154 ---- if (!skip) type = vim_strnsave(type, p - type); } ! else if (*skipwhite(p) != '=' && !types_optional && !is_underscore) { semsg(_(e_missing_argument_type_for_str), arg_copy == NULL ? arg : arg_copy); *** ../vim-8.2.2744/src/version.c 2021-04-10 17:17:33.435942828 +0200 --- src/version.c 2021-04-10 17:46:39.931288458 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2745, /**/ -- From "know your smileys": (:-# Said something he shouldn't have /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///