comparison src/vim9execute.c @ 21232:3f14e0d4a4dd v8.2.1167

patch 8.2.1167: Vim9: builtin function method call only supports first arg Commit: https://github.com/vim/vim/commit/389df259c49d1ca4f7aa129b702f6083985b1e73 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 9 21:20:47 2020 +0200 patch 8.2.1167: Vim9: builtin function method call only supports first arg Problem: Vim9: builtin function method call only supports first argument. Solution: Shift arguments when needed. (closes https://github.com/vim/vim/issues/6305, closes https://github.com/vim/vim/issues/6419)
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 Jul 2020 21:30:03 +0200
parents caab594592cc
children 883315e762b7
comparison
equal deleted inserted replaced
21231:fcc215b37837 21232:3f14e0d4a4dd
552 { 552 {
553 int func_idx = find_internal_func(name); 553 int func_idx = find_internal_func(name);
554 554
555 if (func_idx < 0) 555 if (func_idx < 0)
556 return FAIL; 556 return FAIL;
557 if (check_internal_func(func_idx, argcount) == FAIL) 557 if (check_internal_func(func_idx, argcount) < 0)
558 return FAIL; 558 return FAIL;
559 return call_bfunc(func_idx, argcount, ectx); 559 return call_bfunc(func_idx, argcount, ectx);
560 } 560 }
561 561
562 ufunc = find_func(name, FALSE, NULL); 562 ufunc = find_func(name, FALSE, NULL);
2331 tv->vval.v_string = str; 2331 tv->vval.v_string = str;
2332 } 2332 }
2333 } 2333 }
2334 break; 2334 break;
2335 2335
2336 case ISN_SHUFFLE:
2337 {
2338 typval_T tmp_tv;
2339 int item = iptr->isn_arg.shuffle.shfl_item;
2340 int up = iptr->isn_arg.shuffle.shfl_up;
2341
2342 tmp_tv = *STACK_TV_BOT(-item);
2343 for ( ; up > 0 && item > 1; --up)
2344 {
2345 *STACK_TV_BOT(-item) = *STACK_TV_BOT(-item + 1);
2346 --item;
2347 }
2348 *STACK_TV_BOT(-item) = tmp_tv;
2349 }
2350 break;
2351
2336 case ISN_DROP: 2352 case ISN_DROP:
2337 --ectx.ec_stack.ga_len; 2353 --ectx.ec_stack.ga_len;
2338 clear_tv(STACK_TV_BOT(0)); 2354 clear_tv(STACK_TV_BOT(0));
2339 break; 2355 break;
2340 } 2356 }
2898 else 2914 else
2899 smsg("%4d 2BOOL (!!val)", current); 2915 smsg("%4d 2BOOL (!!val)", current);
2900 break; 2916 break;
2901 case ISN_2STRING: smsg("%4d 2STRING stack[%lld]", current, 2917 case ISN_2STRING: smsg("%4d 2STRING stack[%lld]", current,
2902 (long long)(iptr->isn_arg.number)); 2918 (long long)(iptr->isn_arg.number));
2903 break; 2919 break;
2904 2920
2921 case ISN_SHUFFLE: smsg("%4d SHUFFLE %d up %d", current,
2922 iptr->isn_arg.shuffle.shfl_item,
2923 iptr->isn_arg.shuffle.shfl_up);
2924 break;
2905 case ISN_DROP: smsg("%4d DROP", current); break; 2925 case ISN_DROP: smsg("%4d DROP", current); break;
2906 } 2926 }
2907 } 2927 }
2908 } 2928 }
2909 2929