diff src/eval.c @ 20401:918b9a05cf35 v8.2.0755

patch 8.2.0755: Vim9: No error when variable initializer is not a constant Commit: https://github.com/vim/vim/commit/227a69de1e0f9457a9fc9e098d999304faff55f8 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 15 18:17:28 2020 +0200 patch 8.2.0755: Vim9: No error when variable initializer is not a constant Problem: Vim9: No error when variable initializer is not a constant. Solution: Return FAIL when trying to get a variable value. Do not execute a script when an error is deteted in the first or second phase.
author Bram Moolenaar <Bram@vim.org>
date Fri, 15 May 2020 18:30:04 +0200
parents c225be44692a
children 5950284a517f
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -2695,6 +2695,8 @@ eval7(
 	{
 	    if (**arg == '(')		// recursive!
 		ret = eval_func(arg, s, len, rettv, flags, NULL);
+	    else if (flags & EVAL_CONSTANT)
+		ret = FAIL;
 	    else if (evaluate)
 		ret = get_var_tv(s, len, rettv, NULL, TRUE, FALSE);
 	    else