Lines Matching refs:rettv

48 static int eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg);
49 static int eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg);
50 static int eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg);
51 static int eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg);
52 static int eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int want_string);
53 static int eval7t(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int want_string);
54 static int eval7(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int want_string);
55 static int eval7_leader(typval_T *rettv, int numeric_only, char_u *start_leader, char_u **end_leade…
204 eval1_emsg(char_u **arg, typval_T *rettv, exarg_T *eap) in eval1_emsg() argument
214 ret = eval1(arg, rettv, &evalarg); in eval1_emsg()
247 eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv) in eval_expr_typval() argument
260 if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) in eval_expr_typval()
274 partial, rettv) == FAIL) in eval_expr_typval()
285 if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) in eval_expr_typval()
291 return exe_typval_instr(expr, rettv); in eval_expr_typval()
299 if (eval1_emsg(&s, rettv, NULL) == FAIL) in eval_expr_typval()
303 clear_tv(rettv); in eval_expr_typval()
318 typval_T rettv; in eval_expr_to_bool() local
321 if (eval_expr_typval(expr, NULL, 0, &rettv) == FAIL) in eval_expr_to_bool()
326 res = (tv_get_bool_chk(&rettv, error) != 0); in eval_expr_to_bool()
327 clear_tv(&rettv); in eval_expr_to_bool()
370 typval_T rettv; in skip_expr() local
373 return eval1(pp, &rettv, evalarg); in skip_expr()
392 typval_T rettv; in skip_expr_concatenate() local
416 res = eval1(arg, &rettv, evalarg); in skip_expr_concatenate()
590 typval_T rettv; in eval_to_number() local
596 if (eval1(&p, &rettv, &EVALARG_EVALUATE) == FAIL) in eval_to_number()
600 retval = tv_get_number_chk(&rettv, NULL); in eval_to_number()
601 clear_tv(&rettv); in eval_to_number()
640 typval_T *rettv) in call_vim_function() argument
645 rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this in call_vim_function()
650 ret = call_func(func, -1, rettv, argc, argv, &funcexe); in call_vim_function()
652 clear_tv(rettv); in call_vim_function()
669 typval_T rettv; in call_func_retnr() local
672 if (call_vim_function(func, argc, argv, &rettv) == FAIL) in call_func_retnr()
675 retval = tv_get_number_chk(&rettv, NULL); in call_func_retnr()
676 clear_tv(&rettv); in call_func_retnr()
690 typval_T rettv; in call_func_noret() local
692 if (call_vim_function(func, argc, argv, &rettv) == FAIL) in call_func_noret()
694 clear_tv(&rettv); in call_func_noret()
709 typval_T rettv; in call_func_retstr() local
712 if (call_vim_function(func, argc, argv, &rettv) == FAIL) in call_func_retstr()
715 retval = vim_strsave(tv_get_string(&rettv)); in call_func_retstr()
716 clear_tv(&rettv); in call_func_retstr()
731 typval_T rettv; in call_func_retlist() local
733 if (call_vim_function(func, argc, argv, &rettv) == FAIL) in call_func_retlist()
736 if (rettv.v_type != VAR_LIST) in call_func_retlist()
738 clear_tv(&rettv); in call_func_retlist()
742 return rettv.vval.v_list; in call_func_retlist()
818 typval_T *rettv, in get_lval() argument
1035 if (rettv != NULL in get_lval()
1036 && !(rettv->v_type == VAR_LIST in get_lval()
1037 && rettv->vval.v_list != NULL) in get_lval()
1038 && !(rettv->v_type == VAR_BLOB in get_lval()
1039 && rettv->vval.v_blob != NULL)) in get_lval()
1116 if (rettv != NULL && lp->ll_dict->dv_scope != 0) in get_lval()
1129 && rettv->v_type == VAR_FUNC in get_lval()
1287 typval_T *rettv, in set_var_lval() argument
1315 if (lp->ll_range && rettv->v_type == VAR_BLOB) in set_var_lval()
1321 rettv) == FAIL) in set_var_lval()
1326 val = (int)tv_get_number_chk(rettv, &error); in set_var_lval()
1351 && tv_op(&tv, rettv, op) == OK) in set_var_lval()
1359 if (lp->ll_type != NULL && check_typval_arg_type(lp->ll_type, rettv, in set_var_lval()
1362 set_var_const(lp->ll_name, lp->ll_type, rettv, copy, in set_var_lval()
1380 (void)list_assign_range(lp->ll_list, rettv->vval.v_list, in set_var_lval()
1396 && check_typval_arg_type(lp->ll_valtype, rettv, in set_var_lval()
1407 if (dict_wrong_func_name(lp->ll_tv->vval.v_dict, rettv, in set_var_lval()
1424 tv_op(lp->ll_tv, rettv, op); in set_var_lval()
1434 copy_tv(rettv, lp->ll_tv); in set_var_lval()
1437 *lp->ll_tv = *rettv; in set_var_lval()
1439 init_tv(rettv); in set_var_lval()
1981 typval_T *rettv, in eval_func() argument
2017 ret = get_func_tv(s, len, rettv, arg, evalarg, &funcexe); in eval_func()
2024 if (rettv->v_type == VAR_UNKNOWN && !evaluate && **arg == '(') in eval_func()
2026 rettv->vval.v_string = NULL; in eval_func()
2027 rettv->v_type = VAR_FUNC; in eval_func()
2036 clear_tv(rettv); in eval_func()
2217 typval_T *rettv, in eval0() argument
2229 ret = eval1(&p, rettv, evalarg); in eval0()
2237 clear_tv(rettv); in eval0()
2283 eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg) in eval1() argument
2288 CLEAR_POINTER(rettv); in eval1()
2293 if (eval2(arg, rettv, evalarg) == FAIL) in eval1()
2323 clear_tv(rettv); in eval1()
2335 result = tv2bool(rettv); in eval1()
2337 result = tv_get_bool_chk(rettv, &error); in eval1()
2338 else if (tv_get_number_chk(rettv, &error) != 0) in eval1()
2341 clear_tv(rettv); in eval1()
2354 clear_tv(rettv); in eval1()
2366 *rettv = var2; in eval1()
2378 clear_tv(rettv); in eval1()
2389 clear_tv(rettv); in eval1()
2402 clear_tv(rettv); in eval1()
2412 clear_tv(rettv); in eval1()
2417 *rettv = var2; in eval1()
2439 eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg) in eval2() argument
2447 if (eval3(arg, rettv, evalarg) == FAIL) in eval2()
2475 result = tv_get_bool_chk(rettv, &error); in eval2()
2476 else if (tv_get_number_chk(rettv, &error) != 0) in eval2()
2478 clear_tv(rettv); in eval2()
2495 clear_tv(rettv); in eval2()
2507 clear_tv(rettv); in eval2()
2533 rettv->v_type = VAR_BOOL; in eval2()
2534 rettv->vval.v_number = result ? VVAL_TRUE : VVAL_FALSE; in eval2()
2538 rettv->v_type = VAR_NUMBER; in eval2()
2539 rettv->vval.v_number = result; in eval2()
2565 eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg) in eval3() argument
2573 if (eval4(arg, rettv, evalarg) == FAIL) in eval3()
2601 result = tv_get_bool_chk(rettv, &error); in eval3()
2602 else if (tv_get_number_chk(rettv, &error) == 0) in eval3()
2604 clear_tv(rettv); in eval3()
2621 clear_tv(rettv); in eval3()
2633 clear_tv(rettv); in eval3()
2660 rettv->v_type = VAR_BOOL; in eval3()
2661 rettv->vval.v_number = result ? VVAL_TRUE : VVAL_FALSE; in eval3()
2665 rettv->v_type = VAR_NUMBER; in eval3()
2666 rettv->vval.v_number = result; in eval3()
2701 eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg) in eval4() argument
2712 if (eval5(arg, rettv, evalarg) == FAIL) in eval4()
2737 clear_tv(rettv); in eval4()
2744 clear_tv(rettv); in eval4()
2770 clear_tv(rettv); in eval4()
2776 clear_tv(rettv); in eval4()
2783 if (vim9script && check_compare_types(type, rettv, &var2) == FAIL) in eval4()
2786 clear_tv(rettv); in eval4()
2789 ret = typval_compare(rettv, &var2, type, ic); in eval4()
2854 eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg) in eval5() argument
2859 if (eval6(arg, rettv, evalarg, FALSE) == FAIL) in eval5()
2897 clear_tv(rettv); in eval5()
2902 if ((op != '+' || (rettv->v_type != VAR_LIST in eval5()
2903 && rettv->v_type != VAR_BLOB)) in eval5()
2905 && (op == '.' || rettv->v_type != VAR_FLOAT) in eval5()
2919 tv_get_number_chk(rettv, &error); in eval5()
2920 if ((op == '.' && tv_get_string_chk(rettv) == NULL) || error) in eval5()
2922 clear_tv(rettv); in eval5()
2933 clear_tv(rettv); in eval5()
2939 clear_tv(rettv); in eval5()
2951 char_u *s1 = tv_get_string_buf(rettv, buf1); in eval5()
2971 clear_tv(rettv); in eval5()
2976 clear_tv(rettv); in eval5()
2977 rettv->v_type = VAR_STRING; in eval5()
2978 rettv->vval.v_string = p; in eval5()
2980 else if (op == '+' && rettv->v_type == VAR_BLOB in eval5()
2982 eval_addblob(rettv, &var2); in eval5()
2983 else if (op == '+' && rettv->v_type == VAR_LIST in eval5()
2986 if (eval_addlist(rettv, &var2) == FAIL) in eval5()
2996 if (rettv->v_type == VAR_FLOAT) in eval5()
2998 f1 = rettv->vval.v_float; in eval5()
3004 n1 = tv_get_number_chk(rettv, &error); in eval5()
3011 clear_tv(rettv); in eval5()
3032 clear_tv(rettv); in eval5()
3037 if (rettv->v_type == VAR_FLOAT) in eval5()
3041 clear_tv(rettv); in eval5()
3045 if (rettv->v_type == VAR_FLOAT || var2.v_type == VAR_FLOAT) in eval5()
3051 rettv->v_type = VAR_FLOAT; in eval5()
3052 rettv->vval.v_float = f1; in eval5()
3061 rettv->v_type = VAR_NUMBER; in eval5()
3062 rettv->vval.v_number = n1; in eval5()
3085 typval_T *rettv, in eval6() argument
3096 if (eval7t(arg, rettv, evalarg, want_string) == FAIL) in eval6()
3129 clear_tv(rettv); in eval6()
3143 if (rettv->v_type == VAR_FLOAT) in eval6()
3145 f1 = rettv->vval.v_float; in eval6()
3151 n1 = tv_get_number_chk(rettv, &error); in eval6()
3152 clear_tv(rettv); in eval6()
3165 clear_tv(rettv); in eval6()
3233 rettv->v_type = VAR_FLOAT; in eval6()
3234 rettv->vval.v_float = f1; in eval6()
3250 rettv->v_type = VAR_NUMBER; in eval6()
3251 rettv->vval.v_number = n1; in eval6()
3268 typval_T *rettv, in eval7t() argument
3304 res = eval7(arg, rettv, evalarg, want_string); in eval7t()
3310 type_T *actual = typval2type(rettv, get_copyID(), &type_list, TRUE); in eval7t()
3317 int n = tv2bool(rettv); in eval7t()
3320 clear_tv(rettv); in eval7t()
3321 rettv->v_type = VAR_BOOL; in eval7t()
3322 rettv->vval.v_number = n ? VVAL_TRUE : VVAL_FALSE; in eval7t()
3394 typval_T *rettv, in eval7() argument
3410 rettv->v_type = VAR_UNKNOWN; in eval7()
3446 case '.': ret = eval_number(arg, rettv, evaluate, want_string); in eval7()
3451 && rettv->v_type != VAR_BLOB) in eval7()
3452 ret = eval7_leader(rettv, TRUE, start_leader, &end_leader); in eval7()
3458 case '"': ret = eval_string(arg, rettv, evaluate); in eval7()
3464 case '\'': ret = eval_lit_string(arg, rettv, evaluate); in eval7()
3470 case '[': ret = eval_list(arg, rettv, evalarg, TRUE); in eval7()
3483 ret = eval_dict(arg, rettv, evalarg, TRUE); in eval7()
3496 ret = get_lambda_tv(arg, rettv, in_vim9script(), evalarg); in eval7()
3498 ret = eval_dict(arg, rettv, evalarg, FALSE); in eval7()
3504 case '&': ret = eval_option(arg, rettv, evaluate); in eval7()
3510 case '$': ret = eval_env_var(arg, rettv, evaluate); in eval7()
3525 rettv->v_type = VAR_STRING; in eval7()
3526 rettv->vval.v_string = get_reg_contents(**arg, in eval7()
3541 ret = get_lambda_tv(arg, rettv, TRUE, evalarg); in eval7()
3544 ufunc_T *ufunc = rettv->vval.v_partial->pt_func; in eval7()
3554 clear_tv(rettv); in eval7()
3562 ret = eval1(arg, rettv, evalarg); // recursive! in eval7()
3570 clear_tv(rettv); in eval7()
3606 ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL); in eval7()
3615 rettv->v_type = VAR_BOOL; in eval7()
3616 rettv->vval.v_number = VVAL_TRUE; in eval7()
3622 rettv->v_type = VAR_BOOL; in eval7()
3623 rettv->vval.v_number = VVAL_FALSE; in eval7()
3629 rettv->v_type = VAR_SPECIAL; in eval7()
3630 rettv->vval.v_number = VVAL_NULL; in eval7()
3634 ret = eval_variable(s, len, rettv, NULL, in eval7()
3650 ret = handle_subscript(arg, rettv, evalarg, TRUE); in eval7()
3656 ret = eval7_leader(rettv, FALSE, start_leader, &end_leader); in eval7()
3667 typval_T *rettv, in eval7_leader() argument
3676 vartype_T type = rettv->v_type; in eval7_leader()
3680 if (rettv->v_type == VAR_FLOAT) in eval7_leader()
3681 f = rettv->vval.v_float; in eval7_leader()
3688 val = tv2bool(rettv); in eval7_leader()
3690 val = tv_get_number_chk(rettv, &error); in eval7_leader()
3694 clear_tv(rettv); in eval7_leader()
3710 if (rettv->v_type == VAR_FLOAT) in eval7_leader()
3714 rettv->v_type = VAR_BOOL; in eval7_leader()
3730 if (rettv->v_type == VAR_FLOAT) in eval7_leader()
3741 if (rettv->v_type == VAR_FLOAT) in eval7_leader()
3743 clear_tv(rettv); in eval7_leader()
3744 rettv->vval.v_float = f; in eval7_leader()
3749 clear_tv(rettv); in eval7_leader()
3751 rettv->v_type = type; in eval7_leader()
3753 rettv->v_type = VAR_NUMBER; in eval7_leader()
3754 rettv->vval.v_number = val; in eval7_leader()
3768 typval_T *rettv, in call_func_rettv() argument
3782 functv = *rettv; in call_func_rettv()
3783 rettv->v_type = VAR_UNKNOWN; in call_func_rettv()
3812 ret = get_func_tv(s, -1, rettv, arg, evalarg, &funcexe); in call_func_rettv()
3831 typval_T *rettv, in eval_lambda() argument
3837 typval_T base = *rettv; in eval_lambda()
3840 rettv->v_type = VAR_UNKNOWN; in eval_lambda()
3845 ret = get_lambda_tv(arg, rettv, FALSE, evalarg); in eval_lambda()
3851 ret = eval1(arg, rettv, evalarg); in eval_lambda()
3871 clear_tv(rettv); in eval_lambda()
3875 ret = call_func_rettv(arg, evalarg, rettv, evaluate, NULL, &base); in eval_lambda()
3893 typval_T *rettv, in eval_method() argument
3900 typval_T base = *rettv; in eval_method()
3905 rettv->v_type = VAR_UNKNOWN; in eval_method()
3934 ret = eval_func(arg, evalarg, name, len, rettv, in eval_method()
3954 typval_T *rettv, in eval_index() argument
3967 if (check_can_index(rettv, evaluate, verbose) == FAIL) in eval_index()
4007 if (vim9 && rettv->v_type == VAR_DICT in eval_index()
4073 int res = eval_index_inner(rettv, range, in eval_index()
4090 check_can_index(typval_T *rettv, int evaluate, int verbose) in check_can_index() argument
4092 switch (rettv->v_type) in check_can_index()
4140 f_slice(typval_T *argvars, typval_T *rettv) in f_slice() argument
4153 copy_tv(argvars, rettv); in f_slice()
4154 eval_index_inner(rettv, TRUE, argvars + 1, in f_slice()
4170 typval_T *rettv, in eval_index_inner() argument
4183 if (var1 != NULL && rettv->v_type != VAR_DICT) in eval_index_inner()
4188 if (rettv->v_type == VAR_DICT) in eval_index_inner()
4200 switch (rettv->v_type) in eval_index_inner()
4218 char_u *s = tv_get_string(rettv); in eval_index_inner()
4257 clear_tv(rettv); in eval_index_inner()
4258 rettv->v_type = VAR_STRING; in eval_index_inner()
4259 rettv->vval.v_string = s; in eval_index_inner()
4264 blob_slice_or_index(rettv->vval.v_blob, is_range, n1, n2, in eval_index_inner()
4265 exclusive, rettv); in eval_index_inner()
4273 if (list_slice_or_index(rettv->vval.v_list, in eval_index_inner()
4274 is_range, n1, n2, exclusive, rettv, verbose) == FAIL) in eval_index_inner()
4290 item = dict_find(rettv->vval.v_dict, key, (int)keylen); in eval_index_inner()
4298 clear_tv(rettv); in eval_index_inner()
4299 *rettv = tmp; in eval_index_inner()
5766 typval_T *rettv, in handle_subscript() argument
5784 && ((rettv->v_type == VAR_DICT && *p == '.' && eval_isdictc(p[1])) in handle_subscript()
5794 if (rettv->v_type == VAR_ANY) in handle_subscript()
5827 idx = find_exported(rettv->vval.v_number, exp_name, &ufunc, &type, in handle_subscript()
5839 scriptitem_T *si = SCRIPT_ITEM(rettv->vval.v_number); in handle_subscript()
5842 copy_tv(sv->sv_tv, rettv); in handle_subscript()
5846 rettv->v_type = VAR_FUNC; in handle_subscript()
5847 rettv->vval.v_string = vim_strsave(ufunc->uf_name); in handle_subscript()
5851 if ((**arg == '(' && (!evaluate || rettv->v_type == VAR_FUNC in handle_subscript()
5852 || rettv->v_type == VAR_PARTIAL)) in handle_subscript()
5855 ret = call_func_rettv(arg, evalarg, rettv, evaluate, in handle_subscript()
5864 clear_tv(rettv); in handle_subscript()
5885 ret = eval_lambda(arg, rettv, evalarg, verbose); in handle_subscript()
5888 ret = eval_method(arg, rettv, evalarg, verbose); in handle_subscript()
5894 || (**arg == '.' && (rettv->v_type == VAR_DICT in handle_subscript()
5900 if (rettv->v_type == VAR_DICT) in handle_subscript()
5902 selfdict = rettv->vval.v_dict; in handle_subscript()
5908 if (eval_index(arg, rettv, evalarg, verbose) == FAIL) in handle_subscript()
5910 clear_tv(rettv); in handle_subscript()
5922 && (rettv->v_type == VAR_FUNC in handle_subscript()
5923 || (rettv->v_type == VAR_PARTIAL in handle_subscript()
5924 && (rettv->vval.v_partial->pt_auto in handle_subscript()
5925 || rettv->vval.v_partial->pt_dict == NULL)))) in handle_subscript()
5926 selfdict = make_partial(selfdict, rettv); in handle_subscript()
6016 echo_one(typval_T *rettv, int with_space, int *atstart, int *needclr) in echo_one() argument
6020 char_u *p = echo_string(rettv, &tofree, numbuf, get_copyID()); in echo_one()
6077 typval_T rettv; in ex_echo() local
6096 if (eval1(&arg, &rettv, &evalarg) == FAIL) in ex_echo()
6113 if (rettv.v_type == VAR_VOID) in ex_echo()
6118 echo_one(&rettv, eap->cmdidx == CMD_echo, &atstart, &needclr); in ex_echo()
6121 clear_tv(&rettv); in ex_echo()
6169 typval_T rettv; in ex_execute() local
6182 ret = eval1_emsg(&arg, &rettv, eap); in ex_execute()
6192 if (rettv.v_type == VAR_CHANNEL || rettv.v_type == VAR_JOB) in ex_execute()
6195 vartype_name(rettv.v_type)); in ex_execute()
6199 p = tv_get_string_buf(&rettv, buf); in ex_execute()
6202 p = tv_stringify(&rettv, buf); in ex_execute()
6205 clear_tv(&rettv); in ex_execute()
6212 clear_tv(&rettv); in ex_execute()
6222 clear_tv(&rettv); in ex_execute()