diff src/vim9compile.c @ 23806:c0f2c6c56147 v8.2.2444

patch 8.2.2444: Vim9: compile error with combination of operator and list Commit: https://github.com/vim/vim/commit/e507ff15d52653dad3054ddc0073708977621c0c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 31 21:47:42 2021 +0100 patch 8.2.2444: Vim9: compile error with combination of operator and list Problem: Vim9: compile error with combination of operator and list. Solution: Generate constants before parsing a list or dict. (closes https://github.com/vim/vim/issues/7757)
author Bram Moolenaar <Bram@vim.org>
date Sun, 31 Jan 2021 22:00:03 +0100
parents 7caffd835aa1
children 525c9e218c69
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4121,13 +4121,17 @@ compile_expr7(
 	/*
 	 * List: [expr, expr]
 	 */
-	case '[':   ret = compile_list(arg, cctx, ppconst);
+	case '[':   if (generate_ppconst(cctx, ppconst) == FAIL)
+			return FAIL;
+		    ret = compile_list(arg, cctx, ppconst);
 		    break;
 
 	/*
 	 * Dictionary: {'key': val, 'key': val}
 	 */
-	case '{':   ret = compile_dict(arg, cctx, ppconst);
+	case '{':   if (generate_ppconst(cctx, ppconst) == FAIL)
+			return FAIL;
+		    ret = compile_dict(arg, cctx, ppconst);
 		    break;
 
 	/*