Mercurial > vim
annotate src/vim9instr.c @ 32150:3923c5051b87 v9.0.1406
patch 9.0.1406: ILE RPG files are not recognized
Commit: https://github.com/vim/vim/commit/e202ec8a0c89e8ef47a3d38e668b7326fa68510a
Author: Andreas Louv <andreas@louv.dk>
Date: Thu Mar 16 12:26:51 2023 +0000
patch 9.0.1406: ILE RPG files are not recognized
Problem: ILE RPG files are not recognized.
Solution: Add patterns for ILE RPG files. (Andreas Louv, issue https://github.com/vim/vim/issues/12152)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 16 Mar 2023 13:30:04 +0100 |
parents | 76fd08a4ae1d |
children | 012facc8e25c |
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 RETURN_NULL_IF_SKIP(cctx); |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
61 cctx->ctx_type_stack.ga_len -= drop; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 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
|
63 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 /* |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
66 * Generate instruction "isn_type" and put "type" on the type stack, |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
67 * use "decl_type" for the declared type. |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
68 */ |
27032
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
69 static isn_T * |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
70 generate_instr_type2( |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
71 cctx_T *cctx, |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
72 isntype_T isn_type, |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
73 type_T *type, |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
74 type_T *decl_type) |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
75 { |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
76 isn_T *isn; |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
77 |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
78 if ((isn = generate_instr(cctx, isn_type)) == NULL) |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
79 return NULL; |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
80 |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
81 if (push_type_stack2(cctx, type == NULL ? &t_any : type, |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
82 decl_type == NULL ? &t_any : decl_type) == FAIL) |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
83 return NULL; |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
84 |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
85 return isn; |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
86 } |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
87 |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
88 /* |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 * Generate instruction "isn_type" and put "type" on the type stack. |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
90 * Uses "any" for the declared type, which works for constants. For declared |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
91 * variables use generate_instr_type2(). |
26662
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 * |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 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
|
95 { |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
96 return generate_instr_type2(cctx, isn_type, type, &t_any); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 * 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
|
101 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 isn_T * |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 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
|
104 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 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
|
107 + 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
|
108 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 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
|
110 return NULL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 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
|
112 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
|
113 return isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 /* |
31396
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
117 * Generate an ISN_CONSTRUCT instruction. |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
118 * The object will have "size" members. |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
119 */ |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
120 int |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
121 generate_CONSTRUCT(cctx_T *cctx, class_T *cl) |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
122 { |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
123 isn_T *isn; |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
124 |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
125 RETURN_OK_IF_SKIP(cctx); |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
126 if ((isn = generate_instr(cctx, ISN_CONSTRUCT)) == NULL) |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
127 return FAIL; |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
128 isn->isn_arg.construct.construct_size = sizeof(object_T) |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
129 + cl->class_obj_member_count * sizeof(typval_T); |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
130 isn->isn_arg.construct.construct_class = cl; |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
131 return OK; |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
132 } |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
133 |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
134 /* |
31424
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
135 * Generate ISN_GET_OBJ_MEMBER - access member of object at bottom of stack by |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
136 * index. |
31416
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
137 */ |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
138 int |
31424
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
139 generate_GET_OBJ_MEMBER(cctx_T *cctx, int idx, type_T *type) |
31416
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
140 { |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
141 RETURN_OK_IF_SKIP(cctx); |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
142 |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
143 // drop the object type |
31424
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
144 isn_T *isn = generate_instr_drop(cctx, ISN_GET_OBJ_MEMBER, 1); |
31416
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
145 if (isn == NULL) |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
146 return FAIL; |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
147 |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
148 isn->isn_arg.number = idx; |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
149 return push_type_stack2(cctx, type, &t_any); |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
150 } |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
151 |
f088f1d97eee
patch 9.0.1041: cannot define a method in a class
Bram Moolenaar <Bram@vim.org>
parents:
31396
diff
changeset
|
152 /* |
31754
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
153 * Generate ISN_GET_ITF_MEMBER - access member of interface at bottom of stack |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
154 * by index. |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
155 */ |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
156 int |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
157 generate_GET_ITF_MEMBER(cctx_T *cctx, class_T *itf, int idx, type_T *type) |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
158 { |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
159 RETURN_OK_IF_SKIP(cctx); |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
160 |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
161 // drop the object type |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
162 isn_T *isn = generate_instr_drop(cctx, ISN_GET_ITF_MEMBER, 1); |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
163 if (isn == NULL) |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
164 return FAIL; |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
165 |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
166 isn->isn_arg.classmember.cm_class = itf; |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
167 ++itf->class_refcount; |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
168 isn->isn_arg.classmember.cm_idx = idx; |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
169 return push_type_stack2(cctx, type, &t_any); |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
170 } |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
171 |
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
172 /* |
31424
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
173 * Generate ISN_STORE_THIS - store value in member of "this" object with member |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
174 * index "idx". |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
175 */ |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
176 int |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
177 generate_STORE_THIS(cctx_T *cctx, int idx) |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
178 { |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
179 RETURN_OK_IF_SKIP(cctx); |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
180 |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
181 // drop the value type |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
182 isn_T *isn = generate_instr_drop(cctx, ISN_STORE_THIS, 1); |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
183 if (isn == NULL) |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
184 return FAIL; |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
185 |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
186 isn->isn_arg.number = idx; |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
187 return OK; |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
188 } |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
189 |
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
190 /* |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 * 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
|
192 * 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
|
193 * 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
|
194 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 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
|
197 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 isntype_T isntype = ISN_2STRING; |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
200 type_T *type; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 RETURN_OK_IF_SKIP(cctx); |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
203 type = get_type_on_stack(cctx, -1 - offset); |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
204 switch (type->tt_type) |
26662
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 // nothing to be done |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 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
|
208 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 // conversion possible |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 case VAR_SPECIAL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 case VAR_BOOL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 case VAR_NUMBER: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 case VAR_FLOAT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 // 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
|
217 case VAR_ANY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 case VAR_UNKNOWN: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 isntype = ISN_2STRING_ANY; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 break; |
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 // conversion possible when tolerant |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 case VAR_LIST: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 if (tolerant) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 isntype = ISN_2STRING_ANY; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 // FALLTHROUGH |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 // conversion not possible |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 case VAR_VOID: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 case VAR_BLOB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 case VAR_FUNC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 case VAR_PARTIAL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 case VAR_DICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 case VAR_JOB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 case VAR_CHANNEL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 case VAR_INSTR: |
31396
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
240 case VAR_CLASS: |
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
241 case VAR_OBJECT: |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
242 to_string_error(type->tt_type); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
246 set_type_on_stack(cctx, &t_string, -1 - offset); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 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
|
248 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 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
|
250 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
|
251 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 static int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 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
|
257 { |
26674
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
258 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
|
259 || 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
|
260 && (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
|
261 || 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
|
262 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 if (*op == '+') |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 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
|
265 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 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
|
267 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 } |
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 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 * 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
|
274 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 generate_add_instr( |
31604
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
277 cctx_T *cctx, |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
278 vartype_T vartype, |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
279 type_T *type1, |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
280 type_T *type2, |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
281 exprtype_T expr_type) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
283 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
|
284 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
|
285 : 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
|
286 : 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
|
287 : 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
|
288 : ISN_OPANY, 1); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 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
|
291 && 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
|
292 && 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
|
293 && 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
|
294 && 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
|
295 && check_number_or_float( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 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
|
297 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
298 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
299 if (isn != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
300 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
301 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
|
302 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
|
303 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
304 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
|
305 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
306 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
307 // 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
|
308 // becomes "any". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
309 if (vartype == VAR_LIST |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
310 && 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
|
311 && type1->tt_member != type2->tt_member) |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
312 set_type_on_stack(cctx, &t_list_any, 0); |
26662
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 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
|
315 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
316 |
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 * 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
|
319 * "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
|
320 * 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
|
321 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
322 vartype_T |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 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
|
324 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
325 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
|
326 && (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
|
327 || 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
|
328 || 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
|
329 || 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
|
330 return type1->tt_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 return VAR_ANY; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 * 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
|
336 * type of the arguments. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 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
|
340 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 type_T *type1; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
342 type_T *type2; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
343 vartype_T vartype; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
344 isn_T *isn; |
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 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
|
347 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
348 // Get the known type of the two items on the stack. |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
349 type1 = get_type_on_stack(cctx, 1); |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
350 type2 = get_type_on_stack(cctx, 0); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
351 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
|
352 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
353 switch (*op) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
354 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
355 case '+': |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
356 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
|
357 EXPR_COPY) == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
358 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
359 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 case '-': |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
362 case '*': |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
363 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
|
364 op) == FAIL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
365 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
366 if (vartype == VAR_NUMBER) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
367 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
|
368 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
|
369 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
|
370 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 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
|
372 if (isn != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 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
|
374 ? 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
|
375 break; |
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 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
|
378 && 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
|
379 && 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
|
380 || (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
|
381 && 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
|
382 && 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
|
383 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 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
|
385 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 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
|
388 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
|
389 if (isn != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 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
|
391 break; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 // correct type of result |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 if (vartype == VAR_ANY) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
396 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 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
|
398 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 // 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
|
400 if ((type1->tt_type == VAR_NUMBER || type1->tt_type == VAR_FLOAT) |
30310
029c59bf78f1
patch 9.0.0491: no good reason to build without the float feature
Bram Moolenaar <Bram@vim.org>
parents:
30291
diff
changeset
|
401 && (type2->tt_type == VAR_NUMBER || type2->tt_type == VAR_FLOAT)) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 type = &t_float; |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
403 set_type_on_stack(cctx, type, 0); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
408 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 /* |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
410 * Get the instruction to use for comparing two values with specified types. |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
411 * Either "tv1" and "tv2" are passed or "type1" and "type2". |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
412 * 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
|
413 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
414 static isntype_T |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
415 get_compare_isn( |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
416 exprtype_T exprtype, |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
417 typval_T *tv1, |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
418 typval_T *tv2, |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
419 type_T *type1, |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
420 type_T *type2) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
421 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
422 isntype_T isntype = ISN_DROP; |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
423 vartype_T vartype1 = tv1 != NULL ? tv1->v_type : type1->tt_type; |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
424 vartype_T vartype2 = tv2 != NULL ? tv2->v_type : type2->tt_type; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
425 |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
426 if (vartype1 == vartype2) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 { |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
428 switch (vartype1) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
429 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
430 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
|
431 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
|
432 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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 case VAR_FUNC: isntype = ISN_COMPAREFUNC; break; |
31604
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
439 case VAR_CLASS: isntype = ISN_COMPARECLASS; break; |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
440 case VAR_OBJECT: isntype = ISN_COMPAREOBJECT; break; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 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
|
442 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 } |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
444 else if (vartype1 == VAR_ANY || vartype2 == VAR_ANY |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
445 || ((vartype1 == VAR_NUMBER || vartype1 == VAR_FLOAT) |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
446 && (vartype2 == VAR_NUMBER || vartype2 == VAR_FLOAT)) |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
447 || (vartype1 == VAR_FUNC && vartype2 == VAR_PARTIAL) |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
448 || (vartype1 == VAR_PARTIAL && vartype2 == VAR_FUNC)) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 isntype = ISN_COMPAREANY; |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
450 else if (vartype1 == VAR_SPECIAL || vartype2 == VAR_SPECIAL) |
27924
e6e3abc28c7a
patch 8.2.4487: Vim9: cannot compare with v:null
Bram Moolenaar <Bram@vim.org>
parents:
27569
diff
changeset
|
451 { |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
452 if ((vartype1 == VAR_SPECIAL |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
453 && (tv1 != NULL ? tv1->vval.v_number == VVAL_NONE |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
454 : type1 == &t_none) |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
455 && vartype2 != VAR_STRING) |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
456 || (vartype2 == VAR_SPECIAL |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
457 && (tv2 != NULL ? tv2->vval.v_number == VVAL_NONE |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
458 : type2 == &t_none) |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
459 && vartype1 != VAR_STRING)) |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
460 { |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
461 semsg(_(e_cannot_compare_str_with_str), |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
462 vartype_name(vartype1), vartype_name(vartype2)); |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
463 return ISN_DROP; |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
464 } |
28103
1615d305c71d
patch 8.2.4576: Vim9: error for comparing with null can be annoying
Bram Moolenaar <Bram@vim.org>
parents:
28101
diff
changeset
|
465 // although comparing null with number, float or bool is not useful, we |
1615d305c71d
patch 8.2.4576: Vim9: error for comparing with null can be annoying
Bram Moolenaar <Bram@vim.org>
parents:
28101
diff
changeset
|
466 // allow it |
27924
e6e3abc28c7a
patch 8.2.4487: Vim9: cannot compare with v:null
Bram Moolenaar <Bram@vim.org>
parents:
27569
diff
changeset
|
467 isntype = ISN_COMPARENULL; |
e6e3abc28c7a
patch 8.2.4487: Vim9: cannot compare with v:null
Bram Moolenaar <Bram@vim.org>
parents:
27569
diff
changeset
|
468 } |
26662
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 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
|
471 && (isntype == ISN_COMPAREBOOL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
472 || isntype == ISN_COMPARESPECIAL |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 || isntype == ISN_COMPARENR |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 || isntype == ISN_COMPAREFLOAT)) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 semsg(_(e_cannot_use_str_with_str), |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
477 exprtype == EXPR_IS ? "is" : "isnot" , vartype_name(vartype1)); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
478 return ISN_DROP; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
479 } |
31604
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
480 if (!(exprtype == EXPR_IS || exprtype == EXPR_ISNOT |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
481 || exprtype == EXPR_EQUAL || exprtype == EXPR_NEQUAL) |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
482 && (isntype == ISN_COMPAREOBJECT || isntype == ISN_COMPARECLASS)) |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
483 { |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
484 semsg(_(e_invalid_operation_for_str), vartype_name(vartype1)); |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
485 return ISN_DROP; |
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
486 } |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 if (isntype == ISN_DROP |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
488 || ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
489 && (vartype1 == VAR_BOOL || vartype1 == VAR_SPECIAL |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
490 || vartype2 == VAR_BOOL || vartype2 == VAR_SPECIAL))) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
491 || ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL |
27924
e6e3abc28c7a
patch 8.2.4487: Vim9: cannot compare with v:null
Bram Moolenaar <Bram@vim.org>
parents:
27569
diff
changeset
|
492 && exprtype != EXPR_IS && exprtype != EXPR_ISNOT |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
493 && (vartype1 == VAR_BLOB || vartype2 == VAR_BLOB |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
494 || vartype1 == VAR_LIST || vartype2 == VAR_LIST)))) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
496 semsg(_(e_cannot_compare_str_with_str), |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
497 vartype_name(vartype1), vartype_name(vartype2)); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
498 return ISN_DROP; |
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 isntype; |
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 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
|
505 { |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
506 if (get_compare_isn(type, tv1, tv2, NULL, NULL) == ISN_DROP) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
507 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
508 return OK; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
512 * 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
|
513 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
515 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
|
516 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
517 isntype_T isntype; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 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
|
520 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 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
|
522 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
523 // 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
|
524 // 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
|
525 // checking. |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
526 isntype = get_compare_isn(exprtype, NULL, NULL, |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
527 get_type_on_stack(cctx, 1), get_type_on_stack(cctx, 0)); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
528 if (isntype == ISN_DROP) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
529 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
530 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
531 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
|
532 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
533 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
|
534 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
|
535 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
536 // takes two arguments, puts one bool back |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
537 --stack->ga_len; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
538 set_type_on_stack(cctx, &t_bool, 0); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
539 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
540 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
541 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
542 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
543 /* |
28598
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
544 * Generate an ISN_CONCAT instruction. |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
545 * "count" is the number of stack elements to join together and it must be |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
546 * greater or equal to one. |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
547 * The caller ensures all the "count" elements on the stack have the right type. |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
548 */ |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
549 int |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
550 generate_CONCAT(cctx_T *cctx, int count) |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
551 { |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
552 isn_T *isn; |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
553 garray_T *stack = &cctx->ctx_type_stack; |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
554 |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
555 RETURN_OK_IF_SKIP(cctx); |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
556 |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
557 if ((isn = generate_instr(cctx, ISN_CONCAT)) == NULL) |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
558 return FAIL; |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
559 isn->isn_arg.number = count; |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
560 |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
561 // drop the argument types |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
562 stack->ga_len -= count - 1; |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
563 |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
564 return OK; |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
565 } |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
566 |
d550054e1328
patch 8.2.4823: concat more than 2 strings in :def function is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
28263
diff
changeset
|
567 /* |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
568 * 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
|
569 * "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
|
570 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
571 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
572 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
|
573 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
574 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
575 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
576 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
|
577 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
|
578 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
579 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
|
580 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
|
581 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
582 // type becomes bool |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
583 set_type_on_stack(cctx, &t_bool, -1 - offset); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
584 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
585 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
586 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
587 |
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 * 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
|
590 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
591 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
592 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
|
593 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
594 RETURN_OK_IF_SKIP(cctx); |
30077
d45ee1f829ba
patch 9.0.0376: clang warns for dead assignments
Bram Moolenaar <Bram@vim.org>
parents:
30065
diff
changeset
|
595 if (generate_instr(cctx, ISN_COND2BOOL) == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
596 return FAIL; |
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 // type becomes bool |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
599 set_type_on_stack(cctx, &t_bool, 0); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
600 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
601 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
602 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
603 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
604 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
605 generate_TYPECHECK( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
606 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
607 type_T *expected, |
31551
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
608 int number_ok, // add TTFLAG_NUMBER_OK flag |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
609 int offset, |
28901
11609f025219
patch 8.2.4973: Vim9: type error for list unpack mentions argument
Bram Moolenaar <Bram@vim.org>
parents:
28813
diff
changeset
|
610 int is_var, |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
611 int argidx) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
612 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
613 isn_T *isn; |
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 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
|
616 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
|
617 return FAIL; |
31551
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
618 type_T *tt; |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
619 if (expected->tt_type == VAR_FLOAT && number_ok) |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
620 { |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
621 // always allocate, also for static types |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
622 tt = ALLOC_ONE(type_T); |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
623 if (tt != NULL) |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
624 { |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
625 *tt = *expected; |
31553
d6291139df83
patch 9.0.1109: leaking allocated type
Bram Moolenaar <Bram@vim.org>
parents:
31551
diff
changeset
|
626 tt->tt_flags &= ~TTFLAG_STATIC; |
31551
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
627 tt->tt_flags |= TTFLAG_NUMBER_OK; |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
628 } |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
629 } |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
630 else |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
631 tt = alloc_type(expected); |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
632 |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
633 isn->isn_arg.type.ct_type = tt; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
634 isn->isn_arg.type.ct_off = (int8_T)offset; |
28901
11609f025219
patch 8.2.4973: Vim9: type error for list unpack mentions argument
Bram Moolenaar <Bram@vim.org>
parents:
28813
diff
changeset
|
635 isn->isn_arg.type.ct_is_var = is_var; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
636 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
|
637 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
638 // type becomes expected |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
639 set_type_on_stack(cctx, expected, -1 - offset); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
640 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
641 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
642 } |
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 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
645 generate_SETTYPE( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
646 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
647 type_T *expected) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
648 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
649 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
650 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
651 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
|
652 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
|
653 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
654 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
|
655 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
656 } |
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 /* |
32051
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
659 * Generate an ISN_PUSHOBJ instruction. Object is always NULL. |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
660 */ |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
661 static int |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
662 generate_PUSHOBJ(cctx_T *cctx) |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
663 { |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
664 RETURN_OK_IF_SKIP(cctx); |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
665 if (generate_instr_type(cctx, ISN_PUSHOBJ, &t_any) == NULL) |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
666 return FAIL; |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
667 return OK; |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
668 } |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
669 |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
670 /* |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
671 * Generate an ISN_PUSHCLASS instruction. "class" can be NULL. |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
672 */ |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
673 static int |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
674 generate_PUSHCLASS(cctx_T *cctx, class_T *class) |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
675 { |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
676 RETURN_OK_IF_SKIP(cctx); |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
677 isn_T *isn = generate_instr_type(cctx, ISN_PUSHCLASS, |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
678 class == NULL ? &t_any : &class->class_type); |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
679 if (isn == NULL) |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
680 return FAIL; |
32053
76fd08a4ae1d
patch 9.0.1358: compilation error with some compilers
Bram Moolenaar <Bram@vim.org>
parents:
32051
diff
changeset
|
681 isn->isn_arg.classarg = class; |
32051
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
682 if (class != NULL) |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
683 ++class->class_refcount; |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
684 return OK; |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
685 } |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
686 |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
687 /* |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
688 * 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
|
689 * "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
|
690 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
691 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
692 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
|
693 { |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
694 switch (tv->v_type) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
695 { |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
696 case VAR_BOOL: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
697 generate_PUSHBOOL(cctx, tv->vval.v_number); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
698 break; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
699 case VAR_SPECIAL: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
700 generate_PUSHSPEC(cctx, tv->vval.v_number); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
701 break; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
702 case VAR_NUMBER: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
703 generate_PUSHNR(cctx, tv->vval.v_number); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
704 break; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
705 case VAR_FLOAT: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
706 generate_PUSHF(cctx, tv->vval.v_float); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
707 break; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
708 case VAR_BLOB: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
709 generate_PUSHBLOB(cctx, tv->vval.v_blob); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
710 tv->vval.v_blob = NULL; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
711 break; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
712 case VAR_LIST: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
713 if (tv->vval.v_list != NULL) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
714 iemsg("non-empty list constant not supported"); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
715 generate_NEWLIST(cctx, 0, TRUE); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
716 break; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
717 case VAR_DICT: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
718 if (tv->vval.v_dict != NULL) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
719 iemsg("non-empty dict constant not supported"); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
720 generate_NEWDICT(cctx, 0, TRUE); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
721 break; |
28002
1012048eed26
patch 8.2.4526: Vim9: cannot set variables to a null value
Bram Moolenaar <Bram@vim.org>
parents:
27924
diff
changeset
|
722 #ifdef FEAT_JOB_CHANNEL |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
723 case VAR_JOB: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
724 if (tv->vval.v_job != NULL) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
725 iemsg("non-null job constant not supported"); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
726 generate_PUSHJOB(cctx); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
727 break; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
728 case VAR_CHANNEL: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
729 if (tv->vval.v_channel != NULL) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
730 iemsg("non-null channel constant not supported"); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
731 generate_PUSHCHANNEL(cctx); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
732 break; |
28002
1012048eed26
patch 8.2.4526: Vim9: cannot set variables to a null value
Bram Moolenaar <Bram@vim.org>
parents:
27924
diff
changeset
|
733 #endif |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
734 case VAR_FUNC: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
735 if (tv->vval.v_string != NULL) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
736 iemsg("non-null function constant not supported"); |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
737 generate_PUSHFUNC(cctx, NULL, &t_func_unknown, TRUE); |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
738 break; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
739 case VAR_PARTIAL: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
740 if (tv->vval.v_partial != NULL) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
741 iemsg("non-null partial constant not supported"); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
742 if (generate_instr_type(cctx, ISN_NEWPARTIAL, &t_func_unknown) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
743 == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
744 return FAIL; |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
745 break; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
746 case VAR_STRING: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
747 generate_PUSHS(cctx, &tv->vval.v_string); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
748 tv->vval.v_string = NULL; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
749 break; |
32051
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
750 case VAR_OBJECT: |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
751 if (tv->vval.v_object != NULL) |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
752 { |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
753 emsg(_(e_cannot_use_non_null_object)); |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
754 return FAIL; |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
755 } |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
756 generate_PUSHOBJ(cctx); |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
757 break; |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
758 case VAR_CLASS: |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
759 generate_PUSHCLASS(cctx, tv->vval.v_class); |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
760 break; |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
761 default: |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
762 siemsg("constant type %d not supported", tv->v_type); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
763 clear_tv(tv); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
764 return FAIL; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
765 } |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
766 tv->v_type = VAR_UNKNOWN; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
767 return OK; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
770 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
771 * 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
|
772 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
773 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
774 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
|
775 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
776 isn_T *isn; |
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 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
|
779 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
|
780 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
781 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
|
782 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
783 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
|
784 // A 0 or 1 number can also be used as a bool. |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
785 set_type_on_stack(cctx, &t_number_bool, 0); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
786 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
787 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
788 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
789 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
790 * 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
|
791 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
792 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
793 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
|
794 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
795 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
796 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
797 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
|
798 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
|
799 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
800 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
|
801 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
802 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
803 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
804 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
805 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
806 * 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
|
807 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
808 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
809 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
|
810 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
811 isn_T *isn; |
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 RETURN_OK_IF_SKIP(cctx); |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
814 if ((isn = generate_instr_type(cctx, ISN_PUSHSPEC, |
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
815 number == VVAL_NULL ? &t_null : &t_none)) == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
816 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
817 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
|
818 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
819 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
820 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
821 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
822 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
823 * 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
|
824 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
825 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
826 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
|
827 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
828 isn_T *isn; |
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 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
|
831 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
|
832 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
833 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
|
834 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
835 return OK; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
838 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
839 * 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
|
840 * Consumes "*str". When freed *str is set to NULL, unless "str" is NULL. |
28813
3626ca6a20ea
patch 8.2.4930: interpolated string expression requires escaping
Bram Moolenaar <Bram@vim.org>
parents:
28678
diff
changeset
|
841 * Note that if "str" is used in the instruction OK is returned and "*str" is |
3626ca6a20ea
patch 8.2.4930: interpolated string expression requires escaping
Bram Moolenaar <Bram@vim.org>
parents:
28678
diff
changeset
|
842 * not set to NULL. |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
843 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
844 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
845 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
|
846 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
847 isn_T *isn; |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
848 int ret = OK; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
849 |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
850 if (cctx->ctx_skip != SKIP_YES) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
851 { |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
852 if ((isn = generate_instr_type(cctx, ISN_PUSHS, &t_string)) == NULL) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
853 ret = FAIL; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
854 else |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
855 { |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
856 isn->isn_arg.string = str == NULL ? NULL : *str; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
857 return OK; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
858 } |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
859 } |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
860 if (str != NULL) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
861 VIM_CLEAR(*str); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
862 return ret; |
26662
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
865 /* |
28156
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28103
diff
changeset
|
866 * Generate an ISN_PUSHCHANNEL instruction. Channel is always NULL. |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
867 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
868 int |
28156
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28103
diff
changeset
|
869 generate_PUSHCHANNEL(cctx_T *cctx) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
870 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
871 RETURN_OK_IF_SKIP(cctx); |
28678
a16dae0be398
patch 8.2.4863: accessing freed memory in test without the +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28621
diff
changeset
|
872 #ifdef FEAT_JOB_CHANNEL |
30077
d45ee1f829ba
patch 9.0.0376: clang warns for dead assignments
Bram Moolenaar <Bram@vim.org>
parents:
30065
diff
changeset
|
873 if (generate_instr_type(cctx, ISN_PUSHCHANNEL, &t_channel) == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
874 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
875 return OK; |
28678
a16dae0be398
patch 8.2.4863: accessing freed memory in test without the +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28621
diff
changeset
|
876 #else |
a16dae0be398
patch 8.2.4863: accessing freed memory in test without the +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28621
diff
changeset
|
877 emsg(_(e_channel_job_feature_not_available)); |
a16dae0be398
patch 8.2.4863: accessing freed memory in test without the +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28621
diff
changeset
|
878 return FAIL; |
a16dae0be398
patch 8.2.4863: accessing freed memory in test without the +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28621
diff
changeset
|
879 #endif |
26662
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
882 /* |
28156
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28103
diff
changeset
|
883 * Generate an ISN_PUSHJOB instruction. Job is always NULL. |
26662
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 int |
28156
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28103
diff
changeset
|
886 generate_PUSHJOB(cctx_T *cctx) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
887 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
888 RETURN_OK_IF_SKIP(cctx); |
28678
a16dae0be398
patch 8.2.4863: accessing freed memory in test without the +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28621
diff
changeset
|
889 #ifdef FEAT_JOB_CHANNEL |
30077
d45ee1f829ba
patch 9.0.0376: clang warns for dead assignments
Bram Moolenaar <Bram@vim.org>
parents:
30065
diff
changeset
|
890 if (generate_instr_type(cctx, ISN_PUSHJOB, &t_job) == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
891 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
892 return OK; |
28678
a16dae0be398
patch 8.2.4863: accessing freed memory in test without the +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28621
diff
changeset
|
893 #else |
a16dae0be398
patch 8.2.4863: accessing freed memory in test without the +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28621
diff
changeset
|
894 emsg(_(e_channel_job_feature_not_available)); |
a16dae0be398
patch 8.2.4863: accessing freed memory in test without the +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28621
diff
changeset
|
895 return FAIL; |
a16dae0be398
patch 8.2.4863: accessing freed memory in test without the +channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28621
diff
changeset
|
896 #endif |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
897 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
898 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
899 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
900 * 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
|
901 * Consumes "blob". |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
902 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
903 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
904 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
|
905 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
906 isn_T *isn; |
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 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
|
909 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
|
910 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
911 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
|
912 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
913 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
914 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
915 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
916 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
917 * Generate an ISN_PUSHFUNC instruction with name "name". |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
918 * When "may_prefix" is TRUE prefix "g:" unless "name" is script-local or |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
919 * autoload. |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
920 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
921 int |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
922 generate_PUSHFUNC(cctx_T *cctx, char_u *name, type_T *type, int may_prefix) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
923 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
924 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
925 char_u *funcname; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
926 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
927 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
|
928 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
|
929 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
930 if (name == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
931 funcname = NULL; |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
932 else if (!may_prefix |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
933 || *name == K_SPECIAL // script-local |
27086
1e2a6c6c7e42
patch 8.2.4072: Vim9: compiling function fails when autoload is not loaded
Bram Moolenaar <Bram@vim.org>
parents:
27032
diff
changeset
|
934 || vim_strchr(name, AUTOLOAD_CHAR) != NULL) // autoload |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
935 funcname = vim_strsave(name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
936 else |
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 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
|
939 if (funcname != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
940 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
941 STRCPY(funcname, "g:"); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
942 STRCPY(funcname + 2, name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
943 } |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
946 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
|
947 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
948 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
949 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
950 /* |
27376
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
951 * Generate an ISN_AUTOLOAD instruction. |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
952 */ |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
953 int |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
954 generate_AUTOLOAD(cctx_T *cctx, char_u *name, type_T *type) |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
955 { |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
956 isn_T *isn; |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
957 |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
958 RETURN_OK_IF_SKIP(cctx); |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
959 if ((isn = generate_instr_type(cctx, ISN_AUTOLOAD, type)) == NULL) |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
960 return FAIL; |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
961 isn->isn_arg.string = vim_strsave(name); |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
962 if (isn->isn_arg.string == NULL) |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
963 return FAIL; |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
964 return OK; |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
965 } |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
966 |
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
967 /* |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
968 * 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
|
969 * "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
|
970 * value below the list with values. |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
971 * Caller must check the type is a list. |
26662
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_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
|
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; |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
977 type_T *type = get_type_on_stack(cctx, with_op ? 1 : 0); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
978 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
|
979 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
980 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
|
981 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
982 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
|
983 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
|
984 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
985 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
|
986 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
|
987 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
988 // add the item type to the type stack |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
989 return push_type_stack(cctx, item_type); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
990 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
991 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
992 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
993 * 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
|
994 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
995 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
996 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
|
997 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
998 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
999 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1000 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
|
1001 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
|
1002 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1003 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
|
1004 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1005 } |
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 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1008 * 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
|
1009 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1010 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1011 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
|
1012 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1013 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1014 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1015 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
|
1016 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1017 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
|
1018 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1019 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
|
1020 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
|
1021 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1022 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1023 } |
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 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1026 * 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
|
1027 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1028 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1029 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
|
1030 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1031 isn_T *isn; |
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 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
|
1034 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
|
1035 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1036 if (name != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1037 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
|
1038 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1039 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
|
1040 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1041 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1042 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1043 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1044 /* |
31483
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1045 * Generate an ISN_LOAD_CLASSMEMBER ("load" == TRUE) or ISN_STORE_CLASSMEMBER |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1046 * ("load" == FALSE) instruction. |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1047 */ |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1048 int |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1049 generate_CLASSMEMBER( |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1050 cctx_T *cctx, |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1051 int load, |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1052 class_T *cl, |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1053 int idx) |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1054 { |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1055 isn_T *isn; |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1056 |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1057 RETURN_OK_IF_SKIP(cctx); |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1058 if (load) |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1059 { |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1060 ocmember_T *m = &cl->class_class_members[idx]; |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1061 isn = generate_instr_type(cctx, ISN_LOAD_CLASSMEMBER, m->ocm_type); |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1062 } |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1063 else |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1064 { |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1065 isn = generate_instr_drop(cctx, ISN_STORE_CLASSMEMBER, 1); |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1066 } |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1067 if (isn == NULL) |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1068 return FAIL; |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1069 isn->isn_arg.classmember.cm_class = cl; |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1070 ++cl->class_refcount; |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1071 isn->isn_arg.classmember.cm_idx = idx; |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1072 |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1073 return OK; |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1074 } |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1075 |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
1076 /* |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1077 * 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
|
1078 */ |
27032
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
1079 static int |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1080 generate_STOREOUTER(cctx_T *cctx, int idx, int level, int loop_idx) |
26662
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 isn_T *isn; |
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 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
|
1085 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
|
1086 return FAIL; |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1087 if (level == 1 && loop_idx >= 0 && idx >= loop_idx) |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1088 { |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1089 // Store a variable defined in a loop. A copy will be made at the end |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1090 // of the loop. TODO: how about deeper nesting? |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1091 isn->isn_arg.outer.outer_idx = idx - loop_idx; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1092 isn->isn_arg.outer.outer_depth = OUTER_LOOP_DEPTH; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1093 } |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1094 else |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1095 { |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1096 isn->isn_arg.outer.outer_idx = idx; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1097 isn->isn_arg.outer.outer_depth = level; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1098 } |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1099 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1100 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1101 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1102 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1103 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1104 * 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
|
1105 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1106 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1107 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
|
1108 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1109 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1110 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1111 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
|
1112 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
|
1113 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1114 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
|
1115 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
|
1116 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1117 return OK; |
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 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1121 * 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
|
1122 */ |
27032
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
26935
diff
changeset
|
1123 static int |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1124 generate_STOREOPT( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1125 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1126 isntype_T isn_type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1127 char_u *name, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1128 int opt_flags) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1129 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1130 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1131 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1132 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
|
1133 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
|
1134 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1135 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
|
1136 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
|
1137 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1138 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1139 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1140 |
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 * 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
|
1143 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1144 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1145 generate_LOAD( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1146 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1147 isntype_T isn_type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1148 int idx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1149 char_u *name, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1150 type_T *type) |
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 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1153 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1154 RETURN_OK_IF_SKIP(cctx); |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1155 if ((isn = generate_instr_type2(cctx, isn_type, type, type)) == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1156 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1157 if (name != NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1158 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
|
1159 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1160 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
|
1161 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1162 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1163 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1164 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1165 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1166 * 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
|
1167 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1168 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1169 generate_LOADOUTER( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1170 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1171 int idx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1172 int nesting, |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1173 int loop_depth, |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1174 int loop_idx, |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1175 type_T *type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1176 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1177 isn_T *isn; |
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 RETURN_OK_IF_SKIP(cctx); |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1180 if ((isn = generate_instr_type2(cctx, ISN_LOADOUTER, type, type)) == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1181 return FAIL; |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1182 if (nesting == 1 && loop_idx >= 0 && idx >= loop_idx) |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1183 { |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1184 // Load a variable defined in a loop. A copy will be made at the end |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1185 // of the loop. |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1186 isn->isn_arg.outer.outer_idx = idx - loop_idx; |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1187 isn->isn_arg.outer.outer_depth = -loop_depth - 1; |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1188 } |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1189 else |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1190 { |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1191 isn->isn_arg.outer.outer_idx = idx; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1192 isn->isn_arg.outer.outer_depth = nesting; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1193 } |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1194 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1195 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1196 } |
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 * 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
|
1200 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1201 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1202 generate_LOADV( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1203 cctx_T *cctx, |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1204 char_u *name) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1205 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1206 int di_flags; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1207 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
|
1208 type_T *type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1209 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1210 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
|
1211 if (vidx < 0) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1212 { |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1213 semsg(_(e_variable_not_found_str), name); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1214 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1215 } |
26723
c3cffd372c6f
patch 8.2.3890: Vim9: type check for using v: variables is basic
Bram Moolenaar <Bram@vim.org>
parents:
26674
diff
changeset
|
1216 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
|
1217 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
|
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_UNLET 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_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
|
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_type)) == 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.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
|
1232 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
|
1233 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1234 return OK; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1237 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1238 * 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
|
1239 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1240 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1241 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
|
1242 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1243 RETURN_OK_IF_SKIP(cctx); |
30077
d45ee1f829ba
patch 9.0.0376: clang warns for dead assignments
Bram Moolenaar <Bram@vim.org>
parents:
30065
diff
changeset
|
1244 if (generate_instr(cctx, ISN_LOCKCONST) == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1245 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1246 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1247 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1248 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1249 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1250 * 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
|
1251 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1252 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1253 generate_OLDSCRIPT( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1254 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1255 isntype_T isn_type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1256 char_u *name, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1257 int sid, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1258 type_T *type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1259 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1260 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1261 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1262 RETURN_OK_IF_SKIP(cctx); |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
1263 if (isn_type == ISN_LOADS || isn_type == ISN_LOADEXPORT) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1264 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
|
1265 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1266 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
|
1267 if (isn == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1268 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1269 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
|
1270 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
|
1271 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1272 return OK; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1275 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1276 * 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
|
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_VIM9SCRIPT( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1280 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1281 isntype_T isn_type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1282 int sid, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1283 int idx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1284 type_T *type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1285 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1286 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1287 scriptref_T *sref; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1288 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
|
1289 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1290 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
|
1291 if (isn_type == ISN_LOADSCRIPT) |
27569
f40647a2b36a
patch 8.2.4311: Vim9: changing script variable type not caught compile time
Bram Moolenaar <Bram@vim.org>
parents:
27567
diff
changeset
|
1292 isn = generate_instr_type2(cctx, isn_type, type, type); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1293 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1294 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
|
1295 if (isn == 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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1298 // 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
|
1299 // 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
|
1300 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
|
1301 if (sref == NULL) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1302 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1303 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
|
1304 sref->sref_sid = sid; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1305 sref->sref_idx = idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1306 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
|
1307 sref->sref_type = type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1308 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1309 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1310 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1311 /* |
28217
662d2d5db9a6
patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Bram Moolenaar <Bram@vim.org>
parents:
28173
diff
changeset
|
1312 * Generate an ISN_NEWLIST instruction for "count" items. |
662d2d5db9a6
patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Bram Moolenaar <Bram@vim.org>
parents:
28173
diff
changeset
|
1313 * "use_null" is TRUE for null_list. |
26662
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 int |
28217
662d2d5db9a6
patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Bram Moolenaar <Bram@vim.org>
parents:
28173
diff
changeset
|
1316 generate_NEWLIST(cctx_T *cctx, int count, int use_null) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1317 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1318 isn_T *isn; |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1319 type_T *member_type; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1320 type_T *type; |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1321 type_T *decl_type; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1322 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1323 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
|
1324 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
|
1325 return FAIL; |
28217
662d2d5db9a6
patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Bram Moolenaar <Bram@vim.org>
parents:
28173
diff
changeset
|
1326 isn->isn_arg.number = use_null ? -1 : count; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1327 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1328 // Get the member type and the declared member type from all the items on |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1329 // the stack. |
27567
5bf2fca4f967
patch 8.2.4310: Vim9: constant list and dict get a declaration type
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
1330 member_type = get_member_type_from_stack(count, 1, cctx); |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1331 type = get_list_type(member_type, cctx->ctx_type_list); |
27567
5bf2fca4f967
patch 8.2.4310: Vim9: constant list and dict get a declaration type
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
1332 decl_type = get_list_type(&t_any, 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
|
1333 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1334 // drop the value types |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1335 cctx->ctx_type_stack.ga_len -= count; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1336 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1337 // add the list type to the type stack |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1338 return push_type_stack2(cctx, type, decl_type); |
26662
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 |
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 * Generate an ISN_NEWDICT instruction. |
28217
662d2d5db9a6
patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Bram Moolenaar <Bram@vim.org>
parents:
28173
diff
changeset
|
1343 * "use_null" is TRUE for null_dict. |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1344 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1345 int |
28217
662d2d5db9a6
patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Bram Moolenaar <Bram@vim.org>
parents:
28173
diff
changeset
|
1346 generate_NEWDICT(cctx_T *cctx, int count, int use_null) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1347 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1348 isn_T *isn; |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1349 type_T *member_type; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1350 type_T *type; |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1351 type_T *decl_type; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1352 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1353 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
|
1354 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
|
1355 return FAIL; |
28217
662d2d5db9a6
patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Bram Moolenaar <Bram@vim.org>
parents:
28173
diff
changeset
|
1356 isn->isn_arg.number = use_null ? -1 : count; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1357 |
27567
5bf2fca4f967
patch 8.2.4310: Vim9: constant list and dict get a declaration type
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
1358 member_type = get_member_type_from_stack(count, 2, cctx); |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1359 type = get_dict_type(member_type, cctx->ctx_type_list); |
27567
5bf2fca4f967
patch 8.2.4310: Vim9: constant list and dict get a declaration type
Bram Moolenaar <Bram@vim.org>
parents:
27503
diff
changeset
|
1360 decl_type = get_dict_type(&t_any, 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
|
1361 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1362 // drop the key and value types |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1363 cctx->ctx_type_stack.ga_len -= 2 * count; |
26662
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 // add the dict type to the type stack |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1366 return push_type_stack2(cctx, type, decl_type); |
26662
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_FUNCREF instruction. |
31920
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1371 * For "obj.Method" "cl" is the class of the object (can be an interface or a |
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1372 * base class) and "fi" the index of the method on that class. |
28173
b0c885507de4
patch 8.2.4612: Vim9: cannot use a recursive call in a nested function
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1373 * "isnp" is set to the instruction, so that fr_dfunc_idx can be set later. |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1374 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1375 int |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1376 generate_FUNCREF( |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1377 cctx_T *cctx, |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1378 ufunc_T *ufunc, |
31920
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1379 class_T *cl, |
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1380 int fi, |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1381 isn_T **isnp) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1382 { |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1383 isn_T *isn; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1384 type_T *type; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1385 funcref_extra_T *extra; |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1386 loopvarinfo_T loopinfo; |
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1387 int has_vars; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1388 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1389 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
|
1390 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
|
1391 return FAIL; |
28173
b0c885507de4
patch 8.2.4612: Vim9: cannot use a recursive call in a nested function
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1392 if (isnp != NULL) |
b0c885507de4
patch 8.2.4612: Vim9: cannot use a recursive call in a nested function
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1393 *isnp = isn; |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1394 |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1395 has_vars = get_loop_var_info(cctx, &loopinfo); |
31920
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1396 if (ufunc->uf_def_status == UF_NOT_COMPILED || has_vars || cl != NULL) |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1397 { |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1398 extra = ALLOC_CLEAR_ONE(funcref_extra_T); |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1399 if (extra == NULL) |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1400 return FAIL; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1401 isn->isn_arg.funcref.fr_extra = extra; |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1402 extra->fre_loopvar_info = loopinfo; |
31920
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1403 if (cl != NULL) |
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1404 { |
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1405 extra->fre_class = cl; |
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1406 ++cl->class_refcount; |
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1407 extra->fre_method_idx = fi; |
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1408 } |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1409 } |
31920
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1410 if (ufunc->uf_def_status == UF_NOT_COMPILED || cl != NULL) |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1411 extra->fre_func_name = vim_strsave(ufunc->uf_name); |
31920
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
1412 if (ufunc->uf_def_status != UF_NOT_COMPILED && cl == NULL) |
31835
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
1413 { |
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
1414 if (isnp == NULL && ufunc->uf_def_status == UF_TO_BE_COMPILED) |
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
1415 // compile the function now, we need the uf_dfunc_idx value |
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
1416 (void)compile_def_function(ufunc, FALSE, CT_NONE, NULL); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1417 isn->isn_arg.funcref.fr_dfunc_idx = ufunc->uf_dfunc_idx; |
31835
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
1418 } |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1419 |
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1420 // Reserve an extra variable to keep track of the number of closures |
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1421 // created. |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1422 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
|
1423 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1424 // If the referenced function is a closure, it may use items further up in |
28101
3bc0a639dfb0
patch 8.2.4575: Vim9: test for profiling still fails
Bram Moolenaar <Bram@vim.org>
parents:
28029
diff
changeset
|
1425 // the nested context, including this one. But not a function defined at |
3bc0a639dfb0
patch 8.2.4575: Vim9: test for profiling still fails
Bram Moolenaar <Bram@vim.org>
parents:
28029
diff
changeset
|
1426 // the script level. |
3bc0a639dfb0
patch 8.2.4575: Vim9: test for profiling still fails
Bram Moolenaar <Bram@vim.org>
parents:
28029
diff
changeset
|
1427 if ((ufunc->uf_flags & FC_CLOSURE) |
3bc0a639dfb0
patch 8.2.4575: Vim9: test for profiling still fails
Bram Moolenaar <Bram@vim.org>
parents:
28029
diff
changeset
|
1428 && func_name_refcount(cctx->ctx_ufunc->uf_name)) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1429 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
|
1430 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1431 type = ufunc->uf_func_type == NULL ? &t_func_any : ufunc->uf_func_type; |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1432 return push_type_stack(cctx, type); |
26662
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 |
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 * 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
|
1437 * "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
|
1438 * consumed. |
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 int |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1441 generate_NEWFUNC( |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1442 cctx_T *cctx, |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1443 char_u *lambda_name, |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1444 char_u *func_name) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1445 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1446 isn_T *isn; |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1447 int ret = OK; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1448 |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1449 if (cctx->ctx_skip != SKIP_YES) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1450 { |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1451 if ((isn = generate_instr(cctx, ISN_NEWFUNC)) == NULL) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1452 ret = FAIL; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1453 else |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1454 { |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1455 newfuncarg_T *arg = ALLOC_CLEAR_ONE(newfuncarg_T); |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1456 |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1457 if (arg == NULL) |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1458 ret = FAIL; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1459 else |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1460 { |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1461 // Reserve an extra variable to keep track of the number of |
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1462 // closures created. |
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1463 cctx->ctx_has_closure = 1; |
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1464 |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1465 isn->isn_arg.newfunc.nf_arg = arg; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1466 arg->nfa_lambda = lambda_name; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1467 arg->nfa_global = func_name; |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1468 (void)get_loop_var_info(cctx, &arg->nfa_loopvar_info); |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1469 return OK; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
1470 } |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1471 } |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1472 } |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1473 vim_free(lambda_name); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1474 vim_free(func_name); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
1475 return ret; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1476 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1477 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1478 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1479 * 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
|
1480 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1481 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1482 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
|
1483 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1484 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1485 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1486 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
|
1487 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
|
1488 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1489 if (len > 0) |
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 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
|
1492 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
|
1493 return FAIL; |
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 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1496 } |
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 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1499 * 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
|
1500 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1501 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1502 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
|
1503 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1504 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1505 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
|
1506 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1507 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
|
1508 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
|
1509 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1510 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
|
1511 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
|
1512 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1513 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
|
1514 --stack->ga_len; |
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 return OK; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1519 /* |
30269
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1520 * Generate an ISN_WHILE instruction. Similar to ISN_JUMP for :while |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1521 */ |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1522 int |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1523 generate_WHILE(cctx_T *cctx, int funcref_idx) |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1524 { |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1525 isn_T *isn; |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1526 garray_T *stack = &cctx->ctx_type_stack; |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1527 |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1528 RETURN_OK_IF_SKIP(cctx); |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1529 if ((isn = generate_instr(cctx, ISN_WHILE)) == NULL) |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1530 return FAIL; |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1531 isn->isn_arg.whileloop.while_funcref_idx = funcref_idx; |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1532 isn->isn_arg.whileloop.while_end = 0; // filled in later |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1533 |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1534 if (stack->ga_len > 0) |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1535 --stack->ga_len; |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1536 |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1537 return OK; |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1538 } |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1539 |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1540 /* |
31441
e572ff386670
patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents:
31424
diff
changeset
|
1541 * Generate an ISN_JUMP_IF_ARG_SET or ISN_JUMP_IF_ARG_NOT_SET instruction. |
26662
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 int |
31441
e572ff386670
patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents:
31424
diff
changeset
|
1544 generate_JUMP_IF_ARG(cctx_T *cctx, isntype_T isn_type, int arg_off) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1545 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1546 isn_T *isn; |
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 RETURN_OK_IF_SKIP(cctx); |
31441
e572ff386670
patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents:
31424
diff
changeset
|
1549 if ((isn = generate_instr(cctx, isn_type)) == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1550 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1551 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
|
1552 // 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
|
1553 return OK; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1556 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1557 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
|
1558 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1559 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1560 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1561 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
|
1562 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
|
1563 return FAIL; |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1564 isn->isn_arg.forloop.for_loop_idx = loop_idx; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1565 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1566 // type doesn't matter, will be stored next |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1567 return push_type_stack(cctx, &t_any); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1568 } |
30269
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1569 |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1570 int |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1571 generate_ENDLOOP(cctx_T *cctx, loop_info_T *loop_info) |
30269
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1572 { |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1573 isn_T *isn; |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1574 |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1575 RETURN_OK_IF_SKIP(cctx); |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1576 if ((isn = generate_instr(cctx, ISN_ENDLOOP)) == NULL) |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1577 return FAIL; |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1578 isn->isn_arg.endloop.end_depth = loop_info->li_depth; |
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1579 isn->isn_arg.endloop.end_funcref_idx = loop_info->li_funcref_idx; |
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1580 isn->isn_arg.endloop.end_var_idx = loop_info->li_local_count; |
30269
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1581 isn->isn_arg.endloop.end_var_count = |
30333
fc0830246f49
patch 9.0.0502: a closure in a nested loop in a :def function does not work
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
1582 cctx->ctx_locals.ga_len - loop_info->li_local_count; |
30269
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1583 return OK; |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1584 } |
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
1585 |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1586 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1587 * 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
|
1588 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1589 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1590 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
|
1591 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1592 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1593 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1594 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
|
1595 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
|
1596 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1597 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
|
1598 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
|
1599 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1600 return OK; |
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 |
30166
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1603 /* |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1604 * Check "argount" arguments and their types on the type stack. |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1605 * Give an error and return FAIL if something is wrong. |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1606 * When "method_call" is NULL no code is generated. |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1607 */ |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1608 int |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1609 check_internal_func_args( |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1610 cctx_T *cctx, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1611 int func_idx, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1612 int argcount, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1613 int method_call, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1614 type2_T **argtypes, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1615 type2_T *shuffled_argtypes) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1616 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1617 garray_T *stack = &cctx->ctx_type_stack; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1618 int argoff = check_internal_func(func_idx, argcount); |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1619 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1620 if (argoff < 0) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1621 return FAIL; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1622 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1623 if (method_call && argoff > 1) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1624 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1625 isn_T *isn = generate_instr(cctx, ISN_SHUFFLE); |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1626 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1627 if (isn == NULL) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1628 return FAIL; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1629 isn->isn_arg.shuffle.shfl_item = argcount; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1630 isn->isn_arg.shuffle.shfl_up = argoff - 1; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1631 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1632 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1633 if (argcount > 0) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1634 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1635 type2_T *typep = ((type2_T *)stack->ga_data) + stack->ga_len - argcount; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1636 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1637 // Check the types of the arguments. |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1638 if (method_call && argoff > 1) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1639 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1640 int i; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1641 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1642 for (i = 0; i < argcount; ++i) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1643 shuffled_argtypes[i] = (i < argoff - 1) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1644 ? typep[i + 1] |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1645 : (i == argoff - 1) ? typep[0] : typep[i]; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1646 *argtypes = shuffled_argtypes; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1647 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1648 else |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1649 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1650 int i; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1651 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1652 for (i = 0; i < argcount; ++i) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1653 shuffled_argtypes[i] = typep[i]; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1654 *argtypes = shuffled_argtypes; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1655 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1656 if (internal_func_check_arg_types(*argtypes, func_idx, argcount, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1657 cctx) == FAIL) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1658 return FAIL; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1659 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1660 return OK; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1661 } |
26662
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_BCALL instruction. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1665 * "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
|
1666 * 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
|
1667 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1668 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1669 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
|
1670 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1671 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1672 garray_T *stack = &cctx->ctx_type_stack; |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1673 type2_T *argtypes = NULL; |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1674 type2_T shuffled_argtypes[MAX_FUNC_ARGS]; |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1675 type2_T *maptype = NULL; |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1676 type_T *type; |
27503
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1677 type_T *decl_type; |
26662
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 RETURN_OK_IF_SKIP(cctx); |
30166
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1680 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1681 if (check_internal_func_args(cctx, func_idx, argcount, method_call, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1682 &argtypes, shuffled_argtypes) == FAIL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1683 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1684 |
30166
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1685 if (internal_func_is_map(func_idx)) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1686 maptype = argtypes; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1687 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1688 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
|
1689 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1690 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
|
1691 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
|
1692 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1693 // 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
|
1694 stack->ga_len -= argcount; |
31742
f578bef02249
patch 9.0.1203: return type of values() is always list<any>
Bram Moolenaar <Bram@vim.org>
parents:
31612
diff
changeset
|
1695 type = internal_func_ret_type(func_idx, argcount, argtypes, &decl_type, |
f578bef02249
patch 9.0.1203: return type of values() is always list<any>
Bram Moolenaar <Bram@vim.org>
parents:
31612
diff
changeset
|
1696 cctx->ctx_type_list); |
27503
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1697 if (push_type_stack2(cctx, type, decl_type) == FAIL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1698 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1699 |
27406
4c1bdee75bed
patch 8.2.4231: Vim9: map() gives type error when type was not declared
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1700 if (maptype != NULL && maptype[0].type_decl->tt_member != NULL |
4c1bdee75bed
patch 8.2.4231: Vim9: map() gives type error when type was not declared
Bram Moolenaar <Bram@vim.org>
parents:
27376
diff
changeset
|
1701 && maptype[0].type_decl->tt_member != &t_any) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1702 // Check that map() didn't change the item types. |
31551
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
1703 generate_TYPECHECK(cctx, maptype[0].type_decl, FALSE, -1, FALSE, 1); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1704 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1705 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1706 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1707 |
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 * 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
|
1710 * 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
|
1711 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1712 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1713 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
|
1714 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1715 type_T *list_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1716 type_T *item_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1717 type_T *expected; |
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 // Caller already checked that list_type is a list. |
27503
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1720 // For checking the item type we use the declared type of the list and the |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1721 // current type of the added item, adding a string to [1, 2] is OK. |
4cea92e99a5a
patch 8.2.4279: Vim9: cannot change item type with map() after range()
Bram Moolenaar <Bram@vim.org>
parents:
27406
diff
changeset
|
1722 list_type = get_decl_type_on_stack(cctx, 1); |
30576
72e6073a2822
patch 9.0.0623: error for modifying a const is not detected at compile time
Bram Moolenaar <Bram@vim.org>
parents:
30333
diff
changeset
|
1723 if (arg_type_modifiable(list_type, 1) == FAIL) |
72e6073a2822
patch 9.0.0623: error for modifying a const is not detected at compile time
Bram Moolenaar <Bram@vim.org>
parents:
30333
diff
changeset
|
1724 return FAIL; |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1725 item_type = get_type_on_stack(cctx, 0); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1726 expected = list_type->tt_member; |
31551
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
1727 if (need_type(item_type, expected, FALSE, -1, 0, cctx, FALSE, FALSE) == FAIL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1728 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1729 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1730 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
|
1731 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1732 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1733 --cctx->ctx_type_stack.ga_len; // drop the argument |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1734 return OK; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1737 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1738 * 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
|
1739 * 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
|
1740 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1741 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1742 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
|
1743 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1744 type_T *item_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1745 |
30576
72e6073a2822
patch 9.0.0623: error for modifying a const is not detected at compile time
Bram Moolenaar <Bram@vim.org>
parents:
30333
diff
changeset
|
1746 // Caller already checked that blob_type is a blob, check it is modifiable. |
72e6073a2822
patch 9.0.0623: error for modifying a const is not detected at compile time
Bram Moolenaar <Bram@vim.org>
parents:
30333
diff
changeset
|
1747 if (arg_type_modifiable(get_decl_type_on_stack(cctx, 1), 1) == FAIL) |
72e6073a2822
patch 9.0.0623: error for modifying a const is not detected at compile time
Bram Moolenaar <Bram@vim.org>
parents:
30333
diff
changeset
|
1748 return FAIL; |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1749 item_type = get_type_on_stack(cctx, 0); |
31551
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
1750 if (need_type(item_type, &t_number, FALSE, |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
1751 -1, 0, cctx, FALSE, FALSE) == FAIL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1752 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1753 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1754 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
|
1755 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1756 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1757 --cctx->ctx_type_stack.ga_len; // drop the argument |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1758 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1759 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1760 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1761 /* |
31843
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1762 * Generate an ISN_DCALL, ISN_UCALL or ISN_METHODCALL instruction. |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1763 * When calling a method on an object, of which we know the interface only, |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1764 * then "cl" is the interface and "mi" the method index on the interface. |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1765 * 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
|
1766 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1767 int |
31843
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1768 generate_CALL( |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1769 cctx_T *cctx, |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1770 ufunc_T *ufunc, |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1771 class_T *cl, |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1772 int mi, |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1773 int pushed_argcount) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1774 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1775 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1776 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
|
1777 int argcount = pushed_argcount; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1778 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1779 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
|
1780 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
|
1781 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1782 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
|
1783 printable_func_name(ufunc)); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1784 return FAIL; |
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 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
|
1787 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1788 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
|
1789 printable_func_name(ufunc)); |
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 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1792 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1793 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
|
1794 && 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
|
1795 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1796 int i; |
28101
3bc0a639dfb0
patch 8.2.4575: Vim9: test for profiling still fails
Bram Moolenaar <Bram@vim.org>
parents:
28029
diff
changeset
|
1797 compiletype_T compile_type; |
26662
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 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
|
1800 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1801 type_T *expected; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1802 type_T *actual; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1803 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1804 actual = get_type_on_stack(cctx, argcount - i - 1); |
28029
0ed38a4e028d
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Bram Moolenaar <Bram@vim.org>
parents:
28008
diff
changeset
|
1805 if (actual->tt_type == VAR_SPECIAL |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1806 && 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
|
1807 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1808 // 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
|
1809 continue; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1810 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1811 if (i < regular_args) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1812 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1813 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
|
1814 continue; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1815 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
|
1816 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1817 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
|
1818 || 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
|
1819 // 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
|
1820 expected = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1821 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1822 expected = ufunc->uf_va_type->tt_member; |
31551
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
1823 if (need_type(actual, expected, FALSE, |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
1824 -argcount + i, i + 1, cctx, TRUE, FALSE) == FAIL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1825 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1826 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
|
1827 return FAIL; |
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 } |
28101
3bc0a639dfb0
patch 8.2.4575: Vim9: test for profiling still fails
Bram Moolenaar <Bram@vim.org>
parents:
28029
diff
changeset
|
1830 compile_type = get_compile_type(ufunc); |
3bc0a639dfb0
patch 8.2.4575: Vim9: test for profiling still fails
Bram Moolenaar <Bram@vim.org>
parents:
28029
diff
changeset
|
1831 if (func_needs_compiling(ufunc, compile_type) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1832 && compile_def_function(ufunc, ufunc->uf_ret_type == NULL, |
28101
3bc0a639dfb0
patch 8.2.4575: Vim9: test for profiling still fails
Bram Moolenaar <Bram@vim.org>
parents:
28029
diff
changeset
|
1833 compile_type, NULL) == FAIL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1834 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1835 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1836 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
|
1837 { |
28263
c446812efd60
patch 8.2.4657: errors for functions are sometimes hard to read
Bram Moolenaar <Bram@vim.org>
parents:
28261
diff
changeset
|
1838 emsg_funcname(e_call_to_function_that_failed_to_compile_str, |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1839 ufunc->uf_name); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1840 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1841 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1842 |
31843
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1843 if ((isn = generate_instr(cctx, cl != NULL ? ISN_METHODCALL |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1844 : ufunc->uf_def_status != UF_NOT_COMPILED |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1845 ? ISN_DCALL : ISN_UCALL)) == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1846 return FAIL; |
31855
b7a8611dd9fc
patch 9.0.1260: Coverity warns for possible NULL pointer usage
Bram Moolenaar <Bram@vim.org>
parents:
31843
diff
changeset
|
1847 if (cl != NULL /* isn->isn_type == ISN_METHODCALL */) |
31843
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1848 { |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1849 isn->isn_arg.mfunc = ALLOC_ONE(cmfunc_T); |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1850 if (isn->isn_arg.mfunc == NULL) |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1851 return FAIL; |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1852 isn->isn_arg.mfunc->cmf_itf = cl; |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1853 ++cl->class_refcount; |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1854 isn->isn_arg.mfunc->cmf_idx = mi; |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1855 isn->isn_arg.mfunc->cmf_argcount = argcount; |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1856 } |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
1857 else if (isn->isn_type == ISN_DCALL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1858 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1859 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
|
1860 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
|
1861 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1862 else |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1863 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1864 // 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
|
1865 // 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
|
1866 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
|
1867 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
|
1868 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1869 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1870 // drop the argument types |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1871 cctx->ctx_type_stack.ga_len -= argcount; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1872 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1873 // add return type |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1874 return push_type_stack(cctx, ufunc->uf_ret_type); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1875 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1876 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1877 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1878 * 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
|
1879 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1880 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1881 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
|
1882 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1883 isn_T *isn; |
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_OK_IF_SKIP(cctx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1886 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
|
1887 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1888 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
|
1889 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
|
1890 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1891 // drop the argument types |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1892 cctx->ctx_type_stack.ga_len -= argcount; |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1893 |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1894 // add return value |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1895 return push_type_stack(cctx, &t_any); |
26662
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1898 /* |
30166
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1899 * Check the arguments of function "type" against the types on the stack. |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1900 * Returns OK or FAIL; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1901 */ |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1902 int |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1903 check_func_args_from_type( |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1904 cctx_T *cctx, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1905 type_T *type, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1906 int argcount, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1907 int at_top, |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1908 char_u *name) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1909 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1910 if (type->tt_argcount != -1) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1911 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1912 int varargs = (type->tt_flags & TTFLAG_VARARGS) ? 1 : 0; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1913 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1914 if (argcount < type->tt_min_argcount - varargs) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1915 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1916 emsg_funcname(e_not_enough_arguments_for_function_str, name); |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1917 return FAIL; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1918 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1919 if (!varargs && argcount > type->tt_argcount) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1920 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1921 emsg_funcname(e_too_many_arguments_for_function_str, name); |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1922 return FAIL; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1923 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1924 if (type->tt_args != NULL) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1925 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1926 int i; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1927 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1928 for (i = 0; i < argcount; ++i) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1929 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1930 int offset = -argcount + i - (at_top ? 0 : 1); |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1931 type_T *actual = get_type_on_stack(cctx, -1 - offset); |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1932 type_T *expected; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1933 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1934 if (varargs && i >= type->tt_argcount - 1) |
31612
c467d6e70972
patch 9.0.1138: crash when expecting varargs but it is something else
Bram Moolenaar <Bram@vim.org>
parents:
31604
diff
changeset
|
1935 { |
c467d6e70972
patch 9.0.1138: crash when expecting varargs but it is something else
Bram Moolenaar <Bram@vim.org>
parents:
31604
diff
changeset
|
1936 expected = type->tt_args[type->tt_argcount - 1]; |
c467d6e70972
patch 9.0.1138: crash when expecting varargs but it is something else
Bram Moolenaar <Bram@vim.org>
parents:
31604
diff
changeset
|
1937 if (expected != NULL && expected->tt_type == VAR_LIST) |
c467d6e70972
patch 9.0.1138: crash when expecting varargs but it is something else
Bram Moolenaar <Bram@vim.org>
parents:
31604
diff
changeset
|
1938 expected = expected->tt_member; |
c467d6e70972
patch 9.0.1138: crash when expecting varargs but it is something else
Bram Moolenaar <Bram@vim.org>
parents:
31604
diff
changeset
|
1939 if (expected == NULL) |
c467d6e70972
patch 9.0.1138: crash when expecting varargs but it is something else
Bram Moolenaar <Bram@vim.org>
parents:
31604
diff
changeset
|
1940 expected = &t_any; |
c467d6e70972
patch 9.0.1138: crash when expecting varargs but it is something else
Bram Moolenaar <Bram@vim.org>
parents:
31604
diff
changeset
|
1941 } |
30166
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1942 else if (i >= type->tt_min_argcount |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1943 && actual->tt_type == VAR_SPECIAL) |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1944 expected = &t_any; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1945 else |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1946 expected = type->tt_args[i]; |
31551
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
1947 if (need_type(actual, expected, FALSE, |
67d9fbe516a3
patch 9.0.1108: type error when using "any" type and adding to float
Bram Moolenaar <Bram@vim.org>
parents:
31485
diff
changeset
|
1948 offset, i + 1, cctx, TRUE, FALSE) == FAIL) |
30166
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1949 { |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1950 arg_type_mismatch(expected, actual, i + 1); |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1951 return FAIL; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1952 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1953 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1954 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1955 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1956 |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1957 return OK; |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1958 } |
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1959 /* |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1960 * 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
|
1961 * "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
|
1962 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1963 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1964 generate_PCALL( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1965 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1966 int argcount, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1967 char_u *name, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1968 type_T *type, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1969 int at_top) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1970 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1971 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1972 type_T *ret_type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1973 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1974 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
|
1975 |
26674
38a270fdd3f6
patch 8.2.3866: Vim9: type checking global variables is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26672
diff
changeset
|
1976 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
|
1977 ret_type = &t_any; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1978 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
|
1979 { |
32051
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
1980 if (check_func_args_from_type(cctx, type, argcount, at_top, name) |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
1981 == FAIL) |
30166
d1c04b4dc60d
patch 9.0.0419: the :defer command does not check the function arguments
Bram Moolenaar <Bram@vim.org>
parents:
30077
diff
changeset
|
1982 return FAIL; |
26662
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 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
|
1985 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
|
1986 // 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
|
1987 ret_type = &t_any; |
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 else |
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 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
|
1992 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1993 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1994 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1995 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
|
1996 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1997 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
|
1998 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
|
1999 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
2000 // drop the arguments and the funcref/partial |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
2001 cctx->ctx_type_stack.ga_len -= argcount + 1; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2002 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
2003 // push the return value |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
2004 push_type_stack(cctx, ret_type); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2005 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2006 // 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
|
2007 // the return value. |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2008 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
|
2009 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2010 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2011 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2012 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2013 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2014 /* |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2015 * Generate an ISN_DEFER instruction. |
31835
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
2016 * "obj_method" is one for "obj.Method()", zero otherwise. |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2017 */ |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2018 int |
31835
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
2019 generate_DEFER(cctx_T *cctx, int var_idx, int obj_method, int argcount) |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2020 { |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2021 isn_T *isn; |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2022 |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2023 RETURN_OK_IF_SKIP(cctx); |
31835
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
2024 if ((isn = generate_instr_drop(cctx, |
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
2025 obj_method == 0 ? ISN_DEFER : ISN_DEFEROBJ, |
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
2026 argcount + 1)) == NULL) |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2027 return FAIL; |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2028 isn->isn_arg.defer.defer_var_idx = var_idx; |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2029 isn->isn_arg.defer.defer_argcount = argcount; |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2030 return OK; |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2031 } |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2032 |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2033 /* |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2034 * 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
|
2035 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2036 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2037 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
|
2038 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2039 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2040 type_T *type; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2041 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2042 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
|
2043 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
|
2044 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2045 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
|
2046 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2047 // check for dict type |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
2048 type = get_type_on_stack(cctx, 0); |
30721
030bdef24446
patch 9.0.0695: failing check for dictionary type for const any
Bram Moolenaar <Bram@vim.org>
parents:
30699
diff
changeset
|
2049 if (type->tt_type != VAR_DICT |
030bdef24446
patch 9.0.0695: failing check for dictionary type for const any
Bram Moolenaar <Bram@vim.org>
parents:
30699
diff
changeset
|
2050 && 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
|
2051 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2052 char *tofree; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2053 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2054 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
|
2055 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
|
2056 vim_free(tofree); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2057 return FAIL; |
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 // 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
|
2060 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
|
2061 { |
30721
030bdef24446
patch 9.0.0695: failing check for dictionary type for const any
Bram Moolenaar <Bram@vim.org>
parents:
30699
diff
changeset
|
2062 type_T *ntype = type->tt_member->tt_type == VAR_UNKNOWN |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
2063 ? &t_any : type->tt_member; |
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
2064 set_type_on_stack(cctx, ntype, 0); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2065 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2066 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2067 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2068 } |
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 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2071 * 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
|
2072 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2073 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2074 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
|
2075 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2076 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2077 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2078 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
|
2079 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
|
2080 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2081 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
|
2082 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
|
2083 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2084 return OK; |
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 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2087 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2088 * 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
|
2089 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2090 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2091 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
|
2092 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2093 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2094 |
30699
f60315945f4a
patch 9.0.0684: skipped :exe command fails compilation on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
30697
diff
changeset
|
2095 RETURN_OK_IF_SKIP(cctx); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2096 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
|
2097 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2098 isn->isn_arg.number = count; |
30697
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2099 return OK; |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2100 } |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2101 |
30697
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2102 /* |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2103 * Generate an ISN_ECHOWINDOW instruction |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2104 */ |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2105 int |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2106 generate_ECHOWINDOW(cctx_T *cctx, int count, long time) |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2107 { |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2108 isn_T *isn; |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2109 |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2110 if ((isn = generate_instr_drop(cctx, ISN_ECHOWINDOW, count)) == NULL) |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2111 return FAIL; |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2112 isn->isn_arg.echowin.ewin_count = count; |
d914a3812d5b
patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents:
30576
diff
changeset
|
2113 isn->isn_arg.echowin.ewin_time = time; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2114 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2115 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2116 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2117 /* |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2118 * Generate an ISN_SOURCE instruction. |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2119 */ |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2120 int |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2121 generate_SOURCE(cctx_T *cctx, int sid) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2122 { |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2123 isn_T *isn; |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2124 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2125 if ((isn = generate_instr(cctx, ISN_SOURCE)) == NULL) |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2126 return FAIL; |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2127 isn->isn_arg.number = sid; |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2128 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2129 return OK; |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2130 } |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2131 |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2132 /* |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2133 * 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
|
2134 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2135 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2136 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
|
2137 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2138 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2139 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2140 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
|
2141 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
|
2142 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2143 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
|
2144 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
|
2145 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2146 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2147 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2148 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2149 * 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
|
2150 * 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
|
2151 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2152 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2153 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
|
2154 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2155 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2156 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2157 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
|
2158 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
|
2159 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2160 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
|
2161 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2162 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2163 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2164 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2165 * 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
|
2166 * "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
|
2167 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2168 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2169 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
|
2170 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2171 isn_T *isn; |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2172 int ret = OK; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2173 |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2174 if (cctx->ctx_skip != SKIP_YES) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2175 { |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2176 if ((isn = generate_instr(cctx, isntype)) == NULL) |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2177 ret = FAIL; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2178 else |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2179 { |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2180 isn->isn_arg.string = str; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2181 return OK; |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2182 } |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2183 } |
28992
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2184 vim_free(str); |
0e9642706a59
patch 8.2.5018: Vim9: some code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28901
diff
changeset
|
2185 return ret; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2186 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2187 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2188 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2189 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
|
2190 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2191 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2192 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2193 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
|
2194 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
|
2195 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2196 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
|
2197 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
2198 return push_type_stack(cctx, &t_any); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2199 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2200 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2201 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2202 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
|
2203 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2204 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2205 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2206 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
|
2207 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2208 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
|
2209 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2210 } |
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 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2213 * 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
|
2214 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2215 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2216 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
|
2217 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2218 isn_T *isn; |
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 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
|
2221 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2222 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
|
2223 |
26935
ccb9be1cdd71
patch 8.2.3996: Vim9: type checking lacks information about declared type
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
2224 return push_type_stack(cctx, &t_number); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2225 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2226 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2227 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2228 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
|
2229 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2230 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2231 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2232 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
|
2233 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
|
2234 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2235 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
|
2236 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
|
2237 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2238 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2239 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2240 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2241 * 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
|
2242 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2243 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2244 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
|
2245 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2246 isn_T *isn; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2247 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2248 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
|
2249 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2250 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
|
2251 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2252 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
|
2253 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2254 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
|
2255 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
|
2256 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2257 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
|
2258 // 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
|
2259 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
|
2260 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2261 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2262 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2263 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2264 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2265 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2266 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
|
2267 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2268 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
|
2269 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2270 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
|
2271 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2272 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2273 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2274 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2275 * Generate a STORE instruction for "dest", not being "dest_local". |
31483
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2276 * "lhs" might be NULL. |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2277 * 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
|
2278 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2279 int |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2280 generate_store_var( |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2281 cctx_T *cctx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2282 assign_dest_T dest, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2283 int opt_flags, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2284 int vimvaridx, |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2285 type_T *type, |
31483
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2286 char_u *name, |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2287 lhs_T *lhs) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2288 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2289 switch (dest) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2290 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2291 case dest_option: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2292 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
|
2293 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
|
2294 case dest_func_option: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2295 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
|
2296 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
|
2297 case dest_global: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2298 // 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
|
2299 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
|
2300 ? 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
|
2301 case dest_buffer: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2302 // 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
|
2303 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
|
2304 case dest_window: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2305 // 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
|
2306 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
|
2307 case dest_tab: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2308 // 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
|
2309 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
|
2310 case dest_env: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2311 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
|
2312 case dest_reg: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2313 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
|
2314 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
|
2315 case dest_vimvar: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2316 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
|
2317 case dest_script: |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2318 { |
31485
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2319 int scriptvar_idx = lhs->lhs_scriptvar_idx; |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2320 int scriptvar_sid = lhs->lhs_scriptvar_sid; |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2321 if (scriptvar_idx < 0) |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2322 { |
31485
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2323 isntype_T isn_type = ISN_STORES; |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2324 |
31485
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2325 if (SCRIPT_ID_VALID(scriptvar_sid) |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2326 && SCRIPT_ITEM(scriptvar_sid)->sn_import_autoload |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2327 && SCRIPT_ITEM(scriptvar_sid)->sn_autoload_prefix |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2328 == NULL) |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2329 { |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2330 // "import autoload './dir/script.vim'" - load script |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2331 // first |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2332 if (generate_SOURCE(cctx, scriptvar_sid) == FAIL) |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2333 return FAIL; |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2334 isn_type = ISN_STOREEXPORT; |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2335 } |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2336 |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2337 // "s:" may be included in the name. |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2338 return generate_OLDSCRIPT(cctx, isn_type, name, |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2339 scriptvar_sid, type); |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2340 } |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2341 return generate_VIM9SCRIPT(cctx, ISN_STORESCRIPT, |
97aaede2b4e0
patch 9.0.1075: build fails if compiler doesn't allow declaration after case
Bram Moolenaar <Bram@vim.org>
parents:
31483
diff
changeset
|
2342 scriptvar_sid, scriptvar_idx, type); |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2343 } |
31483
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2344 case dest_class_member: |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2345 return generate_CLASSMEMBER(cctx, FALSE, |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2346 lhs->lhs_class, lhs->lhs_classmember_idx); |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2347 |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2348 case dest_local: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2349 case dest_expr: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2350 // cannot happen |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2351 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2352 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2353 return FAIL; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2354 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2355 |
27148
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2356 /* |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2357 * Return TRUE when inside a "for" or "while" loop. |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2358 */ |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2359 int |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2360 inside_loop_scope(cctx_T *cctx) |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2361 { |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2362 scope_T *scope = cctx->ctx_scope; |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2363 |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2364 for (;;) |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2365 { |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2366 if (scope == NULL) |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2367 break; |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2368 if (scope->se_type == FOR_SCOPE || scope->se_type == WHILE_SCOPE) |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2369 return TRUE; |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2370 scope = scope->se_outer; |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2371 } |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2372 return FALSE; |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2373 } |
6ed31017c303
patch 8.2.4103: Vim9: variable declared in for loop not initialzed
Bram Moolenaar <Bram@vim.org>
parents:
27114
diff
changeset
|
2374 |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2375 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
|
2376 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
|
2377 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2378 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
|
2379 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
|
2380 lhs->lhs_opt_flags, lhs->lhs_vimvaridx, |
31483
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2381 lhs->lhs_type, lhs->lhs_name, lhs); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2382 |
31827
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2383 if (lhs->lhs_lvar == NULL) |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2384 return OK; |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2385 |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2386 garray_T *instr = &cctx->ctx_instr; |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2387 isn_T *isn = ((isn_T *)instr->ga_data) + instr->ga_len - 1; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2388 |
31827
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2389 // Optimization: turn "var = 123" from ISN_PUSHNR + ISN_STORE into |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2390 // ISN_STORENR. |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2391 // And "var = 0" does not need any instruction. |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2392 if (lhs->lhs_lvar->lv_from_outer == 0 |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2393 && instr->ga_len == instr_count + 1 |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2394 && isn->isn_type == ISN_PUSHNR) |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2395 { |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2396 varnumber_T val = isn->isn_arg.number; |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2397 garray_T *stack = &cctx->ctx_type_stack; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2398 |
31827
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2399 if (val == 0 && is_decl && !inside_loop_scope(cctx)) |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2400 { |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2401 // zero is the default value, no need to do anything |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2402 --instr->ga_len; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2403 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2404 else |
31827
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2405 { |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2406 isn->isn_type = ISN_STORENR; |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2407 isn->isn_arg.storenr.stnr_idx = lhs->lhs_lvar->lv_idx; |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2408 isn->isn_arg.storenr.stnr_val = val; |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2409 } |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2410 if (stack->ga_len > 0) |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2411 --stack->ga_len; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2412 } |
31827
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2413 else if (lhs->lhs_lvar->lv_from_outer > 0) |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2414 generate_STOREOUTER(cctx, lhs->lhs_lvar->lv_idx, |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2415 lhs->lhs_lvar->lv_from_outer, lhs->lhs_lvar->lv_loop_idx); |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2416 else |
1009c33499e7
patch 9.0.1246: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31758
diff
changeset
|
2417 generate_STORE(cctx, ISN_STORE, lhs->lhs_lvar->lv_idx, NULL); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2418 return OK; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2419 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2420 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2421 #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
|
2422 void |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2423 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
|
2424 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2425 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
|
2426 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
|
2427 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2428 #endif |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2429 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2430 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2431 /* |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2432 * 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
|
2433 */ |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2434 void |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2435 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
|
2436 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2437 switch (isn->isn_type) |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2438 { |
27376
1a6421c5be20
patch 8.2.4216: Vim9: cannot use a function from an autoload import directly
Bram Moolenaar <Bram@vim.org>
parents:
27348
diff
changeset
|
2439 case ISN_AUTOLOAD: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2440 case ISN_DEF: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2441 case ISN_EXEC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2442 case ISN_EXECRANGE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2443 case ISN_EXEC_SPLIT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2444 case ISN_LEGACY_EVAL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2445 case ISN_LOADAUTO: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2446 case ISN_LOADB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2447 case ISN_LOADENV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2448 case ISN_LOADG: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2449 case ISN_LOADOPT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2450 case ISN_LOADT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2451 case ISN_LOADW: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2452 case ISN_LOCKUNLOCK: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2453 case ISN_PUSHEXC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2454 case ISN_PUSHFUNC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2455 case ISN_PUSHS: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2456 case ISN_RANGE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2457 case ISN_STOREAUTO: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2458 case ISN_STOREB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2459 case ISN_STOREENV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2460 case ISN_STOREG: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2461 case ISN_STORET: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2462 case ISN_STOREW: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2463 case ISN_STRINGMEMBER: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2464 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
|
2465 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2466 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2467 case ISN_SUBSTITUTE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2468 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2469 int idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2470 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
|
2471 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2472 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
|
2473 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
|
2474 delete_instr(list + idx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2475 vim_free(list); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2476 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2477 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2478 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2479 case ISN_INSTR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2480 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2481 int idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2482 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
|
2483 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2484 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
|
2485 delete_instr(list + idx); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2486 vim_free(list); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2487 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2488 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2489 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2490 case ISN_LOADS: |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2491 case ISN_LOADEXPORT: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2492 case ISN_STORES: |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2493 case ISN_STOREEXPORT: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2494 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
|
2495 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2496 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2497 case ISN_UNLET: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2498 case ISN_UNLETENV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2499 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
|
2500 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2501 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2502 case ISN_STOREOPT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2503 case ISN_STOREFUNCOPT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2504 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
|
2505 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2506 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2507 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
|
2508 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
|
2509 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2510 |
32051
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
2511 case ISN_PUSHCLASS: |
32053
76fd08a4ae1d
patch 9.0.1358: compilation error with some compilers
Bram Moolenaar <Bram@vim.org>
parents:
32051
diff
changeset
|
2512 class_unref(isn->isn_arg.classarg); |
32051
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
2513 break; |
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
2514 |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2515 case ISN_UCALL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2516 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
|
2517 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2518 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2519 case ISN_FUNCREF: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2520 { |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2521 funcref_T *funcref = &isn->isn_arg.funcref; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2522 funcref_extra_T *extra = funcref->fr_extra; |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2523 |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2524 if (extra == NULL || extra->fre_func_name == NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2525 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2526 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2527 + funcref->fr_dfunc_idx; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2528 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
|
2529 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2530 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
|
2531 func_ptr_unref(ufunc); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2532 } |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2533 if (extra != NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2534 { |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2535 char_u *name = extra->fre_func_name; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2536 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2537 if (name != NULL) |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2538 { |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2539 func_unref(name); |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2540 vim_free(name); |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2541 } |
31920
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
2542 if (extra->fre_class != NULL) |
f1a5e67e9a1b
patch 9.0.1292: :defer may call the wrong method for an object
Bram Moolenaar <Bram@vim.org>
parents:
31855
diff
changeset
|
2543 class_unref(extra->fre_class); |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2544 vim_free(extra); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2545 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2546 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2547 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2548 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2549 case ISN_DCALL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2550 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2551 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2552 + isn->isn_arg.dfunc.cdf_idx; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2553 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2554 if (dfunc->df_ufunc != NULL |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2555 && func_name_refcount(dfunc->df_ufunc->uf_name)) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2556 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
|
2557 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2558 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2559 |
31843
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
2560 case ISN_METHODCALL: |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
2561 { |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
2562 cmfunc_T *mfunc = isn->isn_arg.mfunc; |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
2563 class_unref(mfunc->cmf_itf); |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
2564 vim_free(mfunc); |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
2565 } |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
2566 break; |
ffa11e2757e7
patch 9.0.1254: calling a method on an interface does not work
Bram Moolenaar <Bram@vim.org>
parents:
31835
diff
changeset
|
2567 |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2568 case ISN_NEWFUNC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2569 { |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2570 newfuncarg_T *arg = isn->isn_arg.newfunc.nf_arg; |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2571 |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2572 if (arg != NULL) |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2573 { |
30291
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2574 ufunc_T *ufunc = find_func_even_dead( |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2575 arg->nfa_lambda, FFED_IS_GLOBAL); |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2576 |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2577 if (ufunc != NULL) |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2578 { |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2579 unlink_def_function(ufunc); |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2580 func_ptr_unref(ufunc); |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2581 } |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2582 |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2583 vim_free(arg->nfa_lambda); |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2584 vim_free(arg->nfa_global); |
61a688be1899
patch 9.0.0481: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30269
diff
changeset
|
2585 vim_free(arg); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2586 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2587 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2588 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2589 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2590 case ISN_CHECKTYPE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2591 case ISN_SETTYPE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2592 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
|
2593 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2594 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2595 case ISN_CMDMOD: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2596 vim_regfree(isn->isn_arg.cmdmod.cf_cmdmod |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2597 ->cmod_filter_regmatch.regprog); |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2598 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
|
2599 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2600 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2601 case ISN_LOADSCRIPT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2602 case ISN_STORESCRIPT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2603 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
|
2604 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2605 |
31483
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2606 case ISN_LOAD_CLASSMEMBER: |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2607 case ISN_STORE_CLASSMEMBER: |
31754
48431422f766
patch 9.0.1209: getting interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31742
diff
changeset
|
2608 case ISN_GET_ITF_MEMBER: |
31483
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2609 class_unref(isn->isn_arg.classmember.cm_class); |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2610 break; |
1bebc2093e6b
patch 9.0.1074: class members are not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
31441
diff
changeset
|
2611 |
31758
85f93e094810
patch 9.0.1211: storing value in interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31754
diff
changeset
|
2612 case ISN_STOREINDEX: |
85f93e094810
patch 9.0.1211: storing value in interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31754
diff
changeset
|
2613 class_unref(isn->isn_arg.storeindex.si_class); |
85f93e094810
patch 9.0.1211: storing value in interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31754
diff
changeset
|
2614 break; |
85f93e094810
patch 9.0.1211: storing value in interface member does not always work
Bram Moolenaar <Bram@vim.org>
parents:
31754
diff
changeset
|
2615 |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2616 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
|
2617 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
|
2618 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2619 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2620 case ISN_CEXPR_CORE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2621 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
|
2622 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
|
2623 break; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2624 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2625 case ISN_2BOOL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2626 case ISN_2STRING: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2627 case ISN_2STRING_ANY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2628 case ISN_ADDBLOB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2629 case ISN_ADDLIST: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2630 case ISN_ANYINDEX: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2631 case ISN_ANYSLICE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2632 case ISN_BCALL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2633 case ISN_BLOBAPPEND: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2634 case ISN_BLOBINDEX: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2635 case ISN_BLOBSLICE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2636 case ISN_CATCH: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2637 case ISN_CEXPR_AUCMD: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2638 case ISN_CHECKLEN: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2639 case ISN_CLEARDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2640 case ISN_CMDMOD_REV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2641 case ISN_COMPAREANY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2642 case ISN_COMPAREBLOB: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2643 case ISN_COMPAREBOOL: |
31604
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
2644 case ISN_COMPARECLASS: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2645 case ISN_COMPAREDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2646 case ISN_COMPAREFLOAT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2647 case ISN_COMPAREFUNC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2648 case ISN_COMPARELIST: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2649 case ISN_COMPARENR: |
27924
e6e3abc28c7a
patch 8.2.4487: Vim9: cannot compare with v:null
Bram Moolenaar <Bram@vim.org>
parents:
27569
diff
changeset
|
2650 case ISN_COMPARENULL: |
31604
9b13b3a63bc0
patch 9.0.1134: comparing objects uses identity instead of equality
Bram Moolenaar <Bram@vim.org>
parents:
31553
diff
changeset
|
2651 case ISN_COMPAREOBJECT: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2652 case ISN_COMPARESPECIAL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2653 case ISN_COMPARESTRING: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2654 case ISN_CONCAT: |
31396
307f68a41b03
patch 9.0.1031: Vim9 class is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
30721
diff
changeset
|
2655 case ISN_CONSTRUCT: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2656 case ISN_COND2BOOL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2657 case ISN_DEBUG: |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2658 case ISN_DEFER: |
31835
5ce5d78afcc9
patch 9.0.1250: cannot use an object method with :defer
Bram Moolenaar <Bram@vim.org>
parents:
31827
diff
changeset
|
2659 case ISN_DEFEROBJ: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2660 case ISN_DROP: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2661 case ISN_ECHO: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2662 case ISN_ECHOCONSOLE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2663 case ISN_ECHOERR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2664 case ISN_ECHOMSG: |
30031
30c642c58cd4
patch 9.0.0353: missing entry in switch
Bram Moolenaar <Bram@vim.org>
parents:
28992
diff
changeset
|
2665 case ISN_ECHOWINDOW: |
30269
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
2666 case ISN_ENDLOOP: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2667 case ISN_ENDTRY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2668 case ISN_EXECCONCAT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2669 case ISN_EXECUTE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2670 case ISN_FINALLY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2671 case ISN_FINISH: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2672 case ISN_FOR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2673 case ISN_GETITEM: |
31424
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
2674 case ISN_GET_OBJ_MEMBER: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2675 case ISN_JUMP: |
31441
e572ff386670
patch 9.0.1053: default constructor arguments are not optional
Bram Moolenaar <Bram@vim.org>
parents:
31424
diff
changeset
|
2676 case ISN_JUMP_IF_ARG_NOT_SET: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2677 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
|
2678 case ISN_LISTAPPEND: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2679 case ISN_LISTINDEX: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2680 case ISN_LISTSLICE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2681 case ISN_LOAD: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2682 case ISN_LOADBDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2683 case ISN_LOADGDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2684 case ISN_LOADOUTER: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2685 case ISN_LOADREG: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2686 case ISN_LOADTDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2687 case ISN_LOADV: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2688 case ISN_LOADWDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2689 case ISN_LOCKCONST: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2690 case ISN_MEMBER: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2691 case ISN_NEGATENR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2692 case ISN_NEWDICT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2693 case ISN_NEWLIST: |
28002
1012048eed26
patch 8.2.4526: Vim9: cannot set variables to a null value
Bram Moolenaar <Bram@vim.org>
parents:
27924
diff
changeset
|
2694 case ISN_NEWPARTIAL: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2695 case ISN_OPANY: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2696 case ISN_OPFLOAT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2697 case ISN_OPNR: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2698 case ISN_PCALL: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2699 case ISN_PCALL_END: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2700 case ISN_PROF_END: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2701 case ISN_PROF_START: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2702 case ISN_PUSHBOOL: |
28156
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28103
diff
changeset
|
2703 case ISN_PUSHCHANNEL: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2704 case ISN_PUSHF: |
28156
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28103
diff
changeset
|
2705 case ISN_PUSHJOB: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2706 case ISN_PUSHNR: |
32051
e8c60d35fce3
patch 9.0.1357: using null_object results in an internal error
Bram Moolenaar <Bram@vim.org>
parents:
31920
diff
changeset
|
2707 case ISN_PUSHOBJ: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2708 case ISN_PUSHSPEC: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2709 case ISN_PUT: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2710 case ISN_REDIREND: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2711 case ISN_REDIRSTART: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2712 case ISN_RETURN: |
31424
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
2713 case ISN_RETURN_OBJECT: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2714 case ISN_RETURN_VOID: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2715 case ISN_SHUFFLE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2716 case ISN_SLICE: |
30269
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
2717 case ISN_SOURCE: |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2718 case ISN_STORE: |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2719 case ISN_STORENR: |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2720 case ISN_STOREOUTER: |
31424
e31fc75f6aff
patch 9.0.1045: in a class object members cannot be initialized
Bram Moolenaar <Bram@vim.org>
parents:
31416
diff
changeset
|
2721 case ISN_STORE_THIS: |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2722 case ISN_STORERANGE: |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2723 case ISN_STOREREG: |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2724 case ISN_STOREV: |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2725 case ISN_STRINDEX: |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2726 case ISN_STRSLICE: |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2727 case ISN_THROW: |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2728 case ISN_TRYCONT: |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2729 case ISN_UNLETINDEX: |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2730 case ISN_UNLETRANGE: |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2731 case ISN_UNPACK: |
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2732 case ISN_USEDICT: |
30269
42a6345b91fd
patch 9.0.0470: in :def function all closures in loop get the same variables
Bram Moolenaar <Bram@vim.org>
parents:
30166
diff
changeset
|
2733 case ISN_WHILE: |
28249
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2734 // nothing allocated |
4b322951ebac
patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents:
28217
diff
changeset
|
2735 break; |
30065
6cf788ab844c
patch 9.0.0370: cleaning up afterwards can make a function messy
Bram Moolenaar <Bram@vim.org>
parents:
30031
diff
changeset
|
2736 } |
26662
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2737 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2738 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2739 void |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2740 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
|
2741 { |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2742 int idx; |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2743 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2744 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
|
2745 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
|
2746 ga_clear(gap); |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2747 } |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2748 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2749 |
4b23672d1f0e
patch 8.2.3860: Vim9: codecov struggles with the file size
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2750 #endif // defined(FEAT_EVAL) |