comparison src/vim9execute.c @ 20287:ce1b73835822 v8.2.0699

patch 8.2.0699: Vim9: not all errors tested Commit: https://github.com/vim/vim/commit/015f4267f4a28627c1872042078a95be7e06c4dc Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 5 21:25:22 2020 +0200 patch 8.2.0699: Vim9: not all errors tested Problem: Vim9: not all errors tested. Solution: Add test for deleted function. Bail out on first error.
author Bram Moolenaar <Bram@vim.org>
date Tue, 05 May 2020 21:30:04 +0200
parents 934657e365e5
children 208b38bddc36
comparison
equal deleted inserted replaced
20286:a7b6adc814f1 20287:ce1b73835822
430 static int 430 static int
431 call_bfunc(int func_idx, int argcount, ectx_T *ectx) 431 call_bfunc(int func_idx, int argcount, ectx_T *ectx)
432 { 432 {
433 typval_T argvars[MAX_FUNC_ARGS]; 433 typval_T argvars[MAX_FUNC_ARGS];
434 int idx; 434 int idx;
435 int called_emsg_before = called_emsg;
435 436
436 if (call_prepare(argcount, argvars, ectx) == FAIL) 437 if (call_prepare(argcount, argvars, ectx) == FAIL)
437 return FAIL; 438 return FAIL;
438 439
439 // Call the builtin function. 440 // Call the builtin function.
440 call_internal_func_by_idx(func_idx, argvars, STACK_TV_BOT(-1)); 441 call_internal_func_by_idx(func_idx, argvars, STACK_TV_BOT(-1));
441 442
442 // Clear the arguments. 443 // Clear the arguments.
443 for (idx = 0; idx < argcount; ++idx) 444 for (idx = 0; idx < argcount; ++idx)
444 clear_tv(&argvars[idx]); 445 clear_tv(&argvars[idx]);
446
447 if (called_emsg != called_emsg_before)
448 return FAIL;
445 return OK; 449 return OK;
446 } 450 }
447 451
448 /* 452 /*
449 * Execute a user defined function. 453 * Execute a user defined function.
547 else if (tv->v_type == VAR_FUNC) 551 else if (tv->v_type == VAR_FUNC)
548 name = tv->vval.v_string; 552 name = tv->vval.v_string;
549 if (name == NULL || call_by_name(name, argcount, ectx, NULL) == FAIL) 553 if (name == NULL || call_by_name(name, argcount, ectx, NULL) == FAIL)
550 { 554 {
551 if (called_emsg == called_emsg_before) 555 if (called_emsg == called_emsg_before)
552 semsg(_(e_unknownfunc), name); 556 semsg(_(e_unknownfunc),
557 name == NULL ? (char_u *)"[unknown]" : name);
553 return FAIL; 558 return FAIL;
554 } 559 }
555 return OK; 560 return OK;
556 } 561 }
557 562