comparison src/eval.c @ 24047:b535ab17d160 v8.2.2565

patch 8.2.2565: Vim9: "..=" not always recognized Commit: https://github.com/vim/vim/commit/f76ec1eeb5bba9457bf2b5564364ee90662a0156 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 3 17:58:16 2021 +0100 patch 8.2.2565: Vim9: "..=" not always recognized Problem: Vim9: "..=" not always recognized. Solution: Do not consider "..=" to be string concatenation. (closes https://github.com/vim/vim/issues/7905)
author Bram Moolenaar <Bram@vim.org>
date Wed, 03 Mar 2021 18:00:04 +0100
parents 9fcd71d0db89
children d8f3a993dc9a
comparison
equal deleted inserted replaced
24046:353c5b0f1f9f 24047:b535ab17d160
2847 int concat; 2847 int concat;
2848 typval_T var2; 2848 typval_T var2;
2849 int vim9script = in_vim9script(); 2849 int vim9script = in_vim9script();
2850 2850
2851 // "." is only string concatenation when scriptversion is 1 2851 // "." is only string concatenation when scriptversion is 1
2852 // "+=" and "-=" are assignment 2852 // "+=", "-=" and "..=" are assignments
2853 p = eval_next_non_blank(*arg, evalarg, &getnext); 2853 p = eval_next_non_blank(*arg, evalarg, &getnext);
2854 op = *p; 2854 op = *p;
2855 concat = op == '.' && (*(p + 1) == '.' || current_sctx.sc_version < 2); 2855 concat = op == '.' && (*(p + 1) == '.' || current_sctx.sc_version < 2);
2856 if ((op != '+' && op != '-' && !concat) || p[1] == '=') 2856 if ((op != '+' && op != '-' && !concat) || p[1] == '='
2857 || (p[1] == '.' && p[2] == '='))
2857 break; 2858 break;
2858 2859
2859 evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE); 2860 evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE);
2860 oplen = (concat && p[1] == '.') ? 2 : 1; 2861 oplen = (concat && p[1] == '.') ? 2 : 1;
2861 if (getnext) 2862 if (getnext)
3078 #ifdef FEAT_FLOAT 3079 #ifdef FEAT_FLOAT
3079 float_T f1, f2; 3080 float_T f1, f2;
3080 #endif 3081 #endif
3081 int error; 3082 int error;
3082 3083
3084 // "*=", "/=" and "%=" are assignments
3083 p = eval_next_non_blank(*arg, evalarg, &getnext); 3085 p = eval_next_non_blank(*arg, evalarg, &getnext);
3084 op = *p; 3086 op = *p;
3085 if (op != '*' && op != '/' && op != '%') 3087 if ((op != '*' && op != '/' && op != '%') || p[1] == '=')
3086 break; 3088 break;
3087 3089
3088 evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE); 3090 evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE);
3089 if (getnext) 3091 if (getnext)
3090 *arg = eval_next_line(evalarg); 3092 *arg = eval_next_line(evalarg);