comparison src/eval.c @ 26877:06a137af96f8 v8.2.3967

patch 8.2.3967: error messages are spread out Commit: https://github.com/vim/vim/commit/460ae5dfca31fa627531c263184849976755cf6b Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 1 14:19:49 2022 +0000 patch 8.2.3967: error messages are spread out Problem: Error messages are spread out. Solution: Move more errors to errors.h.
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Jan 2022 15:30:05 +0100
parents bce848ec8b1b
children 7f150a4936f2
comparison
equal deleted inserted replaced
26876:601a973ac16c 26877:06a137af96f8
995 for (len = 0; ASCII_ISALNUM(key[len]) || key[len] == '_'; ++len) 995 for (len = 0; ASCII_ISALNUM(key[len]) || key[len] == '_'; ++len)
996 ; 996 ;
997 if (len == 0) 997 if (len == 0)
998 { 998 {
999 if (!quiet) 999 if (!quiet)
1000 emsg(_(e_emptykey)); 1000 emsg(_(e_cannot_use_empty_key_for_dictionary));
1001 return NULL; 1001 return NULL;
1002 } 1002 }
1003 p = key + len; 1003 p = key + len;
1004 } 1004 }
1005 else 1005 else
1146 { 1146 {
1147 // Can't add "v:" or "a:" variable. 1147 // Can't add "v:" or "a:" variable.
1148 if (lp->ll_dict == get_vimvar_dict() 1148 if (lp->ll_dict == get_vimvar_dict()
1149 || &lp->ll_dict->dv_hashtab == get_funccal_args_ht()) 1149 || &lp->ll_dict->dv_hashtab == get_funccal_args_ht())
1150 { 1150 {
1151 semsg(_(e_illvar), name); 1151 semsg(_(e_illegal_variable_name_str), name);
1152 clear_tv(&var1); 1152 clear_tv(&var1);
1153 return NULL; 1153 return NULL;
1154 } 1154 }
1155 1155
1156 // Key does not exist in dict: may need to add it. 1156 // Key does not exist in dict: may need to add it.
1157 if (*p == '[' || *p == '.' || unlet) 1157 if (*p == '[' || *p == '.' || unlet)
1158 { 1158 {
1159 if (!quiet) 1159 if (!quiet)
1160 semsg(_(e_dictkey), key); 1160 semsg(_(e_key_not_present_in_dictionary), key);
1161 clear_tv(&var1); 1161 clear_tv(&var1);
1162 return NULL; 1162 return NULL;
1163 } 1163 }
1164 if (len == -1) 1164 if (len == -1)
1165 lp->ll_newkey = vim_strsave(key); 1165 lp->ll_newkey = vim_strsave(key);
1304 { 1304 {
1305 int error = FALSE, val; 1305 int error = FALSE, val;
1306 1306
1307 if (op != NULL && *op != '=') 1307 if (op != NULL && *op != '=')
1308 { 1308 {
1309 semsg(_(e_letwrong), op); 1309 semsg(_(e_wrong_variable_type_for_str_equal), op);
1310 return; 1310 return;
1311 } 1311 }
1312 if (value_check_lock(lp->ll_blob->bv_lock, lp->ll_name, FALSE)) 1312 if (value_check_lock(lp->ll_blob->bv_lock, lp->ll_name, FALSE))
1313 return; 1313 return;
1314 1314
1333 typval_T tv; 1333 typval_T tv;
1334 1334
1335 if ((flags & (ASSIGN_CONST | ASSIGN_FINAL)) 1335 if ((flags & (ASSIGN_CONST | ASSIGN_FINAL))
1336 && (flags & ASSIGN_FOR_LOOP) == 0) 1336 && (flags & ASSIGN_FOR_LOOP) == 0)
1337 { 1337 {
1338 emsg(_(e_cannot_mod)); 1338 emsg(_(e_cannot_modify_existing_variable));
1339 *endp = cc; 1339 *endp = cc;
1340 return; 1340 return;
1341 } 1341 }
1342 1342
1343 // handle +=, -=, *=, /=, %= and .= 1343 // handle +=, -=, *=, /=, %= and .=
1399 1399
1400 if (lp->ll_newkey != NULL) 1400 if (lp->ll_newkey != NULL)
1401 { 1401 {
1402 if (op != NULL && *op != '=') 1402 if (op != NULL && *op != '=')
1403 { 1403 {
1404 semsg(_(e_dictkey), lp->ll_newkey); 1404 semsg(_(e_key_not_present_in_dictionary), lp->ll_newkey);
1405 return; 1405 return;
1406 } 1406 }
1407 if (dict_wrong_func_name(lp->ll_tv->vval.v_dict, rettv, 1407 if (dict_wrong_func_name(lp->ll_tv->vval.v_dict, rettv,
1408 lp->ll_newkey)) 1408 lp->ll_newkey))
1409 return; 1409 return;
1588 #endif 1588 #endif
1589 return OK; 1589 return OK;
1590 } 1590 }
1591 } 1591 }
1592 1592
1593 semsg(_(e_letwrong), op); 1593 semsg(_(e_wrong_variable_type_for_str_equal), op);
1594 return FAIL; 1594 return FAIL;
1595 } 1595 }
1596 1596
1597 /* 1597 /*
1598 * Evaluate the expression used in a ":for var in expr" command. 1598 * Evaluate the expression used in a ":for var in expr" command.
3246 f1 = f1 / f2; 3246 f1 = f1 / f2;
3247 # endif 3247 # endif
3248 } 3248 }
3249 else 3249 else
3250 { 3250 {
3251 emsg(_(e_modulus)); 3251 emsg(_(e_cannot_use_percent_with_float));
3252 return FAIL; 3252 return FAIL;
3253 } 3253 }
3254 rettv->v_type = VAR_FLOAT; 3254 rettv->v_type = VAR_FLOAT;
3255 rettv->vval.v_float = f1; 3255 rettv->vval.v_float = f1;
3256 } 3256 }
4323 { 4323 {
4324 if (verbose) 4324 if (verbose)
4325 { 4325 {
4326 if (keylen > 0) 4326 if (keylen > 0)
4327 key[keylen] = NUL; 4327 key[keylen] = NUL;
4328 semsg(_(e_dictkey), key); 4328 semsg(_(e_key_not_present_in_dictionary), key);
4329 } 4329 }
4330 return FAIL; 4330 return FAIL;
4331 } 4331 }
4332 4332
4333 copy_tv(&item->di_tv, &tmp); 4333 copy_tv(&item->di_tv, &tmp);