Patch 9.0.1452
Problem:    Code using EVAL_CONSTANT is dead, it is never set.
Solution:   Remove EVAL_CONSTANT. (closes #12252)
Files:      src/eval.c, src/structs.h


*** ../vim-9.0.1451/src/eval.c  2023-03-11 16:18:48.457096310 +0000
--- src/eval.c  2023-04-13 22:11:00.252632171 +0100
***************
*** 2358,2364 ****
      // Need to make a copy, in case evaluating the arguments makes
      // the name invalid.
      s = vim_strsave(s);
!     if (s == NULL || (evaluate && (*s == NUL || (flags & EVAL_CONSTANT))))
        ret = FAIL;
      else
      {
--- 2358,2364 ----
      // Need to make a copy, in case evaluating the arguments makes
      // the name invalid.
      s = vim_strsave(s);
!     if (s == NULL || (evaluate && *s == NUL))
        ret = FAIL;
      else
      {
***************
*** 2647,2653 ****
      char_u    *expr_end;
      int               did_emsg_before = did_emsg;
      int               called_emsg_before = called_emsg;
-     int               flags = evalarg == NULL ? 0 : evalarg->eval_flags;
      int               check_for_end = retarg == NULL;
      int               end_error = FALSE;
  
--- 2647,2652 ----
***************
*** 2692,2698 ****
        if (!aborting()
                && did_emsg == did_emsg_before
                && called_emsg == called_emsg_before
-               && (flags & EVAL_CONSTANT) == 0
                && (!in_vim9script() || !vim9_bad_comment(p)))
        {
            if (end_error)
--- 2691,2696 ----
***************
*** 2807,2813 ****
        }
        *arg = skipwhite_and_linebreak(*arg + 1, evalarg_used);
        evalarg_used->eval_flags = (op_falsy ? !result : result)
!                                   ? orig_flags : orig_flags & ~EVAL_EVALUATE;
        if (eval1(arg, &var2, evalarg_used) == FAIL)
        {
            evalarg_used->eval_flags = orig_flags;
--- 2805,2811 ----
        }
        *arg = skipwhite_and_linebreak(*arg + 1, evalarg_used);
        evalarg_used->eval_flags = (op_falsy ? !result : result)
!                                 ? orig_flags : (orig_flags & ~EVAL_EVALUATE);
        if (eval1(arg, &var2, evalarg_used) == FAIL)
        {
            evalarg_used->eval_flags = orig_flags;
***************
*** 2856,2862 ****
            }
            *arg = skipwhite_and_linebreak(*arg + 1, evalarg_used);
            evalarg_used->eval_flags = !result ? orig_flags
!                                                : orig_flags & ~EVAL_EVALUATE;
            if (eval1(arg, &var2, evalarg_used) == FAIL)
            {
                if (evaluate && result)
--- 2854,2860 ----
            }
            *arg = skipwhite_and_linebreak(*arg + 1, evalarg_used);
            evalarg_used->eval_flags = !result ? orig_flags
!                                              : (orig_flags & ~EVAL_EVALUATE);
            if (eval1(arg, &var2, evalarg_used) == FAIL)
            {
                if (evaluate && result)
***************
*** 2960,2966 ****
            }
            *arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
            evalarg_used->eval_flags = !result ? orig_flags
!                                                : orig_flags & ~EVAL_EVALUATE;
            if (eval3(arg, &var2, evalarg_used) == FAIL)
                return FAIL;
  
--- 2958,2964 ----
            }
            *arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
            evalarg_used->eval_flags = !result ? orig_flags
!                                              : (orig_flags & ~EVAL_EVALUATE);
            if (eval3(arg, &var2, evalarg_used) == FAIL)
                return FAIL;
  
***************
*** 3086,3092 ****
            }
            *arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
            evalarg_used->eval_flags = result ? orig_flags
!                                                : orig_flags & ~EVAL_EVALUATE;
            CLEAR_FIELD(var2);
            if (eval4(arg, &var2, evalarg_used) == FAIL)
                return FAIL;
--- 3084,3090 ----
            }
            *arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
            evalarg_used->eval_flags = result ? orig_flags
!                                             : (orig_flags & ~EVAL_EVALUATE);
            CLEAR_FIELD(var2);
            if (eval4(arg, &var2, evalarg_used) == FAIL)
                return FAIL;
***************
*** 4279,4286 ****
                *arg = skipwhite(*arg);
                ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL);
            }
-           else if (flags & EVAL_CONSTANT)
-               ret = FAIL;
            else if (evaluate)
            {
                // get the value of "true", "false", etc. or a variable
--- 4277,4282 ----
*** ../vim-9.0.1451/src/structs.h       2023-04-09 22:01:21.143306278 +0100
--- src/structs.h       2023-04-13 22:09:01.836480799 +0100
***************
*** 2102,2110 ****
      char_u    *eval_tofree_lambda;
  } evalarg_T;
  
! // Flags for expression evaluation.
  #define EVAL_EVALUATE     1       // when missing don't actually evaluate
- #define EVAL_CONSTANT     2       // when not a constant return FAIL
  
  # ifdef FEAT_PROFILE
  /*
--- 2102,2109 ----
      char_u    *eval_tofree_lambda;
  } evalarg_T;
  
! // Flag for expression evaluation.
  #define EVAL_EVALUATE     1       // when missing don't actually evaluate
  
  # ifdef FEAT_PROFILE
  /*
*** ../vim-9.0.1451/src/version.c       2023-04-13 21:47:33.361227019 +0100
--- src/version.c       2023-04-13 22:12:29.284707708 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1452,
  /**/

-- 
I wonder, do vegetarians eat fruit bats?

 /// Bram Moolenaar -- b...@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    ///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230413211323.B86581C0A7C%40moolenaar.net.

Raspunde prin e-mail lui