Patch 8.2.4970

2 views
Skip to first unread message

Bram Moolenaar

unread,
May 17, 2022, 7:46:21 AM5/17/22
to vim...@googlegroups.com

Patch 8.2.4970
Problem: "eval 123" gives an error, "eval 'abc'" does not.
Solution: Also give an error when evaluating only a string. (closes #10434)
Files: src/ex_eval.c, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.4969/src/ex_eval.c 2022-05-06 11:27:48.264809846 +0100
--- src/ex_eval.c 2022-05-17 12:22:54.081996217 +0100
***************
*** 888,895 ****
}

/*
! * Return TRUE if "arg" is only a variable, register, environment variable or
! * option name.
*/
int
cmd_is_name_only(char_u *arg)
--- 888,895 ----
}

/*
! * Return TRUE if "arg" is only a variable, register, environment variable,
! * option name or string.
*/
int
cmd_is_name_only(char_u *arg)
***************
*** 904,909 ****
--- 904,920 ----
if (*p != NUL)
++p;
}
+ else if (*p == '\'' || *p == '"')
+ {
+ int r;
+
+ if (*p == '"')
+ r = eval_string(&p, NULL, FALSE, FALSE);
+ else
+ r = eval_lit_string(&p, NULL, FALSE, FALSE);
+ if (r == FAIL)
+ return FALSE;
+ }
else
{
if (*p == '&')
*** ../vim-8.2.4969/src/testdir/test_vim9_cmd.vim 2022-05-05 16:08:51.256038275 +0100
--- src/testdir/test_vim9_cmd.vim 2022-05-17 12:24:53.873878632 +0100
***************
*** 697,702 ****
--- 697,712 ----
END
v9.CheckDefAndScriptFailure(lines, 'E1207:', 2)
$SomeEnv = ''
+
+ lines =<< trim END
+ eval 'value'
+ END
+ v9.CheckDefAndScriptFailure(lines, 'E1207:', 1)
+
+ lines =<< trim END
+ eval "value"
+ END
+ v9.CheckDefAndScriptFailure(lines, 'E1207:', 1)
enddef

def Test_environment_use_linebreak()
*** ../vim-8.2.4969/src/version.c 2022-05-16 19:40:54.757799730 +0100
--- src/version.c 2022-05-17 12:25:06.617866188 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4970,
/**/

--
hundred-and-one symptoms of being an internet addict:
219. Your spouse has his or her lawyer deliver the divorce papers...
via e-mail.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages