comparison src/eval.c @ 21120:4d844a65183d v8.2.1111

patch 8.2.1111: inconsistent naming of get_list_tv() and eval_dict() Commit: https://github.com/vim/vim/commit/9a78e6df17033223ebdf499f2b02b2538601c52d Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 1 18:29:55 2020 +0200 patch 8.2.1111: inconsistent naming of get_list_tv() and eval_dict() Problem: Inconsistent naming of get_list_tv() and eval_dict(). Solution: Rename get_list_tv() to eval_list(). Similarly for eval_number(), eval_string(), eval_lit_string() and a few others.
author Bram Moolenaar <Bram@vim.org>
date Wed, 01 Jul 2020 18:45:04 +0200
parents b0baa80cb53f
children 165cea61e974
comparison
equal deleted inserted replaced
21119:20dcea08f37b 21120:4d844a65183d
1222 return; 1222 return;
1223 } 1223 }
1224 1224
1225 // handle +=, -=, *=, /=, %= and .= 1225 // handle +=, -=, *=, /=, %= and .=
1226 di = NULL; 1226 di = NULL;
1227 if (get_var_tv(lp->ll_name, (int)STRLEN(lp->ll_name), 1227 if (eval_variable(lp->ll_name, (int)STRLEN(lp->ll_name),
1228 &tv, &di, TRUE, FALSE) == OK) 1228 &tv, &di, TRUE, FALSE) == OK)
1229 { 1229 {
1230 if ((di == NULL 1230 if ((di == NULL
1231 || (!var_check_ro(di->di_flags, lp->ll_name, FALSE) 1231 || (!var_check_ro(di->di_flags, lp->ll_name, FALSE)
1232 && !tv_check_lock(&di->di_tv, lp->ll_name, FALSE))) 1232 && !tv_check_lock(&di->di_tv, lp->ll_name, FALSE)))
2899 case '5': 2899 case '5':
2900 case '6': 2900 case '6':
2901 case '7': 2901 case '7':
2902 case '8': 2902 case '8':
2903 case '9': 2903 case '9':
2904 case '.': ret = get_number_tv(arg, rettv, evaluate, want_string); 2904 case '.': ret = eval_number(arg, rettv, evaluate, want_string);
2905 2905
2906 // Apply prefixed "-" and "+" now. Matters especially when 2906 // Apply prefixed "-" and "+" now. Matters especially when
2907 // "->" follows. 2907 // "->" follows.
2908 if (ret == OK && evaluate && end_leader > start_leader) 2908 if (ret == OK && evaluate && end_leader > start_leader)
2909 ret = eval7_leader(rettv, TRUE, start_leader, &end_leader); 2909 ret = eval7_leader(rettv, TRUE, start_leader, &end_leader);
2910 break; 2910 break;
2911 2911
2912 /* 2912 /*
2913 * String constant: "string". 2913 * String constant: "string".
2914 */ 2914 */
2915 case '"': ret = get_string_tv(arg, rettv, evaluate); 2915 case '"': ret = eval_string(arg, rettv, evaluate);
2916 break; 2916 break;
2917 2917
2918 /* 2918 /*
2919 * Literal string constant: 'str''ing'. 2919 * Literal string constant: 'str''ing'.
2920 */ 2920 */
2921 case '\'': ret = get_lit_string_tv(arg, rettv, evaluate); 2921 case '\'': ret = eval_lit_string(arg, rettv, evaluate);
2922 break; 2922 break;
2923 2923
2924 /* 2924 /*
2925 * List: [expr, expr] 2925 * List: [expr, expr]
2926 */ 2926 */
2927 case '[': ret = get_list_tv(arg, rettv, evalarg, TRUE); 2927 case '[': ret = eval_list(arg, rettv, evalarg, TRUE);
2928 break; 2928 break;
2929 2929
2930 /* 2930 /*
2931 * Dictionary: #{key: val, key: val} 2931 * Dictionary: #{key: val, key: val}
2932 */ 2932 */
2949 break; 2949 break;
2950 2950
2951 /* 2951 /*
2952 * Option value: &name 2952 * Option value: &name
2953 */ 2953 */
2954 case '&': ret = get_option_tv(arg, rettv, evaluate); 2954 case '&': ret = eval_option(arg, rettv, evaluate);
2955 break; 2955 break;
2956 2956
2957 /* 2957 /*
2958 * Environment variable: $VAR. 2958 * Environment variable: $VAR.
2959 */ 2959 */
2960 case '$': ret = get_env_tv(arg, rettv, evaluate); 2960 case '$': ret = eval_env_var(arg, rettv, evaluate);
2961 break; 2961 break;
2962 2962
2963 /* 2963 /*
2964 * Register contents: @r. 2964 * Register contents: @r.
2965 */ 2965 */
3010 3010
3011 if (len <= 0) 3011 if (len <= 0)
3012 ret = FAIL; 3012 ret = FAIL;
3013 else 3013 else
3014 { 3014 {
3015 if (**arg == '(') // recursive! 3015 if (**arg == '(')
3016 // "name(..." recursive!
3016 ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL); 3017 ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL);
3017 else if (flags & EVAL_CONSTANT) 3018 else if (flags & EVAL_CONSTANT)
3018 ret = FAIL; 3019 ret = FAIL;
3019 else if (evaluate) 3020 else if (evaluate)
3020 ret = get_var_tv(s, len, rettv, NULL, TRUE, FALSE); 3021 // get value of variable
3022 ret = eval_variable(s, len, rettv, NULL, TRUE, FALSE);
3021 else 3023 else
3022 { 3024 {
3025 // skip the name
3023 check_vars(s, len); 3026 check_vars(s, len);
3024 ret = OK; 3027 ret = OK;
3025 } 3028 }
3026 } 3029 }
3027 vim_free(alias); 3030 vim_free(alias);