To: vim_dev@googlegroups.com Subject: Patch 8.2.0343 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0343 Problem: Vim9: using wrong instruction, limited test coverage. Solution: Use ISN_PUSHJOB. Add a few more tests. Files: src/vim9compile.c, src/vim9execute.c, src/testdir/test_vim9_script.vim, src/testdir/test_vim9_disassemble.vim *** ../vim-8.2.0342/src/vim9compile.c 2020-03-01 15:36:39.173441814 +0100 --- src/vim9compile.c 2020-03-01 17:12:55.946198251 +0100 *************** *** 666,672 **** { isn_T *isn; ! if ((isn = generate_instr_type(cctx, ISN_PUSHCHANNEL, &t_channel)) == NULL) return FAIL; isn->isn_arg.job = job; --- 666,672 ---- { isn_T *isn; ! if ((isn = generate_instr_type(cctx, ISN_PUSHJOB, &t_channel)) == NULL) return FAIL; isn->isn_arg.job = job; *** ../vim-8.2.0342/src/vim9execute.c 2020-03-01 15:36:39.173441814 +0100 --- src/vim9execute.c 2020-03-01 17:14:31.537791423 +0100 *************** *** 1915,1921 **** tv.v_type = VAR_JOB; tv.vval.v_job = iptr->isn_arg.job; name = tv_get_string(&tv); ! smsg("%4d PUSHJOB %s", current, name); } #endif break; --- 1915,1921 ---- tv.v_type = VAR_JOB; tv.vval.v_job = iptr->isn_arg.job; name = tv_get_string(&tv); ! smsg("%4d PUSHJOB \"%s\"", current, name); } #endif break; *** ../vim-8.2.0342/src/testdir/test_vim9_script.vim 2020-03-01 16:22:37.064963530 +0100 --- src/testdir/test_vim9_script.vim 2020-03-01 17:11:28.566583642 +0100 *************** *** 56,61 **** --- 56,62 ---- if has('channel') let chan1: channel let job1: job + let job2: job = job_start('willfail') endif if has('float') let float1: float = 3.4 *** ../vim-8.2.0342/src/testdir/test_vim9_disassemble.vim 2020-02-26 21:24:19.157582116 +0100 --- src/testdir/test_vim9_disassemble.vim 2020-03-01 17:49:20.142511681 +0100 *************** *** 1,5 **** --- 1,7 ---- " Test the :disassemble command, and compilation as a side effect + source check.vim + func NotCompiled() echo "not" endfunc *************** *** 332,337 **** --- 334,396 ---- assert_notmatch('JUMP', instr) enddef + def WithFunc() + let funky1: func + let funky2: func = function("len") + let party1: partial + let party2: partial = funcref("UserFunc") + enddef + + def Test_disassemble_function() + let instr = execute('disassemble WithFunc') + assert_match('WithFunc.*' + \ .. 'let funky1: func.*' + \ .. '0 PUSHFUNC "\[none]".*' + \ .. '1 STORE $0.*' + \ .. 'let funky2: func = function("len").*' + \ .. '2 PUSHS "len".*' + \ .. '3 BCALL function(argc 1).*' + \ .. '4 STORE $1.*' + \ .. 'let party1: partial.*' + \ .. '5 PUSHPARTIAL "\[none]".*' + \ .. '6 STORE $2.*' + \ .. 'let party2: partial = funcref("UserFunc").*' + \ .. '7 PUSHS "UserFunc".*' + \ .. '8 BCALL funcref(argc 1).*' + \ .. '9 STORE $3.*' + \ .. '10 PUSHNR 0.*' + \ .. '11 RETURN.*' + \, instr) + enddef + + if has('channel') + def WithChannel() + let job1: job + let job2: job = job_start("donothing") + let chan1: channel + enddef + endif + + def Test_disassemble_channel() + CheckFeature channel + + let instr = execute('disassemble WithChannel') + assert_match('WithChannel.*' + \ .. 'let job1: job.*' + \ .. '\d PUSHJOB "no process".*' + \ .. '\d STORE $0.*' + \ .. 'let job2: job = job_start("donothing").*' + \ .. '\d PUSHS "donothing".*' + \ .. '\d BCALL job_start(argc 1).*' + \ .. '\d STORE $1.*' + \ .. 'let chan1: channel.*' + \ .. '\d PUSHCHANNEL 0.*' + \ .. '\d STORE $2.*' + \ .. '\d PUSHNR 0.*' + \ .. '\d RETURN.*' + \, instr) + enddef + def WithLambda(): string let F = {a -> "X" .. a .. "X"} return F("x") *** ../vim-8.2.0342/src/version.c 2020-03-01 16:53:06.378524819 +0100 --- src/version.c 2020-03-01 17:15:43.049495491 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 343, /**/ -- You are not really successful until someone claims he sat beside you in school. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///