Mercurial > vim
comparison src/vim9instr.c @ 31396:307f68a41b03 v9.0.1031
patch 9.0.1031: Vim9 class is not implemented yet
Commit: https://github.com/vim/vim/commit/00b28d6c23d8e662cab27e461825777c0a2e387a
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 8 15:32:33 2022 +0000
patch 9.0.1031: Vim9 class is not implemented yet
Problem: Vim9 class is not implemented yet.
Solution: Add very basic class support.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 08 Dec 2022 16:45:03 +0100 |
parents | 030bdef24446 |
children | f088f1d97eee |
comparison
equal
deleted
inserted
replaced
31395:88027ff41075 | 31396:307f68a41b03 |
---|---|
109 if ((isn = generate_instr(cctx, ISN_DEBUG)) == NULL) | 109 if ((isn = generate_instr(cctx, ISN_DEBUG)) == NULL) |
110 return NULL; | 110 return NULL; |
111 isn->isn_arg.debug.dbg_var_names_len = dfunc->df_var_names.ga_len; | 111 isn->isn_arg.debug.dbg_var_names_len = dfunc->df_var_names.ga_len; |
112 isn->isn_arg.debug.dbg_break_lnum = cctx->ctx_prev_lnum; | 112 isn->isn_arg.debug.dbg_break_lnum = cctx->ctx_prev_lnum; |
113 return isn; | 113 return isn; |
114 } | |
115 | |
116 /* | |
117 * Generate an ISN_CONSTRUCT instruction. | |
118 * The object will have "size" members. | |
119 */ | |
120 int | |
121 generate_CONSTRUCT(cctx_T *cctx, class_T *cl) | |
122 { | |
123 isn_T *isn; | |
124 | |
125 RETURN_OK_IF_SKIP(cctx); | |
126 if ((isn = generate_instr(cctx, ISN_CONSTRUCT)) == NULL) | |
127 return FAIL; | |
128 isn->isn_arg.construct.construct_size = sizeof(object_T) | |
129 + cl->class_obj_member_count * sizeof(typval_T); | |
130 isn->isn_arg.construct.construct_class = cl; | |
131 return OK; | |
114 } | 132 } |
115 | 133 |
116 /* | 134 /* |
117 * If type at "offset" isn't already VAR_STRING then generate ISN_2STRING. | 135 * If type at "offset" isn't already VAR_STRING then generate ISN_2STRING. |
118 * But only for simple types. | 136 * But only for simple types. |
161 case VAR_PARTIAL: | 179 case VAR_PARTIAL: |
162 case VAR_DICT: | 180 case VAR_DICT: |
163 case VAR_JOB: | 181 case VAR_JOB: |
164 case VAR_CHANNEL: | 182 case VAR_CHANNEL: |
165 case VAR_INSTR: | 183 case VAR_INSTR: |
184 case VAR_CLASS: | |
185 case VAR_OBJECT: | |
166 to_string_error(type->tt_type); | 186 to_string_error(type->tt_type); |
167 return FAIL; | 187 return FAIL; |
168 } | 188 } |
169 | 189 |
170 set_type_on_stack(cctx, &t_string, -1 - offset); | 190 set_type_on_stack(cctx, &t_string, -1 - offset); |
2401 case ISN_COMPARENR: | 2421 case ISN_COMPARENR: |
2402 case ISN_COMPARENULL: | 2422 case ISN_COMPARENULL: |
2403 case ISN_COMPARESPECIAL: | 2423 case ISN_COMPARESPECIAL: |
2404 case ISN_COMPARESTRING: | 2424 case ISN_COMPARESTRING: |
2405 case ISN_CONCAT: | 2425 case ISN_CONCAT: |
2426 case ISN_CONSTRUCT: | |
2406 case ISN_COND2BOOL: | 2427 case ISN_COND2BOOL: |
2407 case ISN_DEBUG: | 2428 case ISN_DEBUG: |
2408 case ISN_DEFER: | 2429 case ISN_DEFER: |
2409 case ISN_DROP: | 2430 case ISN_DROP: |
2410 case ISN_ECHO: | 2431 case ISN_ECHO: |
2455 case ISN_PUT: | 2476 case ISN_PUT: |
2456 case ISN_REDIREND: | 2477 case ISN_REDIREND: |
2457 case ISN_REDIRSTART: | 2478 case ISN_REDIRSTART: |
2458 case ISN_RETURN: | 2479 case ISN_RETURN: |
2459 case ISN_RETURN_VOID: | 2480 case ISN_RETURN_VOID: |
2481 case ISN_RETURN_OBJECT: | |
2460 case ISN_SHUFFLE: | 2482 case ISN_SHUFFLE: |
2461 case ISN_SLICE: | 2483 case ISN_SLICE: |
2462 case ISN_SOURCE: | 2484 case ISN_SOURCE: |
2463 case ISN_STORE: | 2485 case ISN_STORE: |
2464 case ISN_STOREINDEX: | 2486 case ISN_STOREINDEX: |