Mercurial > vim
annotate src/vim9instr.c @ 26755:ddaea8dcaff5 v8.2.3906
patch 8.2.3906: Vim9 help still contains "under development" warnings
Commit: https://github.com/vim/vim/commit/1f318c6eac3d894a3fb9c68c53512cdd75e8f6b4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 26 18:09:31 2021 +0000
patch 8.2.3906: Vim9 help still contains "under development" warnings
Problem: Vim9 help still contains "under development" warnings.
Solution: Remove the explicit warning.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 26 Dec 2021 19:15:03 +0100 |
parents | b969fdb8cd46 |
children | 06a137af96f8 |
rev | line source |
---|---|
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 * |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 * VIM - Vi IMproved by Bram Moolenaar |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 * |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 * Do ":help uganda" in Vim to read copying and usage conditions. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 * Do ":help credits" in Vim to see a list of people who contributed. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 * See README.txt for an overview of the Vim source code. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 * vim9instr.c: Dealing with instructions of a compiled function |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 #define USING_FLOAT_STUFF |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 #include "vim.h" |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 #if defined(FEAT_EVAL) || defined(PROTO) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 // When not generating protos this is included in proto.h |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 #ifdef PROTO |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 # include "vim9.h" |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 ///////////////////////////////////////////////////////////////////// |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 // Following generate_ functions expect the caller to call ga_grow(). |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 #define RETURN_NULL_IF_SKIP(cctx) if (cctx->ctx_skip == SKIP_YES) return NULL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 #define RETURN_OK_IF_SKIP(cctx) if (cctx->ctx_skip == SKIP_YES) return OK |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 * Generate an instruction without arguments. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 * Returns a pointer to the new instruction, NULL if failed. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 isn_T * |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 generate_instr(cctx_T *cctx, isntype_T isn_type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 garray_T *instr = &cctx->ctx_instr; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 RETURN_NULL_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 if (GA_GROW_FAILS(instr, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 return NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 isn = ((isn_T *)instr->ga_data) + instr->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 isn->isn_type = isn_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 isn->isn_lnum = cctx->ctx_lnum + 1; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 ++instr->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 return isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 * Generate an instruction without arguments. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 * "drop" will be removed from the stack. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 * Returns a pointer to the new instruction, NULL if failed. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 isn_T * |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 generate_instr_drop(cctx_T *cctx, isntype_T isn_type, int drop) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 RETURN_NULL_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 stack->ga_len -= drop; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 return generate_instr(cctx, isn_type); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 * Generate instruction "isn_type" and put "type" on the type stack. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 isn_T * |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 generate_instr_type(cctx_T *cctx, isntype_T isn_type, type_T *type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 if ((isn = generate_instr(cctx, isn_type)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 return NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 return NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 ((type_T **)stack->ga_data)[stack->ga_len] = type == NULL ? &t_any : type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 return isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 * Generate an ISN_DEBUG instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 isn_T * |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 generate_instr_debug(cctx_T *cctx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 + cctx->ctx_ufunc->uf_dfunc_idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 if ((isn = generate_instr(cctx, ISN_DEBUG)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 return NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 isn->isn_arg.debug.dbg_var_names_len = dfunc->df_var_names.ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 isn->isn_arg.debug.dbg_break_lnum = cctx->ctx_prev_lnum; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 return isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 * If type at "offset" isn't already VAR_STRING then generate ISN_2STRING. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 * But only for simple types. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 * When "tolerant" is TRUE convert most types to string, e.g. a List. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 may_generate_2STRING(int offset, int tolerant, cctx_T *cctx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 isntype_T isntype = ISN_2STRING; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 type_T **type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 type = ((type_T **)stack->ga_data) + stack->ga_len + offset; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 switch ((*type)->tt_type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 // nothing to be done |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 case VAR_STRING: return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 // conversion possible |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 case VAR_SPECIAL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 case VAR_BOOL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 case VAR_NUMBER: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 case VAR_FLOAT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 // conversion possible (with runtime check) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 case VAR_ANY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 case VAR_UNKNOWN: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 isntype = ISN_2STRING_ANY; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 // conversion possible when tolerant |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 case VAR_LIST: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 if (tolerant) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 isntype = ISN_2STRING_ANY; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 // FALLTHROUGH |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 // conversion not possible |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 case VAR_VOID: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 case VAR_BLOB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 case VAR_FUNC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 case VAR_PARTIAL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 case VAR_DICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 case VAR_JOB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 case VAR_CHANNEL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 case VAR_INSTR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 to_string_error((*type)->tt_type); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 *type = &t_string; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 if ((isn = generate_instr(cctx, isntype)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 isn->isn_arg.tostring.offset = offset; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 isn->isn_arg.tostring.tolerant = tolerant; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 static int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 check_number_or_float(vartype_T type1, vartype_T type2, char_u *op) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 { |
26674
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
171 if (!((type1 == VAR_NUMBER || type1 == VAR_FLOAT |
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
172 || type1 == VAR_ANY || type1 == VAR_UNKNOWN) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 && (type2 == VAR_NUMBER || type2 == VAR_FLOAT |
26674
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
174 || type2 == VAR_ANY || type2 == VAR_UNKNOWN))) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 if (*op == '+') |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 emsg(_(e_wrong_argument_type_for_plus)); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 semsg(_(e_char_requires_number_or_float_arguments), *op); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 * Generate instruction for "+". For a list this creates a new list. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 generate_add_instr( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 vartype_T vartype, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 type_T *type1, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 type_T *type2, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 exprtype_T expr_type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 isn_T *isn = generate_instr_drop(cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 vartype == VAR_NUMBER ? ISN_OPNR |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 : vartype == VAR_LIST ? ISN_ADDLIST |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 : vartype == VAR_BLOB ? ISN_ADDBLOB |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 #ifdef FEAT_FLOAT |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 : vartype == VAR_FLOAT ? ISN_OPFLOAT |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 : ISN_OPANY, 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 if (vartype != VAR_LIST && vartype != VAR_BLOB |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 && type1->tt_type != VAR_ANY |
26674
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
208 && type1->tt_type != VAR_UNKNOWN |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 && type2->tt_type != VAR_ANY |
26674
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
210 && type2->tt_type != VAR_UNKNOWN |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 && check_number_or_float( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 type1->tt_type, type2->tt_type, (char_u *)"+") == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 if (isn != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 if (isn->isn_type == ISN_ADDLIST) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 isn->isn_arg.op.op_type = expr_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 isn->isn_arg.op.op_type = EXPR_ADD; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 // When concatenating two lists with different member types the member type |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 // becomes "any". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 if (vartype == VAR_LIST |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 && type1->tt_type == VAR_LIST && type2->tt_type == VAR_LIST |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 && type1->tt_member != type2->tt_member) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 (((type_T **)stack->ga_data)[stack->ga_len - 1]) = &t_list_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 return isn == NULL ? FAIL : OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 * Get the type to use for an instruction for an operation on "type1" and |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 * "type2". If they are matching use a type-specific instruction. Otherwise |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 * fall back to runtime type checking. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 vartype_T |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 operator_type(type_T *type1, type_T *type2) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 if (type1->tt_type == type2->tt_type |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 && (type1->tt_type == VAR_NUMBER |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 || type1->tt_type == VAR_LIST |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 #ifdef FEAT_FLOAT |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 || type1->tt_type == VAR_FLOAT |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 || type1->tt_type == VAR_BLOB)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 return type1->tt_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 return VAR_ANY; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
250 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 * Generate an instruction with two arguments. The instruction depends on the |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 * type of the arguments. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 generate_two_op(cctx_T *cctx, char_u *op) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 type_T *type1; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
261 type_T *type2; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 vartype_T vartype; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
267 // Get the known type of the two items on the stack. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 type1 = ((type_T **)stack->ga_data)[stack->ga_len - 2]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 type2 = ((type_T **)stack->ga_data)[stack->ga_len - 1]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 vartype = operator_type(type1, type2); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 switch (*op) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 case '+': |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 if (generate_add_instr(cctx, vartype, type1, type2, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 EXPR_COPY) == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
279 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 case '-': |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 case '*': |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 case '/': if (check_number_or_float(type1->tt_type, type2->tt_type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
283 op) == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
285 if (vartype == VAR_NUMBER) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 isn = generate_instr_drop(cctx, ISN_OPNR, 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
287 #ifdef FEAT_FLOAT |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 else if (vartype == VAR_FLOAT) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 isn = generate_instr_drop(cctx, ISN_OPFLOAT, 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 isn = generate_instr_drop(cctx, ISN_OPANY, 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 if (isn != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 isn->isn_arg.op.op_type = *op == '*' |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 ? EXPR_MULT : *op == '/'? EXPR_DIV : EXPR_SUB; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
298 case '%': if ((type1->tt_type != VAR_ANY |
26674
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
299 && type1->tt_type != VAR_UNKNOWN |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
300 && type1->tt_type != VAR_NUMBER) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
301 || (type2->tt_type != VAR_ANY |
26674
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
302 && type2->tt_type != VAR_UNKNOWN |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
303 && type2->tt_type != VAR_NUMBER)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
304 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
305 emsg(_(e_percent_requires_number_arguments)); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
306 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
307 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
308 isn = generate_instr_drop(cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
309 vartype == VAR_NUMBER ? ISN_OPNR : ISN_OPANY, 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
310 if (isn != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
311 isn->isn_arg.op.op_type = EXPR_REM; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
312 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
313 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
315 // correct type of result |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
316 if (vartype == VAR_ANY) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
317 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
318 type_T *type = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
320 #ifdef FEAT_FLOAT |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
321 // float+number and number+float results in float |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
322 if ((type1->tt_type == VAR_NUMBER || type1->tt_type == VAR_FLOAT) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 && (type2->tt_type == VAR_NUMBER || type2->tt_type == VAR_FLOAT)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
324 type = &t_float; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
325 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 ((type_T **)stack->ga_data)[stack->ga_len - 1] = type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
328 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
332 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
333 * Get the instruction to use for comparing "type1" with "type2" |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 * Return ISN_DROP when failed. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
336 static isntype_T |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 get_compare_isn(exprtype_T exprtype, vartype_T type1, vartype_T type2) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 isntype_T isntype = ISN_DROP; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
340 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 if (type1 == VAR_UNKNOWN) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
342 type1 = VAR_ANY; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
343 if (type2 == VAR_UNKNOWN) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
344 type2 = VAR_ANY; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
345 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
346 if (type1 == type2) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
347 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
348 switch (type1) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
350 case VAR_BOOL: isntype = ISN_COMPAREBOOL; break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
351 case VAR_SPECIAL: isntype = ISN_COMPARESPECIAL; break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
352 case VAR_NUMBER: isntype = ISN_COMPARENR; break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
353 case VAR_FLOAT: isntype = ISN_COMPAREFLOAT; break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
354 case VAR_STRING: isntype = ISN_COMPARESTRING; break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
355 case VAR_BLOB: isntype = ISN_COMPAREBLOB; break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
356 case VAR_LIST: isntype = ISN_COMPARELIST; break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
357 case VAR_DICT: isntype = ISN_COMPAREDICT; break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
358 case VAR_FUNC: isntype = ISN_COMPAREFUNC; break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
359 default: isntype = ISN_COMPAREANY; break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
360 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
361 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
362 else if (type1 == VAR_ANY || type2 == VAR_ANY |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
363 || ((type1 == VAR_NUMBER || type1 == VAR_FLOAT) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
364 && (type2 == VAR_NUMBER || type2 == VAR_FLOAT))) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
365 isntype = ISN_COMPAREANY; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
366 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
367 if ((exprtype == EXPR_IS || exprtype == EXPR_ISNOT) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
368 && (isntype == ISN_COMPAREBOOL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
369 || isntype == ISN_COMPARESPECIAL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
370 || isntype == ISN_COMPARENR |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 || isntype == ISN_COMPAREFLOAT)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
372 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 semsg(_(e_cannot_use_str_with_str), |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
374 exprtype == EXPR_IS ? "is" : "isnot" , vartype_name(type1)); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 return ISN_DROP; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
377 if (isntype == ISN_DROP |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
378 || ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
379 && (type1 == VAR_BOOL || type1 == VAR_SPECIAL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
380 || type2 == VAR_BOOL || type2 == VAR_SPECIAL))) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 || ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
382 && exprtype != EXPR_IS && exprtype != EXPR_ISNOT |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
383 && (type1 == VAR_BLOB || type2 == VAR_BLOB |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 || type1 == VAR_LIST || type2 == VAR_LIST)))) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 semsg(_(e_cannot_compare_str_with_str), |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 vartype_name(type1), vartype_name(type2)); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
388 return ISN_DROP; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
389 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 return isntype; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
391 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
392 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
393 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 check_compare_types(exprtype_T type, typval_T *tv1, typval_T *tv2) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
396 if (get_compare_isn(type, tv1->v_type, tv2->v_type) == ISN_DROP) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 * Generate an ISN_COMPARE* instruction with a boolean result. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
403 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 generate_COMPARE(cctx_T *cctx, exprtype_T exprtype, int ic) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 isntype_T isntype; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
408 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
410 vartype_T type1; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 vartype_T type2; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
412 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
413 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
414 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
415 // Get the known type of the two items on the stack. If they are matching |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
416 // use a type-specific instruction. Otherwise fall back to runtime type |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
417 // checking. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
418 type1 = ((type_T **)stack->ga_data)[stack->ga_len - 2]->tt_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
419 type2 = ((type_T **)stack->ga_data)[stack->ga_len - 1]->tt_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
420 isntype = get_compare_isn(exprtype, type1, type2); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
421 if (isntype == ISN_DROP) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
422 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
423 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
424 if ((isn = generate_instr(cctx, isntype)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
425 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 isn->isn_arg.op.op_type = exprtype; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 isn->isn_arg.op.op_ic = ic; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
428 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
429 // takes two arguments, puts one bool back |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
430 if (stack->ga_len >= 2) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
431 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
432 --stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
433 ((type_T **)stack->ga_data)[stack->ga_len - 1] = &t_bool; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
434 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
435 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
436 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
437 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 * Generate an ISN_2BOOL instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 * "offset" is the offset in the type stack. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 generate_2BOOL(cctx_T *cctx, int invert, int offset) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
447 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
448 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
450 if ((isn = generate_instr(cctx, ISN_2BOOL)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
451 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 isn->isn_arg.tobool.invert = invert; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 isn->isn_arg.tobool.offset = offset; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
454 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
455 // type becomes bool |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 ((type_T **)stack->ga_data)[stack->ga_len + offset] = &t_bool; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
457 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
458 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
459 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
460 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
461 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
462 * Generate an ISN_COND2BOOL instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
463 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 generate_COND2BOOL(cctx_T *cctx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
466 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
467 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
468 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
470 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
471 if ((isn = generate_instr(cctx, ISN_COND2BOOL)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
472 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 // type becomes bool |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 ((type_T **)stack->ga_data)[stack->ga_len - 1] = &t_bool; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
478 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
479 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
480 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
481 generate_TYPECHECK( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
483 type_T *expected, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
484 int offset, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
485 int argidx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
486 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
488 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
489 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
490 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
491 if ((isn = generate_instr(cctx, ISN_CHECKTYPE)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
493 isn->isn_arg.type.ct_type = alloc_type(expected); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
494 isn->isn_arg.type.ct_off = (int8_T)offset; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 isn->isn_arg.type.ct_arg_idx = (int8_T)argidx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
496 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
497 // type becomes expected |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
498 ((type_T **)stack->ga_data)[stack->ga_len + offset] = expected; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
499 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
500 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
501 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
502 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
503 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
504 generate_SETTYPE( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
506 type_T *expected) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
507 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
508 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
509 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
510 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 if ((isn = generate_instr(cctx, ISN_SETTYPE)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
512 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
513 isn->isn_arg.type.ct_type = alloc_type(expected); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
515 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
517 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 * Generate a PUSH instruction for "tv". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 * "tv" will be consumed or cleared. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 * Nothing happens if "tv" is NULL or of type VAR_UNKNOWN; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
522 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
523 generate_tv_PUSH(cctx_T *cctx, typval_T *tv) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
524 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
525 if (tv != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
526 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
527 switch (tv->v_type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
528 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
529 case VAR_UNKNOWN: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
530 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
531 case VAR_BOOL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
532 generate_PUSHBOOL(cctx, tv->vval.v_number); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
533 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
534 case VAR_SPECIAL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
535 generate_PUSHSPEC(cctx, tv->vval.v_number); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
536 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
537 case VAR_NUMBER: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
538 generate_PUSHNR(cctx, tv->vval.v_number); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
539 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
540 #ifdef FEAT_FLOAT |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
541 case VAR_FLOAT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
542 generate_PUSHF(cctx, tv->vval.v_float); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
543 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
544 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
545 case VAR_BLOB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
546 generate_PUSHBLOB(cctx, tv->vval.v_blob); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
547 tv->vval.v_blob = NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
548 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
549 case VAR_STRING: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
550 generate_PUSHS(cctx, &tv->vval.v_string); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
551 tv->vval.v_string = NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
552 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
553 default: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
554 iemsg("constant type not supported"); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
555 clear_tv(tv); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
556 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
557 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
558 tv->v_type = VAR_UNKNOWN; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
559 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
560 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
561 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
562 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
563 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
564 * Generate an ISN_PUSHNR instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
565 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
566 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
567 generate_PUSHNR(cctx_T *cctx, varnumber_T number) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
568 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
569 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
570 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
571 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
572 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
573 if ((isn = generate_instr_type(cctx, ISN_PUSHNR, &t_number)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
574 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
575 isn->isn_arg.number = number; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
576 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
577 if (number == 0 || number == 1) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
578 // A 0 or 1 number can also be used as a bool. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
579 ((type_T **)stack->ga_data)[stack->ga_len - 1] = &t_number_bool; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
580 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
581 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
582 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
583 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
584 * Generate an ISN_PUSHBOOL instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
585 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
586 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
587 generate_PUSHBOOL(cctx_T *cctx, varnumber_T number) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
588 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
589 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
590 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
591 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
592 if ((isn = generate_instr_type(cctx, ISN_PUSHBOOL, &t_bool)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
593 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
594 isn->isn_arg.number = number; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
595 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
596 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
597 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
598 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
599 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
600 * Generate an ISN_PUSHSPEC instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
601 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
602 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
603 generate_PUSHSPEC(cctx_T *cctx, varnumber_T number) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
604 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
605 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
606 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
607 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
608 if ((isn = generate_instr_type(cctx, ISN_PUSHSPEC, &t_special)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
609 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
610 isn->isn_arg.number = number; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
611 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
612 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
613 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
614 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
615 #if defined(FEAT_FLOAT) || defined(PROTO) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
616 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
617 * Generate an ISN_PUSHF instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
618 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
619 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
620 generate_PUSHF(cctx_T *cctx, float_T fnumber) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
621 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
622 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
623 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
624 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
625 if ((isn = generate_instr_type(cctx, ISN_PUSHF, &t_float)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
626 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
627 isn->isn_arg.fnumber = fnumber; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
628 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
629 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
630 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
631 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
632 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
633 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
634 * Generate an ISN_PUSHS instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
635 * Consumes "*str". When freed *str is set to NULL, unless "str" is NULL. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
636 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
637 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
638 generate_PUSHS(cctx_T *cctx, char_u **str) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
639 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
640 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
641 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
642 if (cctx->ctx_skip == SKIP_YES) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
643 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
644 if (str != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
645 VIM_CLEAR(*str); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
646 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
647 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
648 if ((isn = generate_instr_type(cctx, ISN_PUSHS, &t_string)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
649 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
650 if (str != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
651 VIM_CLEAR(*str); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
652 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
653 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
654 isn->isn_arg.string = str == NULL ? NULL : *str; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
655 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
656 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
657 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
658 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
659 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
660 * Generate an ISN_PUSHCHANNEL instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
661 * Consumes "channel". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
662 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
663 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
664 generate_PUSHCHANNEL(cctx_T *cctx, channel_T *channel) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
665 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
666 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
667 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
668 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
669 if ((isn = generate_instr_type(cctx, ISN_PUSHCHANNEL, &t_channel)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
670 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
671 isn->isn_arg.channel = channel; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
672 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
675 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
676 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
677 * Generate an ISN_PUSHJOB instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
678 * Consumes "job". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
679 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
680 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
681 generate_PUSHJOB(cctx_T *cctx, job_T *job) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
682 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
683 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
684 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
685 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
686 if ((isn = generate_instr_type(cctx, ISN_PUSHJOB, &t_channel)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
687 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
688 isn->isn_arg.job = job; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
689 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
690 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
691 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
692 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
693 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
694 * Generate an ISN_PUSHBLOB instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
695 * Consumes "blob". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
696 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
697 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
698 generate_PUSHBLOB(cctx_T *cctx, blob_T *blob) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
699 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
700 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
701 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
702 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
703 if ((isn = generate_instr_type(cctx, ISN_PUSHBLOB, &t_blob)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
704 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
705 isn->isn_arg.blob = blob; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
706 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
707 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
708 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
709 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
710 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
711 * Generate an ISN_PUSHFUNC instruction with name "name". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
712 * Consumes "name". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
713 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
714 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
715 generate_PUSHFUNC(cctx_T *cctx, char_u *name, type_T *type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
716 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
717 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
718 char_u *funcname; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
719 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
720 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
721 if ((isn = generate_instr_type(cctx, ISN_PUSHFUNC, type)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
722 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
723 if (name == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
724 funcname = NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
725 else if (*name == K_SPECIAL) // script-local |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
726 funcname = vim_strsave(name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
727 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
728 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
729 funcname = alloc(STRLEN(name) + 3); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
730 if (funcname != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
731 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
732 STRCPY(funcname, "g:"); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
733 STRCPY(funcname + 2, name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
734 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
735 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
736 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
737 isn->isn_arg.string = funcname; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
738 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
739 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
740 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
741 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
742 * Generate an ISN_GETITEM instruction with "index". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
743 * "with_op" is TRUE for "+=" and other operators, the stack has the current |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
744 * value below the list with values. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
745 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
746 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
747 generate_GETITEM(cctx_T *cctx, int index, int with_op) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
748 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
749 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
750 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
751 type_T *type = ((type_T **)stack->ga_data)[stack->ga_len |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
752 - (with_op ? 2 : 1)]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
753 type_T *item_type = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
754 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
755 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
756 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
757 if (type->tt_type != VAR_LIST) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
758 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
759 // cannot happen, caller has checked the type |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
760 emsg(_(e_listreq)); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
761 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
762 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
763 item_type = type->tt_member; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
764 if ((isn = generate_instr(cctx, ISN_GETITEM)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
765 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
766 isn->isn_arg.getitem.gi_index = index; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
767 isn->isn_arg.getitem.gi_with_op = with_op; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
768 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
769 // add the item type to the type stack |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
770 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
771 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
772 ((type_T **)stack->ga_data)[stack->ga_len] = item_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
773 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
774 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
775 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
776 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
777 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
778 * Generate an ISN_SLICE instruction with "count". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
779 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
780 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
781 generate_SLICE(cctx_T *cctx, int count) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
782 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
783 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
784 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
785 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
786 if ((isn = generate_instr(cctx, ISN_SLICE)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
787 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
788 isn->isn_arg.number = count; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
789 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
790 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
791 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
792 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
793 * Generate an ISN_CHECKLEN instruction with "min_len". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
794 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
795 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
796 generate_CHECKLEN(cctx_T *cctx, int min_len, int more_OK) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
797 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
798 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
799 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
800 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
801 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
802 if ((isn = generate_instr(cctx, ISN_CHECKLEN)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
803 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
804 isn->isn_arg.checklen.cl_min_len = min_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
805 isn->isn_arg.checklen.cl_more_OK = more_OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
806 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
807 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
808 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
809 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
810 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
811 * Generate an ISN_STORE instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
812 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
813 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
814 generate_STORE(cctx_T *cctx, isntype_T isn_type, int idx, char_u *name) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
815 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
816 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
817 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
818 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
819 if ((isn = generate_instr_drop(cctx, isn_type, 1)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
820 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
821 if (name != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
822 isn->isn_arg.string = vim_strsave(name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
823 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
824 isn->isn_arg.number = idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
825 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
826 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
827 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
828 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
829 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
830 * Generate an ISN_STOREOUTER instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
831 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
832 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
833 generate_STOREOUTER(cctx_T *cctx, int idx, int level) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
834 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
835 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
836 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
837 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
838 if ((isn = generate_instr_drop(cctx, ISN_STOREOUTER, 1)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
839 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
840 isn->isn_arg.outer.outer_idx = idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
841 isn->isn_arg.outer.outer_depth = level; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
842 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
843 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
844 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
845 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
846 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
847 * Generate an ISN_STORENR instruction (short for ISN_PUSHNR + ISN_STORE) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
848 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
849 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
850 generate_STORENR(cctx_T *cctx, int idx, varnumber_T value) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
851 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
852 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
853 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
854 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
855 if ((isn = generate_instr(cctx, ISN_STORENR)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
856 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
857 isn->isn_arg.storenr.stnr_idx = idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
858 isn->isn_arg.storenr.stnr_val = value; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
859 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
860 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
861 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
862 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
863 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
864 * Generate an ISN_STOREOPT or ISN_STOREFUNCOPT instruction |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
865 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
866 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
867 generate_STOREOPT( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
868 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
869 isntype_T isn_type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
870 char_u *name, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
871 int opt_flags) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
872 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
873 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
874 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
875 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
876 if ((isn = generate_instr_drop(cctx, isn_type, 1)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
877 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
878 isn->isn_arg.storeopt.so_name = vim_strsave(name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
879 isn->isn_arg.storeopt.so_flags = opt_flags; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
880 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
881 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
882 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
883 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
884 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
885 * Generate an ISN_LOAD or similar instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
886 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
887 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
888 generate_LOAD( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
889 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
890 isntype_T isn_type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
891 int idx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
892 char_u *name, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
893 type_T *type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
894 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
895 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
896 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
897 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
898 if ((isn = generate_instr_type(cctx, isn_type, type)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
899 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
900 if (name != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
901 isn->isn_arg.string = vim_strsave(name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
902 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
903 isn->isn_arg.number = idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
904 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
905 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
906 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
907 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
908 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
909 * Generate an ISN_LOADOUTER instruction |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
910 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
911 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
912 generate_LOADOUTER( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
913 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
914 int idx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
915 int nesting, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
916 type_T *type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
917 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
918 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
919 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
920 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
921 if ((isn = generate_instr_type(cctx, ISN_LOADOUTER, type)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
922 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
923 isn->isn_arg.outer.outer_idx = idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
924 isn->isn_arg.outer.outer_depth = nesting; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
925 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
926 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
927 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
928 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
929 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
930 * Generate an ISN_LOADV instruction for v:var. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
931 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
932 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
933 generate_LOADV( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
934 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
935 char_u *name, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
936 int error) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
937 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
938 int di_flags; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
939 int vidx = find_vim_var(name, &di_flags); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
940 type_T *type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
941 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
942 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
943 if (vidx < 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
944 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
945 if (error) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
946 semsg(_(e_variable_not_found_str), name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
947 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
948 } |
26723
c3cffd372c6f
patch 8.2.3890: Vim9: type check for using v: variables is basic
Bram Moolenaar <Bram@vim.org>
parents:
26674
diff
changeset
|
949 type = get_vim_var_type(vidx, cctx->ctx_type_list); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
950 return generate_LOAD(cctx, ISN_LOADV, vidx, NULL, type); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
951 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
952 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
953 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
954 * Generate an ISN_UNLET instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
955 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
956 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
957 generate_UNLET(cctx_T *cctx, isntype_T isn_type, char_u *name, int forceit) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
958 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
959 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
960 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
961 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
962 if ((isn = generate_instr(cctx, isn_type)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
963 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
964 isn->isn_arg.unlet.ul_name = vim_strsave(name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
965 isn->isn_arg.unlet.ul_forceit = forceit; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
966 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
967 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
968 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
969 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
970 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
971 * Generate an ISN_LOCKCONST instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
972 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
973 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
974 generate_LOCKCONST(cctx_T *cctx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
975 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
976 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
977 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
978 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
979 if ((isn = generate_instr(cctx, ISN_LOCKCONST)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
980 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
981 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
982 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
983 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
984 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
985 * Generate an ISN_LOADS instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
986 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
987 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
988 generate_OLDSCRIPT( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
989 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
990 isntype_T isn_type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
991 char_u *name, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
992 int sid, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
993 type_T *type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
994 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
995 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
996 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
997 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
998 if (isn_type == ISN_LOADS) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
999 isn = generate_instr_type(cctx, isn_type, type); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1000 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1001 isn = generate_instr_drop(cctx, isn_type, 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1002 if (isn == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1003 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1004 isn->isn_arg.loadstore.ls_name = vim_strsave(name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1005 isn->isn_arg.loadstore.ls_sid = sid; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1006 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1007 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1008 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1009 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1010 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1011 * Generate an ISN_LOADSCRIPT or ISN_STORESCRIPT instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1012 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1013 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1014 generate_VIM9SCRIPT( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1015 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1016 isntype_T isn_type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1017 int sid, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1018 int idx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1019 type_T *type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1020 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1021 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1022 scriptref_T *sref; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1023 scriptitem_T *si = SCRIPT_ITEM(sid); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1024 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1025 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1026 if (isn_type == ISN_LOADSCRIPT) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1027 isn = generate_instr_type(cctx, isn_type, type); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1028 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1029 isn = generate_instr_drop(cctx, isn_type, 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1030 if (isn == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1031 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1032 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1033 // This requires three arguments, which doesn't fit in an instruction, thus |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1034 // we need to allocate a struct for this. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1035 sref = ALLOC_ONE(scriptref_T); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1036 if (sref == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1037 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1038 isn->isn_arg.script.scriptref = sref; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1039 sref->sref_sid = sid; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1040 sref->sref_idx = idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1041 sref->sref_seq = si->sn_script_seq; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1042 sref->sref_type = type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1043 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1044 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1045 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1046 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1047 * Generate an ISN_NEWLIST instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1048 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1049 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1050 generate_NEWLIST(cctx_T *cctx, int count) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1051 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1052 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1053 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1054 type_T *type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1055 type_T *member; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1056 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1057 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1058 if ((isn = generate_instr(cctx, ISN_NEWLIST)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1059 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1060 isn->isn_arg.number = count; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1061 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1062 // get the member type from all the items on the stack. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1063 if (count == 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1064 member = &t_unknown; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1065 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1066 member = get_member_type_from_stack( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1067 ((type_T **)stack->ga_data) + stack->ga_len, count, 1, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1068 cctx->ctx_type_list); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1069 type = get_list_type(member, cctx->ctx_type_list); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1070 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1071 // drop the value types |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1072 stack->ga_len -= count; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1073 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1074 // add the list type to the type stack |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1075 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1076 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1077 ((type_T **)stack->ga_data)[stack->ga_len] = type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1078 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1079 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1080 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1081 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1082 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1083 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1084 * Generate an ISN_NEWDICT instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1085 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1086 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1087 generate_NEWDICT(cctx_T *cctx, int count) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1088 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1089 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1090 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1091 type_T *type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1092 type_T *member; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1093 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1094 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1095 if ((isn = generate_instr(cctx, ISN_NEWDICT)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1096 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1097 isn->isn_arg.number = count; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1098 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1099 if (count == 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1100 member = &t_void; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1101 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1102 member = get_member_type_from_stack( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1103 ((type_T **)stack->ga_data) + stack->ga_len, count, 2, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1104 cctx->ctx_type_list); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1105 type = get_dict_type(member, cctx->ctx_type_list); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1106 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1107 // drop the key and value types |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1108 stack->ga_len -= 2 * count; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1109 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1110 // add the dict type to the type stack |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1111 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1112 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1113 ((type_T **)stack->ga_data)[stack->ga_len] = type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1114 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1115 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1116 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1117 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1118 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1119 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1120 * Generate an ISN_FUNCREF instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1121 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1122 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1123 generate_FUNCREF(cctx_T *cctx, ufunc_T *ufunc) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1124 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1125 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1126 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1127 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1128 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1129 if ((isn = generate_instr(cctx, ISN_FUNCREF)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1130 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1131 if (ufunc->uf_def_status == UF_NOT_COMPILED) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1132 isn->isn_arg.funcref.fr_func_name = vim_strsave(ufunc->uf_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1133 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1134 isn->isn_arg.funcref.fr_dfunc_idx = ufunc->uf_dfunc_idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1135 cctx->ctx_has_closure = 1; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1136 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1137 // If the referenced function is a closure, it may use items further up in |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1138 // the nested context, including this one. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1139 if (ufunc->uf_flags & FC_CLOSURE) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1140 cctx->ctx_ufunc->uf_flags |= FC_CLOSURE; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1141 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1142 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1143 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1144 ((type_T **)stack->ga_data)[stack->ga_len] = |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1145 ufunc->uf_func_type == NULL ? &t_func_any : ufunc->uf_func_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1146 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1147 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1148 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1149 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1150 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1151 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1152 * Generate an ISN_NEWFUNC instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1153 * "lambda_name" and "func_name" must be in allocated memory and will be |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1154 * consumed. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1155 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1156 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1157 generate_NEWFUNC(cctx_T *cctx, char_u *lambda_name, char_u *func_name) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1158 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1159 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1160 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1161 if (cctx->ctx_skip == SKIP_YES) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1162 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1163 vim_free(lambda_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1164 vim_free(func_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1165 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1166 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1167 if ((isn = generate_instr(cctx, ISN_NEWFUNC)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1168 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1169 vim_free(lambda_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1170 vim_free(func_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1171 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1172 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1173 isn->isn_arg.newfunc.nf_lambda = lambda_name; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1174 isn->isn_arg.newfunc.nf_global = func_name; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1175 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1176 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1177 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1178 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1179 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1180 * Generate an ISN_DEF instruction: list functions |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1181 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1182 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1183 generate_DEF(cctx_T *cctx, char_u *name, size_t len) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1184 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1185 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1186 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1187 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1188 if ((isn = generate_instr(cctx, ISN_DEF)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1189 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1190 if (len > 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1191 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1192 isn->isn_arg.string = vim_strnsave(name, len); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1193 if (isn->isn_arg.string == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1194 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1195 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1196 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1197 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1198 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1199 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1200 * Generate an ISN_JUMP instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1201 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1202 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1203 generate_JUMP(cctx_T *cctx, jumpwhen_T when, int where) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1204 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1205 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1206 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1207 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1208 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1209 if ((isn = generate_instr(cctx, ISN_JUMP)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1210 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1211 isn->isn_arg.jump.jump_when = when; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1212 isn->isn_arg.jump.jump_where = where; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1213 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1214 if (when != JUMP_ALWAYS && stack->ga_len > 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1215 --stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1216 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1217 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1218 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1219 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1220 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1221 * Generate an ISN_JUMP_IF_ARG_SET instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1222 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1223 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1224 generate_JUMP_IF_ARG_SET(cctx_T *cctx, int arg_off) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1225 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1226 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1227 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1228 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1229 if ((isn = generate_instr(cctx, ISN_JUMP_IF_ARG_SET)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1230 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1231 isn->isn_arg.jumparg.jump_arg_off = arg_off; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1232 // jump_where is set later |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1233 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1234 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1235 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1236 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1237 generate_FOR(cctx_T *cctx, int loop_idx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1238 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1239 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1240 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1241 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1242 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1243 if ((isn = generate_instr(cctx, ISN_FOR)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1244 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1245 isn->isn_arg.forloop.for_idx = loop_idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1246 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1247 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1248 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1249 // type doesn't matter, will be stored next |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1250 ((type_T **)stack->ga_data)[stack->ga_len] = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1251 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1252 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1253 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1254 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1255 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1256 * Generate an ISN_TRYCONT instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1257 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1258 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1259 generate_TRYCONT(cctx_T *cctx, int levels, int where) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1260 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1261 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1262 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1263 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1264 if ((isn = generate_instr(cctx, ISN_TRYCONT)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1265 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1266 isn->isn_arg.trycont.tct_levels = levels; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1267 isn->isn_arg.trycont.tct_where = where; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1268 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1269 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1270 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1271 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1272 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1273 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1274 * Generate an ISN_BCALL instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1275 * "method_call" is TRUE for "value->method()" |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1276 * Return FAIL if the number of arguments is wrong. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1277 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1278 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1279 generate_BCALL(cctx_T *cctx, int func_idx, int argcount, int method_call) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1280 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1281 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1282 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1283 int argoff; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1284 type_T **argtypes = NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1285 type_T *shuffled_argtypes[MAX_FUNC_ARGS]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1286 type_T *maptype = NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1287 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1288 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1289 argoff = check_internal_func(func_idx, argcount); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1290 if (argoff < 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1291 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1292 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1293 if (method_call && argoff > 1) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1294 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1295 if ((isn = generate_instr(cctx, ISN_SHUFFLE)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1296 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1297 isn->isn_arg.shuffle.shfl_item = argcount; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1298 isn->isn_arg.shuffle.shfl_up = argoff - 1; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1299 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1300 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1301 if (argcount > 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1302 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1303 // Check the types of the arguments. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1304 argtypes = ((type_T **)stack->ga_data) + stack->ga_len - argcount; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1305 if (method_call && argoff > 1) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1306 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1307 int i; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1308 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1309 for (i = 0; i < argcount; ++i) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1310 shuffled_argtypes[i] = (i < argoff - 1) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1311 ? argtypes[i + 1] |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1312 : (i == argoff - 1) ? argtypes[0] : argtypes[i]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1313 argtypes = shuffled_argtypes; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1314 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1315 if (internal_func_check_arg_types(argtypes, func_idx, argcount, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1316 cctx) == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1317 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1318 if (internal_func_is_map(func_idx)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1319 maptype = *argtypes; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1320 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1321 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1322 if ((isn = generate_instr(cctx, ISN_BCALL)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1323 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1324 isn->isn_arg.bfunc.cbf_idx = func_idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1325 isn->isn_arg.bfunc.cbf_argcount = argcount; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1326 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1327 // Drop the argument types and push the return type. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1328 stack->ga_len -= argcount; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1329 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1330 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1331 ((type_T **)stack->ga_data)[stack->ga_len] = |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1332 internal_func_ret_type(func_idx, argcount, argtypes); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1333 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1334 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1335 if (maptype != NULL && maptype->tt_member != NULL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1336 && maptype->tt_member != &t_any) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1337 // Check that map() didn't change the item types. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1338 generate_TYPECHECK(cctx, maptype, -1, 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1339 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1340 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1341 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1342 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1343 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1344 * Generate an ISN_LISTAPPEND instruction. Works like add(). |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1345 * Argument count is already checked. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1346 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1347 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1348 generate_LISTAPPEND(cctx_T *cctx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1349 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1350 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1351 type_T *list_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1352 type_T *item_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1353 type_T *expected; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1354 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1355 // Caller already checked that list_type is a list. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1356 list_type = ((type_T **)stack->ga_data)[stack->ga_len - 2]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1357 item_type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1358 expected = list_type->tt_member; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1359 if (need_type(item_type, expected, -1, 0, cctx, FALSE, FALSE) == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1360 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1361 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1362 if (generate_instr(cctx, ISN_LISTAPPEND) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1363 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1364 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1365 --stack->ga_len; // drop the argument |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1366 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1367 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1368 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1369 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1370 * Generate an ISN_BLOBAPPEND instruction. Works like add(). |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1371 * Argument count is already checked. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1372 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1373 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1374 generate_BLOBAPPEND(cctx_T *cctx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1375 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1376 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1377 type_T *item_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1378 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1379 // Caller already checked that blob_type is a blob. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1380 item_type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1381 if (need_type(item_type, &t_number, -1, 0, cctx, FALSE, FALSE) == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1382 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1383 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1384 if (generate_instr(cctx, ISN_BLOBAPPEND) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1385 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1386 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1387 --stack->ga_len; // drop the argument |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1388 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1389 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1390 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1391 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1392 * Generate an ISN_DCALL or ISN_UCALL instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1393 * Return FAIL if the number of arguments is wrong. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1394 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1395 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1396 generate_CALL(cctx_T *cctx, ufunc_T *ufunc, int pushed_argcount) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1397 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1398 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1399 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1400 int regular_args = ufunc->uf_args.ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1401 int argcount = pushed_argcount; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1402 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1403 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1404 if (argcount > regular_args && !has_varargs(ufunc)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1405 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1406 semsg(_(e_too_many_arguments_for_function_str), |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1407 printable_func_name(ufunc)); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1408 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1409 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1410 if (argcount < regular_args - ufunc->uf_def_args.ga_len) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1411 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1412 semsg(_(e_not_enough_arguments_for_function_str), |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1413 printable_func_name(ufunc)); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1414 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1415 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1416 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1417 if (ufunc->uf_def_status != UF_NOT_COMPILED |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1418 && ufunc->uf_def_status != UF_COMPILE_ERROR) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1419 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1420 int i; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1421 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1422 for (i = 0; i < argcount; ++i) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1423 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1424 type_T *expected; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1425 type_T *actual; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1426 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1427 actual = ((type_T **)stack->ga_data)[stack->ga_len - argcount + i]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1428 if (actual == &t_special |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1429 && i >= regular_args - ufunc->uf_def_args.ga_len) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1430 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1431 // assume v:none used for default argument value |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1432 continue; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1433 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1434 if (i < regular_args) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1435 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1436 if (ufunc->uf_arg_types == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1437 continue; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1438 expected = ufunc->uf_arg_types[i]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1439 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1440 else if (ufunc->uf_va_type == NULL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1441 || ufunc->uf_va_type == &t_list_any) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1442 // possibly a lambda or "...: any" |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1443 expected = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1444 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1445 expected = ufunc->uf_va_type->tt_member; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1446 if (need_type(actual, expected, -argcount + i, i + 1, cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1447 TRUE, FALSE) == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1448 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1449 arg_type_mismatch(expected, actual, i + 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1450 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1451 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1452 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1453 if (func_needs_compiling(ufunc, COMPILE_TYPE(ufunc)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1454 && compile_def_function(ufunc, ufunc->uf_ret_type == NULL, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1455 COMPILE_TYPE(ufunc), NULL) == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1456 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1457 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1458 if (ufunc->uf_def_status == UF_COMPILE_ERROR) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1459 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1460 emsg_funcname(_(e_call_to_function_that_failed_to_compile_str), |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1461 ufunc->uf_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1462 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1463 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1464 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1465 if ((isn = generate_instr(cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1466 ufunc->uf_def_status != UF_NOT_COMPILED ? ISN_DCALL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1467 : ISN_UCALL)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1468 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1469 if (isn->isn_type == ISN_DCALL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1470 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1471 isn->isn_arg.dfunc.cdf_idx = ufunc->uf_dfunc_idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1472 isn->isn_arg.dfunc.cdf_argcount = argcount; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1473 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1474 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1475 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1476 // A user function may be deleted and redefined later, can't use the |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1477 // ufunc pointer, need to look it up again at runtime. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1478 isn->isn_arg.ufunc.cuf_name = vim_strsave(ufunc->uf_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1479 isn->isn_arg.ufunc.cuf_argcount = argcount; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1480 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1481 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1482 stack->ga_len -= argcount; // drop the arguments |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1483 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1484 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1485 // add return value |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1486 ((type_T **)stack->ga_data)[stack->ga_len] = ufunc->uf_ret_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1487 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1488 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1489 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1490 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1491 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1492 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1493 * Generate an ISN_UCALL instruction when the function isn't defined yet. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1494 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1495 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1496 generate_UCALL(cctx_T *cctx, char_u *name, int argcount) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1497 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1498 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1499 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1500 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1501 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1502 if ((isn = generate_instr(cctx, ISN_UCALL)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1503 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1504 isn->isn_arg.ufunc.cuf_name = vim_strsave(name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1505 isn->isn_arg.ufunc.cuf_argcount = argcount; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1506 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1507 stack->ga_len -= argcount; // drop the arguments |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1508 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1509 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1510 // add return value |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1511 ((type_T **)stack->ga_data)[stack->ga_len] = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1512 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1513 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1514 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1515 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1516 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1517 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1518 * Generate an ISN_PCALL instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1519 * "type" is the type of the FuncRef. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1520 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1521 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1522 generate_PCALL( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1523 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1524 int argcount, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1525 char_u *name, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1526 type_T *type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1527 int at_top) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1528 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1529 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1530 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1531 type_T *ret_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1532 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1533 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1534 |
26674
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
1535 if (type->tt_type == VAR_ANY || type->tt_type == VAR_UNKNOWN) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1536 ret_type = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1537 else if (type->tt_type == VAR_FUNC || type->tt_type == VAR_PARTIAL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1538 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1539 if (type->tt_argcount != -1) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1540 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1541 int varargs = (type->tt_flags & TTFLAG_VARARGS) ? 1 : 0; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1542 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1543 if (argcount < type->tt_min_argcount - varargs) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1544 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1545 semsg(_(e_not_enough_arguments_for_function_str), name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1546 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1547 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1548 if (!varargs && argcount > type->tt_argcount) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1549 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1550 semsg(_(e_too_many_arguments_for_function_str), name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1551 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1552 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1553 if (type->tt_args != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1554 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1555 int i; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1556 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1557 for (i = 0; i < argcount; ++i) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1558 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1559 int offset = -argcount + i - (at_top ? 0 : 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1560 type_T *actual = ((type_T **)stack->ga_data)[ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1561 stack->ga_len + offset]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1562 type_T *expected; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1563 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1564 if (varargs && i >= type->tt_argcount - 1) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1565 expected = type->tt_args[ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1566 type->tt_argcount - 1]->tt_member; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1567 else if (i >= type->tt_min_argcount |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1568 && actual == &t_special) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1569 expected = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1570 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1571 expected = type->tt_args[i]; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1572 if (need_type(actual, expected, offset, i + 1, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1573 cctx, TRUE, FALSE) == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1574 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1575 arg_type_mismatch(expected, actual, i + 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1576 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1577 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1578 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1579 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1580 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1581 ret_type = type->tt_member; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1582 if (ret_type == &t_unknown) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1583 // return type not known yet, use a runtime check |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1584 ret_type = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1585 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1586 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1587 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1588 semsg(_(e_not_callable_type_str), name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1589 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1590 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1591 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1592 if ((isn = generate_instr(cctx, ISN_PCALL)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1593 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1594 isn->isn_arg.pfunc.cpf_top = at_top; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1595 isn->isn_arg.pfunc.cpf_argcount = argcount; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1596 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1597 stack->ga_len -= argcount; // drop the arguments |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1598 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1599 // drop the funcref/partial, get back the return value |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1600 ((type_T **)stack->ga_data)[stack->ga_len - 1] = ret_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1601 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1602 // If partial is above the arguments it must be cleared and replaced with |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1603 // the return value. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1604 if (at_top && generate_instr(cctx, ISN_PCALL_END) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1605 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1606 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1607 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1608 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1609 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1610 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1611 * Generate an ISN_STRINGMEMBER instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1612 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1613 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1614 generate_STRINGMEMBER(cctx_T *cctx, char_u *name, size_t len) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1615 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1616 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1617 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1618 type_T *type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1619 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1620 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1621 if ((isn = generate_instr(cctx, ISN_STRINGMEMBER)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1622 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1623 isn->isn_arg.string = vim_strnsave(name, len); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1624 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1625 // check for dict type |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1626 type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; |
26674
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
1627 if (type->tt_type != VAR_DICT && type != &t_any && type != &t_unknown) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1628 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1629 char *tofree; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1630 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1631 semsg(_(e_expected_dictionary_for_using_key_str_but_got_str), |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1632 name, type_name(type, &tofree)); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1633 vim_free(tofree); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1634 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1635 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1636 // change dict type to dict member type |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1637 if (type->tt_type == VAR_DICT) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1638 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1639 ((type_T **)stack->ga_data)[stack->ga_len - 1] = |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1640 type->tt_member == &t_unknown ? &t_any : type->tt_member; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1641 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1642 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1643 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1644 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1645 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1646 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1647 * Generate an ISN_ECHO instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1648 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1649 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1650 generate_ECHO(cctx_T *cctx, int with_white, int count) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1651 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1652 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1653 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1654 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1655 if ((isn = generate_instr_drop(cctx, ISN_ECHO, count)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1656 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1657 isn->isn_arg.echo.echo_with_white = with_white; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1658 isn->isn_arg.echo.echo_count = count; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1659 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1660 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1661 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1662 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1663 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1664 * Generate an ISN_EXECUTE/ISN_ECHOMSG/ISN_ECHOERR instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1665 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1666 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1667 generate_MULT_EXPR(cctx_T *cctx, isntype_T isn_type, int count) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1668 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1669 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1670 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1671 if ((isn = generate_instr_drop(cctx, isn_type, count)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1672 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1673 isn->isn_arg.number = count; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1674 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1675 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1676 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1677 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1678 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1679 * Generate an ISN_PUT instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1680 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1681 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1682 generate_PUT(cctx_T *cctx, int regname, linenr_T lnum) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1683 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1684 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1685 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1686 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1687 if ((isn = generate_instr(cctx, ISN_PUT)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1688 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1689 isn->isn_arg.put.put_regname = regname; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1690 isn->isn_arg.put.put_lnum = lnum; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1691 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1692 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1693 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1694 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1695 * Generate an EXEC instruction that takes a string argument. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1696 * A copy is made of "line". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1697 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1698 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1699 generate_EXEC_copy(cctx_T *cctx, isntype_T isntype, char_u *line) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1700 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1701 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1702 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1703 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1704 if ((isn = generate_instr(cctx, isntype)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1705 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1706 isn->isn_arg.string = vim_strsave(line); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1707 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1708 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1709 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1710 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1711 * Generate an EXEC instruction that takes a string argument. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1712 * "str" must be allocated, it is consumed. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1713 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1714 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1715 generate_EXEC(cctx_T *cctx, isntype_T isntype, char_u *str) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1716 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1717 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1718 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1719 if (cctx->ctx_skip == SKIP_YES) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1720 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1721 vim_free(str); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1722 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1723 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1724 if ((isn = generate_instr(cctx, isntype)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1725 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1726 vim_free(str); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1727 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1728 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1729 isn->isn_arg.string = str; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1730 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1731 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1732 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1733 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1734 generate_LEGACY_EVAL(cctx_T *cctx, char_u *line) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1735 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1736 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1737 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1738 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1739 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1740 if ((isn = generate_instr(cctx, ISN_LEGACY_EVAL)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1741 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1742 isn->isn_arg.string = vim_strsave(line); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1743 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1744 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1745 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1746 ((type_T **)stack->ga_data)[stack->ga_len] = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1747 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1748 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1749 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1750 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1751 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1752 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1753 generate_EXECCONCAT(cctx_T *cctx, int count) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1754 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1755 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1756 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1757 if ((isn = generate_instr_drop(cctx, ISN_EXECCONCAT, count)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1758 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1759 isn->isn_arg.number = count; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1760 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1761 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1762 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1763 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1764 * Generate ISN_RANGE. Consumes "range". Return OK/FAIL. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1765 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1766 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1767 generate_RANGE(cctx_T *cctx, char_u *range) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1768 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1769 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1770 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1771 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1772 if ((isn = generate_instr(cctx, ISN_RANGE)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1773 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1774 isn->isn_arg.string = range; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1775 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1776 if (GA_GROW_FAILS(stack, 1)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1777 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1778 ((type_T **)stack->ga_data)[stack->ga_len] = &t_number; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1779 ++stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1780 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1781 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1782 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1783 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1784 generate_UNPACK(cctx_T *cctx, int var_count, int semicolon) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1785 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1786 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1787 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1788 RETURN_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1789 if ((isn = generate_instr(cctx, ISN_UNPACK)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1790 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1791 isn->isn_arg.unpack.unp_count = var_count; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1792 isn->isn_arg.unpack.unp_semicolon = semicolon; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1793 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1794 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1795 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1796 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1797 * Generate an instruction for any command modifiers. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1798 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1799 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1800 generate_cmdmods(cctx_T *cctx, cmdmod_T *cmod) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1801 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1802 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1803 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1804 if (has_cmdmod(cmod, FALSE)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1805 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1806 cctx->ctx_has_cmdmod = TRUE; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1807 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1808 if ((isn = generate_instr(cctx, ISN_CMDMOD)) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1809 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1810 isn->isn_arg.cmdmod.cf_cmdmod = ALLOC_ONE(cmdmod_T); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1811 if (isn->isn_arg.cmdmod.cf_cmdmod == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1812 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1813 mch_memmove(isn->isn_arg.cmdmod.cf_cmdmod, cmod, sizeof(cmdmod_T)); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1814 // filter program now belongs to the instruction |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1815 cmod->cmod_filter_regmatch.regprog = NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1816 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1817 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1818 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1819 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1820 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1821 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1822 generate_undo_cmdmods(cctx_T *cctx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1823 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1824 if (cctx->ctx_has_cmdmod && generate_instr(cctx, ISN_CMDMOD_REV) == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1825 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1826 cctx->ctx_has_cmdmod = FALSE; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1827 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1828 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1829 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1830 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1831 * Generate a STORE instruction for "dest", not being "dest_local". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1832 * Return FAIL when out of memory. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1833 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1834 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1835 generate_store_var( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1836 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1837 assign_dest_T dest, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1838 int opt_flags, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1839 int vimvaridx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1840 int scriptvar_idx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1841 int scriptvar_sid, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1842 type_T *type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1843 char_u *name) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1844 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1845 switch (dest) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1846 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1847 case dest_option: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1848 return generate_STOREOPT(cctx, ISN_STOREOPT, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1849 skip_option_env_lead(name), opt_flags); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1850 case dest_func_option: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1851 return generate_STOREOPT(cctx, ISN_STOREFUNCOPT, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1852 skip_option_env_lead(name), opt_flags); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1853 case dest_global: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1854 // include g: with the name, easier to execute that way |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1855 return generate_STORE(cctx, vim_strchr(name, AUTOLOAD_CHAR) == NULL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1856 ? ISN_STOREG : ISN_STOREAUTO, 0, name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1857 case dest_buffer: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1858 // include b: with the name, easier to execute that way |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1859 return generate_STORE(cctx, ISN_STOREB, 0, name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1860 case dest_window: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1861 // include w: with the name, easier to execute that way |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1862 return generate_STORE(cctx, ISN_STOREW, 0, name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1863 case dest_tab: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1864 // include t: with the name, easier to execute that way |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1865 return generate_STORE(cctx, ISN_STORET, 0, name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1866 case dest_env: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1867 return generate_STORE(cctx, ISN_STOREENV, 0, name + 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1868 case dest_reg: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1869 return generate_STORE(cctx, ISN_STOREREG, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1870 name[1] == '@' ? '"' : name[1], NULL); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1871 case dest_vimvar: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1872 return generate_STORE(cctx, ISN_STOREV, vimvaridx, NULL); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1873 case dest_script: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1874 if (scriptvar_idx < 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1875 // "s:" may be included in the name. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1876 return generate_OLDSCRIPT(cctx, ISN_STORES, name, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1877 scriptvar_sid, type); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1878 return generate_VIM9SCRIPT(cctx, ISN_STORESCRIPT, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1879 scriptvar_sid, scriptvar_idx, type); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1880 case dest_local: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1881 case dest_expr: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1882 // cannot happen |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1883 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1884 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1885 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1886 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1887 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1888 int |
26729
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1889 generate_store_lhs(cctx_T *cctx, lhs_T *lhs, int instr_count, int is_decl) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1890 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1891 if (lhs->lhs_dest != dest_local) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1892 return generate_store_var(cctx, lhs->lhs_dest, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1893 lhs->lhs_opt_flags, lhs->lhs_vimvaridx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1894 lhs->lhs_scriptvar_idx, lhs->lhs_scriptvar_sid, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1895 lhs->lhs_type, lhs->lhs_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1896 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1897 if (lhs->lhs_lvar != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1898 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1899 garray_T *instr = &cctx->ctx_instr; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1900 isn_T *isn = ((isn_T *)instr->ga_data) + instr->ga_len - 1; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1901 |
26729
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1902 // Optimization: turn "var = 123" from ISN_PUSHNR + ISN_STORE into |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1903 // ISN_STORENR. |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1904 // And "var = 0" does not need any instruction. |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1905 if (lhs->lhs_lvar->lv_from_outer == 0 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1906 && instr->ga_len == instr_count + 1 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1907 && isn->isn_type == ISN_PUSHNR) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1908 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1909 varnumber_T val = isn->isn_arg.number; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1910 garray_T *stack = &cctx->ctx_type_stack; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1911 |
26729
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1912 if (val == 0 && is_decl) |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1913 { |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1914 --instr->ga_len; |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1915 } |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1916 else |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1917 { |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1918 isn->isn_type = ISN_STORENR; |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1919 isn->isn_arg.storenr.stnr_idx = lhs->lhs_lvar->lv_idx; |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1920 isn->isn_arg.storenr.stnr_val = val; |
b969fdb8cd46
patch 8.2.3893: Vim9: many local variables are initialized with an instruction
Bram Moolenaar <Bram@vim.org>
parents:
26723
diff
changeset
|
1921 } |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1922 if (stack->ga_len > 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1923 --stack->ga_len; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1924 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1925 else if (lhs->lhs_lvar->lv_from_outer > 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1926 generate_STOREOUTER(cctx, lhs->lhs_lvar->lv_idx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1927 lhs->lhs_lvar->lv_from_outer); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1928 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1929 generate_STORE(cctx, ISN_STORE, lhs->lhs_lvar->lv_idx, NULL); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1930 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1931 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1932 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1933 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1934 #if defined(FEAT_PROFILE) || defined(PROTO) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1935 void |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1936 may_generate_prof_end(cctx_T *cctx, int prof_lnum) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1937 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1938 if (cctx->ctx_compile_type == CT_PROFILE && prof_lnum >= 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1939 generate_instr(cctx, ISN_PROF_END); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1940 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1941 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1942 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1943 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1944 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1945 * Delete an instruction, free what it contains. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1946 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1947 void |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1948 delete_instr(isn_T *isn) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1949 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1950 switch (isn->isn_type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1951 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1952 case ISN_DEF: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1953 case ISN_EXEC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1954 case ISN_EXECRANGE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1955 case ISN_EXEC_SPLIT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1956 case ISN_LEGACY_EVAL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1957 case ISN_LOADAUTO: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1958 case ISN_LOADB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1959 case ISN_LOADENV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1960 case ISN_LOADG: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1961 case ISN_LOADOPT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1962 case ISN_LOADT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1963 case ISN_LOADW: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1964 case ISN_LOCKUNLOCK: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1965 case ISN_PUSHEXC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1966 case ISN_PUSHFUNC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1967 case ISN_PUSHS: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1968 case ISN_RANGE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1969 case ISN_STOREAUTO: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1970 case ISN_STOREB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1971 case ISN_STOREENV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1972 case ISN_STOREG: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1973 case ISN_STORET: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1974 case ISN_STOREW: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1975 case ISN_STRINGMEMBER: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1976 vim_free(isn->isn_arg.string); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1977 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1978 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1979 case ISN_SUBSTITUTE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1980 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1981 int idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1982 isn_T *list = isn->isn_arg.subs.subs_instr; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1983 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1984 vim_free(isn->isn_arg.subs.subs_cmd); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1985 for (idx = 0; list[idx].isn_type != ISN_FINISH; ++idx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1986 delete_instr(list + idx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1987 vim_free(list); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1988 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1989 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1990 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1991 case ISN_INSTR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1992 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1993 int idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1994 isn_T *list = isn->isn_arg.instr; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1995 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1996 for (idx = 0; list[idx].isn_type != ISN_FINISH; ++idx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1997 delete_instr(list + idx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1998 vim_free(list); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1999 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2000 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2001 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2002 case ISN_LOADS: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2003 case ISN_STORES: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2004 vim_free(isn->isn_arg.loadstore.ls_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2005 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2006 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2007 case ISN_UNLET: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2008 case ISN_UNLETENV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2009 vim_free(isn->isn_arg.unlet.ul_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2010 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2011 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2012 case ISN_STOREOPT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2013 case ISN_STOREFUNCOPT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2014 vim_free(isn->isn_arg.storeopt.so_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2015 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2016 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2017 case ISN_PUSHBLOB: // push blob isn_arg.blob |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2018 blob_unref(isn->isn_arg.blob); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2019 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2020 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2021 case ISN_PUSHJOB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2022 #ifdef FEAT_JOB_CHANNEL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2023 job_unref(isn->isn_arg.job); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2024 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2025 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2026 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2027 case ISN_PUSHCHANNEL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2028 #ifdef FEAT_JOB_CHANNEL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2029 channel_unref(isn->isn_arg.channel); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2030 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2031 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2032 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2033 case ISN_UCALL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2034 vim_free(isn->isn_arg.ufunc.cuf_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2035 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2036 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2037 case ISN_FUNCREF: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2038 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2039 if (isn->isn_arg.funcref.fr_func_name == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2040 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2041 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2042 + isn->isn_arg.funcref.fr_dfunc_idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2043 ufunc_T *ufunc = dfunc->df_ufunc; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2044 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2045 if (ufunc != NULL && func_name_refcount(ufunc->uf_name)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2046 func_ptr_unref(ufunc); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2047 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2048 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2049 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2050 char_u *name = isn->isn_arg.funcref.fr_func_name; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2051 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2052 if (name != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2053 func_unref(name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2054 vim_free(isn->isn_arg.funcref.fr_func_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2055 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2056 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2057 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2058 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2059 case ISN_DCALL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2060 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2061 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2062 + isn->isn_arg.dfunc.cdf_idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2063 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2064 if (dfunc->df_ufunc != NULL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2065 && func_name_refcount(dfunc->df_ufunc->uf_name)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2066 func_ptr_unref(dfunc->df_ufunc); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2067 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2068 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2069 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2070 case ISN_NEWFUNC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2071 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2072 char_u *lambda = isn->isn_arg.newfunc.nf_lambda; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2073 ufunc_T *ufunc = find_func_even_dead(lambda, TRUE, NULL); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2074 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2075 if (ufunc != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2076 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2077 unlink_def_function(ufunc); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2078 func_ptr_unref(ufunc); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2079 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2080 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2081 vim_free(lambda); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2082 vim_free(isn->isn_arg.newfunc.nf_global); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2083 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2084 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2085 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2086 case ISN_CHECKTYPE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2087 case ISN_SETTYPE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2088 free_type(isn->isn_arg.type.ct_type); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2089 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2090 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2091 case ISN_CMDMOD: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2092 vim_regfree(isn->isn_arg.cmdmod.cf_cmdmod |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2093 ->cmod_filter_regmatch.regprog); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2094 vim_free(isn->isn_arg.cmdmod.cf_cmdmod); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2095 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2096 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2097 case ISN_LOADSCRIPT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2098 case ISN_STORESCRIPT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2099 vim_free(isn->isn_arg.script.scriptref); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2100 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2101 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2102 case ISN_TRY: |
26672
3516017e5f54
patch 8.2.3865: Vim9: compiler complains about using "try" as a struct member
Bram Moolenaar <Bram@vim.org>
parents:
26662
diff
changeset
|
2103 vim_free(isn->isn_arg.tryref.try_ref); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2104 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2105 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2106 case ISN_CEXPR_CORE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2107 vim_free(isn->isn_arg.cexpr.cexpr_ref->cer_cmdline); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2108 vim_free(isn->isn_arg.cexpr.cexpr_ref); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2109 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2110 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2111 case ISN_2BOOL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2112 case ISN_2STRING: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2113 case ISN_2STRING_ANY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2114 case ISN_ADDBLOB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2115 case ISN_ADDLIST: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2116 case ISN_ANYINDEX: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2117 case ISN_ANYSLICE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2118 case ISN_BCALL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2119 case ISN_BLOBAPPEND: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2120 case ISN_BLOBINDEX: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2121 case ISN_BLOBSLICE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2122 case ISN_CATCH: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2123 case ISN_CEXPR_AUCMD: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2124 case ISN_CHECKLEN: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2125 case ISN_CHECKNR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2126 case ISN_CLEARDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2127 case ISN_CMDMOD_REV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2128 case ISN_COMPAREANY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2129 case ISN_COMPAREBLOB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2130 case ISN_COMPAREBOOL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2131 case ISN_COMPAREDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2132 case ISN_COMPAREFLOAT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2133 case ISN_COMPAREFUNC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2134 case ISN_COMPARELIST: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2135 case ISN_COMPARENR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2136 case ISN_COMPARESPECIAL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2137 case ISN_COMPARESTRING: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2138 case ISN_CONCAT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2139 case ISN_COND2BOOL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2140 case ISN_DEBUG: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2141 case ISN_DROP: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2142 case ISN_ECHO: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2143 case ISN_ECHOCONSOLE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2144 case ISN_ECHOERR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2145 case ISN_ECHOMSG: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2146 case ISN_ENDTRY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2147 case ISN_EXECCONCAT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2148 case ISN_EXECUTE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2149 case ISN_FINALLY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2150 case ISN_FINISH: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2151 case ISN_FOR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2152 case ISN_GETITEM: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2153 case ISN_JUMP: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2154 case ISN_JUMP_IF_ARG_SET: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2155 case ISN_LISTAPPEND: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2156 case ISN_LISTINDEX: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2157 case ISN_LISTSLICE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2158 case ISN_LOAD: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2159 case ISN_LOADBDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2160 case ISN_LOADGDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2161 case ISN_LOADOUTER: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2162 case ISN_LOADREG: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2163 case ISN_LOADTDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2164 case ISN_LOADV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2165 case ISN_LOADWDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2166 case ISN_LOCKCONST: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2167 case ISN_MEMBER: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2168 case ISN_NEGATENR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2169 case ISN_NEWDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2170 case ISN_NEWLIST: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2171 case ISN_OPANY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2172 case ISN_OPFLOAT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2173 case ISN_OPNR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2174 case ISN_PCALL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2175 case ISN_PCALL_END: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2176 case ISN_PROF_END: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2177 case ISN_PROF_START: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2178 case ISN_PUSHBOOL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2179 case ISN_PUSHF: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2180 case ISN_PUSHNR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2181 case ISN_PUSHSPEC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2182 case ISN_PUT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2183 case ISN_REDIREND: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2184 case ISN_REDIRSTART: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2185 case ISN_RETURN: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2186 case ISN_RETURN_VOID: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2187 case ISN_SHUFFLE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2188 case ISN_SLICE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2189 case ISN_STORE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2190 case ISN_STOREINDEX: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2191 case ISN_STORENR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2192 case ISN_STOREOUTER: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2193 case ISN_STORERANGE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2194 case ISN_STOREREG: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2195 case ISN_STOREV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2196 case ISN_STRINDEX: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2197 case ISN_STRSLICE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2198 case ISN_THROW: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2199 case ISN_TRYCONT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2200 case ISN_UNLETINDEX: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2201 case ISN_UNLETRANGE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2202 case ISN_UNPACK: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2203 case ISN_USEDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2204 // nothing allocated |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2205 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2206 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2207 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2208 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2209 void |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2210 clear_instr_ga(garray_T *gap) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2211 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2212 int idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2213 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2214 for (idx = 0; idx < gap->ga_len; ++idx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2215 delete_instr(((isn_T *)gap->ga_data) + idx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2216 ga_clear(gap); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2217 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2218 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2219 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2220 #endif // defined(FEAT_EVAL) |