Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
31415:4fd33db887f2 | 31416:f088f1d97eee |
---|---|
50 if (lvar != NULL) | 50 if (lvar != NULL) |
51 { | 51 { |
52 CLEAR_POINTER(lvar); | 52 CLEAR_POINTER(lvar); |
53 lvar->lv_name = (char_u *)"this"; | 53 lvar->lv_name = (char_u *)"this"; |
54 if (cctx->ctx_ufunc->uf_class != NULL) | 54 if (cctx->ctx_ufunc->uf_class != NULL) |
55 lvar->lv_type = &cctx->ctx_ufunc->uf_class->class_type; | 55 lvar->lv_type = &cctx->ctx_ufunc->uf_class->class_object_type; |
56 } | 56 } |
57 return OK; | 57 return OK; |
58 } | 58 } |
59 | 59 |
60 // Find local in current function scope. | 60 // Find local in current function scope. |
973 { | 973 { |
974 r = FAIL; | 974 r = FAIL; |
975 goto theend; | 975 goto theend; |
976 } | 976 } |
977 | 977 |
978 ufunc = define_function(eap, lambda_name, lines_to_free, NULL); | 978 ufunc = define_function(eap, lambda_name, lines_to_free, FALSE); |
979 if (ufunc == NULL) | 979 if (ufunc == NULL) |
980 { | 980 { |
981 r = eap->skip ? OK : FAIL; | 981 r = eap->skip ? OK : FAIL; |
982 goto theend; | 982 goto theend; |
983 } | 983 } |