diff src/userfunc.c @ 19183:1168c53d1b49 v8.2.0150

patch 8.2.0150: cannot define python function when using :execute Commit: https://github.com/vim/vim/commit/673660ab00d808d1e96e7181a60c5c8545c0ee75 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 26 16:50:05 2020 +0100 patch 8.2.0150: cannot define python function when using :execute Problem: Cannot define python function when using :execute. (Yasuhiro Matsumoto) Solution: Do not recognize "def" inside "function.
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Jan 2020 17:00:04 +0100
parents 94eda51ba9ba
children e7b4fff348dd
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -2667,8 +2667,11 @@ ex_function(exarg_T *eap)
 		indent += 2;
 
 	    // Check for defining a function inside this function.
+	    // Only recognize "def" inside "def", not inside "function",
+	    // For backwards compatibility, see Test_function_python().
 	    c = *p;
-	    if (checkforcmd(&p, "function", 2) || checkforcmd(&p, "def", 3))
+	    if (checkforcmd(&p, "function", 2)
+		    || (eap->cmdidx == CMD_def && checkforcmd(&p, "def", 3)))
 	    {
 		if (*p == '!')
 		    p = skipwhite(p + 1);