To: vim_dev@googlegroups.com Subject: Patch 8.2.1855 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1855 Problem: Vim9: get error message when nothing is wrong. Solution: Check called_emsg instead of did_emsg. (closes #7143) Files: src/vim9compile.c, src/vim9execute.c, src/errors.h *** ../vim-8.2.1854/src/vim9compile.c 2020-10-15 21:54:51.788563670 +0200 --- src/vim9compile.c 2020-10-16 22:38:09.597244949 +0200 *************** *** 6642,6648 **** else if (eap->regname != NUL) ++line; ! // TODO: if the range is something like "$" need to evaluate at runtime if (parse_cmd_address(eap, &errormsg, FALSE) == FAIL) return NULL; if (eap->addr_count == 0) --- 6642,6650 ---- else if (eap->regname != NUL) ++line; ! // "errormsg" will not be set because the range is ADDR_LINES. ! // TODO: if the range contains something like "$" or "." need to evaluate ! // at runtime if (parse_cmd_address(eap, &errormsg, FALSE) == FAIL) return NULL; if (eap->addr_count == 0) *************** *** 7399,7405 **** if (errormsg != NULL) emsg(errormsg); else if (called_emsg == called_emsg_before) ! emsg(_(e_compile_def_function_failed)); } current_sctx = save_current_sctx; --- 7401,7407 ---- if (errormsg != NULL) emsg(errormsg); else if (called_emsg == called_emsg_before) ! emsg(_(e_compiling_def_function_failed)); } current_sctx = save_current_sctx; *** ../vim-8.2.1854/src/vim9execute.c 2020-10-16 20:25:19.353530443 +0200 --- src/vim9execute.c 2020-10-16 23:13:33.227711063 +0200 *************** *** 550,556 **** { typval_T argvars[MAX_FUNC_ARGS]; int idx; ! int did_emsg_before = did_emsg; ectx_T *prev_ectx = current_ectx; if (call_prepare(argcount, argvars, ectx) == FAIL) --- 550,556 ---- { typval_T argvars[MAX_FUNC_ARGS]; int idx; ! int called_emsg_before = called_emsg; ectx_T *prev_ectx = current_ectx; if (call_prepare(argcount, argvars, ectx) == FAIL) *************** *** 566,572 **** for (idx = 0; idx < argcount; ++idx) clear_tv(&argvars[idx]); ! if (did_emsg != did_emsg_before) return FAIL; return OK; } --- 566,572 ---- for (idx = 0; idx < argcount; ++idx) clear_tv(&argvars[idx]); ! if (called_emsg != called_emsg_before) return FAIL; return OK; } *** ../vim-8.2.1854/src/errors.h 2020-10-16 20:25:19.353530443 +0200 --- src/errors.h 2020-10-16 22:28:56.051560421 +0200 *************** *** 85,91 **** INIT(= N_("E1026: Missing }")); EXTERN char e_missing_return_statement[] INIT(= N_("E1027: Missing return statement")); ! EXTERN char e_compile_def_function_failed[] INIT(= N_("E1028: Compiling :def function failed")); EXTERN char e_expected_str_but_got_str[] INIT(= N_("E1029: Expected %s but got %s")); --- 85,91 ---- INIT(= N_("E1026: Missing }")); EXTERN char e_missing_return_statement[] INIT(= N_("E1027: Missing return statement")); ! EXTERN char e_compiling_def_function_failed[] INIT(= N_("E1028: Compiling :def function failed")); EXTERN char e_expected_str_but_got_str[] INIT(= N_("E1029: Expected %s but got %s")); *** ../vim-8.2.1854/src/version.c 2020-10-16 20:25:19.357530433 +0200 --- src/version.c 2020-10-16 23:03:32.065196685 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1855, /**/ -- From "know your smileys": ...---... SOS /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///