Mercurial > vim
diff src/vim9compile.c @ 31416:f088f1d97eee v9.0.1041
patch 9.0.1041: cannot define a method in a class
Commit: https://github.com/vim/vim/commit/ffdaca9e6f3d39af6857ac52ced9385df203a152
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 9 21:41:48 2022 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 09 Dec 2022 22:45:03 +0100 |
parents | 307f68a41b03 |
children | e31fc75f6aff |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -52,7 +52,7 @@ lookup_local(char_u *name, size_t len, l 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, cc 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;