comparison src/testdir/test_vim9_disassemble.vim @ 25800:fe8d153cb268 v8.2.3435

patch 8.2.3435: Vim9: dict is not passed to dict function Commit: https://github.com/vim/vim/commit/b1b6f4de2b0edc3b6622912132ddb8994ec52709 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Sep 13 18:25:54 2021 +0200 patch 8.2.3435: Vim9: dict is not passed to dict function Problem: Vim9: dict is not passed to dict function. Solution: Keep the dict used until a function call.
author Bram Moolenaar <Bram@vim.org>
date Mon, 13 Sep 2021 18:30:04 +0200
parents 7b80b25a5c2b
children dd4e86558836
comparison
equal deleted inserted replaced
25799:0493410eba74 25800:fe8d153cb268
410 'd.dd\[0\] = 0\_s*' .. 410 'd.dd\[0\] = 0\_s*' ..
411 '\d PUSHNR 0\_s*' .. 411 '\d PUSHNR 0\_s*' ..
412 '\d PUSHNR 0\_s*' .. 412 '\d PUSHNR 0\_s*' ..
413 '\d LOAD $0\_s*' .. 413 '\d LOAD $0\_s*' ..
414 '\d MEMBER dd\_s*' .. 414 '\d MEMBER dd\_s*' ..
415 '\d STOREINDEX any\_s*' .. 415 '\d\+ USEDICT\_s*' ..
416 '\d\+ STOREINDEX any\_s*' ..
416 '\d\+ RETURN void', 417 '\d\+ RETURN void',
417 res) 418 res)
418 enddef 419 enddef
419 420
420 def s:ListAssign() 421 def s:ListAssign()
1623 '\d NEWDICT size 1\_s*' .. 1624 '\d NEWDICT size 1\_s*' ..
1624 '\d STORE $0\_s*' .. 1625 '\d STORE $0\_s*' ..
1625 'var res = d.item\_s*' .. 1626 'var res = d.item\_s*' ..
1626 '\d\+ LOAD $0\_s*' .. 1627 '\d\+ LOAD $0\_s*' ..
1627 '\d\+ MEMBER item\_s*' .. 1628 '\d\+ MEMBER item\_s*' ..
1629 '\d\+ USEDICT\_s*' ..
1628 '\d\+ STORE $1\_s*' .. 1630 '\d\+ STORE $1\_s*' ..
1629 'res = d\["item"\]\_s*' .. 1631 'res = d\["item"\]\_s*' ..
1630 '\d\+ LOAD $0\_s*' .. 1632 '\d\+ LOAD $0\_s*' ..
1631 '\d\+ PUSHS "item"\_s*' .. 1633 '\d\+ PUSHS "item"\_s*' ..
1632 '\d\+ MEMBER\_s*' .. 1634 '\d\+ MEMBER\_s*' ..
1635 '\d\+ USEDICT\_s*' ..
1633 '\d\+ STORE $1\_s*', 1636 '\d\+ STORE $1\_s*',
1634 instr) 1637 instr)
1635 assert_equal(1, DictMember()) 1638 assert_equal(1, DictMember())
1636 enddef 1639 enddef
1637 1640
2300 '19 DEBUG line 6-6 varcount 1\_s*' .. 2303 '19 DEBUG line 6-6 varcount 1\_s*' ..
2301 '20 RETURN void*', 2304 '20 RETURN void*',
2302 res) 2305 res)
2303 enddef 2306 enddef
2304 2307
2308 func Legacy() dict
2309 echo 'legacy'
2310 endfunc
2311
2312 def s:UseMember()
2313 var d = {func: Legacy}
2314 var v = d.func()
2315 enddef
2316
2317 def Test_disassemble_dict_stack()
2318 var res = execute('disass s:UseMember')
2319 assert_match('<SNR>\d*_UseMember\_s*' ..
2320 'var d = {func: Legacy}\_s*' ..
2321 '\d PUSHS "func"\_s*' ..
2322 '\d PUSHFUNC "Legacy"\_s*' ..
2323 '\d NEWDICT size 1\_s*' ..
2324 '\d STORE $0\_s*' ..
2325
2326 'var v = d.func()\_s*' ..
2327 '\d LOAD $0\_s*' ..
2328 '\d MEMBER func\_s*' ..
2329 '\d PCALL top (argc 0)\_s*' ..
2330 '\d PCALL end\_s*' ..
2331 '\d CLEARDICT\_s*' ..
2332 '\d\+ STORE $1\_s*' ..
2333 '\d\+ RETURN void*',
2334 res)
2335 enddef
2336
2305 def s:EchoMessages() 2337 def s:EchoMessages()
2306 echohl ErrorMsg | echom v:exception | echohl NONE 2338 echohl ErrorMsg | echom v:exception | echohl NONE
2307 enddef 2339 enddef
2308 2340
2309 def Test_disassemble_nextcmd() 2341 def Test_disassemble_nextcmd()
2361 delfunc g:ThisFunc 2393 delfunc g:ThisFunc
2362 delfunc g:ThatFunc 2394 delfunc g:ThatFunc
2363 enddef 2395 enddef
2364 2396
2365 2397
2398
2366 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker 2399 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker