0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.1041: cannot define a method in a class

Problem:    Cannot define a method in a class.
Solution:   Implement defining an object method.  Make calling an object
            method work.
This commit is contained in:
Bram Moolenaar
2022-12-09 21:41:48 +00:00
parent 148bcd3610
commit ffdaca9e6f
17 changed files with 267 additions and 86 deletions

View File

@@ -52,7 +52,7 @@ lookup_local(char_u *name, size_t len, lvar_T *lvar, cctx_T *cctx)
CLEAR_POINTER(lvar);
lvar->lv_name = (char_u *)"this";
if (cctx->ctx_ufunc->uf_class != NULL)
lvar->lv_type = &cctx->ctx_ufunc->uf_class->class_type;
lvar->lv_type = &cctx->ctx_ufunc->uf_class->class_object_type;
}
return OK;
}
@@ -975,7 +975,7 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx, garray_T *lines_to_free)
goto theend;
}
ufunc = define_function(eap, lambda_name, lines_to_free, NULL);
ufunc = define_function(eap, lambda_name, lines_to_free, FALSE);
if (ufunc == NULL)
{
r = eap->skip ? OK : FAIL;