Mercurial > vim
diff src/vim9instr.c @ 28156:088d8dc22045 v8.2.4602
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Commit: https://github.com/vim/vim/commit/397a87ac1c9857eb0d5ec3add69e3b9ab6b0c77c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 20 21:14:15 2022 +0000
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Problem: Vim9: not enough test coverage for executing :def function.
Solution: Add a few more tests. Fix uncovered problem. Remove dead code.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Mar 2022 22:15:02 +0100 |
parents | 1615d305c71d |
children | b0c885507de4 |
line wrap: on
line diff
--- a/src/vim9instr.c +++ b/src/vim9instr.c @@ -592,12 +592,12 @@ generate_tv_PUSH(cctx_T *cctx, typval_T case VAR_JOB: if (tv->vval.v_job != NULL) iemsg("non-null job constant not supported"); - generate_PUSHJOB(cctx, NULL); + generate_PUSHJOB(cctx); break; case VAR_CHANNEL: if (tv->vval.v_channel != NULL) iemsg("non-null channel constant not supported"); - generate_PUSHCHANNEL(cctx, NULL); + generate_PUSHCHANNEL(cctx); break; #endif case VAR_FUNC: @@ -723,36 +723,30 @@ generate_PUSHS(cctx_T *cctx, char_u **st } /* - * Generate an ISN_PUSHCHANNEL instruction. - * Consumes "channel". + * Generate an ISN_PUSHCHANNEL instruction. Channel is always NULL. */ int -generate_PUSHCHANNEL(cctx_T *cctx, channel_T *channel) +generate_PUSHCHANNEL(cctx_T *cctx) { isn_T *isn; RETURN_OK_IF_SKIP(cctx); if ((isn = generate_instr_type(cctx, ISN_PUSHCHANNEL, &t_channel)) == NULL) return FAIL; - isn->isn_arg.channel = channel; - return OK; } /* - * Generate an ISN_PUSHJOB instruction. - * Consumes "job". + * Generate an ISN_PUSHJOB instruction. Job is always NULL. */ int -generate_PUSHJOB(cctx_T *cctx, job_T *job) +generate_PUSHJOB(cctx_T *cctx) { isn_T *isn; RETURN_OK_IF_SKIP(cctx); if ((isn = generate_instr_type(cctx, ISN_PUSHJOB, &t_job)) == NULL) return FAIL; - isn->isn_arg.job = job; - return OK; } @@ -2081,18 +2075,6 @@ delete_instr(isn_T *isn) blob_unref(isn->isn_arg.blob); break; - case ISN_PUSHJOB: -#ifdef FEAT_JOB_CHANNEL - job_unref(isn->isn_arg.job); -#endif - break; - - case ISN_PUSHCHANNEL: -#ifdef FEAT_JOB_CHANNEL - channel_unref(isn->isn_arg.channel); -#endif - break; - case ISN_UCALL: vim_free(isn->isn_arg.ufunc.cuf_name); break; @@ -2241,7 +2223,9 @@ delete_instr(isn_T *isn) case ISN_PROF_END: case ISN_PROF_START: case ISN_PUSHBOOL: + case ISN_PUSHCHANNEL: case ISN_PUSHF: + case ISN_PUSHJOB: case ISN_PUSHNR: case ISN_PUSHSPEC: case ISN_PUT: