comparison src/testdir/test_vim9_script.vim @ 19532:b8f778dda1a1 v8.2.0323

patch 8.2.0323: Vim9: calling a function that is defined later is slow Commit: https://github.com/vim/vim/commit/7eeefd4a395fe3d7c7a2a0879467cf7ed4c29fe6 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 26 21:24:23 2020 +0100 patch 8.2.0323: Vim9: calling a function that is defined later is slow Problem: Vim9: calling a function that is defined later is slow. Solution: Once the function is found update the instruction so it can be called directly.
author Bram Moolenaar <Bram@vim.org>
date Wed, 26 Feb 2020 21:30:04 +0100
parents 48e71f948360
children 8eeec8886c02
comparison
equal deleted inserted replaced
19531:d984a63f23df 19532:b8f778dda1a1
209 enddef 209 enddef
210 210
211 func DefinedLater(arg) 211 func DefinedLater(arg)
212 return a:arg 212 return a:arg
213 endfunc 213 endfunc
214
215 def FuncWithForwardCall()
216 return DefinedEvenLater("yes")
217 enddef
218
219 def DefinedEvenLater(arg: string): string
220 return arg
221 enddef
222
223 def Test_error_in_nested_function()
224 " Error in called function requires unwinding the call stack.
225 assert_fails('call FuncWithForwardCall()', 'E1029')
226 enddef
214 227
215 def Test_return_type_wrong() 228 def Test_return_type_wrong()
216 CheckScriptFailure(['def Func(): number', 'return "a"', 'enddef'], 'expected number but got string') 229 CheckScriptFailure(['def Func(): number', 'return "a"', 'enddef'], 'expected number but got string')
217 CheckScriptFailure(['def Func(): string', 'return 1', 'enddef'], 'expected string but got number') 230 CheckScriptFailure(['def Func(): string', 'return 1', 'enddef'], 'expected string but got number')
218 CheckScriptFailure(['def Func(): void', 'return "a"', 'enddef'], 'expected void but got string') 231 CheckScriptFailure(['def Func(): void', 'return "a"', 'enddef'], 'expected void but got string')