diff src/structs.h @ 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 60b1d266548d
children e31fc75f6aff
line wrap: on
line diff
--- a/src/structs.h
+++ b/src/structs.h
@@ -1478,15 +1478,16 @@ struct class_S
 
     int		class_obj_method_count;
     ufunc_T	**class_obj_methods;	// allocated
-    ufunc_T	*class_new_func;	// new() function that was created
 
     garray_T	class_type_list;	// used for type pointers
     type_T	class_type;
+    type_T	class_object_type;	// same as class_type but VAR_OBJECT
 };
 
 // Used for v_object of typval of VAR_OBJECT.
 // The member variables follow in an array of typval_T.
-struct object_S {
+struct object_S
+{
     class_T	*obj_class;	    // class this object is created for;
 				    // pointer adds to class_refcount
     int		obj_refcount;
@@ -2123,6 +2124,7 @@ typedef struct {
     int		fe_evaluate;	// actually evaluate expressions
     partial_T	*fe_partial;	// for extra arguments
     dict_T	*fe_selfdict;	// Dictionary for "self"
+    object_T	*fe_object;	// object, e.g. for "this.Func()"
     typval_T	*fe_basetv;	// base for base->method()
     type_T	*fe_check_type;	// type from funcref or NULL
     int		fe_found_var;	// if the function is not found then give an