comparison src/vim9.h @ 31483:1bebc2093e6b v9.0.1074

patch 9.0.1074: class members are not supported yet Commit: https://github.com/vim/vim/commit/d505d178858434e1afef0363a9fce4bcb1bc3d06 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 18 21:42:55 2022 +0000 patch 9.0.1074: class members are not supported yet Problem: Class members are not supported yet. Solution: Add initial support for class members.
author Bram Moolenaar <Bram@vim.org>
date Sun, 18 Dec 2022 22:45:04 +0100
parents e572ff386670
children 9b13b3a63bc0
comparison
equal deleted inserted replaced
31482:ac877632b863 31483:1bebc2093e6b
34 ISN_INSTR, // instructions compiled from expression 34 ISN_INSTR, // instructions compiled from expression
35 ISN_CONSTRUCT, // construct an object, using contstruct_T 35 ISN_CONSTRUCT, // construct an object, using contstruct_T
36 ISN_GET_OBJ_MEMBER, // object member, index is isn_arg.number 36 ISN_GET_OBJ_MEMBER, // object member, index is isn_arg.number
37 ISN_STORE_THIS, // store value in "this" object member, index is 37 ISN_STORE_THIS, // store value in "this" object member, index is
38 // isn_arg.number 38 // isn_arg.number
39 ISN_LOAD_CLASSMEMBER, // load class member, using classmember_T
40 ISN_STORE_CLASSMEMBER, // store in class member, using classmember_T
39 41
40 // get and set variables 42 // get and set variables
41 ISN_LOAD, // push local variable isn_arg.number 43 ISN_LOAD, // push local variable isn_arg.number
42 ISN_LOADV, // push v: variable isn_arg.number 44 ISN_LOADV, // push v: variable isn_arg.number
43 ISN_LOADG, // push g: variable isn_arg.string 45 ISN_LOADG, // push g: variable isn_arg.string
473 // arguments to ISN_CONSTRUCT 475 // arguments to ISN_CONSTRUCT
474 typedef struct { 476 typedef struct {
475 int construct_size; // size of object in bytes 477 int construct_size; // size of object in bytes
476 class_T *construct_class; // class the object is created from 478 class_T *construct_class; // class the object is created from
477 } construct_T; 479 } construct_T;
480
481 // arguments to ISN_STORE_CLASSMEMBER and ISN_LOAD_CLASSMEMBER
482 typedef struct {
483 class_T *cm_class;
484 int cm_idx;
485 } classmember_T;
478 486
479 /* 487 /*
480 * Instruction 488 * Instruction
481 */ 489 */
482 struct isn_S { 490 struct isn_S {
526 getitem_T getitem; 534 getitem_T getitem;
527 debug_T debug; 535 debug_T debug;
528 deferins_T defer; 536 deferins_T defer;
529 echowin_T echowin; 537 echowin_T echowin;
530 construct_T construct; 538 construct_T construct;
539 classmember_T classmember;
531 } isn_arg; 540 } isn_arg;
532 }; 541 };
533 542
534 /* 543 /*
535 * Info about a function defined with :def. Used in "def_functions". 544 * Info about a function defined with :def. Used in "def_functions".
536 */ 545 */
537 struct dfunc_S { 546 struct dfunc_S {
538 ufunc_T *df_ufunc; // struct containing most stuff 547 ufunc_T *df_ufunc; // struct containing most stuff
539 int df_refcount; // how many ufunc_T point to this dfunc_T 548 int df_refcount; // how many ufunc_T point to this dfunc_T
540 int df_idx; // index in def_functions 549 int df_idx; // index in def_functions
541 int df_deleted; // if TRUE function was deleted 550 char df_deleted; // if TRUE function was deleted
551 char df_delete_busy; // TRUE when in
552 // delete_def_function_contents()
542 int df_script_seq; // Value of sctx_T sc_seq when the function 553 int df_script_seq; // Value of sctx_T sc_seq when the function
543 // was compiled. 554 // was compiled.
544 char_u *df_name; // name used for error messages 555 char_u *df_name; // name used for error messages
545 556
546 garray_T df_def_args_isn; // default argument instructions 557 garray_T df_def_args_isn; // default argument instructions
733 dest_global, 744 dest_global,
734 dest_buffer, 745 dest_buffer,
735 dest_window, 746 dest_window,
736 dest_tab, 747 dest_tab,
737 dest_vimvar, 748 dest_vimvar,
749 dest_class_member,
738 dest_script, 750 dest_script,
739 dest_reg, 751 dest_reg,
740 dest_expr, 752 dest_expr,
741 } assign_dest_T; 753 } assign_dest_T;
742 754
764 int lhs_vimvaridx; // for when destination is a v:var 776 int lhs_vimvaridx; // for when destination is a v:var
765 777
766 lvar_T lhs_local_lvar; // used for existing local destination 778 lvar_T lhs_local_lvar; // used for existing local destination
767 lvar_T lhs_arg_lvar; // used for argument destination 779 lvar_T lhs_arg_lvar; // used for argument destination
768 lvar_T *lhs_lvar; // points to destination lvar 780 lvar_T *lhs_lvar; // points to destination lvar
781
782 class_T *lhs_class; // for dest_class_member
783 int lhs_classmember_idx; // for dest_class_member
784
769 int lhs_scriptvar_sid; 785 int lhs_scriptvar_sid;
770 int lhs_scriptvar_idx; 786 int lhs_scriptvar_idx;
771 787
772 int lhs_has_type; // type was specified 788 int lhs_has_type; // type was specified
773 type_T *lhs_type; 789 type_T *lhs_type;