]> granicus.if.org Git - vim/commitdiff
patch 8.2.1855: Vim9: get error message when nothing is wrong v8.2.1855
authorBram Moolenaar <Bram@vim.org>
Fri, 16 Oct 2020 21:16:47 +0000 (23:16 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 16 Oct 2020 21:16:47 +0000 (23:16 +0200)
Problem:    Vim9: get error message when nothing is wrong.
Solution:   Check called_emsg instead of did_emsg. (closes #7143)

src/errors.h
src/version.c
src/vim9compile.c
src/vim9execute.c

index 7bacbd5317267803f15815ddc883ea01fde9d280..664bcd93258f8c7ca2bf931b558d01f7a5b748ca 100644 (file)
@@ -85,7 +85,7 @@ EXTERN char e_missing_rcurly[]
        INIT(= N_("E1026: Missing }"));
 EXTERN char e_missing_return_statement[]
        INIT(= N_("E1027: Missing return statement"));
-EXTERN char e_compile_def_function_failed[]
+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"));
index 4710689b691292224794137ce065b1fd64fd9d75..cc9876911a853ab1fd1d74775dd64f607dfe8b40 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1855,
 /**/
     1854,
 /**/
index 74156249e1ce3f0ebe15d03ef0443ba996b33693..edfa32566a7b51080a818816542c32a494c90ae8 100644 (file)
@@ -6642,7 +6642,9 @@ compile_put(char_u *arg, exarg_T *eap, cctx_T *cctx)
     else if (eap->regname != NUL)
        ++line;
 
-    // TODO: if the range is something like "$" need to evaluate at runtime
+    // "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,7 +7401,7 @@ erret:
        if (errormsg != NULL)
            emsg(errormsg);
        else if (called_emsg == called_emsg_before)
-           emsg(_(e_compile_def_function_failed));
+           emsg(_(e_compiling_def_function_failed));
     }
 
     current_sctx = save_current_sctx;
index 521f1c9c0cd052b55b4e0ce97ac8091592a2e5cc..27e636804681a2ba1b0ec5008a9635ad5c5bcaaa 100644 (file)
@@ -550,7 +550,7 @@ call_bfunc(int func_idx, int argcount, ectx_T *ectx)
 {
     typval_T   argvars[MAX_FUNC_ARGS];
     int                idx;
-    int                did_emsg_before = did_emsg;
+    int                called_emsg_before = called_emsg;
     ectx_T     *prev_ectx = current_ectx;
 
     if (call_prepare(argcount, argvars, ectx) == FAIL)
@@ -566,7 +566,7 @@ call_bfunc(int func_idx, int argcount, ectx_T *ectx)
     for (idx = 0; idx < argcount; ++idx)
        clear_tv(&argvars[idx]);
 
-    if (did_emsg != did_emsg_before)
+    if (called_emsg != called_emsg_before)
        return FAIL;
     return OK;
 }