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

patch 9.0.1074: class members are not supported yet

Problem:    Class members are not supported yet.
Solution:   Add initial support for class members.
This commit is contained in:
Bram Moolenaar
2022-12-18 21:42:55 +00:00
parent 731d00770d
commit d505d17885
13 changed files with 578 additions and 215 deletions

View File

@@ -1387,6 +1387,7 @@ typedef signed char int8_T;
typedef double float_T;
typedef struct typval_S typval_T;
typedef struct listvar_S list_T;
typedef struct dictvar_S dict_T;
typedef struct partial_S partial_T;
@@ -1466,14 +1467,14 @@ typedef enum {
} omacc_T;
/*
* Entry for an object member variable.
* Entry for an object or class member variable.
*/
typedef struct {
char_u *om_name; // allocated
omacc_T om_access;
type_T *om_type;
char_u *om_init; // allocated
} objmember_T;
char_u *ocm_name; // allocated
omacc_T ocm_access;
type_T *ocm_type;
char_u *ocm_init; // allocated
} ocmember_T;
// "class_T": used for v_class of typval of VAR_CLASS
struct class_S
@@ -1481,14 +1482,25 @@ struct class_S
char_u *class_name; // allocated
int class_refcount;
int class_obj_member_count;
objmember_T *class_obj_members; // allocated
// class members: "static varname"
int class_class_member_count;
ocmember_T *class_class_members; // allocated
typval_T *class_members_tv; // allocated array of class member vals
// class methods: "static def SomeMethod()"
int class_class_method_count;
ufunc_T **class_class_methods; // allocated
// object members: "this.varname"
int class_obj_member_count;
ocmember_T *class_obj_members; // allocated
// object methods: "def SomeMethod()"
int class_obj_method_count;
ufunc_T **class_obj_methods; // allocated
garray_T class_type_list; // used for type pointers
type_T class_type;
type_T class_type; // type used for the class
type_T class_object_type; // same as class_type but VAR_OBJECT
};
@@ -1513,7 +1525,7 @@ struct object_S
/*
* Structure to hold an internal variable without a name.
*/
typedef struct
struct typval_S
{
vartype_T v_type;
char v_lock; // see below: VAR_LOCKED, VAR_FIXED
@@ -1534,7 +1546,7 @@ typedef struct
class_T *v_class; // class value (can be NULL)
object_T *v_object; // object value (can be NULL)
} vval;
} typval_T;
};
// Values for "dv_scope".
#define VAR_SCOPE 1 // a:, v:, s:, etc. scope dictionaries