@@ -474,6 +474,15 @@ def s:ScriptFuncLoad(arg: string)
474474 echo @z
475475enddef
476476
477+ def s: ScriptFuncPush ()
478+ let localbool = true
479+ let localspec = v: none
480+ let localblob = 0z1234
481+ if has (' float' )
482+ let localfloat = 1.234
483+ endif
484+ enddef
485+
477486def s: ScriptFuncStore ()
478487 let localnr = 1
479488 localnr = 2
@@ -487,6 +496,16 @@ def s:ScriptFuncStore()
487496 @z = ' rv'
488497enddef
489498
499+ def s: ScriptFuncTry ()
500+ try
501+ echo ' yes'
502+ catch /fail/
503+ echo ' no'
504+ finally
505+ echo ' end'
506+ endtry
507+ enddef
508+
490509def Test_disassemble ()
491510 assert_fails (' disass NoFunc' , ' E1061:' )
492511 assert_fails (' disass NotCompiled' , ' E1062:' )
@@ -504,9 +523,22 @@ def Test_disassemble()
504523 \ .. ' LOADREG @z.*'
505524 \, res )
506525
507- " TODO:
508- " v:char =
509- " s:scriptvar =
526+ res = execute (' disass s:ScriptFuncPush' )
527+ assert_match (' <SNR>\d*_ScriptFuncPush.*'
528+ \ .. ' localbool = true.*'
529+ \ .. ' PUSH v:true.*'
530+ \ .. ' localspec = v:none.*'
531+ \ .. ' PUSH v:none.*'
532+ \ .. ' localblob = 0z1234.*'
533+ \ .. ' PUSHBLOB 0z1234.*'
534+ \, res )
535+ if has (' float' )
536+ assert_match (' <SNR>\d*_ScriptFuncPush.*'
537+ \ .. ' localfloat = 1.234.*'
538+ \ .. ' PUSHF 1.234.*'
539+ \, res )
540+ endif
541+
510542 res = execute (' disass s:ScriptFuncStore' )
511543 assert_match (' <SNR>\d*_ScriptFuncStore.*'
512544 \ .. ' localnr = 2.*'
@@ -526,6 +558,23 @@ def Test_disassemble()
526558 \ .. ' @z = '' rv'' .*'
527559 \ .. ' STOREREG @z.*'
528560 \, res )
561+
562+ res = execute (' disass s:ScriptFuncTry' )
563+ assert_match (' <SNR>\d*_ScriptFuncTry.*'
564+ \ .. ' try.*'
565+ \ .. ' TRY catch -> \d\+, finally -> \d\+.*'
566+ \ .. ' catch /fail/.*'
567+ \ .. ' JUMP -> \d\+.*'
568+ \ .. ' PUSH v:exception.*'
569+ \ .. ' PUSHS "fail".*'
570+ \ .. ' COMPARESTRING =\~.*'
571+ \ .. ' JUMP_IF_FALSE -> \d\+.*'
572+ \ .. ' CATCH.*'
573+ \ .. ' finally.*'
574+ \ .. ' PUSHS "end".*'
575+ \ .. ' endtry.*'
576+ \ .. ' ENDTRY.*'
577+ \, res )
529578enddef
530579
531580
0 commit comments