comparison src/testdir/test_vim9_disassemble.vim @ 22975:a943b175586a v8.2.2034

patch 8.2.2034: Vim9: list unpack in for statement not compiled yet Commit: https://github.com/vim/vim/commit/792f786aad8409ca9ab895392742643a5b6aed8f Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 23 08:31:18 2020 +0100 patch 8.2.2034: Vim9: list unpack in for statement not compiled yet Problem: Vim9: list unpack in for statement not compiled yet. Solution: Compile list unpack. (closes https://github.com/vim/vim/issues/7345)
author Bram Moolenaar <Bram@vim.org>
date Mon, 23 Nov 2020 08:45:04 +0100
parents 4c97c0747017
children 4b398a229b0b
comparison
equal deleted inserted replaced
22974:3f8025537dd9 22975:a943b175586a
1024 '\d\+ LOAD $0\_s*' .. 1024 '\d\+ LOAD $0\_s*' ..
1025 '\d\+ RETURN', 1025 '\d\+ RETURN',
1026 instr) 1026 instr)
1027 enddef 1027 enddef
1028 1028
1029 def ForLoopUnpack()
1030 for [x1, x2] in [[1, 2], [3, 4]]
1031 echo x1 x2
1032 endfor
1033 enddef
1034
1035 def Test_disassemble_for_loop_unpack()
1036 var instr = execute('disassemble ForLoopUnpack')
1037 assert_match('ForLoopUnpack\_s*' ..
1038 'for \[x1, x2\] in \[\[1, 2\], \[3, 4\]\]\_s*' ..
1039 '\d\+ STORE -1 in $0\_s*' ..
1040 '\d\+ PUSHNR 1\_s*' ..
1041 '\d\+ PUSHNR 2\_s*' ..
1042 '\d\+ NEWLIST size 2\_s*' ..
1043 '\d\+ PUSHNR 3\_s*' ..
1044 '\d\+ PUSHNR 4\_s*' ..
1045 '\d\+ NEWLIST size 2\_s*' ..
1046 '\d\+ NEWLIST size 2\_s*' ..
1047 '\d\+ FOR $0 -> 16\_s*' ..
1048 '\d\+ UNPACK 2\_s*' ..
1049 '\d\+ STORE $1\_s*' ..
1050 '\d\+ STORE $2\_s*' ..
1051 'echo x1 x2\_s*' ..
1052 '\d\+ LOAD $1\_s*' ..
1053 '\d\+ LOAD $2\_s*' ..
1054 '\d\+ ECHO 2\_s*' ..
1055 'endfor\_s*' ..
1056 '\d\+ JUMP -> 8\_s*' ..
1057 '\d\+ DROP\_s*' ..
1058 '\d\+ PUSHNR 0\_s*' ..
1059 '\d\+ RETURN',
1060 instr)
1061 enddef
1062
1029 let g:number = 42 1063 let g:number = 42
1030 1064
1031 def TypeCast() 1065 def TypeCast()
1032 var l: list<number> = [23, <number>g:number] 1066 var l: list<number> = [23, <number>g:number]
1033 enddef 1067 enddef