0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 9.1.0148: Vim9: can't call internal methods with objects

Problem:  Vim9: can't call internal methods with objects
Solution: Add support for empty(), len() and string() function
          calls for objects (Yegappan Lakshmanan)

closes: #14129

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2024-03-03 16:26:58 +01:00
committed by Christian Brabandt
parent 2157035637
commit d3eae7bc11
16 changed files with 1083 additions and 83 deletions

View File

@@ -1530,6 +1530,17 @@ typedef enum {
#define OCMFLAG_FINAL 0x02 // "final" object/class member
#define OCMFLAG_CONST 0x04 // "const" object/class member
/*
* Object methods called by builtin functions (e.g. string(), empty(), etc.)
*/
typedef enum {
CLASS_BUILTIN_INVALID,
CLASS_BUILTIN_STRING,
CLASS_BUILTIN_EMPTY,
CLASS_BUILTIN_LEN,
CLASS_BUILTIN_MAX
} class_builtin_T;
/*
* Entry for an object or class member variable.
*/
@@ -1593,6 +1604,9 @@ struct class_S
int class_obj_method_count_child; // count without "extends"
ufunc_T **class_obj_methods; // allocated
// index of builtin methods
int class_builtin_methods[CLASS_BUILTIN_MAX];
garray_T class_type_list; // used for type pointers
type_T class_type; // type used for the class
type_T class_object_type; // same as class_type but VAR_OBJECT