1
0
forked from aniani/vim

patch 9.0.1031: Vim9 class is not implemented yet

Problem:    Vim9 class is not implemented yet.
Solution:   Add very basic class support.
This commit is contained in:
Bram Moolenaar
2022-12-08 15:32:33 +00:00
parent 038e6d20e6
commit 00b28d6c23
29 changed files with 1066 additions and 74 deletions

View File

@@ -32,6 +32,7 @@ typedef enum {
ISN_SOURCE, // source autoload script, isn_arg.number is the script ID
ISN_INSTR, // instructions compiled from expression
ISN_CONSTRUCT, // construct an object, using contstruct_T
// get and set variables
ISN_LOAD, // push local variable isn_arg.number
@@ -110,6 +111,7 @@ typedef enum {
ISN_PCALL_END, // cleanup after ISN_PCALL with cpf_top set
ISN_RETURN, // return, result is on top of stack
ISN_RETURN_VOID, // Push void, then return
ISN_RETURN_OBJECT, // Push constructed object, then return
ISN_FUNCREF, // push a function ref to dfunc isn_arg.funcref
ISN_NEWFUNC, // create a global function from a lambda function
ISN_DEF, // list functions
@@ -463,6 +465,12 @@ typedef struct {
long ewin_time; // time argument (msec)
} echowin_T;
// arguments to ISN_CONSTRUCT
typedef struct {
int construct_size; // size of object in bytes
class_T *construct_class; // class the object is created from
} construct_T;
/*
* Instruction
*/
@@ -514,6 +522,7 @@ struct isn_S {
debug_T debug;
deferins_T defer;
echowin_T echowin;
construct_T construct;
} isn_arg;
};
@@ -757,7 +766,8 @@ typedef struct {
int lhs_has_type; // type was specified
type_T *lhs_type;
type_T *lhs_member_type;
int lhs_member_idx; // object member index
type_T *lhs_member_type; // list/dict/object member type
int lhs_append; // used by ISN_REDIREND
} lhs_T;