diff src/userfunc.c @ 14706:2c0f454fcdc9 v8.1.0365

patch 8.1.0365: function profile doesn't specify where it was defined commit https://github.com/vim/vim/commit/4c7b08f6409349cf5324a26f7523c438590550ef Author: Bram Moolenaar <Bram@vim.org> Date: Mon Sep 10 22:03:40 2018 +0200 patch 8.1.0365: function profile doesn't specify where it was defined Problem: Function profile doesn't specify where it was defined. Solution: Show the script name and line number.
author Christian Brabandt <cb@256bit.org>
date Mon, 10 Sep 2018 22:15:05 +0200
parents 0a3b9ecf7cb8
children 162d79d273e6
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -2587,6 +2587,7 @@ func_dump_profile(FILE *fd)
     int		i;
     ufunc_T	**sorttab;
     int		st_len = 0;
+    char_u	*p;
 
     todo = (int)func_hashtab.ht_used;
     if (todo == 0)
@@ -2609,6 +2610,14 @@ func_dump_profile(FILE *fd)
 		    fprintf(fd, "FUNCTION  <SNR>%s()\n", fp->uf_name + 3);
 		else
 		    fprintf(fd, "FUNCTION  %s()\n", fp->uf_name);
+		p = home_replace_save(NULL,
+				     get_scriptname(fp->uf_script_ctx.sc_sid));
+		if (p != NULL)
+		{
+		    fprintf(fd, "    Defined: %s line %ld\n",
+					   p, (long)fp->uf_script_ctx.sc_lnum);
+		    vim_free(p);
+		}
 		if (fp->uf_tm_count == 1)
 		    fprintf(fd, "Called 1 time\n");
 		else