comparison src/vim9execute.c @ 26624:bdf11d8e3df3 v8.2.3841

patch 8.2.3841: Vim9: outdated TODO items, disabled tests that work Commit: https://github.com/vim/vim/commit/71b768509250b12696e8cc90e5902029f1b5433d Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 17 20:15:38 2021 +0000 patch 8.2.3841: Vim9: outdated TODO items, disabled tests that work Problem: Vim9: outdated TODO items, disabled tests that work. Solution: Remove TODO items, run tests that work now. Check that a dict item isn't locked.
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 Dec 2021 21:30:03 +0100
parents fac6673086df
children 4d18b3a5254a
comparison
equal deleted inserted replaced
26623:f94007638026 26624:bdf11d8e3df3
913 return FAIL; 913 return FAIL;
914 } 914 }
915 915
916 // The function has been compiled, can call it quickly. For a function 916 // The function has been compiled, can call it quickly. For a function
917 // that was defined later: we can call it directly next time. 917 // that was defined later: we can call it directly next time.
918 // TODO: what if the function was deleted and then defined again?
919 if (iptr != NULL) 918 if (iptr != NULL)
920 { 919 {
921 delete_instr(iptr); 920 delete_instr(iptr);
922 iptr->isn_type = ISN_DCALL; 921 iptr->isn_type = ISN_DCALL;
923 iptr->isn_arg.dfunc.cdf_idx = ufunc->uf_dfunc_idx; 922 iptr->isn_arg.dfunc.cdf_idx = ufunc->uf_dfunc_idx;
931 CLEAR_FIELD(funcexe); 930 CLEAR_FIELD(funcexe);
932 funcexe.fe_evaluate = TRUE; 931 funcexe.fe_evaluate = TRUE;
933 funcexe.fe_selfdict = selfdict != NULL ? selfdict : dict_stack_get_dict(); 932 funcexe.fe_selfdict = selfdict != NULL ? selfdict : dict_stack_get_dict();
934 933
935 // Call the user function. Result goes in last position on the stack. 934 // Call the user function. Result goes in last position on the stack.
936 // TODO: add selfdict if there is one
937 error = call_user_func_check(ufunc, argcount, argvars, 935 error = call_user_func_check(ufunc, argcount, argvars,
938 STACK_TV_BOT(-1), &funcexe, funcexe.fe_selfdict); 936 STACK_TV_BOT(-1), &funcexe, funcexe.fe_selfdict);
939 937
940 // Clear the arguments. 938 // Clear the arguments.
941 for (idx = 0; idx < argcount; ++idx) 939 for (idx = 0; idx < argcount; ++idx)
2860 { 2858 {
2861 dict_T *d = tv_dest->vval.v_dict; 2859 dict_T *d = tv_dest->vval.v_dict;
2862 char_u *key = tv_idx->vval.v_string; 2860 char_u *key = tv_idx->vval.v_string;
2863 dictitem_T *di = NULL; 2861 dictitem_T *di = NULL;
2864 2862
2865 if (key == NULL) 2863 if (d != NULL && value_check_lock(
2866 key = (char_u *)""; 2864 d->dv_lock, NULL, FALSE))
2867 if (d != NULL)
2868 di = dict_find(d, key, (int)STRLEN(key));
2869 if (di == NULL)
2870 {
2871 // NULL dict is equivalent to empty dict
2872 SOURCING_LNUM = iptr->isn_lnum;
2873 semsg(_(e_dictkey), key);
2874 status = FAIL; 2865 status = FAIL;
2875 }
2876 else 2866 else
2877 { 2867 {
2878 // TODO: check for dict or item locked 2868 SOURCING_LNUM = iptr->isn_lnum;
2879 dictitem_remove(d, di); 2869 if (key == NULL)
2870 key = (char_u *)"";
2871 if (d != NULL)
2872 di = dict_find(d, key, (int)STRLEN(key));
2873 if (di == NULL)
2874 {
2875 // NULL dict is equivalent to empty dict
2876 semsg(_(e_dictkey), key);
2877 status = FAIL;
2878 }
2879 else if (var_check_fixed(di->di_flags,
2880 NULL, FALSE)
2881 || var_check_ro(di->di_flags,
2882 NULL, FALSE))
2883 status = FAIL;
2884 else
2885 dictitem_remove(d, di);
2880 } 2886 }
2881 } 2887 }
2882 } 2888 }
2883 else if (tv_dest->v_type == VAR_LIST) 2889 else if (tv_dest->v_type == VAR_LIST)
2884 { 2890 {