forked from aniani/vim
		
	patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Problem: Vim9: no test for STORELIST and STOREDICT. Solution: Add a test. Make matches stricter.
This commit is contained in:
		| @@ -154,6 +154,37 @@ def Test_disassemble_store() | |||||||
|         res) |         res) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
|  | def s:ScriptFuncStoreMember() | ||||||
|  |   let locallist: list<number> = [] | ||||||
|  |   locallist[0] = 123 | ||||||
|  |   let localdict: dict<number> = {} | ||||||
|  |   localdict["a"] = 456 | ||||||
|  | enddef | ||||||
|  |  | ||||||
|  | def Test_disassemble_store_member() | ||||||
|  |   let res = execute('disass s:ScriptFuncStoreMember') | ||||||
|  |   assert_match('<SNR>\d*_ScriptFuncStoreMember\_s*' .. | ||||||
|  |         'let locallist: list<number> = []\_s*' .. | ||||||
|  |         '\d NEWLIST size 0\_s*' .. | ||||||
|  |         '\d STORE $0\_s*' .. | ||||||
|  |         'locallist\[0\] = 123\_s*' .. | ||||||
|  |         '\d PUSHNR 123\_s*' .. | ||||||
|  |         '\d PUSHNR 0\_s*' .. | ||||||
|  |         '\d LOAD $0\_s*' .. | ||||||
|  |         '\d STORELIST\_s*' .. | ||||||
|  |         'let localdict: dict<number> = {}\_s*' .. | ||||||
|  |         '\d NEWDICT size 0\_s*' .. | ||||||
|  |         '\d STORE $1\_s*' .. | ||||||
|  |         'localdict\["a"\] = 456\_s*' .. | ||||||
|  |         '\d\+ PUSHNR 456\_s*' .. | ||||||
|  |         '\d\+ PUSHS "a"\_s*' .. | ||||||
|  |         '\d\+ LOAD $1\_s*' .. | ||||||
|  |         '\d\+ STOREDICT\_s*' .. | ||||||
|  |         '\d\+ PUSHNR 0\_s*' .. | ||||||
|  |         '\d\+ RETURN', | ||||||
|  |         res) | ||||||
|  | enddef | ||||||
|  |  | ||||||
| def s:ScriptFuncUnlet() | def s:ScriptFuncUnlet() | ||||||
|   g:somevar = "value" |   g:somevar = "value" | ||||||
|   unlet g:somevar |   unlet g:somevar | ||||||
| @@ -163,46 +194,53 @@ enddef | |||||||
|  |  | ||||||
| def Test_disassemble_unlet() | def Test_disassemble_unlet() | ||||||
|   let res = execute('disass s:ScriptFuncUnlet') |   let res = execute('disass s:ScriptFuncUnlet') | ||||||
|   assert_match('<SNR>\d*_ScriptFuncUnlet.*' .. |   assert_match('<SNR>\d*_ScriptFuncUnlet\_s*' .. | ||||||
|         'g:somevar = "value".*' .. |         'g:somevar = "value"\_s*' .. | ||||||
|         '\d PUSHS "value".*' .. |         '\d PUSHS "value"\_s*' .. | ||||||
|         '\d STOREG g:somevar.*' .. |         '\d STOREG g:somevar\_s*' .. | ||||||
|         'unlet g:somevar.*' .. |         'unlet g:somevar\_s*' .. | ||||||
|         '\d UNLET g:somevar.*' .. |         '\d UNLET g:somevar\_s*' .. | ||||||
|         'unlet! g:somevar.*' .. |         'unlet! g:somevar\_s*' .. | ||||||
|         '\d UNLET! g:somevar.*' .. |         '\d UNLET! g:somevar\_s*' .. | ||||||
|         'unlet $SOMEVAR.*' .. |         'unlet $SOMEVAR\_s*' .. | ||||||
|         '\d UNLETENV $SOMEVAR.*', |         '\d UNLETENV $SOMEVAR\_s*', | ||||||
|         res) |         res) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| def s:ScriptFuncTry() | def s:ScriptFuncTry() | ||||||
|   try |   try | ||||||
|     echo 'yes' |     echo "yes" | ||||||
|   catch /fail/ |   catch /fail/ | ||||||
|     echo 'no' |     echo "no" | ||||||
|   finally |   finally | ||||||
|     throw 'end' |     throw "end" | ||||||
|   endtry |   endtry | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| def Test_disassemble_try() | def Test_disassemble_try() | ||||||
|   let res = execute('disass s:ScriptFuncTry') |   let res = execute('disass s:ScriptFuncTry') | ||||||
|   assert_match('<SNR>\d*_ScriptFuncTry.*' .. |   assert_match('<SNR>\d*_ScriptFuncTry\_s*' .. | ||||||
|         'try.*' .. |         'try\_s*' .. | ||||||
|         'TRY catch -> \d\+, finally -> \d\+.*' .. |         '\d TRY catch -> \d\+, finally -> \d\+\_s*' .. | ||||||
|         'catch /fail/.*' .. |         'echo "yes"\_s*' .. | ||||||
|         ' JUMP -> \d\+.*' .. |         '\d PUSHS "yes"\_s*' .. | ||||||
|         ' PUSH v:exception.*' .. |         '\d ECHO 1\_s*' .. | ||||||
|         ' PUSHS "fail".*' .. |         'catch /fail/\_s*' .. | ||||||
|         ' COMPARESTRING =\~.*' .. |         '\d JUMP -> \d\+\_s*' .. | ||||||
|         ' JUMP_IF_FALSE -> \d\+.*' .. |         '\d PUSH v:exception\_s*' .. | ||||||
|         ' CATCH.*' .. |         '\d PUSHS "fail"\_s*' .. | ||||||
|         'finally.*' .. |         '\d COMPARESTRING =\~\_s*' .. | ||||||
|         ' PUSHS "end".*' .. |         '\d JUMP_IF_FALSE -> \d\+\_s*' .. | ||||||
|         ' THROW.*' .. |         '\d CATCH\_s*' .. | ||||||
|         'endtry.*' .. |         'echo "no"\_s*' .. | ||||||
|         ' ENDTRY.*', |         '\d\+ PUSHS "no"\_s*' .. | ||||||
|  |         '\d\+ ECHO 1\_s*' .. | ||||||
|  |         'finally\_s*' .. | ||||||
|  |         'throw "end"\_s*' .. | ||||||
|  |         '\d\+ PUSHS "end"\_s*' .. | ||||||
|  |         '\d\+ THROW\_s*' .. | ||||||
|  |         'endtry\_s*' .. | ||||||
|  |         '\d\+ ENDTRY', | ||||||
|         res) |         res) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| @@ -213,18 +251,19 @@ enddef | |||||||
|  |  | ||||||
| def Test_disassemble_new() | def Test_disassemble_new() | ||||||
|   let res = execute('disass s:ScriptFuncNew') |   let res = execute('disass s:ScriptFuncNew') | ||||||
|   assert_match('<SNR>\d*_ScriptFuncNew.*' .. |   assert_match('<SNR>\d*_ScriptFuncNew\_s*' .. | ||||||
|         'let ll = \[1, "two", 333].*' .. |         'let ll = \[1, "two", 333\]\_s*' .. | ||||||
|         'PUSHNR 1.*' .. |         '\d PUSHNR 1\_s*' .. | ||||||
|         'PUSHS "two".*' .. |         '\d PUSHS "two"\_s*' .. | ||||||
|         'PUSHNR 333.*' .. |         '\d PUSHNR 333\_s*' .. | ||||||
|         'NEWLIST size 3.*' .. |         '\d NEWLIST size 3\_s*' .. | ||||||
|         'let dd = #{one: 1, two: "val"}.*' .. |         '\d STORE $0\_s*' .. | ||||||
|         'PUSHS "one".*' .. |         'let dd = #{one: 1, two: "val"}\_s*' .. | ||||||
|         'PUSHNR 1.*' .. |         '\d PUSHS "one"\_s*' .. | ||||||
|         'PUSHS "two".*' .. |         '\d PUSHNR 1\_s*' .. | ||||||
|         'PUSHS "val".*' .. |         '\d PUSHS "two"\_s*' .. | ||||||
|         'NEWDICT size 2.*', |         '\d PUSHS "val"\_s*' .. | ||||||
|  |         '\d NEWDICT size 2\_s*', | ||||||
|         res) |         res) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| @@ -258,38 +297,54 @@ enddef | |||||||
|  |  | ||||||
| def Test_disassemble_call() | def Test_disassemble_call() | ||||||
|   let res = execute('disass s:ScriptFuncCall') |   let res = execute('disass s:ScriptFuncCall') | ||||||
|   assert_match('<SNR>\d\+_ScriptFuncCall.*' .. |   assert_match('<SNR>\d\+_ScriptFuncCall\_s*' .. | ||||||
|         'changenr().*' .. |         'changenr()\_s*' .. | ||||||
|         ' BCALL changenr(argc 0).*' .. |         '\d BCALL changenr(argc 0)\_s*' .. | ||||||
|         'char2nr("abc").*' .. |         '\d DROP\_s*' .. | ||||||
|         ' PUSHS "abc".*' .. |         'char2nr("abc")\_s*' .. | ||||||
|         ' BCALL char2nr(argc 1).*' .. |         '\d PUSHS "abc"\_s*' .. | ||||||
|         'Test_disassemble_new().*' .. |         '\d BCALL char2nr(argc 1)\_s*' .. | ||||||
|         ' DCALL Test_disassemble_new(argc 0).*' .. |         '\d DROP\_s*' .. | ||||||
|         'FuncWithArg(343).*' .. |         'Test_disassemble_new()\_s*' .. | ||||||
|         ' PUSHNR 343.*' .. |         '\d DCALL Test_disassemble_new(argc 0)\_s*' .. | ||||||
|         ' DCALL FuncWithArg(argc 1).*' .. |         '\d DROP\_s*' .. | ||||||
|         'ScriptFuncNew().*' .. |         'FuncWithArg(343)\_s*' .. | ||||||
|         ' DCALL <SNR>\d\+_ScriptFuncNew(argc 0).*' .. |         '\d\+ PUSHNR 343\_s*' .. | ||||||
|         's:ScriptFuncNew().*' .. |         '\d\+ DCALL FuncWithArg(argc 1)\_s*' .. | ||||||
|         ' DCALL <SNR>\d\+_ScriptFuncNew(argc 0).*' .. |         '\d\+ DROP\_s*' .. | ||||||
|         'UserFunc().*' .. |         'ScriptFuncNew()\_s*' .. | ||||||
|         ' UCALL UserFunc(argc 0).*' .. |         '\d\+ DCALL <SNR>\d\+_ScriptFuncNew(argc 0)\_s*' .. | ||||||
|         'UserFuncWithArg("foo").*' .. |         '\d\+ DROP\_s*' .. | ||||||
|         ' PUSHS "foo".*' .. |         's:ScriptFuncNew()\_s*' .. | ||||||
|         ' UCALL UserFuncWithArg(argc 1).*' .. |         '\d\+ DCALL <SNR>\d\+_ScriptFuncNew(argc 0)\_s*' .. | ||||||
|         'let FuncRef = function("UserFunc").*' .. |         '\d\+ DROP\_s*' .. | ||||||
|         'FuncRef().*' .. |         'UserFunc()\_s*' .. | ||||||
|         ' LOAD $\d.*' .. |         '\d\+ UCALL UserFunc(argc 0)\_s*' .. | ||||||
|         ' PCALL (argc 0).*' .. |         '\d\+ DROP\_s*' .. | ||||||
|         'let FuncRefWithArg = function("UserFuncWithArg").*' .. |         'UserFuncWithArg("foo")\_s*' .. | ||||||
|         'FuncRefWithArg("bar").*' .. |         '\d\+ PUSHS "foo"\_s*' .. | ||||||
|         ' PUSHS "bar".*' .. |         '\d\+ UCALL UserFuncWithArg(argc 1)\_s*' .. | ||||||
|         ' LOAD $\d.*' .. |         '\d\+ DROP\_s*' .. | ||||||
|         ' PCALL (argc 1).*' .. |         'let FuncRef = function("UserFunc")\_s*' .. | ||||||
|         'return "yes".*' .. |         '\d\+ PUSHS "UserFunc"\_s*' .. | ||||||
|         ' PUSHS "yes".*' .. |         '\d\+ BCALL function(argc 1)\_s*' .. | ||||||
|         ' RETURN.*', |         '\d\+ STORE $0\_s*' .. | ||||||
|  |         'FuncRef()\_s*' .. | ||||||
|  |         '\d\+ LOAD $\d\_s*' .. | ||||||
|  |         '\d\+ PCALL (argc 0)\_s*' .. | ||||||
|  |         '\d\+ DROP\_s*' .. | ||||||
|  |         'let FuncRefWithArg = function("UserFuncWithArg")\_s*' .. | ||||||
|  |         '\d\+ PUSHS "UserFuncWithArg"\_s*' .. | ||||||
|  |         '\d\+ BCALL function(argc 1)\_s*' .. | ||||||
|  |         '\d\+ STORE $1\_s*' .. | ||||||
|  |         'FuncRefWithArg("bar")\_s*' .. | ||||||
|  |         '\d\+ PUSHS "bar"\_s*' .. | ||||||
|  |         '\d\+ LOAD $\d\_s*' .. | ||||||
|  |         '\d\+ PCALL (argc 1)\_s*' .. | ||||||
|  |         '\d\+ DROP\_s*' .. | ||||||
|  |         'return "yes"\_s*' .. | ||||||
|  |         '\d\+ PUSHS "yes"\_s*' .. | ||||||
|  |         '\d\+ RETURN', | ||||||
|         res) |         res) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| @@ -308,21 +363,21 @@ enddef | |||||||
| def Test_disassemble_closure() | def Test_disassemble_closure() | ||||||
|   CreateRefs() |   CreateRefs() | ||||||
|   let res = execute('disass g:Append') |   let res = execute('disass g:Append') | ||||||
|   assert_match('<lambda>\d.*' .. |   assert_match('<lambda>\d\_s*' .. | ||||||
|         'local ..= arg.*' .. |         'local ..= arg\_s*' .. | ||||||
|         '\d LOADOUTER $0.*' .. |         '\d LOADOUTER $0\_s*' .. | ||||||
|         '\d LOAD arg\[-1\].*' .. |         '\d LOAD arg\[-1\]\_s*' .. | ||||||
|         '\d CONCAT.*' .. |         '\d CONCAT\_s*' .. | ||||||
|         '\d STOREOUTER $0.*' .. |         '\d STOREOUTER $0\_s*' .. | ||||||
|         '\d PUSHNR 0.*' .. |         '\d PUSHNR 0\_s*' .. | ||||||
|         '\d RETURN.*', |         '\d RETURN', | ||||||
|         res) |         res) | ||||||
|  |  | ||||||
|   res = execute('disass g:Get') |   res = execute('disass g:Get') | ||||||
|   assert_match('<lambda>\d.*' .. |   assert_match('<lambda>\d\_s*' .. | ||||||
|         'return local.*' .. |         'return local\_s*' .. | ||||||
|         '\d LOADOUTER $0.*' .. |         '\d LOADOUTER $0\_s*' .. | ||||||
|         '\d RETURN.*', |         '\d RETURN', | ||||||
|         res) |         res) | ||||||
|  |  | ||||||
|   unlet g:Append |   unlet g:Append | ||||||
| @@ -342,15 +397,15 @@ enddef | |||||||
|  |  | ||||||
| def Test_disassemble_pcall() | def Test_disassemble_pcall() | ||||||
|   let res = execute('disass s:ScriptPCall') |   let res = execute('disass s:ScriptPCall') | ||||||
|   assert_match('<SNR>\d\+_ScriptPCall.*' .. |   assert_match('<SNR>\d\+_ScriptPCall\_s*' .. | ||||||
|         'RefThis()("text").*' .. |         'RefThis()("text")\_s*' .. | ||||||
|         '\d DCALL RefThis(argc 0).*' .. |         '\d DCALL RefThis(argc 0)\_s*' .. | ||||||
|         '\d PUSHS "text".*' .. |         '\d PUSHS "text"\_s*' .. | ||||||
|         '\d PCALL top (argc 1).*' .. |         '\d PCALL top (argc 1)\_s*' .. | ||||||
|         '\d PCALL end.*' .. |         '\d PCALL end\_s*' .. | ||||||
|         '\d DROP.*' .. |         '\d DROP\_s*' .. | ||||||
|         '\d PUSHNR 0.*' .. |         '\d PUSHNR 0\_s*' .. | ||||||
|         '\d RETURN.*', |         '\d RETURN', | ||||||
|         res) |         res) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| @@ -365,24 +420,24 @@ enddef | |||||||
|  |  | ||||||
| def Test_disassemble_update_instr() | def Test_disassemble_update_instr() | ||||||
|   let res = execute('disass s:FuncWithForwardCall') |   let res = execute('disass s:FuncWithForwardCall') | ||||||
|   assert_match('FuncWithForwardCall.*' .. |   assert_match('FuncWithForwardCall\_s*' .. | ||||||
|         'return g:DefinedLater("yes").*' .. |         'return g:DefinedLater("yes")\_s*' .. | ||||||
|         '\d PUSHS "yes".*' .. |         '\d PUSHS "yes"\_s*' .. | ||||||
|         '\d UCALL g:DefinedLater(argc 1).*' .. |         '\d UCALL g:DefinedLater(argc 1)\_s*' .. | ||||||
|         '\d CHECKTYPE string stack\[-1].*' .. |         '\d CHECKTYPE string stack\[-1]\_s*' .. | ||||||
|         '\d RETURN.*', |         '\d RETURN', | ||||||
|         res) |         res) | ||||||
|  |  | ||||||
|   " Calling the function will change UCALL into the faster DCALL |   " Calling the function will change UCALL into the faster DCALL | ||||||
|   assert_equal('yes', FuncWithForwardCall()) |   assert_equal('yes', FuncWithForwardCall()) | ||||||
|  |  | ||||||
|   res = execute('disass s:FuncWithForwardCall') |   res = execute('disass s:FuncWithForwardCall') | ||||||
|   assert_match('FuncWithForwardCall.*' .. |   assert_match('FuncWithForwardCall\_s*' .. | ||||||
|         'return g:DefinedLater("yes").*' .. |         'return g:DefinedLater("yes")\_s*' .. | ||||||
|         '\d PUSHS "yes".*' .. |         '\d PUSHS "yes"\_s*' .. | ||||||
|         '\d DCALL DefinedLater(argc 1).*' .. |         '\d DCALL DefinedLater(argc 1)\_s*' .. | ||||||
|         '\d CHECKTYPE string stack\[-1].*' .. |         '\d CHECKTYPE string stack\[-1]\_s*' .. | ||||||
|         '\d RETURN.*', |         '\d RETURN', | ||||||
|         res) |         res) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| @@ -393,12 +448,12 @@ enddef | |||||||
|  |  | ||||||
| def Test_disassemble_call_default() | def Test_disassemble_call_default() | ||||||
|   let res = execute('disass FuncWithDefault') |   let res = execute('disass FuncWithDefault') | ||||||
|   assert_match('FuncWithDefault.*' .. |   assert_match('FuncWithDefault\_s*' .. | ||||||
|         '\d PUSHS "default".*' .. |         '\d PUSHS "default"\_s*' .. | ||||||
|         '\d STORE arg\[-1].*' .. |         '\d STORE arg\[-1]\_s*' .. | ||||||
|         'return arg.*' .. |         'return arg\_s*' .. | ||||||
|         '\d LOAD arg\[-1].*' .. |         '\d LOAD arg\[-1]\_s*' .. | ||||||
|         '\d RETURN.*', |         '\d RETURN', | ||||||
|         res) |         res) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| @@ -434,18 +489,27 @@ enddef | |||||||
| def Test_disassemble_const_expr() | def Test_disassemble_const_expr() | ||||||
|   assert_equal("\nyes", execute('call HasEval()')) |   assert_equal("\nyes", execute('call HasEval()')) | ||||||
|   let instr = execute('disassemble HasEval') |   let instr = execute('disassemble HasEval') | ||||||
|   assert_match('HasEval.*' .. |   assert_match('HasEval\_s*' .. | ||||||
|         'if has("eval").*' .. |         'if has("eval")\_s*' .. | ||||||
|         ' PUSHS "yes".*', |         'echo "yes"\_s*' .. | ||||||
|  |         '\d PUSHS "yes"\_s*' .. | ||||||
|  |         '\d ECHO 1\_s*' .. | ||||||
|  |         'else\_s*' .. | ||||||
|  |         'echo "no"\_s*' .. | ||||||
|  |         'endif\_s*', | ||||||
|         instr) |         instr) | ||||||
|   assert_notmatch('JUMP', instr) |   assert_notmatch('JUMP', instr) | ||||||
|  |  | ||||||
|   assert_equal("\nno", execute('call HasNothing()')) |   assert_equal("\nno", execute('call HasNothing()')) | ||||||
|   instr = execute('disassemble HasNothing') |   instr = execute('disassemble HasNothing') | ||||||
|   assert_match('HasNothing.*' .. |   assert_match('HasNothing\_s*' .. | ||||||
|         'if has("nothing").*' .. |         'if has("nothing")\_s*' .. | ||||||
|         'else.*' .. |         'echo "yes"\_s*' .. | ||||||
|         ' PUSHS "no".*', |         'else\_s*' .. | ||||||
|  |         'echo "no"\_s*' .. | ||||||
|  |         '\d PUSHS "no"\_s*' .. | ||||||
|  |         '\d ECHO 1\_s*' .. | ||||||
|  |         'endif', | ||||||
|         instr) |         instr) | ||||||
|   assert_notmatch('PUSHS "yes"', instr) |   assert_notmatch('PUSHS "yes"', instr) | ||||||
|   assert_notmatch('JUMP', instr) |   assert_notmatch('JUMP', instr) | ||||||
| @@ -453,11 +517,17 @@ def Test_disassemble_const_expr() | |||||||
|   assert_equal("\neval", execute('call HasSomething()')) |   assert_equal("\neval", execute('call HasSomething()')) | ||||||
|   instr = execute('disassemble HasSomething') |   instr = execute('disassemble HasSomething') | ||||||
|   assert_match('HasSomething.*' .. |   assert_match('HasSomething.*' .. | ||||||
|         'if has("nothing").*' .. |         'if has("nothing")\_s*' .. | ||||||
|         'elseif has("something").*' .. |         'echo "nothing"\_s*' .. | ||||||
|         'elseif has("eval").*' .. |         'elseif has("something")\_s*' .. | ||||||
|         ' PUSHS "eval".*' .. |         'echo "something"\_s*' .. | ||||||
|         'elseif has("less").*', |         'elseif has("eval")\_s*' .. | ||||||
|  |         'echo "eval"\_s*' .. | ||||||
|  |         '\d PUSHS "eval"\_s*' .. | ||||||
|  |         '\d ECHO 1\_s*' .. | ||||||
|  |         'elseif has("less").*' .. | ||||||
|  |         'echo "less"\_s*' .. | ||||||
|  |         'endif', | ||||||
|         instr) |         instr) | ||||||
|   assert_notmatch('PUSHS "nothing"', instr) |   assert_notmatch('PUSHS "nothing"', instr) | ||||||
|   assert_notmatch('PUSHS "something"', instr) |   assert_notmatch('PUSHS "something"', instr) | ||||||
| @@ -473,20 +543,20 @@ enddef | |||||||
|  |  | ||||||
| def Test_disassemble_function() | def Test_disassemble_function() | ||||||
|   let instr = execute('disassemble WithFunc') |   let instr = execute('disassemble WithFunc') | ||||||
|   assert_match('WithFunc.*' .. |   assert_match('WithFunc\_s*' .. | ||||||
|         'let Funky1: func.*' .. |         'let Funky1: func\_s*' .. | ||||||
|         '0 PUSHFUNC "\[none]".*' .. |         '0 PUSHFUNC "\[none]"\_s*' .. | ||||||
|         '1 STORE $0.*' .. |         '1 STORE $0\_s*' .. | ||||||
|         'let Funky2: func = function("len").*' .. |         'let Funky2: func = function("len")\_s*' .. | ||||||
|         '2 PUSHS "len".*' .. |         '2 PUSHS "len"\_s*' .. | ||||||
|         '3 BCALL function(argc 1).*' .. |         '3 BCALL function(argc 1)\_s*' .. | ||||||
|         '4 STORE $1.*' .. |         '4 STORE $1\_s*' .. | ||||||
|         'let Party2: func = funcref("UserFunc").*' .. |         'let Party2: func = funcref("UserFunc")\_s*' .. | ||||||
|         '\d PUSHS "UserFunc".*' .. |         '\d PUSHS "UserFunc"\_s*' .. | ||||||
|         '\d BCALL funcref(argc 1).*' .. |         '\d BCALL funcref(argc 1)\_s*' .. | ||||||
|         '\d STORE $2.*' .. |         '\d STORE $2\_s*' .. | ||||||
|         '\d PUSHNR 0.*' .. |         '\d PUSHNR 0\_s*' .. | ||||||
|         '\d RETURN.*', |         '\d RETURN', | ||||||
|         instr) |         instr) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| @@ -502,19 +572,19 @@ def Test_disassemble_channel() | |||||||
|   CheckFeature channel |   CheckFeature channel | ||||||
|  |  | ||||||
|   let instr = execute('disassemble WithChannel') |   let instr = execute('disassemble WithChannel') | ||||||
|   assert_match('WithChannel.*' .. |   assert_match('WithChannel\_s*' .. | ||||||
|         'let job1: job.*' .. |         'let job1: job\_s*' .. | ||||||
|         '\d PUSHJOB "no process".*' .. |         '\d PUSHJOB "no process"\_s*' .. | ||||||
|         '\d STORE $0.*' .. |         '\d STORE $0\_s*' .. | ||||||
|         'let job2: job = job_start("donothing").*' .. |         'let job2: job = job_start("donothing")\_s*' .. | ||||||
|         '\d PUSHS "donothing".*' .. |         '\d PUSHS "donothing"\_s*' .. | ||||||
|         '\d BCALL job_start(argc 1).*' .. |         '\d BCALL job_start(argc 1)\_s*' .. | ||||||
|         '\d STORE $1.*' .. |         '\d STORE $1\_s*' .. | ||||||
|         'let chan1: channel.*' .. |         'let chan1: channel\_s*' .. | ||||||
|         '\d PUSHCHANNEL 0.*' .. |         '\d PUSHCHANNEL 0\_s*' .. | ||||||
|         '\d STORE $2.*' .. |         '\d STORE $2\_s*' .. | ||||||
|         '\d PUSHNR 0.*' .. |         '\d PUSHNR 0\_s*' .. | ||||||
|         '\d RETURN.*', |         '\d RETURN', | ||||||
|         instr) |         instr) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| @@ -526,13 +596,15 @@ enddef | |||||||
| def Test_disassemble_lambda() | def Test_disassemble_lambda() | ||||||
|   assert_equal("XxX", WithLambda()) |   assert_equal("XxX", WithLambda()) | ||||||
|   let instr = execute('disassemble WithLambda') |   let instr = execute('disassemble WithLambda') | ||||||
|   assert_match('WithLambda.*' .. |   assert_match('WithLambda\_s*' .. | ||||||
|         'let F = {a -> "X" .. a .. "X"}.*' .. |         'let F = {a -> "X" .. a .. "X"}\_s*' .. | ||||||
|         ' FUNCREF <lambda>\d\+.*' .. |         '\d FUNCREF <lambda>\d\+ $1\_s*' .. | ||||||
|         'PUSHS "x".*' .. |         '\d STORE $0\_s*' .. | ||||||
|         ' LOAD $0.*' .. |         'return F("x")\_s*' .. | ||||||
|         ' PCALL (argc 1).*' .. |         '\d PUSHS "x"\_s*' .. | ||||||
|         ' CHECKTYPE string stack\[-1].*', |         '\d LOAD $0\_s*' .. | ||||||
|  |         '\d PCALL (argc 1)\_s*' .. | ||||||
|  |         '\d CHECKTYPE string stack\[-1]', | ||||||
|         instr) |         instr) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| @@ -548,20 +620,20 @@ def Test_disassemble_and_or() | |||||||
|   assert_equal("no", AndOr(2)) |   assert_equal("no", AndOr(2)) | ||||||
|   assert_equal("yes", AndOr(4)) |   assert_equal("yes", AndOr(4)) | ||||||
|   let instr = execute('disassemble AndOr') |   let instr = execute('disassemble AndOr') | ||||||
|   assert_match('AndOr.*' .. |   assert_match('AndOr\_s*' .. | ||||||
|         'if arg == 1 && arg != 2 || arg == 4.*' .. |         'if arg == 1 && arg != 2 || arg == 4\_s*' .. | ||||||
|         '\d LOAD arg\[-1].*' .. |         '\d LOAD arg\[-1]\_s*' .. | ||||||
|         '\d PUSHNR 1.*' .. |         '\d PUSHNR 1\_s*' .. | ||||||
|         '\d COMPAREANY ==.*' .. |         '\d COMPAREANY ==\_s*' .. | ||||||
|         '\d JUMP_AND_KEEP_IF_FALSE -> \d\+.*' .. |         '\d JUMP_AND_KEEP_IF_FALSE -> \d\+\_s*' .. | ||||||
|         '\d LOAD arg\[-1].*' .. |         '\d LOAD arg\[-1]\_s*' .. | ||||||
|         '\d PUSHNR 2.*' .. |         '\d PUSHNR 2\_s*' .. | ||||||
|         '\d COMPAREANY !=.*' .. |         '\d COMPAREANY !=\_s*' .. | ||||||
|         '\d JUMP_AND_KEEP_IF_TRUE -> \d\+.*' .. |         '\d JUMP_AND_KEEP_IF_TRUE -> \d\+\_s*' .. | ||||||
|         '\d LOAD arg\[-1].*' .. |         '\d LOAD arg\[-1]\_s*' .. | ||||||
|         '\d PUSHNR 4.*' .. |         '\d\+ PUSHNR 4\_s*' .. | ||||||
|         '\d COMPAREANY ==.*' .. |         '\d\+ COMPAREANY ==\_s*' .. | ||||||
|         '\d JUMP_IF_FALSE -> \d\+.*', |         '\d\+ JUMP_IF_FALSE -> \d\+', | ||||||
|         instr) |         instr) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| @@ -576,24 +648,24 @@ enddef | |||||||
| def Test_disassemble_for_loop() | def Test_disassemble_for_loop() | ||||||
|   assert_equal([0, 1, 2], ForLoop()) |   assert_equal([0, 1, 2], ForLoop()) | ||||||
|   let instr = execute('disassemble ForLoop') |   let instr = execute('disassemble ForLoop') | ||||||
|   assert_match('ForLoop.*' .. |   assert_match('ForLoop\_s*' .. | ||||||
|         'let res: list<number>.*' .. |         'let res: list<number>\_s*' .. | ||||||
|         ' NEWLIST size 0.*' .. |         '\d NEWLIST size 0\_s*' .. | ||||||
|         '\d STORE $0.*' .. |         '\d STORE $0\_s*' .. | ||||||
|         'for i in range(3).*' .. |         'for i in range(3)\_s*' .. | ||||||
|         '\d STORE -1 in $1.*' .. |         '\d STORE -1 in $1\_s*' .. | ||||||
|         '\d PUSHNR 3.*' .. |         '\d PUSHNR 3\_s*' .. | ||||||
|         '\d BCALL range(argc 1).*' .. |         '\d BCALL range(argc 1)\_s*' .. | ||||||
|         '\d FOR $1 -> \d\+.*' .. |         '\d FOR $1 -> \d\+\_s*' .. | ||||||
|         '\d STORE $2.*' .. |         '\d STORE $2\_s*' .. | ||||||
|         'res->add(i).*' .. |         'res->add(i)\_s*' .. | ||||||
|         '\d LOAD $0.*' .. |         '\d LOAD $0\_s*' .. | ||||||
|         '\d LOAD $2.*' .. |         '\d LOAD $2\_s*' .. | ||||||
|         '\d BCALL add(argc 2).*' .. |         '\d\+ BCALL add(argc 2)\_s*' .. | ||||||
|         '\d DROP.*' .. |         '\d\+ DROP\_s*' .. | ||||||
|         'endfor.*' .. |         'endfor\_s*' .. | ||||||
|         '\d JUMP -> \d\+.*' .. |         '\d\+ JUMP -> \d\+\_s*' .. | ||||||
|         '\d DROP.*', |         '\d\+ DROP', | ||||||
|         instr) |         instr) | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
|   | |||||||
| @@ -746,6 +746,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     758, | ||||||
| /**/ | /**/ | ||||||
|     757, |     757, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user