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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220517114616.1F0C71C08DA%40moolenaar.net.

Raspunde prin e-mail lui