Patch 8.2.1203
Problem:    Unused assignments in expression evaluation.
Solution:   Move declarations and assignments to inner blocks where possible.
Files:      src/eval.c


*** ../vim-8.2.1202/src/eval.c  2020-07-12 17:07:01.020810937 +0200
--- src/eval.c  2020-07-13 21:23:29.754005840 +0200
***************
*** 2538,2545 ****
      static int
  eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
  {
-     int       evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & 
EVAL_EVALUATE);
- 
      /*
       * Get the first variable.
       */
--- 2538,2543 ----
***************
*** 2551,2556 ****
--- 2549,2555 ----
       */
      for (;;)
      {
+       int         evaluate;
        int         getnext;
        char_u      *p;
        int         op;
***************
*** 2563,2571 ****
        concat = op == '.' && (*(p + 1) == '.' || current_sctx.sc_version < 2);
        if (op != '+' && op != '-' && !concat)
            break;
        if (getnext)
            *arg = eval_next_line(evalarg);
! 
        if ((op != '+' || (rettv->v_type != VAR_LIST
                                                 && rettv->v_type != VAR_BLOB))
  #ifdef FEAT_FLOAT
--- 2562,2571 ----
        concat = op == '.' && (*(p + 1) == '.' || current_sctx.sc_version < 2);
        if (op != '+' && op != '-' && !concat)
            break;
+ 
        if (getnext)
            *arg = eval_next_line(evalarg);
!       evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE);
        if ((op != '+' || (rettv->v_type != VAR_LIST
                                                 && rettv->v_type != VAR_BLOB))
  #ifdef FEAT_FLOAT
***************
*** 2728,2741 ****
      evalarg_T *evalarg,
      int               want_string)  // after "." operator
  {
-     typval_T  var2;
-     int               op;
-     varnumber_T       n1, n2;
  #ifdef FEAT_FLOAT
!     int               use_float = FALSE;
!     float_T   f1 = 0, f2 = 0;
  #endif
-     int               error = FALSE;
  
      /*
       * Get the first variable.
--- 2728,2736 ----
      evalarg_T *evalarg,
      int               want_string)  // after "." operator
  {
  #ifdef FEAT_FLOAT
!     int           use_float = FALSE;
  #endif
  
      /*
       * Get the first variable.
***************
*** 2748,2763 ****
       */
      for (;;)
      {
!       int     evaluate = evalarg == NULL ? 0
!                                      : (evalarg->eval_flags & EVAL_EVALUATE);
!       int     getnext;
  
        op = *eval_next_non_blank(*arg, evalarg, &getnext);
        if (op != '*' && op != '/' && op != '%')
            break;
        if (getnext)
            *arg = eval_next_line(evalarg);
  
        if (evaluate)
        {
  #ifdef FEAT_FLOAT
--- 2743,2771 ----
       */
      for (;;)
      {
!       int         evaluate;
!       int         getnext;
!       typval_T    var2;
!       int         op;
!       varnumber_T n1, n2;
! #ifdef FEAT_FLOAT
!       float_T     f1, f2;
! #endif
!       int         error;
  
        op = *eval_next_non_blank(*arg, evalarg, &getnext);
        if (op != '*' && op != '/' && op != '%')
            break;
+ 
        if (getnext)
            *arg = eval_next_line(evalarg);
  
+ #ifdef FEAT_FLOAT
+       f1 = 0;
+       f2 = 0;
+ #endif
+       error = FALSE;
+       evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE);
        if (evaluate)
        {
  #ifdef FEAT_FLOAT
***************
*** 2904,2910 ****
      evalarg_T *evalarg,
      int               want_string)    // after "." operator
  {
-     int               flags = evalarg == NULL ? 0 : evalarg->eval_flags;
      int               evaluate = evalarg != NULL
                                      && (evalarg->eval_flags & EVAL_EVALUATE);
      int               len;
--- 2912,2917 ----
***************
*** 3064,3069 ****
--- 3071,3078 ----
            ret = FAIL;
        else
        {
+           int     flags = evalarg == NULL ? 0 : evalarg->eval_flags;
+ 
            if (**arg == '(')
                // "name(..."  recursive!
                ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL);
*** ../vim-8.2.1202/src/version.c       2020-07-13 20:41:04.476449692 +0200
--- src/version.c       2020-07-13 21:27:43.289347828 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1203,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
27. You refer to your age as 3.x.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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/202007131928.06DJSnOe2832944%40masaka.moolenaar.net.

Raspunde prin e-mail lui