@@ -3461,7 +3461,7 @@ ex_call(exarg_T *eap)
34613461 int doesrange;
34623462 int failed = FALSE;
34633463 funcdict_T fudi;
3464- partial_T *partial;
3464+ partial_T *partial = NULL ;
34653465
34663466 if (eap->skip)
34673467 {
@@ -3497,12 +3497,6 @@ ex_call(exarg_T *eap)
34973497 name = deref_func_name(tofree, &len,
34983498 partial != NULL ? NULL : &partial, FALSE);
34993499
3500- /* When calling fdict.func(), where "func" is a partial, use "fdict"
3501- * instead of the dict in the partial, for backwards compatibility.
3502- * TODO: Do use the arguments in the partial? */
3503- if (fudi.fd_dict != NULL)
3504- partial = NULL;
3505-
35063500 /* Skip white space to allow ":call func ()". Not good, but required for
35073501 * backward compatibility. */
35083502 startarg = skipwhite(arg);
@@ -21734,17 +21728,18 @@ handle_subscript(
2173421728 }
2173521729 }
2173621730
21737- if (rettv->v_type == VAR_FUNC && selfdict != NULL)
21731+ if ((rettv->v_type == VAR_FUNC || rettv->v_type == VAR_PARTIAL)
21732+ && selfdict != NULL)
2173821733 {
21739- char_u *fname;
21734+ char_u *fname = rettv->v_type == VAR_FUNC ? rettv->vval.v_string
21735+ : rettv->vval.v_partial->pt_name;
2174021736 char_u *tofree = NULL;
2174121737 ufunc_T *fp;
2174221738 char_u fname_buf[FLEN_FIXED + 1];
2174321739 int error;
2174421740
2174521741 /* Translate "s:func" to the stored function name. */
21746- fname = fname_trans_sid(rettv->vval.v_string, fname_buf,
21747- &tofree, &error);
21742+ fname = fname_trans_sid(fname, fname_buf, &tofree, &error);
2174821743 fp = find_func(fname);
2174921744 vim_free(tofree);
2175021745
@@ -21758,7 +21753,34 @@ handle_subscript(
2175821753 pt->pt_refcount = 1;
2175921754 pt->pt_dict = selfdict;
2176021755 selfdict = NULL;
21761- pt->pt_name = rettv->vval.v_string;
21756+ if (rettv->v_type == VAR_FUNC)
21757+ {
21758+ /* just a function: use selfdict */
21759+ pt->pt_name = rettv->vval.v_string;
21760+ }
21761+ else
21762+ {
21763+ partial_T *ret_pt = rettv->vval.v_partial;
21764+ int i;
21765+
21766+ /* partial: use selfdict and copy args */
21767+ pt->pt_name = vim_strsave(ret_pt->pt_name);
21768+ if (ret_pt->pt_argc > 0)
21769+ {
21770+ pt->pt_argv = (typval_T *)alloc(
21771+ sizeof(typval_T) * ret_pt->pt_argc);
21772+ if (pt->pt_argv == NULL)
21773+ /* out of memory: drop the arguments */
21774+ pt->pt_argc = 0;
21775+ else
21776+ {
21777+ pt->pt_argc = ret_pt->pt_argc;
21778+ for (i = 0; i < pt->pt_argc; i++)
21779+ copy_tv(&ret_pt->pt_argv[i], &pt->pt_argv[i]);
21780+ }
21781+ }
21782+ partial_unref(ret_pt);
21783+ }
2176221784 func_ref(pt->pt_name);
2176321785 rettv->v_type = VAR_PARTIAL;
2176421786 rettv->vval.v_partial = pt;
@@ -23915,6 +23937,8 @@ trans_function_name(
2391523937 {
2391623938 name = vim_strsave(lv.ll_tv->vval.v_partial->pt_name);
2391723939 *pp = end;
23940+ if (partial != NULL)
23941+ *partial = lv.ll_tv->vval.v_partial;
2391823942 }
2391923943 else
2392023944 {
0 commit comments