Mercurial > vim
comparison src/eval.c @ 15470:55ccc2d353bd v8.1.0743
patch 8.1.0743: giving error messages is not flexible
commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:38:42 2019 +0100
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible.
Solution: Add semsg(). Change argument from "char_u *" to "char *", also
for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
#3302) Also make emsg() accept a "char *" argument. Get rid of
an enormous number of type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 23:45:08 +0100 |
parents | 435fcefd2c8e |
children | 051937ebaf22 |
comparison
equal
deleted
inserted
replaced
15469:bc9b5261ed01 | 15470:55ccc2d353bd |
---|---|
299 for (i = 0; i < VV_LEN; ++i) | 299 for (i = 0; i < VV_LEN; ++i) |
300 { | 300 { |
301 p = &vimvars[i]; | 301 p = &vimvars[i]; |
302 if (STRLEN(p->vv_name) > 16) | 302 if (STRLEN(p->vv_name) > 16) |
303 { | 303 { |
304 IEMSG("INTERNAL: name too long, increase size of dictitem16_T"); | 304 iemsg("INTERNAL: name too long, increase size of dictitem16_T"); |
305 getout(1); | 305 getout(1); |
306 } | 306 } |
307 STRCPY(p->vv_di.di_key, p->vv_name); | 307 STRCPY(p->vv_di.di_key, p->vv_name); |
308 if (p->vv_flags & VV_RO) | 308 if (p->vv_flags & VV_RO) |
309 p->vv_di.di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; | 309 p->vv_di.di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; |
446 typval_T tv; | 446 typval_T tv; |
447 | 447 |
448 /* Catch a bad name early. */ | 448 /* Catch a bad name early. */ |
449 if (!eval_isnamec1(*name)) | 449 if (!eval_isnamec1(*name)) |
450 { | 450 { |
451 EMSG(_(e_invarg)); | 451 emsg(_(e_invarg)); |
452 return FAIL; | 452 return FAIL; |
453 } | 453 } |
454 | 454 |
455 /* Make a copy of the name, it is used in redir_lval until redir ends. */ | 455 /* Make a copy of the name, it is used in redir_lval until redir ends. */ |
456 redir_varname = vim_strsave(name); | 456 redir_varname = vim_strsave(name); |
473 if (redir_endp == NULL || redir_lval->ll_name == NULL || *redir_endp != NUL) | 473 if (redir_endp == NULL || redir_lval->ll_name == NULL || *redir_endp != NUL) |
474 { | 474 { |
475 clear_lval(redir_lval); | 475 clear_lval(redir_lval); |
476 if (redir_endp != NULL && *redir_endp != NUL) | 476 if (redir_endp != NULL && *redir_endp != NUL) |
477 /* Trailing characters are present after the variable name */ | 477 /* Trailing characters are present after the variable name */ |
478 EMSG(_(e_trailing)); | 478 emsg(_(e_trailing)); |
479 else | 479 else |
480 EMSG(_(e_invarg)); | 480 emsg(_(e_invarg)); |
481 redir_endp = NULL; /* don't store a value, only cleanup */ | 481 redir_endp = NULL; /* don't store a value, only cleanup */ |
482 var_redir_stop(); | 482 var_redir_stop(); |
483 return FAIL; | 483 return FAIL; |
484 } | 484 } |
485 | 485 |
732 if (eval1(&s, rettv, TRUE) == FAIL) | 732 if (eval1(&s, rettv, TRUE) == FAIL) |
733 return FAIL; | 733 return FAIL; |
734 if (*s != NUL) /* check for trailing chars after expr */ | 734 if (*s != NUL) /* check for trailing chars after expr */ |
735 { | 735 { |
736 clear_tv(rettv); | 736 clear_tv(rettv); |
737 EMSG2(_(e_invexpr2), s); | 737 semsg(_(e_invexpr2), s); |
738 return FAIL; | 738 return FAIL; |
739 } | 739 } |
740 } | 740 } |
741 return OK; | 741 return OK; |
742 } | 742 } |
1200 { | 1200 { |
1201 /* | 1201 /* |
1202 * ":let" without "=": list variables | 1202 * ":let" without "=": list variables |
1203 */ | 1203 */ |
1204 if (*arg == '[') | 1204 if (*arg == '[') |
1205 EMSG(_(e_invarg)); | 1205 emsg(_(e_invarg)); |
1206 else if (!ends_excmd(*arg)) | 1206 else if (!ends_excmd(*arg)) |
1207 /* ":let var1 var2" */ | 1207 /* ":let var1 var2" */ |
1208 arg = list_arg_vars(eap, arg, &first); | 1208 arg = list_arg_vars(eap, arg, &first); |
1209 else if (!eap->skip) | 1209 else if (!eap->skip) |
1210 { | 1210 { |
1286 /* | 1286 /* |
1287 * ":let [v1, v2] = list" or ":for [v1, v2] in listlist" | 1287 * ":let [v1, v2] = list" or ":for [v1, v2] in listlist" |
1288 */ | 1288 */ |
1289 if (tv->v_type != VAR_LIST || (l = tv->vval.v_list) == NULL) | 1289 if (tv->v_type != VAR_LIST || (l = tv->vval.v_list) == NULL) |
1290 { | 1290 { |
1291 EMSG(_(e_listreq)); | 1291 emsg(_(e_listreq)); |
1292 return FAIL; | 1292 return FAIL; |
1293 } | 1293 } |
1294 | 1294 |
1295 i = list_len(l); | 1295 i = list_len(l); |
1296 if (semicolon == 0 && var_count < i) | 1296 if (semicolon == 0 && var_count < i) |
1297 { | 1297 { |
1298 EMSG(_("E687: Less targets than List items")); | 1298 emsg(_("E687: Less targets than List items")); |
1299 return FAIL; | 1299 return FAIL; |
1300 } | 1300 } |
1301 if (var_count - semicolon > i) | 1301 if (var_count - semicolon > i) |
1302 { | 1302 { |
1303 EMSG(_("E688: More targets than List items")); | 1303 emsg(_("E688: More targets than List items")); |
1304 return FAIL; | 1304 return FAIL; |
1305 } | 1305 } |
1306 | 1306 |
1307 item = l->lv_first; | 1307 item = l->lv_first; |
1308 while (*arg != ']') | 1308 while (*arg != ']') |
1372 { | 1372 { |
1373 p = skipwhite(p + 1); /* skip whites after '[', ';' or ',' */ | 1373 p = skipwhite(p + 1); /* skip whites after '[', ';' or ',' */ |
1374 s = skip_var_one(p); | 1374 s = skip_var_one(p); |
1375 if (s == p) | 1375 if (s == p) |
1376 { | 1376 { |
1377 EMSG2(_(e_invarg2), p); | 1377 semsg(_(e_invarg2), p); |
1378 return NULL; | 1378 return NULL; |
1379 } | 1379 } |
1380 ++*var_count; | 1380 ++*var_count; |
1381 | 1381 |
1382 p = skipwhite(s); | 1382 p = skipwhite(s); |
1384 break; | 1384 break; |
1385 else if (*p == ';') | 1385 else if (*p == ';') |
1386 { | 1386 { |
1387 if (*semicolon == 1) | 1387 if (*semicolon == 1) |
1388 { | 1388 { |
1389 EMSG(_("Double ; in list of variables")); | 1389 emsg(_("Double ; in list of variables")); |
1390 return NULL; | 1390 return NULL; |
1391 } | 1391 } |
1392 *semicolon = 1; | 1392 *semicolon = 1; |
1393 } | 1393 } |
1394 else if (*p != ',') | 1394 else if (*p != ',') |
1395 { | 1395 { |
1396 EMSG2(_(e_invarg2), p); | 1396 semsg(_(e_invarg2), p); |
1397 return NULL; | 1397 return NULL; |
1398 } | 1398 } |
1399 } | 1399 } |
1400 return p + 1; | 1400 return p + 1; |
1401 } | 1401 } |
1532 { | 1532 { |
1533 arg = find_name_end(arg, NULL, NULL, FNE_INCL_BR | FNE_CHECK_START); | 1533 arg = find_name_end(arg, NULL, NULL, FNE_INCL_BR | FNE_CHECK_START); |
1534 if (!VIM_ISWHITE(*arg) && !ends_excmd(*arg)) | 1534 if (!VIM_ISWHITE(*arg) && !ends_excmd(*arg)) |
1535 { | 1535 { |
1536 emsg_severe = TRUE; | 1536 emsg_severe = TRUE; |
1537 EMSG(_(e_trailing)); | 1537 emsg(_(e_trailing)); |
1538 break; | 1538 break; |
1539 } | 1539 } |
1540 } | 1540 } |
1541 else | 1541 else |
1542 { | 1542 { |
1548 /* This is mainly to keep test 49 working: when expanding | 1548 /* This is mainly to keep test 49 working: when expanding |
1549 * curly braces fails overrule the exception error message. */ | 1549 * curly braces fails overrule the exception error message. */ |
1550 if (len < 0 && !aborting()) | 1550 if (len < 0 && !aborting()) |
1551 { | 1551 { |
1552 emsg_severe = TRUE; | 1552 emsg_severe = TRUE; |
1553 EMSG2(_(e_invarg2), arg); | 1553 semsg(_(e_invarg2), arg); |
1554 break; | 1554 break; |
1555 } | 1555 } |
1556 error = TRUE; | 1556 error = TRUE; |
1557 } | 1557 } |
1558 else | 1558 else |
1579 case 't': list_tab_vars(first); break; | 1579 case 't': list_tab_vars(first); break; |
1580 case 'v': list_vim_vars(first); break; | 1580 case 'v': list_vim_vars(first); break; |
1581 case 's': list_script_vars(first); break; | 1581 case 's': list_script_vars(first); break; |
1582 case 'l': list_func_vars(first); break; | 1582 case 'l': list_func_vars(first); break; |
1583 default: | 1583 default: |
1584 EMSG2(_("E738: Can't list variables for %s"), name); | 1584 semsg(_("E738: Can't list variables for %s"), name); |
1585 } | 1585 } |
1586 } | 1586 } |
1587 else | 1587 else |
1588 { | 1588 { |
1589 char_u numbuf[NUMBUFLEN]; | 1589 char_u numbuf[NUMBUFLEN]; |
1645 /* Find the end of the name. */ | 1645 /* Find the end of the name. */ |
1646 ++arg; | 1646 ++arg; |
1647 name = arg; | 1647 name = arg; |
1648 len = get_env_len(&arg); | 1648 len = get_env_len(&arg); |
1649 if (len == 0) | 1649 if (len == 0) |
1650 EMSG2(_(e_invarg2), name - 1); | 1650 semsg(_(e_invarg2), name - 1); |
1651 else | 1651 else |
1652 { | 1652 { |
1653 if (op != NULL && (*op == '+' || *op == '-')) | 1653 if (op != NULL && (*op == '+' || *op == '-')) |
1654 EMSG2(_(e_letwrong), op); | 1654 semsg(_(e_letwrong), op); |
1655 else if (endchars != NULL | 1655 else if (endchars != NULL |
1656 && vim_strchr(endchars, *skipwhite(arg)) == NULL) | 1656 && vim_strchr(endchars, *skipwhite(arg)) == NULL) |
1657 EMSG(_(e_letunexp)); | 1657 emsg(_(e_letunexp)); |
1658 else if (!check_secure()) | 1658 else if (!check_secure()) |
1659 { | 1659 { |
1660 c1 = name[len]; | 1660 c1 = name[len]; |
1661 name[len] = NUL; | 1661 name[len] = NUL; |
1662 p = tv_get_string_chk(tv); | 1662 p = tv_get_string_chk(tv); |
1699 { | 1699 { |
1700 /* Find the end of the name. */ | 1700 /* Find the end of the name. */ |
1701 p = find_option_end(&arg, &opt_flags); | 1701 p = find_option_end(&arg, &opt_flags); |
1702 if (p == NULL || (endchars != NULL | 1702 if (p == NULL || (endchars != NULL |
1703 && vim_strchr(endchars, *skipwhite(p)) == NULL)) | 1703 && vim_strchr(endchars, *skipwhite(p)) == NULL)) |
1704 EMSG(_(e_letunexp)); | 1704 emsg(_(e_letunexp)); |
1705 else | 1705 else |
1706 { | 1706 { |
1707 long n; | 1707 long n; |
1708 int opt_type; | 1708 int opt_type; |
1709 long numval; | 1709 long numval; |
1720 opt_type = get_option_value(arg, &numval, | 1720 opt_type = get_option_value(arg, &numval, |
1721 &stringval, opt_flags); | 1721 &stringval, opt_flags); |
1722 if ((opt_type == 1 && *op == '.') | 1722 if ((opt_type == 1 && *op == '.') |
1723 || (opt_type == 0 && *op != '.')) | 1723 || (opt_type == 0 && *op != '.')) |
1724 { | 1724 { |
1725 EMSG2(_(e_letwrong), op); | 1725 semsg(_(e_letwrong), op); |
1726 s = NULL; /* don't set the value */ | 1726 s = NULL; /* don't set the value */ |
1727 } | 1727 } |
1728 else | 1728 else |
1729 { | 1729 { |
1730 if (opt_type == 1) /* number */ | 1730 if (opt_type == 1) /* number */ |
1757 */ | 1757 */ |
1758 else if (*arg == '@') | 1758 else if (*arg == '@') |
1759 { | 1759 { |
1760 ++arg; | 1760 ++arg; |
1761 if (op != NULL && (*op == '+' || *op == '-')) | 1761 if (op != NULL && (*op == '+' || *op == '-')) |
1762 EMSG2(_(e_letwrong), op); | 1762 semsg(_(e_letwrong), op); |
1763 else if (endchars != NULL | 1763 else if (endchars != NULL |
1764 && vim_strchr(endchars, *skipwhite(arg + 1)) == NULL) | 1764 && vim_strchr(endchars, *skipwhite(arg + 1)) == NULL) |
1765 EMSG(_(e_letunexp)); | 1765 emsg(_(e_letunexp)); |
1766 else | 1766 else |
1767 { | 1767 { |
1768 char_u *ptofree = NULL; | 1768 char_u *ptofree = NULL; |
1769 char_u *s; | 1769 char_u *s; |
1770 | 1770 |
1797 | 1797 |
1798 p = get_lval(arg, tv, &lv, FALSE, FALSE, 0, FNE_CHECK_START); | 1798 p = get_lval(arg, tv, &lv, FALSE, FALSE, 0, FNE_CHECK_START); |
1799 if (p != NULL && lv.ll_name != NULL) | 1799 if (p != NULL && lv.ll_name != NULL) |
1800 { | 1800 { |
1801 if (endchars != NULL && vim_strchr(endchars, *skipwhite(p)) == NULL) | 1801 if (endchars != NULL && vim_strchr(endchars, *skipwhite(p)) == NULL) |
1802 EMSG(_(e_letunexp)); | 1802 emsg(_(e_letunexp)); |
1803 else | 1803 else |
1804 { | 1804 { |
1805 set_var_lval(&lv, p, tv, copy, op); | 1805 set_var_lval(&lv, p, tv, copy, op); |
1806 arg_end = p; | 1806 arg_end = p; |
1807 } | 1807 } |
1808 } | 1808 } |
1809 clear_lval(&lv); | 1809 clear_lval(&lv); |
1810 } | 1810 } |
1811 | 1811 |
1812 else | 1812 else |
1813 EMSG2(_(e_invarg2), arg); | 1813 semsg(_(e_invarg2), arg); |
1814 | 1814 |
1815 return arg_end; | 1815 return arg_end; |
1816 } | 1816 } |
1817 | 1817 |
1818 /* | 1818 /* |
1873 { | 1873 { |
1874 /* Don't expand the name when we already know there is an error. */ | 1874 /* Don't expand the name when we already know there is an error. */ |
1875 if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p) | 1875 if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p) |
1876 && *p != '[' && *p != '.') | 1876 && *p != '[' && *p != '.') |
1877 { | 1877 { |
1878 EMSG(_(e_trailing)); | 1878 emsg(_(e_trailing)); |
1879 return NULL; | 1879 return NULL; |
1880 } | 1880 } |
1881 | 1881 |
1882 lp->ll_exp_name = make_expanded_name(name, expr_start, expr_end, p); | 1882 lp->ll_exp_name = make_expanded_name(name, expr_start, expr_end, p); |
1883 if (lp->ll_exp_name == NULL) | 1883 if (lp->ll_exp_name == NULL) |
1886 * expression evaluation has been cancelled due to an | 1886 * expression evaluation has been cancelled due to an |
1887 * aborting error, an interrupt, or an exception. */ | 1887 * aborting error, an interrupt, or an exception. */ |
1888 if (!aborting() && !quiet) | 1888 if (!aborting() && !quiet) |
1889 { | 1889 { |
1890 emsg_severe = TRUE; | 1890 emsg_severe = TRUE; |
1891 EMSG2(_(e_invarg2), name); | 1891 semsg(_(e_invarg2), name); |
1892 return NULL; | 1892 return NULL; |
1893 } | 1893 } |
1894 } | 1894 } |
1895 lp->ll_name = lp->ll_exp_name; | 1895 lp->ll_name = lp->ll_exp_name; |
1896 } | 1896 } |
1906 /* Only pass &ht when we would write to the variable, it prevents autoload | 1906 /* Only pass &ht when we would write to the variable, it prevents autoload |
1907 * as well. */ | 1907 * as well. */ |
1908 v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht, | 1908 v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht, |
1909 flags & GLV_NO_AUTOLOAD); | 1909 flags & GLV_NO_AUTOLOAD); |
1910 if (v == NULL && !quiet) | 1910 if (v == NULL && !quiet) |
1911 EMSG2(_(e_undefvar), lp->ll_name); | 1911 semsg(_(e_undefvar), lp->ll_name); |
1912 *p = cc; | 1912 *p = cc; |
1913 if (v == NULL) | 1913 if (v == NULL) |
1914 return NULL; | 1914 return NULL; |
1915 | 1915 |
1916 /* | 1916 /* |
1926 && lp->ll_tv->vval.v_dict != NULL) | 1926 && lp->ll_tv->vval.v_dict != NULL) |
1927 && !(lp->ll_tv->v_type == VAR_BLOB | 1927 && !(lp->ll_tv->v_type == VAR_BLOB |
1928 && lp->ll_tv->vval.v_blob != NULL)) | 1928 && lp->ll_tv->vval.v_blob != NULL)) |
1929 { | 1929 { |
1930 if (!quiet) | 1930 if (!quiet) |
1931 EMSG(_("E689: Can only index a List, Dictionary or Blob")); | 1931 emsg(_("E689: Can only index a List, Dictionary or Blob")); |
1932 return NULL; | 1932 return NULL; |
1933 } | 1933 } |
1934 if (lp->ll_range) | 1934 if (lp->ll_range) |
1935 { | 1935 { |
1936 if (!quiet) | 1936 if (!quiet) |
1937 EMSG(_("E708: [:] must come last")); | 1937 emsg(_("E708: [:] must come last")); |
1938 return NULL; | 1938 return NULL; |
1939 } | 1939 } |
1940 | 1940 |
1941 len = -1; | 1941 len = -1; |
1942 if (*p == '.') | 1942 if (*p == '.') |
1945 for (len = 0; ASCII_ISALNUM(key[len]) || key[len] == '_'; ++len) | 1945 for (len = 0; ASCII_ISALNUM(key[len]) || key[len] == '_'; ++len) |
1946 ; | 1946 ; |
1947 if (len == 0) | 1947 if (len == 0) |
1948 { | 1948 { |
1949 if (!quiet) | 1949 if (!quiet) |
1950 EMSG(_(e_emptykey)); | 1950 emsg(_(e_emptykey)); |
1951 return NULL; | 1951 return NULL; |
1952 } | 1952 } |
1953 p = key + len; | 1953 p = key + len; |
1954 } | 1954 } |
1955 else | 1955 else |
1975 if (*p == ':') | 1975 if (*p == ':') |
1976 { | 1976 { |
1977 if (lp->ll_tv->v_type == VAR_DICT) | 1977 if (lp->ll_tv->v_type == VAR_DICT) |
1978 { | 1978 { |
1979 if (!quiet) | 1979 if (!quiet) |
1980 EMSG(_(e_dictrange)); | 1980 emsg(_(e_dictrange)); |
1981 clear_tv(&var1); | 1981 clear_tv(&var1); |
1982 return NULL; | 1982 return NULL; |
1983 } | 1983 } |
1984 if (rettv != NULL | 1984 if (rettv != NULL |
1985 && !(rettv->v_type == VAR_LIST | 1985 && !(rettv->v_type == VAR_LIST |
1986 && rettv->vval.v_list != NULL) | 1986 && rettv->vval.v_list != NULL) |
1987 && !(rettv->v_type == VAR_BLOB | 1987 && !(rettv->v_type == VAR_BLOB |
1988 && rettv->vval.v_blob != NULL)) | 1988 && rettv->vval.v_blob != NULL)) |
1989 { | 1989 { |
1990 if (!quiet) | 1990 if (!quiet) |
1991 EMSG(_("E709: [:] requires a List or Blob value")); | 1991 emsg(_("E709: [:] requires a List or Blob value")); |
1992 clear_tv(&var1); | 1992 clear_tv(&var1); |
1993 return NULL; | 1993 return NULL; |
1994 } | 1994 } |
1995 p = skipwhite(p + 1); | 1995 p = skipwhite(p + 1); |
1996 if (*p == ']') | 1996 if (*p == ']') |
2017 lp->ll_range = FALSE; | 2017 lp->ll_range = FALSE; |
2018 | 2018 |
2019 if (*p != ']') | 2019 if (*p != ']') |
2020 { | 2020 { |
2021 if (!quiet) | 2021 if (!quiet) |
2022 EMSG(_(e_missbrac)); | 2022 emsg(_(e_missbrac)); |
2023 clear_tv(&var1); | 2023 clear_tv(&var1); |
2024 clear_tv(&var2); | 2024 clear_tv(&var2); |
2025 return NULL; | 2025 return NULL; |
2026 } | 2026 } |
2027 | 2027 |
2073 if (lp->ll_di == NULL) | 2073 if (lp->ll_di == NULL) |
2074 { | 2074 { |
2075 /* Can't add "v:" variable. */ | 2075 /* Can't add "v:" variable. */ |
2076 if (lp->ll_dict == &vimvardict) | 2076 if (lp->ll_dict == &vimvardict) |
2077 { | 2077 { |
2078 EMSG2(_(e_illvar), name); | 2078 semsg(_(e_illvar), name); |
2079 return NULL; | 2079 return NULL; |
2080 } | 2080 } |
2081 | 2081 |
2082 /* Key does not exist in dict: may need to add it. */ | 2082 /* Key does not exist in dict: may need to add it. */ |
2083 if (*p == '[' || *p == '.' || unlet) | 2083 if (*p == '[' || *p == '.' || unlet) |
2084 { | 2084 { |
2085 if (!quiet) | 2085 if (!quiet) |
2086 EMSG2(_(e_dictkey), key); | 2086 semsg(_(e_dictkey), key); |
2087 clear_tv(&var1); | 2087 clear_tv(&var1); |
2088 return NULL; | 2088 return NULL; |
2089 } | 2089 } |
2090 if (len == -1) | 2090 if (len == -1) |
2091 lp->ll_newkey = vim_strsave(key); | 2091 lp->ll_newkey = vim_strsave(key); |
2124 if (lp->ll_n1 < 0 | 2124 if (lp->ll_n1 < 0 |
2125 || lp->ll_n1 > bloblen | 2125 || lp->ll_n1 > bloblen |
2126 || (lp->ll_range && lp->ll_n1 == bloblen)) | 2126 || (lp->ll_range && lp->ll_n1 == bloblen)) |
2127 { | 2127 { |
2128 if (!quiet) | 2128 if (!quiet) |
2129 EMSGN(_(e_blobidx), lp->ll_n1); | 2129 semsg(_(e_blobidx), lp->ll_n1); |
2130 clear_tv(&var2); | 2130 clear_tv(&var2); |
2131 return NULL; | 2131 return NULL; |
2132 } | 2132 } |
2133 if (lp->ll_range && !lp->ll_empty2) | 2133 if (lp->ll_range && !lp->ll_empty2) |
2134 { | 2134 { |
2137 if (lp->ll_n2 < 0 | 2137 if (lp->ll_n2 < 0 |
2138 || lp->ll_n2 >= bloblen | 2138 || lp->ll_n2 >= bloblen |
2139 || lp->ll_n2 < lp->ll_n1) | 2139 || lp->ll_n2 < lp->ll_n1) |
2140 { | 2140 { |
2141 if (!quiet) | 2141 if (!quiet) |
2142 EMSGN(_(e_blobidx), lp->ll_n2); | 2142 semsg(_(e_blobidx), lp->ll_n2); |
2143 return NULL; | 2143 return NULL; |
2144 } | 2144 } |
2145 } | 2145 } |
2146 lp->ll_blob = lp->ll_tv->vval.v_blob; | 2146 lp->ll_blob = lp->ll_tv->vval.v_blob; |
2147 lp->ll_tv = NULL; | 2147 lp->ll_tv = NULL; |
2171 } | 2171 } |
2172 if (lp->ll_li == NULL) | 2172 if (lp->ll_li == NULL) |
2173 { | 2173 { |
2174 clear_tv(&var2); | 2174 clear_tv(&var2); |
2175 if (!quiet) | 2175 if (!quiet) |
2176 EMSGN(_(e_listidx), lp->ll_n1); | 2176 semsg(_(e_listidx), lp->ll_n1); |
2177 return NULL; | 2177 return NULL; |
2178 } | 2178 } |
2179 | 2179 |
2180 /* | 2180 /* |
2181 * May need to find the item or absolute index for the second | 2181 * May need to find the item or absolute index for the second |
2192 { | 2192 { |
2193 ni = list_find(lp->ll_list, lp->ll_n2); | 2193 ni = list_find(lp->ll_list, lp->ll_n2); |
2194 if (ni == NULL) | 2194 if (ni == NULL) |
2195 { | 2195 { |
2196 if (!quiet) | 2196 if (!quiet) |
2197 EMSGN(_(e_listidx), lp->ll_n2); | 2197 semsg(_(e_listidx), lp->ll_n2); |
2198 return NULL; | 2198 return NULL; |
2199 } | 2199 } |
2200 lp->ll_n2 = list_idx_of_item(lp->ll_list, ni); | 2200 lp->ll_n2 = list_idx_of_item(lp->ll_list, ni); |
2201 } | 2201 } |
2202 | 2202 |
2204 if (lp->ll_n1 < 0) | 2204 if (lp->ll_n1 < 0) |
2205 lp->ll_n1 = list_idx_of_item(lp->ll_list, lp->ll_li); | 2205 lp->ll_n1 = list_idx_of_item(lp->ll_list, lp->ll_li); |
2206 if (lp->ll_n2 < lp->ll_n1) | 2206 if (lp->ll_n2 < lp->ll_n1) |
2207 { | 2207 { |
2208 if (!quiet) | 2208 if (!quiet) |
2209 EMSGN(_(e_listidx), lp->ll_n2); | 2209 semsg(_(e_listidx), lp->ll_n2); |
2210 return NULL; | 2210 return NULL; |
2211 } | 2211 } |
2212 } | 2212 } |
2213 | 2213 |
2214 lp->ll_tv = &lp->ll_li->li_tv; | 2214 lp->ll_tv = &lp->ll_li->li_tv; |
2254 { | 2254 { |
2255 int error = FALSE, val; | 2255 int error = FALSE, val; |
2256 | 2256 |
2257 if (op != NULL && *op != '=') | 2257 if (op != NULL && *op != '=') |
2258 { | 2258 { |
2259 EMSG2(_(e_letwrong), op); | 2259 semsg(_(e_letwrong), op); |
2260 return; | 2260 return; |
2261 } | 2261 } |
2262 | 2262 |
2263 if (lp->ll_range && rettv->v_type == VAR_BLOB) | 2263 if (lp->ll_range && rettv->v_type == VAR_BLOB) |
2264 { | 2264 { |
2267 if (lp->ll_empty2) | 2267 if (lp->ll_empty2) |
2268 lp->ll_n2 = blob_len(lp->ll_blob) - 1; | 2268 lp->ll_n2 = blob_len(lp->ll_blob) - 1; |
2269 | 2269 |
2270 if (lp->ll_n2 - lp->ll_n1 + 1 != blob_len(rettv->vval.v_blob)) | 2270 if (lp->ll_n2 - lp->ll_n1 + 1 != blob_len(rettv->vval.v_blob)) |
2271 { | 2271 { |
2272 EMSG(_("E972: Blob value does not have the right number of bytes")); | 2272 emsg(_("E972: Blob value does not have the right number of bytes")); |
2273 return; | 2273 return; |
2274 } | 2274 } |
2275 if (lp->ll_empty2) | 2275 if (lp->ll_empty2) |
2276 lp->ll_n2 = blob_len(lp->ll_blob); | 2276 lp->ll_n2 = blob_len(lp->ll_blob); |
2277 | 2277 |
2372 } | 2372 } |
2373 lp->ll_li = lp->ll_li->li_next; | 2373 lp->ll_li = lp->ll_li->li_next; |
2374 ++lp->ll_n1; | 2374 ++lp->ll_n1; |
2375 } | 2375 } |
2376 if (ri != NULL) | 2376 if (ri != NULL) |
2377 EMSG(_("E710: List value has more items than target")); | 2377 emsg(_("E710: List value has more items than target")); |
2378 else if (lp->ll_empty2 | 2378 else if (lp->ll_empty2 |
2379 ? (lp->ll_li != NULL && lp->ll_li->li_next != NULL) | 2379 ? (lp->ll_li != NULL && lp->ll_li->li_next != NULL) |
2380 : lp->ll_n1 != lp->ll_n2) | 2380 : lp->ll_n1 != lp->ll_n2) |
2381 EMSG(_("E711: List value has not enough items")); | 2381 emsg(_("E711: List value has not enough items")); |
2382 } | 2382 } |
2383 else | 2383 else |
2384 { | 2384 { |
2385 /* | 2385 /* |
2386 * Assign to a List or Dictionary item. | 2386 * Assign to a List or Dictionary item. |
2387 */ | 2387 */ |
2388 if (lp->ll_newkey != NULL) | 2388 if (lp->ll_newkey != NULL) |
2389 { | 2389 { |
2390 if (op != NULL && *op != '=') | 2390 if (op != NULL && *op != '=') |
2391 { | 2391 { |
2392 EMSG2(_(e_letwrong), op); | 2392 semsg(_(e_letwrong), op); |
2393 return; | 2393 return; |
2394 } | 2394 } |
2395 | 2395 |
2396 /* Need to add an item to the Dictionary. */ | 2396 /* Need to add an item to the Dictionary. */ |
2397 di = dictitem_alloc(lp->ll_newkey); | 2397 di = dictitem_alloc(lp->ll_newkey); |
2542 #endif | 2542 #endif |
2543 return OK; | 2543 return OK; |
2544 } | 2544 } |
2545 } | 2545 } |
2546 | 2546 |
2547 EMSG2(_(e_letwrong), op); | 2547 semsg(_(e_letwrong), op); |
2548 return FAIL; | 2548 return FAIL; |
2549 } | 2549 } |
2550 | 2550 |
2551 /* | 2551 /* |
2552 * Evaluate the expression used in a ":for var in expr" command. | 2552 * Evaluate the expression used in a ":for var in expr" command. |
2578 return fi; | 2578 return fi; |
2579 | 2579 |
2580 expr = skipwhite(expr); | 2580 expr = skipwhite(expr); |
2581 if (expr[0] != 'i' || expr[1] != 'n' || !VIM_ISWHITE(expr[2])) | 2581 if (expr[0] != 'i' || expr[1] != 'n' || !VIM_ISWHITE(expr[2])) |
2582 { | 2582 { |
2583 EMSG(_("E690: Missing \"in\" after :for")); | 2583 emsg(_("E690: Missing \"in\" after :for")); |
2584 return fi; | 2584 return fi; |
2585 } | 2585 } |
2586 | 2586 |
2587 if (skip) | 2587 if (skip) |
2588 ++emsg_skip; | 2588 ++emsg_skip; |
2621 fi->fi_bi = 0; | 2621 fi->fi_bi = 0; |
2622 } | 2622 } |
2623 } | 2623 } |
2624 else | 2624 else |
2625 { | 2625 { |
2626 EMSG(_(e_listreq)); | 2626 emsg(_(e_listreq)); |
2627 clear_tv(&tv); | 2627 clear_tv(&tv); |
2628 } | 2628 } |
2629 } | 2629 } |
2630 } | 2630 } |
2631 if (skip) | 2631 if (skip) |
2858 { | 2858 { |
2859 char_u *name = ++arg; | 2859 char_u *name = ++arg; |
2860 | 2860 |
2861 if (get_env_len(&arg) == 0) | 2861 if (get_env_len(&arg) == 0) |
2862 { | 2862 { |
2863 EMSG2(_(e_invarg2), name - 1); | 2863 semsg(_(e_invarg2), name - 1); |
2864 return; | 2864 return; |
2865 } | 2865 } |
2866 vim_unsetenv(name); | 2866 vim_unsetenv(name); |
2867 arg = skipwhite(arg); | 2867 arg = skipwhite(arg); |
2868 continue; | 2868 continue; |
2877 && !ends_excmd(*name_end))) | 2877 && !ends_excmd(*name_end))) |
2878 { | 2878 { |
2879 if (name_end != NULL) | 2879 if (name_end != NULL) |
2880 { | 2880 { |
2881 emsg_severe = TRUE; | 2881 emsg_severe = TRUE; |
2882 EMSG(_(e_trailing)); | 2882 emsg(_(e_trailing)); |
2883 } | 2883 } |
2884 if (!(eap->skip || error)) | 2884 if (!(eap->skip || error)) |
2885 clear_lval(&lv); | 2885 clear_lval(&lv); |
2886 break; | 2886 break; |
2887 } | 2887 } |
3020 return OK; | 3020 return OK; |
3021 } | 3021 } |
3022 } | 3022 } |
3023 if (forceit) | 3023 if (forceit) |
3024 return OK; | 3024 return OK; |
3025 EMSG2(_("E108: No such variable: \"%s\""), name); | 3025 semsg(_("E108: No such variable: \"%s\""), name); |
3026 return FAIL; | 3026 return FAIL; |
3027 } | 3027 } |
3028 | 3028 |
3029 /* | 3029 /* |
3030 * Lock or unlock variable indicated by "lp". | 3030 * Lock or unlock variable indicated by "lp". |
3057 else if ((di->di_flags & DI_FLAGS_FIX) | 3057 else if ((di->di_flags & DI_FLAGS_FIX) |
3058 && di->di_tv.v_type != VAR_DICT | 3058 && di->di_tv.v_type != VAR_DICT |
3059 && di->di_tv.v_type != VAR_LIST) | 3059 && di->di_tv.v_type != VAR_LIST) |
3060 /* For historic reasons this error is not given for a list or dict. | 3060 /* For historic reasons this error is not given for a list or dict. |
3061 * E.g., the b: dict could be locked/unlocked. */ | 3061 * E.g., the b: dict could be locked/unlocked. */ |
3062 EMSG2(_("E940: Cannot lock or unlock variable %s"), lp->ll_name); | 3062 semsg(_("E940: Cannot lock or unlock variable %s"), lp->ll_name); |
3063 else | 3063 else |
3064 { | 3064 { |
3065 if (lock) | 3065 if (lock) |
3066 di->di_flags |= DI_FLAGS_LOCK; | 3066 di->di_flags |= DI_FLAGS_LOCK; |
3067 else | 3067 else |
3106 hashitem_T *hi; | 3106 hashitem_T *hi; |
3107 int todo; | 3107 int todo; |
3108 | 3108 |
3109 if (recurse >= DICT_MAXNEST) | 3109 if (recurse >= DICT_MAXNEST) |
3110 { | 3110 { |
3111 EMSG(_("E743: variable nested too deep for (un)lock")); | 3111 emsg(_("E743: variable nested too deep for (un)lock")); |
3112 return; | 3112 return; |
3113 } | 3113 } |
3114 if (deep == 0) | 3114 if (deep == 0) |
3115 return; | 3115 return; |
3116 ++recurse; | 3116 ++recurse; |
3391 * exception, or we already gave a more specific error. | 3391 * exception, or we already gave a more specific error. |
3392 * Also check called_emsg for when using assert_fails(). | 3392 * Also check called_emsg for when using assert_fails(). |
3393 */ | 3393 */ |
3394 if (!aborting() && did_emsg == did_emsg_before | 3394 if (!aborting() && did_emsg == did_emsg_before |
3395 && called_emsg == called_emsg_before) | 3395 && called_emsg == called_emsg_before) |
3396 EMSG2(_(e_invexpr2), arg); | 3396 semsg(_(e_invexpr2), arg); |
3397 ret = FAIL; | 3397 ret = FAIL; |
3398 } | 3398 } |
3399 if (nextcmd != NULL) | 3399 if (nextcmd != NULL) |
3400 *nextcmd = check_nextcmd(p); | 3400 *nextcmd = check_nextcmd(p); |
3401 | 3401 |
3449 /* | 3449 /* |
3450 * Check for the ":". | 3450 * Check for the ":". |
3451 */ | 3451 */ |
3452 if ((*arg)[0] != ':') | 3452 if ((*arg)[0] != ':') |
3453 { | 3453 { |
3454 EMSG(_("E109: Missing ':' after '?'")); | 3454 emsg(_("E109: Missing ':' after '?'")); |
3455 if (evaluate && result) | 3455 if (evaluate && result) |
3456 clear_tv(rettv); | 3456 clear_tv(rettv); |
3457 return FAIL; | 3457 return FAIL; |
3458 } | 3458 } |
3459 | 3459 |
4056 f1 = f1 / f2; | 4056 f1 = f1 / f2; |
4057 # endif | 4057 # endif |
4058 } | 4058 } |
4059 else | 4059 else |
4060 { | 4060 { |
4061 EMSG(_("E804: Cannot use '%' with Float")); | 4061 emsg(_("E804: Cannot use '%' with Float")); |
4062 return FAIL; | 4062 return FAIL; |
4063 } | 4063 } |
4064 rettv->v_type = VAR_FLOAT; | 4064 rettv->v_type = VAR_FLOAT; |
4065 rettv->vval.v_float = f1; | 4065 rettv->vval.v_float = f1; |
4066 } | 4066 } |
4221 { | 4221 { |
4222 if (!vim_isxdigit(bp[1])) | 4222 if (!vim_isxdigit(bp[1])) |
4223 { | 4223 { |
4224 if (blob != NULL) | 4224 if (blob != NULL) |
4225 { | 4225 { |
4226 EMSG(_("E973: Blob literal should have an even number of hex characters")); | 4226 emsg(_("E973: Blob literal should have an even number of hex characters")); |
4227 ga_clear(&blob->bv_ga); | 4227 ga_clear(&blob->bv_ga); |
4228 VIM_CLEAR(blob); | 4228 VIM_CLEAR(blob); |
4229 } | 4229 } |
4230 ret = FAIL; | 4230 ret = FAIL; |
4231 break; | 4231 break; |
4312 ret = eval1(arg, rettv, evaluate); /* recursive! */ | 4312 ret = eval1(arg, rettv, evaluate); /* recursive! */ |
4313 if (**arg == ')') | 4313 if (**arg == ')') |
4314 ++*arg; | 4314 ++*arg; |
4315 else if (ret == OK) | 4315 else if (ret == OK) |
4316 { | 4316 { |
4317 EMSG(_("E110: Missing ')'")); | 4317 emsg(_("E110: Missing ')'")); |
4318 clear_tv(rettv); | 4318 clear_tv(rettv); |
4319 ret = FAIL; | 4319 ret = FAIL; |
4320 } | 4320 } |
4321 break; | 4321 break; |
4322 | 4322 |
4486 switch (rettv->v_type) | 4486 switch (rettv->v_type) |
4487 { | 4487 { |
4488 case VAR_FUNC: | 4488 case VAR_FUNC: |
4489 case VAR_PARTIAL: | 4489 case VAR_PARTIAL: |
4490 if (verbose) | 4490 if (verbose) |
4491 EMSG(_("E695: Cannot index a Funcref")); | 4491 emsg(_("E695: Cannot index a Funcref")); |
4492 return FAIL; | 4492 return FAIL; |
4493 case VAR_FLOAT: | 4493 case VAR_FLOAT: |
4494 #ifdef FEAT_FLOAT | 4494 #ifdef FEAT_FLOAT |
4495 if (verbose) | 4495 if (verbose) |
4496 EMSG(_(e_float_as_string)); | 4496 emsg(_(e_float_as_string)); |
4497 return FAIL; | 4497 return FAIL; |
4498 #endif | 4498 #endif |
4499 case VAR_SPECIAL: | 4499 case VAR_SPECIAL: |
4500 case VAR_JOB: | 4500 case VAR_JOB: |
4501 case VAR_CHANNEL: | 4501 case VAR_CHANNEL: |
4502 if (verbose) | 4502 if (verbose) |
4503 EMSG(_("E909: Cannot index a special variable")); | 4503 emsg(_("E909: Cannot index a special variable")); |
4504 return FAIL; | 4504 return FAIL; |
4505 case VAR_UNKNOWN: | 4505 case VAR_UNKNOWN: |
4506 if (evaluate) | 4506 if (evaluate) |
4507 return FAIL; | 4507 return FAIL; |
4508 /* FALLTHROUGH */ | 4508 /* FALLTHROUGH */ |
4575 | 4575 |
4576 /* Check for the ']'. */ | 4576 /* Check for the ']'. */ |
4577 if (**arg != ']') | 4577 if (**arg != ']') |
4578 { | 4578 { |
4579 if (verbose) | 4579 if (verbose) |
4580 EMSG(_(e_missbrac)); | 4580 emsg(_(e_missbrac)); |
4581 clear_tv(&var1); | 4581 clear_tv(&var1); |
4582 if (range) | 4582 if (range) |
4583 clear_tv(&var2); | 4583 clear_tv(&var2); |
4584 return FAIL; | 4584 return FAIL; |
4585 } | 4585 } |
4709 clear_tv(rettv); | 4709 clear_tv(rettv); |
4710 rettv->v_type = VAR_NUMBER; | 4710 rettv->v_type = VAR_NUMBER; |
4711 rettv->vval.v_number = v; | 4711 rettv->vval.v_number = v; |
4712 } | 4712 } |
4713 else | 4713 else |
4714 EMSGN(_(e_blobidx), n1); | 4714 semsg(_(e_blobidx), n1); |
4715 } | 4715 } |
4716 break; | 4716 break; |
4717 | 4717 |
4718 case VAR_LIST: | 4718 case VAR_LIST: |
4719 len = list_len(rettv->vval.v_list); | 4719 len = list_len(rettv->vval.v_list); |
4724 /* For a range we allow invalid values and return an empty | 4724 /* For a range we allow invalid values and return an empty |
4725 * list. A list index out of range is an error. */ | 4725 * list. A list index out of range is an error. */ |
4726 if (!range) | 4726 if (!range) |
4727 { | 4727 { |
4728 if (verbose) | 4728 if (verbose) |
4729 EMSGN(_(e_listidx), n1); | 4729 semsg(_(e_listidx), n1); |
4730 return FAIL; | 4730 return FAIL; |
4731 } | 4731 } |
4732 n1 = len; | 4732 n1 = len; |
4733 } | 4733 } |
4734 if (range) | 4734 if (range) |
4768 | 4768 |
4769 case VAR_DICT: | 4769 case VAR_DICT: |
4770 if (range) | 4770 if (range) |
4771 { | 4771 { |
4772 if (verbose) | 4772 if (verbose) |
4773 EMSG(_(e_dictrange)); | 4773 emsg(_(e_dictrange)); |
4774 if (len == -1) | 4774 if (len == -1) |
4775 clear_tv(&var1); | 4775 clear_tv(&var1); |
4776 return FAIL; | 4776 return FAIL; |
4777 } | 4777 } |
4778 { | 4778 { |
4789 } | 4789 } |
4790 | 4790 |
4791 item = dict_find(rettv->vval.v_dict, key, (int)len); | 4791 item = dict_find(rettv->vval.v_dict, key, (int)len); |
4792 | 4792 |
4793 if (item == NULL && verbose) | 4793 if (item == NULL && verbose) |
4794 EMSG2(_(e_dictkey), key); | 4794 semsg(_(e_dictkey), key); |
4795 if (len == -1) | 4795 if (len == -1) |
4796 clear_tv(&var1); | 4796 clear_tv(&var1); |
4797 if (item == NULL) | 4797 if (item == NULL) |
4798 return FAIL; | 4798 return FAIL; |
4799 | 4799 |
4834 */ | 4834 */ |
4835 option_end = find_option_end(arg, &opt_flags); | 4835 option_end = find_option_end(arg, &opt_flags); |
4836 if (option_end == NULL) | 4836 if (option_end == NULL) |
4837 { | 4837 { |
4838 if (rettv != NULL) | 4838 if (rettv != NULL) |
4839 EMSG2(_("E112: Option name missing: %s"), *arg); | 4839 semsg(_("E112: Option name missing: %s"), *arg); |
4840 return FAIL; | 4840 return FAIL; |
4841 } | 4841 } |
4842 | 4842 |
4843 if (!evaluate) | 4843 if (!evaluate) |
4844 { | 4844 { |
4852 rettv == NULL ? NULL : &stringval, opt_flags); | 4852 rettv == NULL ? NULL : &stringval, opt_flags); |
4853 | 4853 |
4854 if (opt_type == -3) /* invalid name */ | 4854 if (opt_type == -3) /* invalid name */ |
4855 { | 4855 { |
4856 if (rettv != NULL) | 4856 if (rettv != NULL) |
4857 EMSG2(_("E113: Unknown option: %s"), *arg); | 4857 semsg(_("E113: Unknown option: %s"), *arg); |
4858 ret = FAIL; | 4858 ret = FAIL; |
4859 } | 4859 } |
4860 else if (rettv != NULL) | 4860 else if (rettv != NULL) |
4861 { | 4861 { |
4862 if (opt_type == -2) /* hidden string option */ | 4862 if (opt_type == -2) /* hidden string option */ |
4915 } | 4915 } |
4916 } | 4916 } |
4917 | 4917 |
4918 if (*p != '"') | 4918 if (*p != '"') |
4919 { | 4919 { |
4920 EMSG2(_("E114: Missing quote: %s"), *arg); | 4920 semsg(_("E114: Missing quote: %s"), *arg); |
4921 return FAIL; | 4921 return FAIL; |
4922 } | 4922 } |
4923 | 4923 |
4924 /* If only parsing, set *arg and return here */ | 4924 /* If only parsing, set *arg and return here */ |
4925 if (!evaluate) | 4925 if (!evaluate) |
5052 } | 5052 } |
5053 } | 5053 } |
5054 | 5054 |
5055 if (*p != '\'') | 5055 if (*p != '\'') |
5056 { | 5056 { |
5057 EMSG2(_("E115: Missing quote: %s"), *arg); | 5057 semsg(_("E115: Missing quote: %s"), *arg); |
5058 return FAIL; | 5058 return FAIL; |
5059 } | 5059 } |
5060 | 5060 |
5061 /* If only parsing return after setting "*arg" */ | 5061 /* If only parsing return after setting "*arg" */ |
5062 if (!evaluate) | 5062 if (!evaluate) |
5796 { | 5796 { |
5797 /* Only give this message once for a recursive call to avoid | 5797 /* Only give this message once for a recursive call to avoid |
5798 * flooding the user with errors. And stop iterating over lists | 5798 * flooding the user with errors. And stop iterating over lists |
5799 * and dicts. */ | 5799 * and dicts. */ |
5800 did_echo_string_emsg = TRUE; | 5800 did_echo_string_emsg = TRUE; |
5801 EMSG(_("E724: variable nested too deep for displaying")); | 5801 emsg(_("E724: variable nested too deep for displaying")); |
5802 } | 5802 } |
5803 *tofree = NULL; | 5803 *tofree = NULL; |
5804 return (char_u *)"{E724}"; | 5804 return (char_u *)"{E724}"; |
5805 } | 5805 } |
5806 ++recurse; | 5806 ++recurse; |
6437 | 6437 |
6438 len += get_id_len(arg); | 6438 len += get_id_len(arg); |
6439 // Only give an error when there is something, otherwise it will be | 6439 // Only give an error when there is something, otherwise it will be |
6440 // reported at a higher level. | 6440 // reported at a higher level. |
6441 if (len == 0 && verbose && **arg != NUL) | 6441 if (len == 0 && verbose && **arg != NUL) |
6442 EMSG2(_(e_invexpr2), *arg); | 6442 semsg(_(e_invexpr2), *arg); |
6443 | 6443 |
6444 return len; | 6444 return len; |
6445 } | 6445 } |
6446 | 6446 |
6447 /* | 6447 /* |
6935 } | 6935 } |
6936 | 6936 |
6937 if (tv == NULL) | 6937 if (tv == NULL) |
6938 { | 6938 { |
6939 if (rettv != NULL && verbose) | 6939 if (rettv != NULL && verbose) |
6940 EMSG2(_(e_undefvar), name); | 6940 semsg(_(e_undefvar), name); |
6941 ret = FAIL; | 6941 ret = FAIL; |
6942 } | 6942 } |
6943 else if (rettv != NULL) | 6943 else if (rettv != NULL) |
6944 copy_tv(tv, rettv); | 6944 copy_tv(tv, rettv); |
6945 | 6945 |
7249 { | 7249 { |
7250 case VAR_NUMBER: | 7250 case VAR_NUMBER: |
7251 return varp->vval.v_number; | 7251 return varp->vval.v_number; |
7252 case VAR_FLOAT: | 7252 case VAR_FLOAT: |
7253 #ifdef FEAT_FLOAT | 7253 #ifdef FEAT_FLOAT |
7254 EMSG(_("E805: Using a Float as a Number")); | 7254 emsg(_("E805: Using a Float as a Number")); |
7255 break; | 7255 break; |
7256 #endif | 7256 #endif |
7257 case VAR_FUNC: | 7257 case VAR_FUNC: |
7258 case VAR_PARTIAL: | 7258 case VAR_PARTIAL: |
7259 EMSG(_("E703: Using a Funcref as a Number")); | 7259 emsg(_("E703: Using a Funcref as a Number")); |
7260 break; | 7260 break; |
7261 case VAR_STRING: | 7261 case VAR_STRING: |
7262 if (varp->vval.v_string != NULL) | 7262 if (varp->vval.v_string != NULL) |
7263 vim_str2nr(varp->vval.v_string, NULL, NULL, | 7263 vim_str2nr(varp->vval.v_string, NULL, NULL, |
7264 STR2NR_ALL, &n, NULL, 0); | 7264 STR2NR_ALL, &n, NULL, 0); |
7265 return n; | 7265 return n; |
7266 case VAR_LIST: | 7266 case VAR_LIST: |
7267 EMSG(_("E745: Using a List as a Number")); | 7267 emsg(_("E745: Using a List as a Number")); |
7268 break; | 7268 break; |
7269 case VAR_DICT: | 7269 case VAR_DICT: |
7270 EMSG(_("E728: Using a Dictionary as a Number")); | 7270 emsg(_("E728: Using a Dictionary as a Number")); |
7271 break; | 7271 break; |
7272 case VAR_SPECIAL: | 7272 case VAR_SPECIAL: |
7273 return varp->vval.v_number == VVAL_TRUE ? 1 : 0; | 7273 return varp->vval.v_number == VVAL_TRUE ? 1 : 0; |
7274 break; | 7274 break; |
7275 case VAR_JOB: | 7275 case VAR_JOB: |
7276 #ifdef FEAT_JOB_CHANNEL | 7276 #ifdef FEAT_JOB_CHANNEL |
7277 EMSG(_("E910: Using a Job as a Number")); | 7277 emsg(_("E910: Using a Job as a Number")); |
7278 break; | 7278 break; |
7279 #endif | 7279 #endif |
7280 case VAR_CHANNEL: | 7280 case VAR_CHANNEL: |
7281 #ifdef FEAT_JOB_CHANNEL | 7281 #ifdef FEAT_JOB_CHANNEL |
7282 EMSG(_("E913: Using a Channel as a Number")); | 7282 emsg(_("E913: Using a Channel as a Number")); |
7283 break; | 7283 break; |
7284 #endif | 7284 #endif |
7285 case VAR_BLOB: | 7285 case VAR_BLOB: |
7286 EMSG(_("E974: Using a Blob as a Number")); | 7286 emsg(_("E974: Using a Blob as a Number")); |
7287 break; | 7287 break; |
7288 case VAR_UNKNOWN: | 7288 case VAR_UNKNOWN: |
7289 internal_error("tv_get_number(UNKNOWN)"); | 7289 internal_error("tv_get_number(UNKNOWN)"); |
7290 break; | 7290 break; |
7291 } | 7291 } |
7306 return (float_T)(varp->vval.v_number); | 7306 return (float_T)(varp->vval.v_number); |
7307 case VAR_FLOAT: | 7307 case VAR_FLOAT: |
7308 return varp->vval.v_float; | 7308 return varp->vval.v_float; |
7309 case VAR_FUNC: | 7309 case VAR_FUNC: |
7310 case VAR_PARTIAL: | 7310 case VAR_PARTIAL: |
7311 EMSG(_("E891: Using a Funcref as a Float")); | 7311 emsg(_("E891: Using a Funcref as a Float")); |
7312 break; | 7312 break; |
7313 case VAR_STRING: | 7313 case VAR_STRING: |
7314 EMSG(_("E892: Using a String as a Float")); | 7314 emsg(_("E892: Using a String as a Float")); |
7315 break; | 7315 break; |
7316 case VAR_LIST: | 7316 case VAR_LIST: |
7317 EMSG(_("E893: Using a List as a Float")); | 7317 emsg(_("E893: Using a List as a Float")); |
7318 break; | 7318 break; |
7319 case VAR_DICT: | 7319 case VAR_DICT: |
7320 EMSG(_("E894: Using a Dictionary as a Float")); | 7320 emsg(_("E894: Using a Dictionary as a Float")); |
7321 break; | 7321 break; |
7322 case VAR_SPECIAL: | 7322 case VAR_SPECIAL: |
7323 EMSG(_("E907: Using a special value as a Float")); | 7323 emsg(_("E907: Using a special value as a Float")); |
7324 break; | 7324 break; |
7325 case VAR_JOB: | 7325 case VAR_JOB: |
7326 # ifdef FEAT_JOB_CHANNEL | 7326 # ifdef FEAT_JOB_CHANNEL |
7327 EMSG(_("E911: Using a Job as a Float")); | 7327 emsg(_("E911: Using a Job as a Float")); |
7328 break; | 7328 break; |
7329 # endif | 7329 # endif |
7330 case VAR_CHANNEL: | 7330 case VAR_CHANNEL: |
7331 # ifdef FEAT_JOB_CHANNEL | 7331 # ifdef FEAT_JOB_CHANNEL |
7332 EMSG(_("E914: Using a Channel as a Float")); | 7332 emsg(_("E914: Using a Channel as a Float")); |
7333 break; | 7333 break; |
7334 # endif | 7334 # endif |
7335 case VAR_BLOB: | 7335 case VAR_BLOB: |
7336 EMSG(_("E975: Using a Blob as a Float")); | 7336 emsg(_("E975: Using a Blob as a Float")); |
7337 break; | 7337 break; |
7338 case VAR_UNKNOWN: | 7338 case VAR_UNKNOWN: |
7339 internal_error("tv_get_float(UNKNOWN)"); | 7339 internal_error("tv_get_float(UNKNOWN)"); |
7340 break; | 7340 break; |
7341 } | 7341 } |
7389 vim_snprintf((char *)buf, NUMBUFLEN, "%lld", | 7389 vim_snprintf((char *)buf, NUMBUFLEN, "%lld", |
7390 (long long)varp->vval.v_number); | 7390 (long long)varp->vval.v_number); |
7391 return buf; | 7391 return buf; |
7392 case VAR_FUNC: | 7392 case VAR_FUNC: |
7393 case VAR_PARTIAL: | 7393 case VAR_PARTIAL: |
7394 EMSG(_("E729: using Funcref as a String")); | 7394 emsg(_("E729: using Funcref as a String")); |
7395 break; | 7395 break; |
7396 case VAR_LIST: | 7396 case VAR_LIST: |
7397 EMSG(_("E730: using List as a String")); | 7397 emsg(_("E730: using List as a String")); |
7398 break; | 7398 break; |
7399 case VAR_DICT: | 7399 case VAR_DICT: |
7400 EMSG(_("E731: using Dictionary as a String")); | 7400 emsg(_("E731: using Dictionary as a String")); |
7401 break; | 7401 break; |
7402 case VAR_FLOAT: | 7402 case VAR_FLOAT: |
7403 #ifdef FEAT_FLOAT | 7403 #ifdef FEAT_FLOAT |
7404 EMSG(_(e_float_as_string)); | 7404 emsg(_(e_float_as_string)); |
7405 break; | 7405 break; |
7406 #endif | 7406 #endif |
7407 case VAR_STRING: | 7407 case VAR_STRING: |
7408 if (varp->vval.v_string != NULL) | 7408 if (varp->vval.v_string != NULL) |
7409 return varp->vval.v_string; | 7409 return varp->vval.v_string; |
7410 return (char_u *)""; | 7410 return (char_u *)""; |
7411 case VAR_SPECIAL: | 7411 case VAR_SPECIAL: |
7412 STRCPY(buf, get_var_special_name(varp->vval.v_number)); | 7412 STRCPY(buf, get_var_special_name(varp->vval.v_number)); |
7413 return buf; | 7413 return buf; |
7414 case VAR_BLOB: | 7414 case VAR_BLOB: |
7415 EMSG(_("E976: using Blob as a String")); | 7415 emsg(_("E976: using Blob as a String")); |
7416 break; | 7416 break; |
7417 case VAR_JOB: | 7417 case VAR_JOB: |
7418 #ifdef FEAT_JOB_CHANNEL | 7418 #ifdef FEAT_JOB_CHANNEL |
7419 { | 7419 { |
7420 job_T *job = varp->vval.v_job; | 7420 job_T *job = varp->vval.v_job; |
7455 return buf; | 7455 return buf; |
7456 } | 7456 } |
7457 #endif | 7457 #endif |
7458 break; | 7458 break; |
7459 case VAR_UNKNOWN: | 7459 case VAR_UNKNOWN: |
7460 EMSG(_("E908: using an invalid value as a String")); | 7460 emsg(_("E908: using an invalid value as a String")); |
7461 break; | 7461 break; |
7462 } | 7462 } |
7463 return NULL; | 7463 return NULL; |
7464 } | 7464 } |
7465 | 7465 |
7837 hashtab_T *ht; | 7837 hashtab_T *ht; |
7838 | 7838 |
7839 ht = find_var_ht(name, &varname); | 7839 ht = find_var_ht(name, &varname); |
7840 if (ht == NULL || *varname == NUL) | 7840 if (ht == NULL || *varname == NUL) |
7841 { | 7841 { |
7842 EMSG2(_(e_illvar), name); | 7842 semsg(_(e_illvar), name); |
7843 return; | 7843 return; |
7844 } | 7844 } |
7845 v = find_var_in_ht(ht, 0, varname, TRUE); | 7845 v = find_var_in_ht(ht, 0, varname, TRUE); |
7846 | 7846 |
7847 /* Search in parent scope which is possible to reference from lambda */ | 7847 /* Search in parent scope which is possible to reference from lambda */ |
7892 #endif | 7892 #endif |
7893 return; | 7893 return; |
7894 } | 7894 } |
7895 else if (v->di_tv.v_type != tv->v_type) | 7895 else if (v->di_tv.v_type != tv->v_type) |
7896 { | 7896 { |
7897 EMSG2(_("E963: setting %s to value with wrong type"), name); | 7897 semsg(_("E963: setting %s to value with wrong type"), name); |
7898 return; | 7898 return; |
7899 } | 7899 } |
7900 } | 7900 } |
7901 | 7901 |
7902 clear_tv(&v->di_tv); | 7902 clear_tv(&v->di_tv); |
7904 else /* add a new variable */ | 7904 else /* add a new variable */ |
7905 { | 7905 { |
7906 /* Can't add "v:" variable. */ | 7906 /* Can't add "v:" variable. */ |
7907 if (ht == &vimvarht) | 7907 if (ht == &vimvarht) |
7908 { | 7908 { |
7909 EMSG2(_(e_illvar), name); | 7909 semsg(_(e_illvar), name); |
7910 return; | 7910 return; |
7911 } | 7911 } |
7912 | 7912 |
7913 /* Make sure the variable name is valid. */ | 7913 /* Make sure the variable name is valid. */ |
7914 if (!valid_varname(varname)) | 7914 if (!valid_varname(varname)) |
7944 int | 7944 int |
7945 var_check_ro(int flags, char_u *name, int use_gettext) | 7945 var_check_ro(int flags, char_u *name, int use_gettext) |
7946 { | 7946 { |
7947 if (flags & DI_FLAGS_RO) | 7947 if (flags & DI_FLAGS_RO) |
7948 { | 7948 { |
7949 EMSG2(_(e_readonlyvar), use_gettext ? (char_u *)_(name) : name); | 7949 semsg(_(e_readonlyvar), use_gettext ? (char_u *)_(name) : name); |
7950 return TRUE; | 7950 return TRUE; |
7951 } | 7951 } |
7952 if ((flags & DI_FLAGS_RO_SBX) && sandbox) | 7952 if ((flags & DI_FLAGS_RO_SBX) && sandbox) |
7953 { | 7953 { |
7954 EMSG2(_(e_readonlysbx), use_gettext ? (char_u *)_(name) : name); | 7954 semsg(_(e_readonlysbx), use_gettext ? (char_u *)_(name) : name); |
7955 return TRUE; | 7955 return TRUE; |
7956 } | 7956 } |
7957 return FALSE; | 7957 return FALSE; |
7958 } | 7958 } |
7959 | 7959 |
7964 int | 7964 int |
7965 var_check_fixed(int flags, char_u *name, int use_gettext) | 7965 var_check_fixed(int flags, char_u *name, int use_gettext) |
7966 { | 7966 { |
7967 if (flags & DI_FLAGS_FIX) | 7967 if (flags & DI_FLAGS_FIX) |
7968 { | 7968 { |
7969 EMSG2(_("E795: Cannot delete variable %s"), | 7969 semsg(_("E795: Cannot delete variable %s"), |
7970 use_gettext ? (char_u *)_(name) : name); | 7970 use_gettext ? (char_u *)_(name) : name); |
7971 return TRUE; | 7971 return TRUE; |
7972 } | 7972 } |
7973 return FALSE; | 7973 return FALSE; |
7974 } | 7974 } |
7985 /* Allow for w: b: s: and t:. */ | 7985 /* Allow for w: b: s: and t:. */ |
7986 if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':') | 7986 if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':') |
7987 && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') | 7987 && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') |
7988 ? name[2] : name[0])) | 7988 ? name[2] : name[0])) |
7989 { | 7989 { |
7990 EMSG2(_("E704: Funcref variable name must start with a capital: %s"), | 7990 semsg(_("E704: Funcref variable name must start with a capital: %s"), |
7991 name); | 7991 name); |
7992 return TRUE; | 7992 return TRUE; |
7993 } | 7993 } |
7994 /* Don't allow hiding a function. When "v" is not NULL we might be | 7994 /* Don't allow hiding a function. When "v" is not NULL we might be |
7995 * assigning another function to the same var, the type is checked | 7995 * assigning another function to the same var, the type is checked |
7996 * below. */ | 7996 * below. */ |
7997 if (new_var && function_exists(name, FALSE)) | 7997 if (new_var && function_exists(name, FALSE)) |
7998 { | 7998 { |
7999 EMSG2(_("E705: Variable name conflicts with existing function: %s"), | 7999 semsg(_("E705: Variable name conflicts with existing function: %s"), |
8000 name); | 8000 name); |
8001 return TRUE; | 8001 return TRUE; |
8002 } | 8002 } |
8003 return FALSE; | 8003 return FALSE; |
8004 } | 8004 } |
8014 | 8014 |
8015 for (p = varname; *p != NUL; ++p) | 8015 for (p = varname; *p != NUL; ++p) |
8016 if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p)) | 8016 if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p)) |
8017 && *p != AUTOLOAD_CHAR) | 8017 && *p != AUTOLOAD_CHAR) |
8018 { | 8018 { |
8019 EMSG2(_(e_illvar), varname); | 8019 semsg(_(e_illvar), varname); |
8020 return FALSE; | 8020 return FALSE; |
8021 } | 8021 } |
8022 return TRUE; | 8022 return TRUE; |
8023 } | 8023 } |
8024 | 8024 |
8030 int | 8030 int |
8031 tv_check_lock(int lock, char_u *name, int use_gettext) | 8031 tv_check_lock(int lock, char_u *name, int use_gettext) |
8032 { | 8032 { |
8033 if (lock & VAR_LOCKED) | 8033 if (lock & VAR_LOCKED) |
8034 { | 8034 { |
8035 EMSG2(_("E741: Value is locked: %s"), | 8035 semsg(_("E741: Value is locked: %s"), |
8036 name == NULL ? (char_u *)_("Unknown") | 8036 name == NULL ? (char_u *)_("Unknown") |
8037 : use_gettext ? (char_u *)_(name) | 8037 : use_gettext ? (char_u *)_(name) |
8038 : name); | 8038 : name); |
8039 return TRUE; | 8039 return TRUE; |
8040 } | 8040 } |
8041 if (lock & VAR_FIXED) | 8041 if (lock & VAR_FIXED) |
8042 { | 8042 { |
8043 EMSG2(_("E742: Cannot change value of %s"), | 8043 semsg(_("E742: Cannot change value of %s"), |
8044 name == NULL ? (char_u *)_("Unknown") | 8044 name == NULL ? (char_u *)_("Unknown") |
8045 : use_gettext ? (char_u *)_(name) | 8045 : use_gettext ? (char_u *)_(name) |
8046 : name); | 8046 : name); |
8047 return TRUE; | 8047 return TRUE; |
8048 } | 8048 } |
8156 static int recurse = 0; | 8156 static int recurse = 0; |
8157 int ret = OK; | 8157 int ret = OK; |
8158 | 8158 |
8159 if (recurse >= DICT_MAXNEST) | 8159 if (recurse >= DICT_MAXNEST) |
8160 { | 8160 { |
8161 EMSG(_("E698: variable nested too deep for making a copy")); | 8161 emsg(_("E698: variable nested too deep for making a copy")); |
8162 return FAIL; | 8162 return FAIL; |
8163 } | 8163 } |
8164 ++recurse; | 8164 ++recurse; |
8165 | 8165 |
8166 switch (from->v_type) | 8166 switch (from->v_type) |
8356 * has been cancelled due to an aborting error, an interrupt, or an | 8356 * has been cancelled due to an aborting error, an interrupt, or an |
8357 * exception. | 8357 * exception. |
8358 */ | 8358 */ |
8359 if (!aborting() && did_emsg == did_emsg_before | 8359 if (!aborting() && did_emsg == did_emsg_before |
8360 && called_emsg == called_emsg_before) | 8360 && called_emsg == called_emsg_before) |
8361 EMSG2(_(e_invexpr2), p); | 8361 semsg(_(e_invexpr2), p); |
8362 need_clr_eos = FALSE; | 8362 need_clr_eos = FALSE; |
8363 break; | 8363 break; |
8364 } | 8364 } |
8365 need_clr_eos = FALSE; | 8365 need_clr_eos = FALSE; |
8366 | 8366 |
8470 * Report the invalid expression unless the expression evaluation | 8470 * Report the invalid expression unless the expression evaluation |
8471 * has been cancelled due to an aborting error, an interrupt, or an | 8471 * has been cancelled due to an aborting error, an interrupt, or an |
8472 * exception. | 8472 * exception. |
8473 */ | 8473 */ |
8474 if (!aborting() && did_emsg == save_did_emsg) | 8474 if (!aborting() && did_emsg == save_did_emsg) |
8475 EMSG2(_(e_invexpr2), p); | 8475 semsg(_(e_invexpr2), p); |
8476 ret = FAIL; | 8476 ret = FAIL; |
8477 break; | 8477 break; |
8478 } | 8478 } |
8479 | 8479 |
8480 if (!eap->skip) | 8480 if (!eap->skip) |
8519 } | 8519 } |
8520 else if (eap->cmdidx == CMD_echoerr) | 8520 else if (eap->cmdidx == CMD_echoerr) |
8521 { | 8521 { |
8522 /* We don't want to abort following commands, restore did_emsg. */ | 8522 /* We don't want to abort following commands, restore did_emsg. */ |
8523 save_did_emsg = did_emsg; | 8523 save_did_emsg = did_emsg; |
8524 EMSG((char_u *)ga.ga_data); | 8524 emsg(ga.ga_data); |
8525 if (!force_abort) | 8525 if (!force_abort) |
8526 did_emsg = save_did_emsg; | 8526 did_emsg = save_did_emsg; |
8527 } | 8527 } |
8528 else if (eap->cmdidx == CMD_execute) | 8528 else if (eap->cmdidx == CMD_execute) |
8529 do_cmdline((char_u *)ga.ga_data, | 8529 do_cmdline((char_u *)ga.ga_data, |
9284 char_u buf2[NUMBUFLEN]; | 9284 char_u buf2[NUMBUFLEN]; |
9285 char_u *pat = tv_get_string_buf_chk(&argvars[0], buf1); | 9285 char_u *pat = tv_get_string_buf_chk(&argvars[0], buf1); |
9286 char_u *text = tv_get_string_buf_chk(&argvars[1], buf2); | 9286 char_u *text = tv_get_string_buf_chk(&argvars[1], buf2); |
9287 | 9287 |
9288 if (pat == NULL || text == NULL) | 9288 if (pat == NULL || text == NULL) |
9289 EMSG(_(e_invarg)); | 9289 emsg(_(e_invarg)); |
9290 else if (pattern_match(pat, text, FALSE) != (atype == ASSERT_MATCH)) | 9290 else if (pattern_match(pat, text, FALSE) != (atype == ASSERT_MATCH)) |
9291 { | 9291 { |
9292 prepare_assert_error(&ga); | 9292 prepare_assert_error(&ga); |
9293 fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1], | 9293 fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1], |
9294 atype); | 9294 atype); |
9600 } | 9600 } |
9601 else if (typ1->v_type != typ2->v_type | 9601 else if (typ1->v_type != typ2->v_type |
9602 || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) | 9602 || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) |
9603 { | 9603 { |
9604 if (typ1->v_type != typ2->v_type) | 9604 if (typ1->v_type != typ2->v_type) |
9605 EMSG(_("E977: Can only compare Blob with Blob")); | 9605 emsg(_("E977: Can only compare Blob with Blob")); |
9606 else | 9606 else |
9607 EMSG(_(e_invalblob)); | 9607 emsg(_(e_invalblob)); |
9608 clear_tv(typ1); | 9608 clear_tv(typ1); |
9609 return FAIL; | 9609 return FAIL; |
9610 } | 9610 } |
9611 else | 9611 else |
9612 { | 9612 { |
9627 } | 9627 } |
9628 else if (typ1->v_type != typ2->v_type | 9628 else if (typ1->v_type != typ2->v_type |
9629 || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) | 9629 || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) |
9630 { | 9630 { |
9631 if (typ1->v_type != typ2->v_type) | 9631 if (typ1->v_type != typ2->v_type) |
9632 EMSG(_("E691: Can only compare List with List")); | 9632 emsg(_("E691: Can only compare List with List")); |
9633 else | 9633 else |
9634 EMSG(_("E692: Invalid operation for List")); | 9634 emsg(_("E692: Invalid operation for List")); |
9635 clear_tv(typ1); | 9635 clear_tv(typ1); |
9636 return FAIL; | 9636 return FAIL; |
9637 } | 9637 } |
9638 else | 9638 else |
9639 { | 9639 { |
9656 } | 9656 } |
9657 else if (typ1->v_type != typ2->v_type | 9657 else if (typ1->v_type != typ2->v_type |
9658 || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) | 9658 || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) |
9659 { | 9659 { |
9660 if (typ1->v_type != typ2->v_type) | 9660 if (typ1->v_type != typ2->v_type) |
9661 EMSG(_("E735: Can only compare Dictionary with Dictionary")); | 9661 emsg(_("E735: Can only compare Dictionary with Dictionary")); |
9662 else | 9662 else |
9663 EMSG(_("E736: Invalid operation for Dictionary")); | 9663 emsg(_("E736: Invalid operation for Dictionary")); |
9664 clear_tv(typ1); | 9664 clear_tv(typ1); |
9665 return FAIL; | 9665 return FAIL; |
9666 } | 9666 } |
9667 else | 9667 else |
9668 { | 9668 { |
9677 else if (typ1->v_type == VAR_FUNC || typ2->v_type == VAR_FUNC | 9677 else if (typ1->v_type == VAR_FUNC || typ2->v_type == VAR_FUNC |
9678 || typ1->v_type == VAR_PARTIAL || typ2->v_type == VAR_PARTIAL) | 9678 || typ1->v_type == VAR_PARTIAL || typ2->v_type == VAR_PARTIAL) |
9679 { | 9679 { |
9680 if (type != TYPE_EQUAL && type != TYPE_NEQUAL) | 9680 if (type != TYPE_EQUAL && type != TYPE_NEQUAL) |
9681 { | 9681 { |
9682 EMSG(_("E694: Invalid operation for Funcrefs")); | 9682 emsg(_("E694: Invalid operation for Funcrefs")); |
9683 clear_tv(typ1); | 9683 clear_tv(typ1); |
9684 return FAIL; | 9684 return FAIL; |
9685 } | 9685 } |
9686 if ((typ1->v_type == VAR_PARTIAL | 9686 if ((typ1->v_type == VAR_PARTIAL |
9687 && typ1->vval.v_partial == NULL) | 9687 && typ1->vval.v_partial == NULL) |
10670 || (!map && tv_check_lock(d->dv_lock, arg_errmsg, TRUE))) | 10670 || (!map && tv_check_lock(d->dv_lock, arg_errmsg, TRUE))) |
10671 return; | 10671 return; |
10672 } | 10672 } |
10673 else | 10673 else |
10674 { | 10674 { |
10675 EMSG2(_(e_listdictarg), ermsg); | 10675 semsg(_(e_listdictarg), ermsg); |
10676 return; | 10676 return; |
10677 } | 10677 } |
10678 | 10678 |
10679 expr = &argvars[1]; | 10679 expr = &argvars[1]; |
10680 /* On type errors, the preceding call has already displayed an error | 10680 /* On type errors, the preceding call has already displayed an error |
10738 vimvars[VV_KEY].vv_nr = idx; | 10738 vimvars[VV_KEY].vv_nr = idx; |
10739 if (filter_map_one(&tv, expr, map, &rem) == FAIL || did_emsg) | 10739 if (filter_map_one(&tv, expr, map, &rem) == FAIL || did_emsg) |
10740 break; | 10740 break; |
10741 if (tv.v_type != VAR_NUMBER) | 10741 if (tv.v_type != VAR_NUMBER) |
10742 { | 10742 { |
10743 EMSG(_(e_invalblob)); | 10743 emsg(_(e_invalblob)); |
10744 return; | 10744 return; |
10745 } | 10745 } |
10746 tv.v_type = VAR_NUMBER; | 10746 tv.v_type = VAR_NUMBER; |
10747 blob_set(b, i, tv.vval.v_number); | 10747 blob_set(b, i, tv.vval.v_number); |
10748 if (!map && rem) | 10748 if (!map && rem) |