comparison src/terminal.c @ 17606:ff097edaae89 v8.1.1800

patch 8.1.1800: function call functions have too many arguments commit https://github.com/vim/vim/commit/c6538bcc1cdd1fb83732f22fdc69bd9bb66f968a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 3 18:17:11 2019 +0200 patch 8.1.1800: function call functions have too many arguments Problem: Function call functions have too many arguments. Solution: Pass values in a funcexe_T struct.
author Bram Moolenaar <Bram@vim.org>
date Sat, 03 Aug 2019 18:30:07 +0200
parents 278583ff5e44
children ba18f78c8529
comparison
equal deleted inserted replaced
17605:bb1b495f4e05 17606:ff097edaae89
3770 handle_call_command(term_T *term, channel_T *channel, listitem_T *item) 3770 handle_call_command(term_T *term, channel_T *channel, listitem_T *item)
3771 { 3771 {
3772 char_u *func; 3772 char_u *func;
3773 typval_T argvars[2]; 3773 typval_T argvars[2];
3774 typval_T rettv; 3774 typval_T rettv;
3775 int doesrange; 3775 funcexe_T funcexe;
3776 3776
3777 if (item->li_next == NULL) 3777 if (item->li_next == NULL)
3778 { 3778 {
3779 ch_log(channel, "Missing function arguments for call"); 3779 ch_log(channel, "Missing function arguments for call");
3780 return; 3780 return;
3788 } 3788 }
3789 3789
3790 argvars[0].v_type = VAR_NUMBER; 3790 argvars[0].v_type = VAR_NUMBER;
3791 argvars[0].vval.v_number = term->tl_buffer->b_fnum; 3791 argvars[0].vval.v_number = term->tl_buffer->b_fnum;
3792 argvars[1] = item->li_next->li_tv; 3792 argvars[1] = item->li_next->li_tv;
3793 if (call_func(func, -1, &rettv, 3793 vim_memset(&funcexe, 0, sizeof(funcexe));
3794 2, argvars, /* argv_func */ NULL, 3794 funcexe.firstline = 1L;
3795 /* firstline */ 1, /* lastline */ 1, 3795 funcexe.lastline = 1L;
3796 &doesrange, /* evaluate */ TRUE, 3796 funcexe.evaluate = TRUE;
3797 /* partial */ NULL, /* selfdict */ NULL) == OK) 3797 if (call_func(func, -1, &rettv, 2, argvars, &funcexe) == OK)
3798 { 3798 {
3799 clear_tv(&rettv); 3799 clear_tv(&rettv);
3800 ch_log(channel, "Function %s called", func); 3800 ch_log(channel, "Function %s called", func);
3801 } 3801 }
3802 else 3802 else