diff src/dict.c @ 22625:0afa30d6dc72 v8.2.1861

patch 8.2.1861: Vim9: no specific error when parsing lambda fails Commit: https://github.com/vim/vim/commit/a2c026d0fd470d68d679616fddfc285cb4834412 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 18 18:03:17 2020 +0200 patch 8.2.1861: Vim9: no specific error when parsing lambda fails Problem: Vim9: no specific error when parsing lambda fails. Solution: Also give syntax errors when not evaluating. (closes https://github.com/vim/vim/issues/7154)
author Bram Moolenaar <Bram@vim.org>
date Sun, 18 Oct 2020 18:15:03 +0200
parents 542682b758dc
children 674ba3200e1f
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -860,13 +860,10 @@ eval_dict(char_u **arg, typval_T *rettv,
 	    *arg = skipwhite(*arg);
 	if (**arg != ':')
 	{
-	    if (evaluate)
-	    {
-		if (*skipwhite(*arg) == ':')
-		    semsg(_(e_no_white_space_allowed_before_str), ":");
-		else
-		    semsg(_(e_missing_dict_colon), *arg);
-	    }
+	    if (*skipwhite(*arg) == ':')
+		semsg(_(e_no_white_space_allowed_before_str), ":");
+	    else
+		semsg(_(e_missing_dict_colon), *arg);
 	    clear_tv(&tvkey);
 	    goto failret;
 	}
@@ -899,8 +896,7 @@ eval_dict(char_u **arg, typval_T *rettv,
 	    item = dict_find(d, key, -1);
 	    if (item != NULL)
 	    {
-		if (evaluate)
-		    semsg(_(e_duplicate_key), key);
+		semsg(_(e_duplicate_key), key);
 		clear_tv(&tvkey);
 		clear_tv(&tv);
 		goto failret;
@@ -937,21 +933,17 @@ eval_dict(char_u **arg, typval_T *rettv,
 	    break;
 	if (!had_comma)
 	{
-	    if (evaluate)
-	    {
-		if (**arg == ',')
-		    semsg(_(e_no_white_space_allowed_before_str), ",");
-		else
-		    semsg(_(e_missing_dict_comma), *arg);
-	    }
+	    if (**arg == ',')
+		semsg(_(e_no_white_space_allowed_before_str), ",");
+	    else
+		semsg(_(e_missing_dict_comma), *arg);
 	    goto failret;
 	}
     }
 
     if (**arg != '}')
     {
-	if (evaluate)
-	    semsg(_(e_missing_dict_end), *arg);
+	semsg(_(e_missing_dict_end), *arg);
 failret:
 	if (d != NULL)
 	    dict_free(d);