comparison src/eval.c @ 25622:15b54e0a576b v8.2.3347

patch 8.2.3347: check for legacy script is incomplete Commit: https://github.com/vim/vim/commit/dd9de50f4262898384be6ea7694d05507c7cb260 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 15 13:49:42 2021 +0200 patch 8.2.3347: check for legacy script is incomplete Problem: Check for legacy script is incomplete. (Naohiro Ono) Solution: Also check the :legacy modifier. Use for string concatenation with "." and others (issue #8756)
author Bram Moolenaar <Bram@vim.org>
date Sun, 15 Aug 2021 14:00:04 +0200
parents 49a798fa0e73
children ba4e6e74c89f
comparison
equal deleted inserted replaced
25621:9860aad58985 25622:15b54e0a576b
2858 // "." is only string concatenation when scriptversion is 1 2858 // "." is only string concatenation when scriptversion is 1
2859 // "+=", "-=" and "..=" are assignments 2859 // "+=", "-=" and "..=" are assignments
2860 // "++" and "--" on the next line are a separate command. 2860 // "++" and "--" on the next line are a separate command.
2861 p = eval_next_non_blank(*arg, evalarg, &getnext); 2861 p = eval_next_non_blank(*arg, evalarg, &getnext);
2862 op = *p; 2862 op = *p;
2863 concat = op == '.' && (*(p + 1) == '.' 2863 concat = op == '.' && (*(p + 1) == '.' || in_old_script(2));
2864 || (current_sctx.sc_version < 2 && !vim9script));
2865 if ((op != '+' && op != '-' && !concat) || p[1] == '=' 2864 if ((op != '+' && op != '-' && !concat) || p[1] == '='
2866 || (p[1] == '.' && p[2] == '=')) 2865 || (p[1] == '.' && p[2] == '='))
2867 break; 2866 break;
2868 if (getnext && (op == '+' || op == '-') && p[0] == p[1]) 2867 if (getnext && (op == '+' || op == '-') && p[0] == p[1])
2869 break; 2868 break;
3400 return FAIL; 3399 return FAIL;
3401 end_leader = *arg; 3400 end_leader = *arg;
3402 3401
3403 if (**arg == '.' && (!isdigit(*(*arg + 1)) 3402 if (**arg == '.' && (!isdigit(*(*arg + 1))
3404 #ifdef FEAT_FLOAT 3403 #ifdef FEAT_FLOAT
3405 || current_sctx.sc_version < 2 3404 || in_old_script(2)
3406 #endif 3405 #endif
3407 )) 3406 ))
3408 { 3407 {
3409 semsg(_(e_invalid_expression_str), *arg); 3408 semsg(_(e_invalid_expression_str), *arg);
3410 ++*arg; 3409 ++*arg;
5875 // scriptversion is at least 2, where string concatenation is "..". 5874 // scriptversion is at least 2, where string concatenation is "..".
5876 else if (**arg == '[' 5875 else if (**arg == '['
5877 || (**arg == '.' && (rettv->v_type == VAR_DICT 5876 || (**arg == '.' && (rettv->v_type == VAR_DICT
5878 || (!evaluate 5877 || (!evaluate
5879 && (*arg)[1] != '.' 5878 && (*arg)[1] != '.'
5880 && current_sctx.sc_version >= 2)))) 5879 && !in_old_script(2)))))
5881 { 5880 {
5882 dict_unref(selfdict); 5881 dict_unref(selfdict);
5883 if (rettv->v_type == VAR_DICT) 5882 if (rettv->v_type == VAR_DICT)
5884 { 5883 {
5885 selfdict = rettv->vval.v_dict; 5884 selfdict = rettv->vval.v_dict;