patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Problem: Vim9: cannot call a function declared later in Vim9 script.
Solution: Make two passes through the script file.
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index 610c565..7213ee4 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -1045,6 +1045,31 @@
res3)
enddef
+def Test_vim9script_forward_func()
+ let lines =<< trim END
+ vim9script
+ def FuncOne(): string
+ return FuncTwo()
+ enddef
+ def FuncTwo(): string
+ return 'two'
+ enddef
+ let g:res_FuncOne = execute('disass FuncOne')
+ END
+ writefile(lines, 'Xdisassemble')
+ source Xdisassemble
+
+ " check that the first function calls the second with DCALL
+ assert_match('\<SNR>\d*_FuncOne.*' ..
+ 'return FuncTwo().*' ..
+ '\d DCALL <SNR>\d\+_FuncTwo(argc 0).*' ..
+ '\d RETURN',
+ g:res_FuncOne)
+
+ delete('Xdisassemble')
+ unlet g:res_FuncOne
+enddef
+
def s:ConcatStrings(): string
return 'one' .. 'two' .. 'three'
enddef