Mercurial > vim
diff src/userfunc.c @ 17612:e259d11e2900 v8.1.1803
patch 8.1.1803: all builtin functions are global
commit https://github.com/vim/vim/commit/ac92e25a33c37ec5becbfffeccda136c73b761ac
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 3 21:58:38 2019 +0200
patch 8.1.1803: all builtin functions are global
Problem: All builtin functions are global.
Solution: Add the method call operator ->. Implemented for a limited number
of functions.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 03 Aug 2019 22:00:07 +0200 |
parents | ff097edaae89 |
children | 9ffec4eb8d33 |
line wrap: on
line diff
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -1431,10 +1431,9 @@ func_call( { funcexe_T funcexe; - funcexe.argv_func = NULL; + vim_memset(&funcexe, 0, sizeof(funcexe)); funcexe.firstline = curwin->w_cursor.lnum; funcexe.lastline = curwin->w_cursor.lnum; - funcexe.doesrange = NULL; funcexe.evaluate = TRUE; funcexe.partial = partial; funcexe.selfdict = selfdict; @@ -1555,7 +1554,10 @@ call_func( /* * User defined function. */ - if (partial != NULL && partial->pt_func != NULL) + if (funcexe->basetv != NULL) + // TODO: support User function: base->Method() + fp = NULL; + else if (partial != NULL && partial->pt_func != NULL) fp = partial->pt_func; else fp = find_func(rfname); @@ -1625,6 +1627,14 @@ call_func( } } } + else if (funcexe->basetv != NULL) + { + /* + * Find the method name in the table, call its implementation. + */ + error = call_internal_method(fname, argcount, argvars, rettv, + funcexe->basetv); + } else { /* @@ -2715,7 +2725,7 @@ eval_fname_script(char_u *p) translated_function_exists(char_u *name) { if (builtin_function(name, -1)) - return find_internal_func(name) >= 0; + return has_internal_func(name); return find_func(name) != NULL; } @@ -3084,7 +3094,7 @@ ex_call(exarg_T *eap) if (*startarg != '(') { - semsg(_("E107: Missing parentheses: %s"), eap->arg); + semsg(_(e_missingparen), eap->arg); goto end; } @@ -3120,7 +3130,7 @@ ex_call(exarg_T *eap) } arg = startarg; - funcexe.argv_func = NULL; + vim_memset(&funcexe, 0, sizeof(funcexe)); funcexe.firstline = eap->line1; funcexe.lastline = eap->line2; funcexe.doesrange = &doesrange;