summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-05-21 15:39:02 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-21 15:39:02 +0100
commitf79d9dd43f6fe05711d7e2616ab4b8bde2ccb089 (patch)
treecf41b3c62e71e9fca5ddc61636465ab5e05283a9 /src/vim9execute.c
parent2d8ed0203aedd5f6c22efa99394a3677c17c7a7a (diff)
downloadvim-git-f79d9dd43f6fe05711d7e2616ab4b8bde2ccb089.tar.gz
patch 8.2.4989: cannot specify a function name for :defcompilev8.2.4989
Problem: Cannot specify a function name for :defcompile. Solution: Implement a function name argument for :defcompile.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c44
1 files changed, 2 insertions, 42 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index a64ae5cbb..d89f44236 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -6277,55 +6277,15 @@ get_disassemble_argument(expand_T *xp, int idx)
ex_disassemble(exarg_T *eap)
{
char_u *arg = eap->arg;
- char_u *fname;
ufunc_T *ufunc;
dfunc_T *dfunc;
isn_T *instr;
int instr_count;
- int is_global = FALSE;
- compiletype_T compile_type = CT_NONE;
-
- if (STRNCMP(arg, "profile", 7) == 0 && VIM_ISWHITE(arg[7]))
- {
- compile_type = CT_PROFILE;
- arg = skipwhite(arg + 7);
- }
- else if (STRNCMP(arg, "debug", 5) == 0 && VIM_ISWHITE(arg[5]))
- {
- compile_type = CT_DEBUG;
- arg = skipwhite(arg + 5);
- }
-
- if (STRNCMP(arg, "<lambda>", 8) == 0)
- {
- arg += 8;
- (void)getdigits(&arg);
- fname = vim_strnsave(eap->arg, arg - eap->arg);
- }
- else
- fname = trans_function_name(&arg, &is_global, FALSE,
- TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD, NULL, NULL, NULL);
- if (fname == NULL)
- {
- semsg(_(e_invalid_argument_str), eap->arg);
- return;
- }
-
- ufunc = find_func(fname, is_global);
- if (ufunc == NULL)
- {
- char_u *p = untrans_function_name(fname);
+ compiletype_T compile_type;
- if (p != NULL)
- // Try again without making it script-local.
- ufunc = find_func(p, FALSE);
- }
- vim_free(fname);
+ ufunc = find_func_by_name(arg, &compile_type);
if (ufunc == NULL)
- {
- semsg(_(e_cannot_find_function_str), eap->arg);
return;
- }
if (func_needs_compiling(ufunc, compile_type)
&& compile_def_function(ufunc, FALSE, compile_type, NULL) == FAIL)
return;