vim-patch:9.1.1195: inside try-block: fn body executed with default arg undefined (#32866)

Problem:  inside try-block: fn body executed when default arg is
          undefined
Solution: When inside a try-block do not execute function body after an
          error in evaluating a default argument expression
          (Shane Harper).

closes: vim/vim#16865

2d18789aa6

Co-authored-by: Shane Harper <shane@shaneharper.net>
This commit is contained in:
zeertzjq
2025-03-13 08:46:47 +08:00
committed by GitHub
parent dbd76c2c41
commit 90d1260cb8
2 changed files with 30 additions and 9 deletions

View File

@@ -1246,7 +1246,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
int save_did_emsg = did_emsg;
did_emsg = false;
if (default_arg_err && (fp->uf_flags & FC_ABORT)) {
if (default_arg_err && (fp->uf_flags & FC_ABORT || trylevel > 0)) {
did_emsg = true;
} else if (islambda) {
char *p = *(char **)fp->uf_lines.ga_data + 7;