comparison src/testdir/test_vim9_disassemble.vim @ 19912:d4fa9db88d16 v8.2.0512

patch 8.2.0512: Vim9: no optional arguments in func type Commit: https://github.com/vim/vim/commit/5deeb3f1f9db4eabd36e99cbf857fe376eb37e10 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 5 17:08:17 2020 +0200 patch 8.2.0512: Vim9: no optional arguments in func type Problem: Vim9: no optional arguments in func type. Solution: Check for question mark after type. Find function reference without function().
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Apr 2020 17:15:25 +0200
parents bd4f91762d0f
children e9af5a09a55b
comparison
equal deleted inserted replaced
19911:70edfdef3b83 19912:d4fa9db88d16
85 enddef 85 enddef
86 86
87 def Test_disassemble_store() 87 def Test_disassemble_store()
88 let res = execute('disass s:ScriptFuncStore') 88 let res = execute('disass s:ScriptFuncStore')
89 assert_match('<SNR>\d*_ScriptFuncStore.*' 89 assert_match('<SNR>\d*_ScriptFuncStore.*'
90 \ .. 'let localnr = 1.*'
90 \ .. 'localnr = 2.*' 91 \ .. 'localnr = 2.*'
91 \ .. ' STORE 2 in $0.*' 92 \ .. ' STORE 2 in $0.*'
93 \ .. 'let localstr = ''abc''.*'
92 \ .. 'localstr = ''xyz''.*' 94 \ .. 'localstr = ''xyz''.*'
93 \ .. ' STORE $1.*' 95 \ .. ' STORE $1.*'
94 \ .. 'v:char = ''abc''.*' 96 \ .. 'v:char = ''abc''.*'
95 \ .. 'STOREV v:char.*' 97 \ .. 'STOREV v:char.*'
96 \ .. 's:scriptvar = ''sv''.*' 98 \ .. 's:scriptvar = ''sv''.*'
358 assert_notmatch('PUSHS "less"', instr) 360 assert_notmatch('PUSHS "less"', instr)
359 assert_notmatch('JUMP', instr) 361 assert_notmatch('JUMP', instr)
360 enddef 362 enddef
361 363
362 def WithFunc() 364 def WithFunc()
363 let funky1: func 365 let Funky1: func
364 let funky2: func = function("len") 366 let Funky2: func = function("len")
365 let party2: func = funcref("UserFunc") 367 let Party2: func = funcref("UserFunc")
366 enddef 368 enddef
367 369
368 def Test_disassemble_function() 370 def Test_disassemble_function()
369 let instr = execute('disassemble WithFunc') 371 let instr = execute('disassemble WithFunc')
370 assert_match('WithFunc.*' 372 assert_match('WithFunc.*'
371 \ .. 'let funky1: func.*' 373 \ .. 'let Funky1: func.*'
372 \ .. '0 PUSHFUNC "\[none]".*' 374 \ .. '0 PUSHFUNC "\[none]".*'
373 \ .. '1 STORE $0.*' 375 \ .. '1 STORE $0.*'
374 \ .. 'let funky2: func = function("len").*' 376 \ .. 'let Funky2: func = function("len").*'
375 \ .. '2 PUSHS "len".*' 377 \ .. '2 PUSHS "len".*'
376 \ .. '3 BCALL function(argc 1).*' 378 \ .. '3 BCALL function(argc 1).*'
377 \ .. '4 STORE $1.*' 379 \ .. '4 STORE $1.*'
378 \ .. 'let party2: func = funcref("UserFunc").*' 380 \ .. 'let Party2: func = funcref("UserFunc").*'
379 \ .. '\d PUSHS "UserFunc".*' 381 \ .. '\d PUSHS "UserFunc".*'
380 \ .. '\d BCALL funcref(argc 1).*' 382 \ .. '\d BCALL funcref(argc 1).*'
381 \ .. '\d STORE $2.*' 383 \ .. '\d STORE $2.*'
382 \ .. '\d PUSHNR 0.*' 384 \ .. '\d PUSHNR 0.*'
383 \ .. '\d RETURN.*' 385 \ .. '\d RETURN.*'