diff src/vim9execute.c @ 28934:a712ea475390 v8.2.4989

patch 8.2.4989: cannot specify a function name for :defcompile Commit: https://github.com/vim/vim/commit/f79d9dd43f6fe05711d7e2616ab4b8bde2ccb089 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 21 15:39:02 2022 +0100 patch 8.2.4989: cannot specify a function name for :defcompile Problem: Cannot specify a function name for :defcompile. Solution: Implement a function name argument for :defcompile.
author Bram Moolenaar <Bram@vim.org>
date Sat, 21 May 2022 16:45:03 +0200
parents 8f599b6d9f54
children b02044bc8c20
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -6277,55 +6277,15 @@ get_disassemble_argument(expand_T *xp, i
 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);
+    compiletype_T compile_type;
+
+    ufunc = find_func_by_name(arg, &compile_type);
+    if (ufunc == NULL)
 	return;
-    }
-
-    ufunc = find_func(fname, is_global);
-    if (ufunc == NULL)
-    {
-	char_u *p = untrans_function_name(fname);
-
-	if (p != NULL)
-	    // Try again without making it script-local.
-	    ufunc = find_func(p, FALSE);
-    }
-    vim_free(fname);
-    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;