diff src/dict.c @ 19822:fc3cdc819d80 v8.2.0467

patch 8.2.0467: Vim9: some errors are not tested Commit: https://github.com/vim/vim/commit/33fa29cf74ea314f89cfa58ec9ffc2d6781a59d4 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 28 19:41:33 2020 +0100 patch 8.2.0467: Vim9: some errors are not tested Problem: Vim9: some errors are not tested Solution: Add more tests. Fix that Vim9 script flag is not reset.
author Bram Moolenaar <Bram@vim.org>
date Sat, 28 Mar 2020 19:45:04 +0100
parents 94eda51ba9ba
children 0b35a7ffceb2
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -826,7 +826,8 @@ eval_dict(char_u **arg, typval_T *rettv,
 
 	if (**arg != ':')
 	{
-	    semsg(_(e_missing_dict_colon), *arg);
+	    if (evaluate)
+		semsg(_(e_missing_dict_colon), *arg);
 	    clear_tv(&tvkey);
 	    goto failret;
 	}
@@ -853,7 +854,8 @@ eval_dict(char_u **arg, typval_T *rettv,
 	    item = dict_find(d, key, -1);
 	    if (item != NULL)
 	    {
-		semsg(_(e_duplicate_key), key);
+		if (evaluate)
+		    semsg(_(e_duplicate_key), key);
 		clear_tv(&tvkey);
 		clear_tv(&tv);
 		goto failret;
@@ -873,7 +875,8 @@ eval_dict(char_u **arg, typval_T *rettv,
 	    break;
 	if (**arg != ',')
 	{
-	    semsg(_(e_missing_dict_comma), *arg);
+	    if (evaluate)
+		semsg(_(e_missing_dict_comma), *arg);
 	    goto failret;
 	}
 	*arg = skipwhite(*arg + 1);
@@ -881,7 +884,8 @@ eval_dict(char_u **arg, typval_T *rettv,
 
     if (**arg != '}')
     {
-	semsg(_(e_missing_dict_end), *arg);
+	if (evaluate)
+	    semsg(_(e_missing_dict_end), *arg);
 failret:
 	if (d != NULL)
 	    dict_free(d);