" Test various aspects of the Vim9 script language.
+source check.vim
+
" Check that "lines" inside ":def" results in an "error" message.
func CheckDefFailure(lines, error)
call writefile(['def! Func()'] + a:lines + ['enddef'], 'Xdef')
call assert_equal([2, 99, 3, 4, 5], l)
enddef
+" Test that inside :function a Python function can be defined, :def is not
+" recognized.
+func Test_function_python()
+ CheckFeature python3
+ let py = 'python3'
+ execute py "<< EOF"
+def do_something():
+ return 1
+EOF
+endfunc
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
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);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 150,
/**/
149,
/**/