comparison 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
comparison
equal deleted inserted replaced
31415:4fd33db887f2 31416:f088f1d97eee
1476 int class_obj_member_count; 1476 int class_obj_member_count;
1477 objmember_T *class_obj_members; // allocated 1477 objmember_T *class_obj_members; // allocated
1478 1478
1479 int class_obj_method_count; 1479 int class_obj_method_count;
1480 ufunc_T **class_obj_methods; // allocated 1480 ufunc_T **class_obj_methods; // allocated
1481 ufunc_T *class_new_func; // new() function that was created
1482 1481
1483 garray_T class_type_list; // used for type pointers 1482 garray_T class_type_list; // used for type pointers
1484 type_T class_type; 1483 type_T class_type;
1484 type_T class_object_type; // same as class_type but VAR_OBJECT
1485 }; 1485 };
1486 1486
1487 // Used for v_object of typval of VAR_OBJECT. 1487 // Used for v_object of typval of VAR_OBJECT.
1488 // The member variables follow in an array of typval_T. 1488 // The member variables follow in an array of typval_T.
1489 struct object_S { 1489 struct object_S
1490 {
1490 class_T *obj_class; // class this object is created for; 1491 class_T *obj_class; // class this object is created for;
1491 // pointer adds to class_refcount 1492 // pointer adds to class_refcount
1492 int obj_refcount; 1493 int obj_refcount;
1493 1494
1494 object_T *obj_next_used; // for list headed by "first_object" 1495 object_T *obj_next_used; // for list headed by "first_object"
2121 linenr_T fe_lastline; // last line of range 2122 linenr_T fe_lastline; // last line of range
2122 int *fe_doesrange; // if not NULL: return: function handled range 2123 int *fe_doesrange; // if not NULL: return: function handled range
2123 int fe_evaluate; // actually evaluate expressions 2124 int fe_evaluate; // actually evaluate expressions
2124 partial_T *fe_partial; // for extra arguments 2125 partial_T *fe_partial; // for extra arguments
2125 dict_T *fe_selfdict; // Dictionary for "self" 2126 dict_T *fe_selfdict; // Dictionary for "self"
2127 object_T *fe_object; // object, e.g. for "this.Func()"
2126 typval_T *fe_basetv; // base for base->method() 2128 typval_T *fe_basetv; // base for base->method()
2127 type_T *fe_check_type; // type from funcref or NULL 2129 type_T *fe_check_type; // type from funcref or NULL
2128 int fe_found_var; // if the function is not found then give an 2130 int fe_found_var; // if the function is not found then give an
2129 // error that a variable is not callable. 2131 // error that a variable is not callable.
2130 } funcexe_T; 2132 } funcexe_T;