Line | Count | Source |
1 | | /*----------------------------------------------------------------------------*/ |
2 | | /* This file is generated by the templates/template.rb script and should not */ |
3 | | /* be modified manually. See */ |
4 | | /* templates/src/json.c.erb */ |
5 | | /* if you are looking to modify the */ |
6 | | /* template */ |
7 | | /*----------------------------------------------------------------------------*/ |
8 | | |
9 | | #include "prism/json.h" |
10 | | |
11 | | // Ensure this translation unit is never empty, even when JSON is excluded. |
12 | | typedef int pm_json_unused_t; |
13 | | |
14 | | #ifndef PRISM_EXCLUDE_JSON |
15 | | |
16 | | #include "prism/internal/buffer.h" |
17 | | #include "prism/internal/constant_pool.h" |
18 | | #include "prism/internal/integer.h" |
19 | | #include "prism/internal/parser.h" |
20 | | |
21 | | #include <inttypes.h> |
22 | | |
23 | | static void |
24 | 318k | pm_dump_json_constant(pm_buffer_t *buffer, const pm_parser_t *parser, pm_constant_id_t constant_id) { |
25 | 318k | const pm_constant_t *constant = pm_constant_pool_id_to_constant(&parser->constant_pool, constant_id); |
26 | 318k | pm_buffer_append_byte(buffer, '"'); |
27 | 318k | pm_buffer_append_source(buffer, constant->start, constant->length, PM_BUFFER_ESCAPING_JSON); |
28 | 318k | pm_buffer_append_byte(buffer, '"'); |
29 | 318k | } |
30 | | |
31 | | static void |
32 | 1.36M | pm_dump_json_location(pm_buffer_t *buffer, const pm_location_t *location) { |
33 | 1.36M | pm_buffer_append_format(buffer, "{\"start\":%" PRIu32 ",\"length\":%" PRIu32 "}", location->start, location->length); |
34 | 1.36M | } |
35 | | |
36 | | /** |
37 | | * Dump JSON to the given buffer. |
38 | | */ |
39 | | void |
40 | 725k | pm_dump_json(pm_buffer_t *buffer, const pm_parser_t *parser, const pm_node_t *node) { |
41 | 725k | switch (PM_NODE_TYPE(node)) { |
42 | 126 | case PM_ALIAS_GLOBAL_VARIABLE_NODE: { Branch (42:9): [True: 126, False: 725k]
|
43 | 126 | pm_buffer_append_string(buffer, "{\"type\":\"AliasGlobalVariableNode\",\"location\":", 45); |
44 | | |
45 | 126 | const pm_alias_global_variable_node_t *cast = (const pm_alias_global_variable_node_t *) node; |
46 | 126 | pm_dump_json_location(buffer, &cast->base.location); |
47 | | |
48 | | // Dump the new_name field |
49 | 126 | pm_buffer_append_byte(buffer, ','); |
50 | 126 | pm_buffer_append_string(buffer, "\"new_name\":", 11); |
51 | 126 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->new_name); |
52 | | |
53 | | // Dump the old_name field |
54 | 126 | pm_buffer_append_byte(buffer, ','); |
55 | 126 | pm_buffer_append_string(buffer, "\"old_name\":", 11); |
56 | 126 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->old_name); |
57 | | |
58 | | // Dump the keyword_loc field |
59 | 126 | pm_buffer_append_byte(buffer, ','); |
60 | 126 | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
61 | 126 | pm_dump_json_location(buffer, &cast->keyword_loc); |
62 | | |
63 | 126 | pm_buffer_append_byte(buffer, '}'); |
64 | 126 | break; |
65 | 0 | } |
66 | 564 | case PM_ALIAS_METHOD_NODE: { Branch (66:9): [True: 564, False: 724k]
|
67 | 564 | pm_buffer_append_string(buffer, "{\"type\":\"AliasMethodNode\",\"location\":", 37); |
68 | | |
69 | 564 | const pm_alias_method_node_t *cast = (const pm_alias_method_node_t *) node; |
70 | 564 | pm_dump_json_location(buffer, &cast->base.location); |
71 | | |
72 | | // Dump the new_name field |
73 | 564 | pm_buffer_append_byte(buffer, ','); |
74 | 564 | pm_buffer_append_string(buffer, "\"new_name\":", 11); |
75 | 564 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->new_name); |
76 | | |
77 | | // Dump the old_name field |
78 | 564 | pm_buffer_append_byte(buffer, ','); |
79 | 564 | pm_buffer_append_string(buffer, "\"old_name\":", 11); |
80 | 564 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->old_name); |
81 | | |
82 | | // Dump the keyword_loc field |
83 | 564 | pm_buffer_append_byte(buffer, ','); |
84 | 564 | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
85 | 564 | pm_dump_json_location(buffer, &cast->keyword_loc); |
86 | | |
87 | 564 | pm_buffer_append_byte(buffer, '}'); |
88 | 564 | break; |
89 | 0 | } |
90 | 530 | case PM_ALTERNATION_PATTERN_NODE: { Branch (90:9): [True: 530, False: 724k]
|
91 | 530 | pm_buffer_append_string(buffer, "{\"type\":\"AlternationPatternNode\",\"location\":", 44); |
92 | | |
93 | 530 | const pm_alternation_pattern_node_t *cast = (const pm_alternation_pattern_node_t *) node; |
94 | 530 | pm_dump_json_location(buffer, &cast->base.location); |
95 | | |
96 | | // Dump the left field |
97 | 530 | pm_buffer_append_byte(buffer, ','); |
98 | 530 | pm_buffer_append_string(buffer, "\"left\":", 7); |
99 | 530 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->left); |
100 | | |
101 | | // Dump the right field |
102 | 530 | pm_buffer_append_byte(buffer, ','); |
103 | 530 | pm_buffer_append_string(buffer, "\"right\":", 8); |
104 | 530 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->right); |
105 | | |
106 | | // Dump the operator_loc field |
107 | 530 | pm_buffer_append_byte(buffer, ','); |
108 | 530 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
109 | 530 | pm_dump_json_location(buffer, &cast->operator_loc); |
110 | | |
111 | 530 | pm_buffer_append_byte(buffer, '}'); |
112 | 530 | break; |
113 | 0 | } |
114 | 710 | case PM_AND_NODE: { Branch (114:9): [True: 710, False: 724k]
|
115 | 710 | pm_buffer_append_string(buffer, "{\"type\":\"AndNode\",\"location\":", 29); |
116 | | |
117 | 710 | const pm_and_node_t *cast = (const pm_and_node_t *) node; |
118 | 710 | pm_dump_json_location(buffer, &cast->base.location); |
119 | | |
120 | | // Dump the left field |
121 | 710 | pm_buffer_append_byte(buffer, ','); |
122 | 710 | pm_buffer_append_string(buffer, "\"left\":", 7); |
123 | 710 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->left); |
124 | | |
125 | | // Dump the right field |
126 | 710 | pm_buffer_append_byte(buffer, ','); |
127 | 710 | pm_buffer_append_string(buffer, "\"right\":", 8); |
128 | 710 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->right); |
129 | | |
130 | | // Dump the operator_loc field |
131 | 710 | pm_buffer_append_byte(buffer, ','); |
132 | 710 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
133 | 710 | pm_dump_json_location(buffer, &cast->operator_loc); |
134 | | |
135 | 710 | pm_buffer_append_byte(buffer, '}'); |
136 | 710 | break; |
137 | 0 | } |
138 | 46.1k | case PM_ARGUMENTS_NODE: { Branch (138:9): [True: 46.1k, False: 679k]
|
139 | 46.1k | pm_buffer_append_string(buffer, "{\"type\":\"ArgumentsNode\",\"location\":", 35); |
140 | | |
141 | 46.1k | const pm_arguments_node_t *cast = (const pm_arguments_node_t *) node; |
142 | 46.1k | pm_dump_json_location(buffer, &cast->base.location); |
143 | | |
144 | | // Dump the ArgumentsNodeFlags field |
145 | 46.1k | pm_buffer_append_byte(buffer, ','); |
146 | 46.1k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
147 | 46.1k | size_t flags = 0; |
148 | 46.1k | pm_buffer_append_byte(buffer, '['); |
149 | 46.1k | if (PM_NODE_FLAG_P(cast, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_FORWARDING)) { |
150 | 184 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (150:21): [True: 0, False: 184]
|
151 | 184 | pm_buffer_append_string(buffer, "\"CONTAINS_FORWARDING\"", 21); |
152 | 184 | flags++; |
153 | 184 | } |
154 | 46.1k | if (PM_NODE_FLAG_P(cast, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS)) { |
155 | 2.56k | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (155:21): [True: 0, False: 2.56k]
|
156 | 2.56k | pm_buffer_append_string(buffer, "\"CONTAINS_KEYWORDS\"", 19); |
157 | 2.56k | flags++; |
158 | 2.56k | } |
159 | 46.1k | if (PM_NODE_FLAG_P(cast, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT)) { |
160 | 1.29k | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (160:21): [True: 1.29k, False: 0]
|
161 | 1.29k | pm_buffer_append_string(buffer, "\"CONTAINS_KEYWORD_SPLAT\"", 24); |
162 | 1.29k | flags++; |
163 | 1.29k | } |
164 | 46.1k | if (PM_NODE_FLAG_P(cast, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT)) { |
165 | 2.46k | if (flags != 0) pm_buffer_append_byte(buffer, ',')60 ; Branch (165:21): [True: 60, False: 2.40k]
|
166 | 2.46k | pm_buffer_append_string(buffer, "\"CONTAINS_SPLAT\"", 16); |
167 | 2.46k | flags++; |
168 | 2.46k | } |
169 | 46.1k | if (PM_NODE_FLAG_P(cast, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_MULTIPLE_SPLATS)) { |
170 | 61 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (170:21): [True: 61, False: 0]
|
171 | 61 | pm_buffer_append_string(buffer, "\"CONTAINS_MULTIPLE_SPLATS\"", 26); |
172 | 61 | flags++; |
173 | 61 | } |
174 | 46.1k | pm_buffer_append_byte(buffer, ']'); |
175 | | |
176 | | // Dump the arguments field |
177 | 46.1k | pm_buffer_append_byte(buffer, ','); |
178 | 46.1k | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
179 | 46.1k | const pm_node_list_t *arguments = &cast->arguments; |
180 | 46.1k | pm_buffer_append_byte(buffer, '['); |
181 | | |
182 | 97.5k | for (size_t index = 0; index < arguments->size; index++51.4k ) { Branch (182:36): [True: 51.4k, False: 46.1k]
|
183 | 51.4k | if (index != 0) pm_buffer_append_byte(buffer, ',')5.24k ; Branch (183:21): [True: 5.24k, False: 46.1k]
|
184 | 51.4k | pm_dump_json(buffer, parser, arguments->nodes[index]); |
185 | 51.4k | } |
186 | 46.1k | pm_buffer_append_byte(buffer, ']'); |
187 | | |
188 | 46.1k | pm_buffer_append_byte(buffer, '}'); |
189 | 46.1k | break; |
190 | 0 | } |
191 | 13.1k | case PM_ARRAY_NODE: { Branch (191:9): [True: 13.1k, False: 712k]
|
192 | 13.1k | pm_buffer_append_string(buffer, "{\"type\":\"ArrayNode\",\"location\":", 31); |
193 | | |
194 | 13.1k | const pm_array_node_t *cast = (const pm_array_node_t *) node; |
195 | 13.1k | pm_dump_json_location(buffer, &cast->base.location); |
196 | | |
197 | | // Dump the ArrayNodeFlags field |
198 | 13.1k | pm_buffer_append_byte(buffer, ','); |
199 | 13.1k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
200 | 13.1k | size_t flags = 0; |
201 | 13.1k | pm_buffer_append_byte(buffer, '['); |
202 | 13.1k | if (PM_NODE_FLAG_P(cast, PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT)) { |
203 | 651 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (203:21): [True: 0, False: 651]
|
204 | 651 | pm_buffer_append_string(buffer, "\"CONTAINS_SPLAT\"", 16); |
205 | 651 | flags++; |
206 | 651 | } |
207 | 13.1k | pm_buffer_append_byte(buffer, ']'); |
208 | | |
209 | | // Dump the elements field |
210 | 13.1k | pm_buffer_append_byte(buffer, ','); |
211 | 13.1k | pm_buffer_append_string(buffer, "\"elements\":", 11); |
212 | 13.1k | const pm_node_list_t *elements = &cast->elements; |
213 | 13.1k | pm_buffer_append_byte(buffer, '['); |
214 | | |
215 | 53.0k | for (size_t index = 0; index < elements->size; index++39.8k ) { Branch (215:36): [True: 39.8k, False: 13.1k]
|
216 | 39.8k | if (index != 0) pm_buffer_append_byte(buffer, ',')27.5k ; Branch (216:21): [True: 27.5k, False: 12.3k]
|
217 | 39.8k | pm_dump_json(buffer, parser, elements->nodes[index]); |
218 | 39.8k | } |
219 | 13.1k | pm_buffer_append_byte(buffer, ']'); |
220 | | |
221 | | // Dump the opening_loc field |
222 | 13.1k | pm_buffer_append_byte(buffer, ','); |
223 | 13.1k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
224 | 13.1k | if (cast->opening_loc.length != 0) { Branch (224:17): [True: 10.7k, False: 2.37k]
|
225 | 10.7k | pm_dump_json_location(buffer, &cast->opening_loc); |
226 | 10.7k | } else { |
227 | 2.37k | pm_buffer_append_string(buffer, "null", 4); |
228 | 2.37k | } |
229 | | |
230 | | // Dump the closing_loc field |
231 | 13.1k | pm_buffer_append_byte(buffer, ','); |
232 | 13.1k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
233 | 13.1k | if (cast->closing_loc.length != 0) { Branch (233:17): [True: 7.25k, False: 5.86k]
|
234 | 7.25k | pm_dump_json_location(buffer, &cast->closing_loc); |
235 | 7.25k | } else { |
236 | 5.86k | pm_buffer_append_string(buffer, "null", 4); |
237 | 5.86k | } |
238 | | |
239 | 13.1k | pm_buffer_append_byte(buffer, '}'); |
240 | 13.1k | break; |
241 | 0 | } |
242 | 1.78k | case PM_ARRAY_PATTERN_NODE: { Branch (242:9): [True: 1.78k, False: 723k]
|
243 | 1.78k | pm_buffer_append_string(buffer, "{\"type\":\"ArrayPatternNode\",\"location\":", 38); |
244 | | |
245 | 1.78k | const pm_array_pattern_node_t *cast = (const pm_array_pattern_node_t *) node; |
246 | 1.78k | pm_dump_json_location(buffer, &cast->base.location); |
247 | | |
248 | | // Dump the constant field |
249 | 1.78k | pm_buffer_append_byte(buffer, ','); |
250 | 1.78k | pm_buffer_append_string(buffer, "\"constant\":", 11); |
251 | 1.78k | if (cast->constant != NULL) { Branch (251:17): [True: 318, False: 1.46k]
|
252 | 318 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant); |
253 | 1.46k | } else { |
254 | 1.46k | pm_buffer_append_string(buffer, "null", 4); |
255 | 1.46k | } |
256 | | |
257 | | // Dump the requireds field |
258 | 1.78k | pm_buffer_append_byte(buffer, ','); |
259 | 1.78k | pm_buffer_append_string(buffer, "\"requireds\":", 12); |
260 | 1.78k | const pm_node_list_t *requireds = &cast->requireds; |
261 | 1.78k | pm_buffer_append_byte(buffer, '['); |
262 | | |
263 | 5.69k | for (size_t index = 0; index < requireds->size; index++3.91k ) { Branch (263:36): [True: 3.91k, False: 1.78k]
|
264 | 3.91k | if (index != 0) pm_buffer_append_byte(buffer, ',')2.34k ; Branch (264:21): [True: 2.34k, False: 1.56k]
|
265 | 3.91k | pm_dump_json(buffer, parser, requireds->nodes[index]); |
266 | 3.91k | } |
267 | 1.78k | pm_buffer_append_byte(buffer, ']'); |
268 | | |
269 | | // Dump the rest field |
270 | 1.78k | pm_buffer_append_byte(buffer, ','); |
271 | 1.78k | pm_buffer_append_string(buffer, "\"rest\":", 7); |
272 | 1.78k | if (cast->rest != NULL) { Branch (272:17): [True: 653, False: 1.12k]
|
273 | 653 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest); |
274 | 1.12k | } else { |
275 | 1.12k | pm_buffer_append_string(buffer, "null", 4); |
276 | 1.12k | } |
277 | | |
278 | | // Dump the posts field |
279 | 1.78k | pm_buffer_append_byte(buffer, ','); |
280 | 1.78k | pm_buffer_append_string(buffer, "\"posts\":", 8); |
281 | 1.78k | const pm_node_list_t *posts = &cast->posts; |
282 | 1.78k | pm_buffer_append_byte(buffer, '['); |
283 | | |
284 | 2.12k | for (size_t index = 0; index < posts->size; index++343 ) { Branch (284:36): [True: 343, False: 1.78k]
|
285 | 343 | if (index != 0) pm_buffer_append_byte(buffer, ',')77 ; Branch (285:21): [True: 77, False: 266]
|
286 | 343 | pm_dump_json(buffer, parser, posts->nodes[index]); |
287 | 343 | } |
288 | 1.78k | pm_buffer_append_byte(buffer, ']'); |
289 | | |
290 | | // Dump the opening_loc field |
291 | 1.78k | pm_buffer_append_byte(buffer, ','); |
292 | 1.78k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
293 | 1.78k | if (cast->opening_loc.length != 0) { Branch (293:17): [True: 1.49k, False: 292]
|
294 | 1.49k | pm_dump_json_location(buffer, &cast->opening_loc); |
295 | 1.49k | } else { |
296 | 292 | pm_buffer_append_string(buffer, "null", 4); |
297 | 292 | } |
298 | | |
299 | | // Dump the closing_loc field |
300 | 1.78k | pm_buffer_append_byte(buffer, ','); |
301 | 1.78k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
302 | 1.78k | if (cast->closing_loc.length != 0) { Branch (302:17): [True: 753, False: 1.02k]
|
303 | 753 | pm_dump_json_location(buffer, &cast->closing_loc); |
304 | 1.02k | } else { |
305 | 1.02k | pm_buffer_append_string(buffer, "null", 4); |
306 | 1.02k | } |
307 | | |
308 | 1.78k | pm_buffer_append_byte(buffer, '}'); |
309 | 1.78k | break; |
310 | 0 | } |
311 | 14.7k | case PM_ASSOC_NODE: { Branch (311:9): [True: 14.7k, False: 710k]
|
312 | 14.7k | pm_buffer_append_string(buffer, "{\"type\":\"AssocNode\",\"location\":", 31); |
313 | | |
314 | 14.7k | const pm_assoc_node_t *cast = (const pm_assoc_node_t *) node; |
315 | 14.7k | pm_dump_json_location(buffer, &cast->base.location); |
316 | | |
317 | | // Dump the key field |
318 | 14.7k | pm_buffer_append_byte(buffer, ','); |
319 | 14.7k | pm_buffer_append_string(buffer, "\"key\":", 6); |
320 | 14.7k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->key); |
321 | | |
322 | | // Dump the value field |
323 | 14.7k | pm_buffer_append_byte(buffer, ','); |
324 | 14.7k | pm_buffer_append_string(buffer, "\"value\":", 8); |
325 | 14.7k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
326 | | |
327 | | // Dump the operator_loc field |
328 | 14.7k | pm_buffer_append_byte(buffer, ','); |
329 | 14.7k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
330 | 14.7k | if (cast->operator_loc.length != 0) { Branch (330:17): [True: 1.03k, False: 13.7k]
|
331 | 1.03k | pm_dump_json_location(buffer, &cast->operator_loc); |
332 | 13.7k | } else { |
333 | 13.7k | pm_buffer_append_string(buffer, "null", 4); |
334 | 13.7k | } |
335 | | |
336 | 14.7k | pm_buffer_append_byte(buffer, '}'); |
337 | 14.7k | break; |
338 | 0 | } |
339 | 2.71k | case PM_ASSOC_SPLAT_NODE: { Branch (339:9): [True: 2.71k, False: 722k]
|
340 | 2.71k | pm_buffer_append_string(buffer, "{\"type\":\"AssocSplatNode\",\"location\":", 36); |
341 | | |
342 | 2.71k | const pm_assoc_splat_node_t *cast = (const pm_assoc_splat_node_t *) node; |
343 | 2.71k | pm_dump_json_location(buffer, &cast->base.location); |
344 | | |
345 | | // Dump the value field |
346 | 2.71k | pm_buffer_append_byte(buffer, ','); |
347 | 2.71k | pm_buffer_append_string(buffer, "\"value\":", 8); |
348 | 2.71k | if (cast->value != NULL) { Branch (348:17): [True: 2.33k, False: 379]
|
349 | 2.33k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
350 | 2.33k | } else { |
351 | 379 | pm_buffer_append_string(buffer, "null", 4); |
352 | 379 | } |
353 | | |
354 | | // Dump the operator_loc field |
355 | 2.71k | pm_buffer_append_byte(buffer, ','); |
356 | 2.71k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
357 | 2.71k | pm_dump_json_location(buffer, &cast->operator_loc); |
358 | | |
359 | 2.71k | pm_buffer_append_byte(buffer, '}'); |
360 | 2.71k | break; |
361 | 0 | } |
362 | 155 | case PM_BACK_REFERENCE_READ_NODE: { Branch (362:9): [True: 155, False: 725k]
|
363 | 155 | pm_buffer_append_string(buffer, "{\"type\":\"BackReferenceReadNode\",\"location\":", 43); |
364 | | |
365 | 155 | const pm_back_reference_read_node_t *cast = (const pm_back_reference_read_node_t *) node; |
366 | 155 | pm_dump_json_location(buffer, &cast->base.location); |
367 | | |
368 | | // Dump the name field |
369 | 155 | pm_buffer_append_byte(buffer, ','); |
370 | 155 | pm_buffer_append_string(buffer, "\"name\":", 7); |
371 | 155 | pm_dump_json_constant(buffer, parser, cast->name); |
372 | | |
373 | 155 | pm_buffer_append_byte(buffer, '}'); |
374 | 155 | break; |
375 | 0 | } |
376 | 2.47k | case PM_BEGIN_NODE: { Branch (376:9): [True: 2.47k, False: 722k]
|
377 | 2.47k | pm_buffer_append_string(buffer, "{\"type\":\"BeginNode\",\"location\":", 31); |
378 | | |
379 | 2.47k | const pm_begin_node_t *cast = (const pm_begin_node_t *) node; |
380 | 2.47k | pm_dump_json_location(buffer, &cast->base.location); |
381 | | |
382 | | // Dump the begin_keyword_loc field |
383 | 2.47k | pm_buffer_append_byte(buffer, ','); |
384 | 2.47k | pm_buffer_append_string(buffer, "\"begin_keyword_loc\":", 20); |
385 | 2.47k | if (cast->begin_keyword_loc.length != 0) { Branch (385:17): [True: 962, False: 1.51k]
|
386 | 962 | pm_dump_json_location(buffer, &cast->begin_keyword_loc); |
387 | 1.51k | } else { |
388 | 1.51k | pm_buffer_append_string(buffer, "null", 4); |
389 | 1.51k | } |
390 | | |
391 | | // Dump the statements field |
392 | 2.47k | pm_buffer_append_byte(buffer, ','); |
393 | 2.47k | pm_buffer_append_string(buffer, "\"statements\":", 13); |
394 | 2.47k | if (cast->statements != NULL) { Branch (394:17): [True: 1.18k, False: 1.28k]
|
395 | 1.18k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
396 | 1.28k | } else { |
397 | 1.28k | pm_buffer_append_string(buffer, "null", 4); |
398 | 1.28k | } |
399 | | |
400 | | // Dump the rescue_clause field |
401 | 2.47k | pm_buffer_append_byte(buffer, ','); |
402 | 2.47k | pm_buffer_append_string(buffer, "\"rescue_clause\":", 16); |
403 | 2.47k | if (cast->rescue_clause != NULL) { Branch (403:17): [True: 1.21k, False: 1.26k]
|
404 | 1.21k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->rescue_clause); |
405 | 1.26k | } else { |
406 | 1.26k | pm_buffer_append_string(buffer, "null", 4); |
407 | 1.26k | } |
408 | | |
409 | | // Dump the else_clause field |
410 | 2.47k | pm_buffer_append_byte(buffer, ','); |
411 | 2.47k | pm_buffer_append_string(buffer, "\"else_clause\":", 14); |
412 | 2.47k | if (cast->else_clause != NULL) { Branch (412:17): [True: 567, False: 1.90k]
|
413 | 567 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause); |
414 | 1.90k | } else { |
415 | 1.90k | pm_buffer_append_string(buffer, "null", 4); |
416 | 1.90k | } |
417 | | |
418 | | // Dump the ensure_clause field |
419 | 2.47k | pm_buffer_append_byte(buffer, ','); |
420 | 2.47k | pm_buffer_append_string(buffer, "\"ensure_clause\":", 16); |
421 | 2.47k | if (cast->ensure_clause != NULL) { Branch (421:17): [True: 936, False: 1.53k]
|
422 | 936 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->ensure_clause); |
423 | 1.53k | } else { |
424 | 1.53k | pm_buffer_append_string(buffer, "null", 4); |
425 | 1.53k | } |
426 | | |
427 | | // Dump the end_keyword_loc field |
428 | 2.47k | pm_buffer_append_byte(buffer, ','); |
429 | 2.47k | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
430 | 2.47k | if (cast->end_keyword_loc.length != 0) { Branch (430:17): [True: 2.12k, False: 352]
|
431 | 2.12k | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
432 | 2.12k | } else { |
433 | 352 | pm_buffer_append_string(buffer, "null", 4); |
434 | 352 | } |
435 | | |
436 | 2.47k | pm_buffer_append_byte(buffer, '}'); |
437 | 2.47k | break; |
438 | 0 | } |
439 | 1.58k | case PM_BLOCK_ARGUMENT_NODE: { Branch (439:9): [True: 1.58k, False: 723k]
|
440 | 1.58k | pm_buffer_append_string(buffer, "{\"type\":\"BlockArgumentNode\",\"location\":", 39); |
441 | | |
442 | 1.58k | const pm_block_argument_node_t *cast = (const pm_block_argument_node_t *) node; |
443 | 1.58k | pm_dump_json_location(buffer, &cast->base.location); |
444 | | |
445 | | // Dump the expression field |
446 | 1.58k | pm_buffer_append_byte(buffer, ','); |
447 | 1.58k | pm_buffer_append_string(buffer, "\"expression\":", 13); |
448 | 1.58k | if (cast->expression != NULL) { Branch (448:17): [True: 1.49k, False: 92]
|
449 | 1.49k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression); |
450 | 1.49k | } else { |
451 | 92 | pm_buffer_append_string(buffer, "null", 4); |
452 | 92 | } |
453 | | |
454 | | // Dump the operator_loc field |
455 | 1.58k | pm_buffer_append_byte(buffer, ','); |
456 | 1.58k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
457 | 1.58k | pm_dump_json_location(buffer, &cast->operator_loc); |
458 | | |
459 | 1.58k | pm_buffer_append_byte(buffer, '}'); |
460 | 1.58k | break; |
461 | 0 | } |
462 | 415 | case PM_BLOCK_LOCAL_VARIABLE_NODE: { Branch (462:9): [True: 415, False: 724k]
|
463 | 415 | pm_buffer_append_string(buffer, "{\"type\":\"BlockLocalVariableNode\",\"location\":", 44); |
464 | | |
465 | 415 | const pm_block_local_variable_node_t *cast = (const pm_block_local_variable_node_t *) node; |
466 | 415 | pm_dump_json_location(buffer, &cast->base.location); |
467 | | |
468 | | // Dump the ParameterFlags field |
469 | 415 | pm_buffer_append_byte(buffer, ','); |
470 | 415 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
471 | 415 | size_t flags = 0; |
472 | 415 | pm_buffer_append_byte(buffer, '['); |
473 | 415 | if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) { |
474 | 74 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (474:21): [True: 0, False: 74]
|
475 | 74 | pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20); |
476 | 74 | flags++; |
477 | 74 | } |
478 | 415 | pm_buffer_append_byte(buffer, ']'); |
479 | | |
480 | | // Dump the name field |
481 | 415 | pm_buffer_append_byte(buffer, ','); |
482 | 415 | pm_buffer_append_string(buffer, "\"name\":", 7); |
483 | 415 | pm_dump_json_constant(buffer, parser, cast->name); |
484 | | |
485 | 415 | pm_buffer_append_byte(buffer, '}'); |
486 | 415 | break; |
487 | 0 | } |
488 | 5.69k | case PM_BLOCK_NODE: { Branch (488:9): [True: 5.69k, False: 719k]
|
489 | 5.69k | pm_buffer_append_string(buffer, "{\"type\":\"BlockNode\",\"location\":", 31); |
490 | | |
491 | 5.69k | const pm_block_node_t *cast = (const pm_block_node_t *) node; |
492 | 5.69k | pm_dump_json_location(buffer, &cast->base.location); |
493 | | |
494 | | // Dump the locals field |
495 | 5.69k | pm_buffer_append_byte(buffer, ','); |
496 | 5.69k | pm_buffer_append_string(buffer, "\"locals\":", 9); |
497 | 5.69k | const pm_constant_id_list_t *locals = &cast->locals; |
498 | 5.69k | pm_buffer_append_byte(buffer, '['); |
499 | | |
500 | 8.43k | for (size_t index = 0; index < locals->size; index++2.74k ) { Branch (500:36): [True: 2.74k, False: 5.69k]
|
501 | 2.74k | if (index != 0) pm_buffer_append_byte(buffer, ',')1.01k ; Branch (501:21): [True: 1.01k, False: 1.73k]
|
502 | 2.74k | pm_dump_json_constant(buffer, parser, locals->ids[index]); |
503 | 2.74k | } |
504 | 5.69k | pm_buffer_append_byte(buffer, ']'); |
505 | | |
506 | | // Dump the parameters field |
507 | 5.69k | pm_buffer_append_byte(buffer, ','); |
508 | 5.69k | pm_buffer_append_string(buffer, "\"parameters\":", 13); |
509 | 5.69k | if (cast->parameters != NULL) { Branch (509:17): [True: 1.55k, False: 4.13k]
|
510 | 1.55k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters); |
511 | 4.13k | } else { |
512 | 4.13k | pm_buffer_append_string(buffer, "null", 4); |
513 | 4.13k | } |
514 | | |
515 | | // Dump the body field |
516 | 5.69k | pm_buffer_append_byte(buffer, ','); |
517 | 5.69k | pm_buffer_append_string(buffer, "\"body\":", 7); |
518 | 5.69k | if (cast->body != NULL) { Branch (518:17): [True: 3.86k, False: 1.82k]
|
519 | 3.86k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->body); |
520 | 3.86k | } else { |
521 | 1.82k | pm_buffer_append_string(buffer, "null", 4); |
522 | 1.82k | } |
523 | | |
524 | | // Dump the opening_loc field |
525 | 5.69k | pm_buffer_append_byte(buffer, ','); |
526 | 5.69k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
527 | 5.69k | pm_dump_json_location(buffer, &cast->opening_loc); |
528 | | |
529 | | // Dump the closing_loc field |
530 | 5.69k | pm_buffer_append_byte(buffer, ','); |
531 | 5.69k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
532 | 5.69k | pm_dump_json_location(buffer, &cast->closing_loc); |
533 | | |
534 | 5.69k | pm_buffer_append_byte(buffer, '}'); |
535 | 5.69k | break; |
536 | 0 | } |
537 | 1.27k | case PM_BLOCK_PARAMETER_NODE: { Branch (537:9): [True: 1.27k, False: 723k]
|
538 | 1.27k | pm_buffer_append_string(buffer, "{\"type\":\"BlockParameterNode\",\"location\":", 40); |
539 | | |
540 | 1.27k | const pm_block_parameter_node_t *cast = (const pm_block_parameter_node_t *) node; |
541 | 1.27k | pm_dump_json_location(buffer, &cast->base.location); |
542 | | |
543 | | // Dump the ParameterFlags field |
544 | 1.27k | pm_buffer_append_byte(buffer, ','); |
545 | 1.27k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
546 | 1.27k | size_t flags = 0; |
547 | 1.27k | pm_buffer_append_byte(buffer, '['); |
548 | 1.27k | if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) { |
549 | 45 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (549:21): [True: 0, False: 45]
|
550 | 45 | pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20); |
551 | 45 | flags++; |
552 | 45 | } |
553 | 1.27k | pm_buffer_append_byte(buffer, ']'); |
554 | | |
555 | | // Dump the name field |
556 | 1.27k | pm_buffer_append_byte(buffer, ','); |
557 | 1.27k | pm_buffer_append_string(buffer, "\"name\":", 7); |
558 | 1.27k | if (cast->name != PM_CONSTANT_ID_UNSET) { Branch (558:17): [True: 1.20k, False: 72]
|
559 | 1.20k | pm_dump_json_constant(buffer, parser, cast->name); |
560 | 1.20k | } else { |
561 | 72 | pm_buffer_append_string(buffer, "null", 4); |
562 | 72 | } |
563 | | |
564 | | // Dump the name_loc field |
565 | 1.27k | pm_buffer_append_byte(buffer, ','); |
566 | 1.27k | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
567 | 1.27k | if (cast->name_loc.length != 0) { Branch (567:17): [True: 1.20k, False: 72]
|
568 | 1.20k | pm_dump_json_location(buffer, &cast->name_loc); |
569 | 1.20k | } else { |
570 | 72 | pm_buffer_append_string(buffer, "null", 4); |
571 | 72 | } |
572 | | |
573 | | // Dump the operator_loc field |
574 | 1.27k | pm_buffer_append_byte(buffer, ','); |
575 | 1.27k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
576 | 1.27k | pm_dump_json_location(buffer, &cast->operator_loc); |
577 | | |
578 | 1.27k | pm_buffer_append_byte(buffer, '}'); |
579 | 1.27k | break; |
580 | 0 | } |
581 | 1.88k | case PM_BLOCK_PARAMETERS_NODE: { Branch (581:9): [True: 1.88k, False: 723k]
|
582 | 1.88k | pm_buffer_append_string(buffer, "{\"type\":\"BlockParametersNode\",\"location\":", 41); |
583 | | |
584 | 1.88k | const pm_block_parameters_node_t *cast = (const pm_block_parameters_node_t *) node; |
585 | 1.88k | pm_dump_json_location(buffer, &cast->base.location); |
586 | | |
587 | | // Dump the parameters field |
588 | 1.88k | pm_buffer_append_byte(buffer, ','); |
589 | 1.88k | pm_buffer_append_string(buffer, "\"parameters\":", 13); |
590 | 1.88k | if (cast->parameters != NULL) { Branch (590:17): [True: 1.80k, False: 81]
|
591 | 1.80k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters); |
592 | 1.80k | } else { |
593 | 81 | pm_buffer_append_string(buffer, "null", 4); |
594 | 81 | } |
595 | | |
596 | | // Dump the locals field |
597 | 1.88k | pm_buffer_append_byte(buffer, ','); |
598 | 1.88k | pm_buffer_append_string(buffer, "\"locals\":", 9); |
599 | 1.88k | const pm_node_list_t *locals = &cast->locals; |
600 | 1.88k | pm_buffer_append_byte(buffer, '['); |
601 | | |
602 | 2.29k | for (size_t index = 0; index < locals->size; index++415 ) { Branch (602:36): [True: 415, False: 1.88k]
|
603 | 415 | if (index != 0) pm_buffer_append_byte(buffer, ',')235 ; Branch (603:21): [True: 235, False: 180]
|
604 | 415 | pm_dump_json(buffer, parser, locals->nodes[index]); |
605 | 415 | } |
606 | 1.88k | pm_buffer_append_byte(buffer, ']'); |
607 | | |
608 | | // Dump the opening_loc field |
609 | 1.88k | pm_buffer_append_byte(buffer, ','); |
610 | 1.88k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
611 | 1.88k | if (cast->opening_loc.length != 0) { Branch (611:17): [True: 1.58k, False: 301]
|
612 | 1.58k | pm_dump_json_location(buffer, &cast->opening_loc); |
613 | 1.58k | } else { |
614 | 301 | pm_buffer_append_string(buffer, "null", 4); |
615 | 301 | } |
616 | | |
617 | | // Dump the closing_loc field |
618 | 1.88k | pm_buffer_append_byte(buffer, ','); |
619 | 1.88k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
620 | 1.88k | if (cast->closing_loc.length != 0) { Branch (620:17): [True: 1.36k, False: 513]
|
621 | 1.36k | pm_dump_json_location(buffer, &cast->closing_loc); |
622 | 1.36k | } else { |
623 | 513 | pm_buffer_append_string(buffer, "null", 4); |
624 | 513 | } |
625 | | |
626 | 1.88k | pm_buffer_append_byte(buffer, '}'); |
627 | 1.88k | break; |
628 | 0 | } |
629 | 1.01k | case PM_BREAK_NODE: { Branch (629:9): [True: 1.01k, False: 724k]
|
630 | 1.01k | pm_buffer_append_string(buffer, "{\"type\":\"BreakNode\",\"location\":", 31); |
631 | | |
632 | 1.01k | const pm_break_node_t *cast = (const pm_break_node_t *) node; |
633 | 1.01k | pm_dump_json_location(buffer, &cast->base.location); |
634 | | |
635 | | // Dump the arguments field |
636 | 1.01k | pm_buffer_append_byte(buffer, ','); |
637 | 1.01k | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
638 | 1.01k | if (cast->arguments != NULL) { Branch (638:17): [True: 85, False: 930]
|
639 | 85 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments); |
640 | 930 | } else { |
641 | 930 | pm_buffer_append_string(buffer, "null", 4); |
642 | 930 | } |
643 | | |
644 | | // Dump the keyword_loc field |
645 | 1.01k | pm_buffer_append_byte(buffer, ','); |
646 | 1.01k | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
647 | 1.01k | pm_dump_json_location(buffer, &cast->keyword_loc); |
648 | | |
649 | 1.01k | pm_buffer_append_byte(buffer, '}'); |
650 | 1.01k | break; |
651 | 0 | } |
652 | 130 | case PM_CALL_AND_WRITE_NODE: { Branch (652:9): [True: 130, False: 725k]
|
653 | 130 | pm_buffer_append_string(buffer, "{\"type\":\"CallAndWriteNode\",\"location\":", 38); |
654 | | |
655 | 130 | const pm_call_and_write_node_t *cast = (const pm_call_and_write_node_t *) node; |
656 | 130 | pm_dump_json_location(buffer, &cast->base.location); |
657 | | |
658 | | // Dump the CallNodeFlags field |
659 | 130 | pm_buffer_append_byte(buffer, ','); |
660 | 130 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
661 | 130 | size_t flags = 0; |
662 | 130 | pm_buffer_append_byte(buffer, '['); |
663 | 130 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) { |
664 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (664:21): [True: 0, False: 0]
|
665 | 0 | pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17); |
666 | 0 | flags++; |
667 | 0 | } |
668 | 130 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) { |
669 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (669:21): [True: 0, False: 0]
|
670 | 0 | pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15); |
671 | 0 | flags++; |
672 | 0 | } |
673 | 130 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) { |
674 | 4 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (674:21): [True: 0, False: 4]
|
675 | 4 | pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17); |
676 | 4 | flags++; |
677 | 4 | } |
678 | 130 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) { |
679 | 7 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (679:21): [True: 0, False: 7]
|
680 | 7 | pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19); |
681 | 7 | flags++; |
682 | 7 | } |
683 | 130 | pm_buffer_append_byte(buffer, ']'); |
684 | | |
685 | | // Dump the receiver field |
686 | 130 | pm_buffer_append_byte(buffer, ','); |
687 | 130 | pm_buffer_append_string(buffer, "\"receiver\":", 11); |
688 | 130 | if (cast->receiver != NULL) { Branch (688:17): [True: 123, False: 7]
|
689 | 123 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver); |
690 | 123 | } else { |
691 | 7 | pm_buffer_append_string(buffer, "null", 4); |
692 | 7 | } |
693 | | |
694 | | // Dump the call_operator_loc field |
695 | 130 | pm_buffer_append_byte(buffer, ','); |
696 | 130 | pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20); |
697 | 130 | if (cast->call_operator_loc.length != 0) { Branch (697:17): [True: 109, False: 21]
|
698 | 109 | pm_dump_json_location(buffer, &cast->call_operator_loc); |
699 | 109 | } else { |
700 | 21 | pm_buffer_append_string(buffer, "null", 4); |
701 | 21 | } |
702 | | |
703 | | // Dump the message_loc field |
704 | 130 | pm_buffer_append_byte(buffer, ','); |
705 | 130 | pm_buffer_append_string(buffer, "\"message_loc\":", 14); |
706 | 130 | if (cast->message_loc.length != 0) { Branch (706:17): [True: 118, False: 12]
|
707 | 118 | pm_dump_json_location(buffer, &cast->message_loc); |
708 | 118 | } else { |
709 | 12 | pm_buffer_append_string(buffer, "null", 4); |
710 | 12 | } |
711 | | |
712 | | // Dump the read_name field |
713 | 130 | pm_buffer_append_byte(buffer, ','); |
714 | 130 | pm_buffer_append_string(buffer, "\"read_name\":", 12); |
715 | 130 | pm_dump_json_constant(buffer, parser, cast->read_name); |
716 | | |
717 | | // Dump the write_name field |
718 | 130 | pm_buffer_append_byte(buffer, ','); |
719 | 130 | pm_buffer_append_string(buffer, "\"write_name\":", 13); |
720 | 130 | pm_dump_json_constant(buffer, parser, cast->write_name); |
721 | | |
722 | | // Dump the operator_loc field |
723 | 130 | pm_buffer_append_byte(buffer, ','); |
724 | 130 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
725 | 130 | pm_dump_json_location(buffer, &cast->operator_loc); |
726 | | |
727 | | // Dump the value field |
728 | 130 | pm_buffer_append_byte(buffer, ','); |
729 | 130 | pm_buffer_append_string(buffer, "\"value\":", 8); |
730 | 130 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
731 | | |
732 | 130 | pm_buffer_append_byte(buffer, '}'); |
733 | 130 | break; |
734 | 0 | } |
735 | 147k | case PM_CALL_NODE: { Branch (735:9): [True: 147k, False: 577k]
|
736 | 147k | pm_buffer_append_string(buffer, "{\"type\":\"CallNode\",\"location\":", 30); |
737 | | |
738 | 147k | const pm_call_node_t *cast = (const pm_call_node_t *) node; |
739 | 147k | pm_dump_json_location(buffer, &cast->base.location); |
740 | | |
741 | | // Dump the CallNodeFlags field |
742 | 147k | pm_buffer_append_byte(buffer, ','); |
743 | 147k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
744 | 147k | size_t flags = 0; |
745 | 147k | pm_buffer_append_byte(buffer, '['); |
746 | 147k | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) { |
747 | 111 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (747:21): [True: 0, False: 111]
|
748 | 111 | pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17); |
749 | 111 | flags++; |
750 | 111 | } |
751 | 147k | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) { |
752 | 57.3k | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (752:21): [True: 0, False: 57.3k]
|
753 | 57.3k | pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15); |
754 | 57.3k | flags++; |
755 | 57.3k | } |
756 | 147k | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) { |
757 | 1.18k | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (757:21): [True: 0, False: 1.18k]
|
758 | 1.18k | pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17); |
759 | 1.18k | flags++; |
760 | 1.18k | } |
761 | 147k | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) { |
762 | 86.6k | if (flags != 0) pm_buffer_append_byte(buffer, ',')57.3k ; Branch (762:21): [True: 57.3k, False: 29.2k]
|
763 | 86.6k | pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19); |
764 | 86.6k | flags++; |
765 | 86.6k | } |
766 | 147k | pm_buffer_append_byte(buffer, ']'); |
767 | | |
768 | | // Dump the receiver field |
769 | 147k | pm_buffer_append_byte(buffer, ','); |
770 | 147k | pm_buffer_append_string(buffer, "\"receiver\":", 11); |
771 | 147k | if (cast->receiver != NULL) { Branch (771:17): [True: 61.4k, False: 86.5k]
|
772 | 61.4k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver); |
773 | 86.5k | } else { |
774 | 86.5k | pm_buffer_append_string(buffer, "null", 4); |
775 | 86.5k | } |
776 | | |
777 | | // Dump the call_operator_loc field |
778 | 147k | pm_buffer_append_byte(buffer, ','); |
779 | 147k | pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20); |
780 | 147k | if (cast->call_operator_loc.length != 0) { Branch (780:17): [True: 41.5k, False: 106k]
|
781 | 41.5k | pm_dump_json_location(buffer, &cast->call_operator_loc); |
782 | 106k | } else { |
783 | 106k | pm_buffer_append_string(buffer, "null", 4); |
784 | 106k | } |
785 | | |
786 | | // Dump the name field |
787 | 147k | pm_buffer_append_byte(buffer, ','); |
788 | 147k | pm_buffer_append_string(buffer, "\"name\":", 7); |
789 | 147k | pm_dump_json_constant(buffer, parser, cast->name); |
790 | | |
791 | | // Dump the message_loc field |
792 | 147k | pm_buffer_append_byte(buffer, ','); |
793 | 147k | pm_buffer_append_string(buffer, "\"message_loc\":", 14); |
794 | 147k | if (cast->message_loc.length != 0) { Branch (794:17): [True: 144k, False: 3.19k]
|
795 | 144k | pm_dump_json_location(buffer, &cast->message_loc); |
796 | 144k | } else { |
797 | 3.19k | pm_buffer_append_string(buffer, "null", 4); |
798 | 3.19k | } |
799 | | |
800 | | // Dump the opening_loc field |
801 | 147k | pm_buffer_append_byte(buffer, ','); |
802 | 147k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
803 | 147k | if (cast->opening_loc.length != 0) { Branch (803:17): [True: 7.12k, False: 140k]
|
804 | 7.12k | pm_dump_json_location(buffer, &cast->opening_loc); |
805 | 140k | } else { |
806 | 140k | pm_buffer_append_string(buffer, "null", 4); |
807 | 140k | } |
808 | | |
809 | | // Dump the arguments field |
810 | 147k | pm_buffer_append_byte(buffer, ','); |
811 | 147k | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
812 | 147k | if (cast->arguments != NULL) { Branch (812:17): [True: 44.0k, False: 103k]
|
813 | 44.0k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments); |
814 | 103k | } else { |
815 | 103k | pm_buffer_append_string(buffer, "null", 4); |
816 | 103k | } |
817 | | |
818 | | // Dump the closing_loc field |
819 | 147k | pm_buffer_append_byte(buffer, ','); |
820 | 147k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
821 | 147k | if (cast->closing_loc.length != 0) { Branch (821:17): [True: 4.97k, False: 142k]
|
822 | 4.97k | pm_dump_json_location(buffer, &cast->closing_loc); |
823 | 142k | } else { |
824 | 142k | pm_buffer_append_string(buffer, "null", 4); |
825 | 142k | } |
826 | | |
827 | | // Dump the equal_loc field |
828 | 147k | pm_buffer_append_byte(buffer, ','); |
829 | 147k | pm_buffer_append_string(buffer, "\"equal_loc\":", 12); |
830 | 147k | if (cast->equal_loc.length != 0) { Branch (830:17): [True: 1.18k, False: 146k]
|
831 | 1.18k | pm_dump_json_location(buffer, &cast->equal_loc); |
832 | 146k | } else { |
833 | 146k | pm_buffer_append_string(buffer, "null", 4); |
834 | 146k | } |
835 | | |
836 | | // Dump the block field |
837 | 147k | pm_buffer_append_byte(buffer, ','); |
838 | 147k | pm_buffer_append_string(buffer, "\"block\":", 8); |
839 | 147k | if (cast->block != NULL) { Branch (839:17): [True: 7.10k, False: 140k]
|
840 | 7.10k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->block); |
841 | 140k | } else { |
842 | 140k | pm_buffer_append_string(buffer, "null", 4); |
843 | 140k | } |
844 | | |
845 | 147k | pm_buffer_append_byte(buffer, '}'); |
846 | 147k | break; |
847 | 0 | } |
848 | 440 | case PM_CALL_OPERATOR_WRITE_NODE: { Branch (848:9): [True: 440, False: 724k]
|
849 | 440 | pm_buffer_append_string(buffer, "{\"type\":\"CallOperatorWriteNode\",\"location\":", 43); |
850 | | |
851 | 440 | const pm_call_operator_write_node_t *cast = (const pm_call_operator_write_node_t *) node; |
852 | 440 | pm_dump_json_location(buffer, &cast->base.location); |
853 | | |
854 | | // Dump the CallNodeFlags field |
855 | 440 | pm_buffer_append_byte(buffer, ','); |
856 | 440 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
857 | 440 | size_t flags = 0; |
858 | 440 | pm_buffer_append_byte(buffer, '['); |
859 | 440 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) { |
860 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (860:21): [True: 0, False: 0]
|
861 | 0 | pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17); |
862 | 0 | flags++; |
863 | 0 | } |
864 | 440 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) { |
865 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (865:21): [True: 0, False: 0]
|
866 | 0 | pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15); |
867 | 0 | flags++; |
868 | 0 | } |
869 | 440 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) { |
870 | 3 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (870:21): [True: 0, False: 3]
|
871 | 3 | pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17); |
872 | 3 | flags++; |
873 | 3 | } |
874 | 440 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) { |
875 | 20 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (875:21): [True: 0, False: 20]
|
876 | 20 | pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19); |
877 | 20 | flags++; |
878 | 20 | } |
879 | 440 | pm_buffer_append_byte(buffer, ']'); |
880 | | |
881 | | // Dump the receiver field |
882 | 440 | pm_buffer_append_byte(buffer, ','); |
883 | 440 | pm_buffer_append_string(buffer, "\"receiver\":", 11); |
884 | 440 | if (cast->receiver != NULL) { Branch (884:17): [True: 422, False: 18]
|
885 | 422 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver); |
886 | 422 | } else { |
887 | 18 | pm_buffer_append_string(buffer, "null", 4); |
888 | 18 | } |
889 | | |
890 | | // Dump the call_operator_loc field |
891 | 440 | pm_buffer_append_byte(buffer, ','); |
892 | 440 | pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20); |
893 | 440 | if (cast->call_operator_loc.length != 0) { Branch (893:17): [True: 397, False: 43]
|
894 | 397 | pm_dump_json_location(buffer, &cast->call_operator_loc); |
895 | 397 | } else { |
896 | 43 | pm_buffer_append_string(buffer, "null", 4); |
897 | 43 | } |
898 | | |
899 | | // Dump the message_loc field |
900 | 440 | pm_buffer_append_byte(buffer, ','); |
901 | 440 | pm_buffer_append_string(buffer, "\"message_loc\":", 14); |
902 | 440 | if (cast->message_loc.length != 0) { Branch (902:17): [True: 432, False: 8]
|
903 | 432 | pm_dump_json_location(buffer, &cast->message_loc); |
904 | 432 | } else { |
905 | 8 | pm_buffer_append_string(buffer, "null", 4); |
906 | 8 | } |
907 | | |
908 | | // Dump the read_name field |
909 | 440 | pm_buffer_append_byte(buffer, ','); |
910 | 440 | pm_buffer_append_string(buffer, "\"read_name\":", 12); |
911 | 440 | pm_dump_json_constant(buffer, parser, cast->read_name); |
912 | | |
913 | | // Dump the write_name field |
914 | 440 | pm_buffer_append_byte(buffer, ','); |
915 | 440 | pm_buffer_append_string(buffer, "\"write_name\":", 13); |
916 | 440 | pm_dump_json_constant(buffer, parser, cast->write_name); |
917 | | |
918 | | // Dump the binary_operator field |
919 | 440 | pm_buffer_append_byte(buffer, ','); |
920 | 440 | pm_buffer_append_string(buffer, "\"binary_operator\":", 18); |
921 | 440 | pm_dump_json_constant(buffer, parser, cast->binary_operator); |
922 | | |
923 | | // Dump the binary_operator_loc field |
924 | 440 | pm_buffer_append_byte(buffer, ','); |
925 | 440 | pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22); |
926 | 440 | pm_dump_json_location(buffer, &cast->binary_operator_loc); |
927 | | |
928 | | // Dump the value field |
929 | 440 | pm_buffer_append_byte(buffer, ','); |
930 | 440 | pm_buffer_append_string(buffer, "\"value\":", 8); |
931 | 440 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
932 | | |
933 | 440 | pm_buffer_append_byte(buffer, '}'); |
934 | 440 | break; |
935 | 0 | } |
936 | 54 | case PM_CALL_OR_WRITE_NODE: { Branch (936:9): [True: 54, False: 725k]
|
937 | 54 | pm_buffer_append_string(buffer, "{\"type\":\"CallOrWriteNode\",\"location\":", 37); |
938 | | |
939 | 54 | const pm_call_or_write_node_t *cast = (const pm_call_or_write_node_t *) node; |
940 | 54 | pm_dump_json_location(buffer, &cast->base.location); |
941 | | |
942 | | // Dump the CallNodeFlags field |
943 | 54 | pm_buffer_append_byte(buffer, ','); |
944 | 54 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
945 | 54 | size_t flags = 0; |
946 | 54 | pm_buffer_append_byte(buffer, '['); |
947 | 54 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) { |
948 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (948:21): [True: 0, False: 0]
|
949 | 0 | pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17); |
950 | 0 | flags++; |
951 | 0 | } |
952 | 54 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) { |
953 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (953:21): [True: 0, False: 0]
|
954 | 0 | pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15); |
955 | 0 | flags++; |
956 | 0 | } |
957 | 54 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) { |
958 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (958:21): [True: 0, False: 0]
|
959 | 0 | pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17); |
960 | 0 | flags++; |
961 | 0 | } |
962 | 54 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) { |
963 | 14 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (963:21): [True: 0, False: 14]
|
964 | 14 | pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19); |
965 | 14 | flags++; |
966 | 14 | } |
967 | 54 | pm_buffer_append_byte(buffer, ']'); |
968 | | |
969 | | // Dump the receiver field |
970 | 54 | pm_buffer_append_byte(buffer, ','); |
971 | 54 | pm_buffer_append_string(buffer, "\"receiver\":", 11); |
972 | 54 | if (cast->receiver != NULL) { Branch (972:17): [True: 40, False: 14]
|
973 | 40 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver); |
974 | 40 | } else { |
975 | 14 | pm_buffer_append_string(buffer, "null", 4); |
976 | 14 | } |
977 | | |
978 | | // Dump the call_operator_loc field |
979 | 54 | pm_buffer_append_byte(buffer, ','); |
980 | 54 | pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20); |
981 | 54 | if (cast->call_operator_loc.length != 0) { Branch (981:17): [True: 21, False: 33]
|
982 | 21 | pm_dump_json_location(buffer, &cast->call_operator_loc); |
983 | 33 | } else { |
984 | 33 | pm_buffer_append_string(buffer, "null", 4); |
985 | 33 | } |
986 | | |
987 | | // Dump the message_loc field |
988 | 54 | pm_buffer_append_byte(buffer, ','); |
989 | 54 | pm_buffer_append_string(buffer, "\"message_loc\":", 14); |
990 | 54 | if (cast->message_loc.length != 0) { Branch (990:17): [True: 50, False: 4]
|
991 | 50 | pm_dump_json_location(buffer, &cast->message_loc); |
992 | 50 | } else { |
993 | 4 | pm_buffer_append_string(buffer, "null", 4); |
994 | 4 | } |
995 | | |
996 | | // Dump the read_name field |
997 | 54 | pm_buffer_append_byte(buffer, ','); |
998 | 54 | pm_buffer_append_string(buffer, "\"read_name\":", 12); |
999 | 54 | pm_dump_json_constant(buffer, parser, cast->read_name); |
1000 | | |
1001 | | // Dump the write_name field |
1002 | 54 | pm_buffer_append_byte(buffer, ','); |
1003 | 54 | pm_buffer_append_string(buffer, "\"write_name\":", 13); |
1004 | 54 | pm_dump_json_constant(buffer, parser, cast->write_name); |
1005 | | |
1006 | | // Dump the operator_loc field |
1007 | 54 | pm_buffer_append_byte(buffer, ','); |
1008 | 54 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1009 | 54 | pm_dump_json_location(buffer, &cast->operator_loc); |
1010 | | |
1011 | | // Dump the value field |
1012 | 54 | pm_buffer_append_byte(buffer, ','); |
1013 | 54 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1014 | 54 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1015 | | |
1016 | 54 | pm_buffer_append_byte(buffer, '}'); |
1017 | 54 | break; |
1018 | 0 | } |
1019 | 100 | case PM_CALL_TARGET_NODE: { Branch (1019:9): [True: 100, False: 725k]
|
1020 | 100 | pm_buffer_append_string(buffer, "{\"type\":\"CallTargetNode\",\"location\":", 36); |
1021 | | |
1022 | 100 | const pm_call_target_node_t *cast = (const pm_call_target_node_t *) node; |
1023 | 100 | pm_dump_json_location(buffer, &cast->base.location); |
1024 | | |
1025 | | // Dump the CallNodeFlags field |
1026 | 100 | pm_buffer_append_byte(buffer, ','); |
1027 | 100 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
1028 | 100 | size_t flags = 0; |
1029 | 100 | pm_buffer_append_byte(buffer, '['); |
1030 | 100 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) { |
1031 | 3 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (1031:21): [True: 0, False: 3]
|
1032 | 3 | pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17); |
1033 | 3 | flags++; |
1034 | 3 | } |
1035 | 100 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) { |
1036 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (1036:21): [True: 0, False: 0]
|
1037 | 0 | pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15); |
1038 | 0 | flags++; |
1039 | 0 | } |
1040 | 100 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) { |
1041 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (1041:21): [True: 0, False: 0]
|
1042 | 0 | pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17); |
1043 | 0 | flags++; |
1044 | 0 | } |
1045 | 100 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) { |
1046 | 12 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (1046:21): [True: 0, False: 12]
|
1047 | 12 | pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19); |
1048 | 12 | flags++; |
1049 | 12 | } |
1050 | 100 | pm_buffer_append_byte(buffer, ']'); |
1051 | | |
1052 | | // Dump the receiver field |
1053 | 100 | pm_buffer_append_byte(buffer, ','); |
1054 | 100 | pm_buffer_append_string(buffer, "\"receiver\":", 11); |
1055 | 100 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver); |
1056 | | |
1057 | | // Dump the call_operator_loc field |
1058 | 100 | pm_buffer_append_byte(buffer, ','); |
1059 | 100 | pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20); |
1060 | 100 | pm_dump_json_location(buffer, &cast->call_operator_loc); |
1061 | | |
1062 | | // Dump the name field |
1063 | 100 | pm_buffer_append_byte(buffer, ','); |
1064 | 100 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1065 | 100 | pm_dump_json_constant(buffer, parser, cast->name); |
1066 | | |
1067 | | // Dump the message_loc field |
1068 | 100 | pm_buffer_append_byte(buffer, ','); |
1069 | 100 | pm_buffer_append_string(buffer, "\"message_loc\":", 14); |
1070 | 100 | pm_dump_json_location(buffer, &cast->message_loc); |
1071 | | |
1072 | 100 | pm_buffer_append_byte(buffer, '}'); |
1073 | 100 | break; |
1074 | 0 | } |
1075 | 272 | case PM_CAPTURE_PATTERN_NODE: { Branch (1075:9): [True: 272, False: 724k]
|
1076 | 272 | pm_buffer_append_string(buffer, "{\"type\":\"CapturePatternNode\",\"location\":", 40); |
1077 | | |
1078 | 272 | const pm_capture_pattern_node_t *cast = (const pm_capture_pattern_node_t *) node; |
1079 | 272 | pm_dump_json_location(buffer, &cast->base.location); |
1080 | | |
1081 | | // Dump the value field |
1082 | 272 | pm_buffer_append_byte(buffer, ','); |
1083 | 272 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1084 | 272 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1085 | | |
1086 | | // Dump the target field |
1087 | 272 | pm_buffer_append_byte(buffer, ','); |
1088 | 272 | pm_buffer_append_string(buffer, "\"target\":", 9); |
1089 | 272 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->target); |
1090 | | |
1091 | | // Dump the operator_loc field |
1092 | 272 | pm_buffer_append_byte(buffer, ','); |
1093 | 272 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1094 | 272 | pm_dump_json_location(buffer, &cast->operator_loc); |
1095 | | |
1096 | 272 | pm_buffer_append_byte(buffer, '}'); |
1097 | 272 | break; |
1098 | 0 | } |
1099 | 3.74k | case PM_CASE_MATCH_NODE: { Branch (1099:9): [True: 3.74k, False: 721k]
|
1100 | 3.74k | pm_buffer_append_string(buffer, "{\"type\":\"CaseMatchNode\",\"location\":", 35); |
1101 | | |
1102 | 3.74k | const pm_case_match_node_t *cast = (const pm_case_match_node_t *) node; |
1103 | 3.74k | pm_dump_json_location(buffer, &cast->base.location); |
1104 | | |
1105 | | // Dump the predicate field |
1106 | 3.74k | pm_buffer_append_byte(buffer, ','); |
1107 | 3.74k | pm_buffer_append_string(buffer, "\"predicate\":", 12); |
1108 | 3.74k | if (cast->predicate != NULL) { Branch (1108:17): [True: 3.59k, False: 153]
|
1109 | 3.59k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate); |
1110 | 3.59k | } else { |
1111 | 153 | pm_buffer_append_string(buffer, "null", 4); |
1112 | 153 | } |
1113 | | |
1114 | | // Dump the conditions field |
1115 | 3.74k | pm_buffer_append_byte(buffer, ','); |
1116 | 3.74k | pm_buffer_append_string(buffer, "\"conditions\":", 13); |
1117 | 3.74k | const pm_node_list_t *conditions = &cast->conditions; |
1118 | 3.74k | pm_buffer_append_byte(buffer, '['); |
1119 | | |
1120 | 7.95k | for (size_t index = 0; index < conditions->size; index++4.20k ) { Branch (1120:36): [True: 4.20k, False: 3.74k]
|
1121 | 4.20k | if (index != 0) pm_buffer_append_byte(buffer, ',')1.33k ; Branch (1121:21): [True: 1.33k, False: 2.86k]
|
1122 | 4.20k | pm_dump_json(buffer, parser, conditions->nodes[index]); |
1123 | 4.20k | } |
1124 | 3.74k | pm_buffer_append_byte(buffer, ']'); |
1125 | | |
1126 | | // Dump the else_clause field |
1127 | 3.74k | pm_buffer_append_byte(buffer, ','); |
1128 | 3.74k | pm_buffer_append_string(buffer, "\"else_clause\":", 14); |
1129 | 3.74k | if (cast->else_clause != NULL) { Branch (1129:17): [True: 185, False: 3.56k]
|
1130 | 185 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause); |
1131 | 3.56k | } else { |
1132 | 3.56k | pm_buffer_append_string(buffer, "null", 4); |
1133 | 3.56k | } |
1134 | | |
1135 | | // Dump the case_keyword_loc field |
1136 | 3.74k | pm_buffer_append_byte(buffer, ','); |
1137 | 3.74k | pm_buffer_append_string(buffer, "\"case_keyword_loc\":", 19); |
1138 | 3.74k | pm_dump_json_location(buffer, &cast->case_keyword_loc); |
1139 | | |
1140 | | // Dump the end_keyword_loc field |
1141 | 3.74k | pm_buffer_append_byte(buffer, ','); |
1142 | 3.74k | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
1143 | 3.74k | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
1144 | | |
1145 | 3.74k | pm_buffer_append_byte(buffer, '}'); |
1146 | 3.74k | break; |
1147 | 0 | } |
1148 | 4.46k | case PM_CASE_NODE: { Branch (1148:9): [True: 4.46k, False: 720k]
|
1149 | 4.46k | pm_buffer_append_string(buffer, "{\"type\":\"CaseNode\",\"location\":", 30); |
1150 | | |
1151 | 4.46k | const pm_case_node_t *cast = (const pm_case_node_t *) node; |
1152 | 4.46k | pm_dump_json_location(buffer, &cast->base.location); |
1153 | | |
1154 | | // Dump the predicate field |
1155 | 4.46k | pm_buffer_append_byte(buffer, ','); |
1156 | 4.46k | pm_buffer_append_string(buffer, "\"predicate\":", 12); |
1157 | 4.46k | if (cast->predicate != NULL) { Branch (1157:17): [True: 2.77k, False: 1.69k]
|
1158 | 2.77k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate); |
1159 | 2.77k | } else { |
1160 | 1.69k | pm_buffer_append_string(buffer, "null", 4); |
1161 | 1.69k | } |
1162 | | |
1163 | | // Dump the conditions field |
1164 | 4.46k | pm_buffer_append_byte(buffer, ','); |
1165 | 4.46k | pm_buffer_append_string(buffer, "\"conditions\":", 13); |
1166 | 4.46k | const pm_node_list_t *conditions = &cast->conditions; |
1167 | 4.46k | pm_buffer_append_byte(buffer, '['); |
1168 | | |
1169 | 9.41k | for (size_t index = 0; index < conditions->size; index++4.94k ) { Branch (1169:36): [True: 4.94k, False: 4.46k]
|
1170 | 4.94k | if (index != 0) pm_buffer_append_byte(buffer, ',')553 ; Branch (1170:21): [True: 553, False: 4.39k]
|
1171 | 4.94k | pm_dump_json(buffer, parser, conditions->nodes[index]); |
1172 | 4.94k | } |
1173 | 4.46k | pm_buffer_append_byte(buffer, ']'); |
1174 | | |
1175 | | // Dump the else_clause field |
1176 | 4.46k | pm_buffer_append_byte(buffer, ','); |
1177 | 4.46k | pm_buffer_append_string(buffer, "\"else_clause\":", 14); |
1178 | 4.46k | if (cast->else_clause != NULL) { Branch (1178:17): [True: 1.18k, False: 3.28k]
|
1179 | 1.18k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause); |
1180 | 3.28k | } else { |
1181 | 3.28k | pm_buffer_append_string(buffer, "null", 4); |
1182 | 3.28k | } |
1183 | | |
1184 | | // Dump the case_keyword_loc field |
1185 | 4.46k | pm_buffer_append_byte(buffer, ','); |
1186 | 4.46k | pm_buffer_append_string(buffer, "\"case_keyword_loc\":", 19); |
1187 | 4.46k | pm_dump_json_location(buffer, &cast->case_keyword_loc); |
1188 | | |
1189 | | // Dump the end_keyword_loc field |
1190 | 4.46k | pm_buffer_append_byte(buffer, ','); |
1191 | 4.46k | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
1192 | 4.46k | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
1193 | | |
1194 | 4.46k | pm_buffer_append_byte(buffer, '}'); |
1195 | 4.46k | break; |
1196 | 0 | } |
1197 | 1.98k | case PM_CLASS_NODE: { Branch (1197:9): [True: 1.98k, False: 723k]
|
1198 | 1.98k | pm_buffer_append_string(buffer, "{\"type\":\"ClassNode\",\"location\":", 31); |
1199 | | |
1200 | 1.98k | const pm_class_node_t *cast = (const pm_class_node_t *) node; |
1201 | 1.98k | pm_dump_json_location(buffer, &cast->base.location); |
1202 | | |
1203 | | // Dump the locals field |
1204 | 1.98k | pm_buffer_append_byte(buffer, ','); |
1205 | 1.98k | pm_buffer_append_string(buffer, "\"locals\":", 9); |
1206 | 1.98k | const pm_constant_id_list_t *locals = &cast->locals; |
1207 | 1.98k | pm_buffer_append_byte(buffer, '['); |
1208 | | |
1209 | 2.34k | for (size_t index = 0; index < locals->size; index++364 ) { Branch (1209:36): [True: 364, False: 1.98k]
|
1210 | 364 | if (index != 0) pm_buffer_append_byte(buffer, ',')52 ; Branch (1210:21): [True: 52, False: 312]
|
1211 | 364 | pm_dump_json_constant(buffer, parser, locals->ids[index]); |
1212 | 364 | } |
1213 | 1.98k | pm_buffer_append_byte(buffer, ']'); |
1214 | | |
1215 | | // Dump the class_keyword_loc field |
1216 | 1.98k | pm_buffer_append_byte(buffer, ','); |
1217 | 1.98k | pm_buffer_append_string(buffer, "\"class_keyword_loc\":", 20); |
1218 | 1.98k | pm_dump_json_location(buffer, &cast->class_keyword_loc); |
1219 | | |
1220 | | // Dump the constant_path field |
1221 | 1.98k | pm_buffer_append_byte(buffer, ','); |
1222 | 1.98k | pm_buffer_append_string(buffer, "\"constant_path\":", 16); |
1223 | 1.98k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant_path); |
1224 | | |
1225 | | // Dump the inheritance_operator_loc field |
1226 | 1.98k | pm_buffer_append_byte(buffer, ','); |
1227 | 1.98k | pm_buffer_append_string(buffer, "\"inheritance_operator_loc\":", 27); |
1228 | 1.98k | if (cast->inheritance_operator_loc.length != 0) { Branch (1228:17): [True: 522, False: 1.46k]
|
1229 | 522 | pm_dump_json_location(buffer, &cast->inheritance_operator_loc); |
1230 | 1.46k | } else { |
1231 | 1.46k | pm_buffer_append_string(buffer, "null", 4); |
1232 | 1.46k | } |
1233 | | |
1234 | | // Dump the superclass field |
1235 | 1.98k | pm_buffer_append_byte(buffer, ','); |
1236 | 1.98k | pm_buffer_append_string(buffer, "\"superclass\":", 13); |
1237 | 1.98k | if (cast->superclass != NULL) { Branch (1237:17): [True: 522, False: 1.46k]
|
1238 | 522 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->superclass); |
1239 | 1.46k | } else { |
1240 | 1.46k | pm_buffer_append_string(buffer, "null", 4); |
1241 | 1.46k | } |
1242 | | |
1243 | | // Dump the body field |
1244 | 1.98k | pm_buffer_append_byte(buffer, ','); |
1245 | 1.98k | pm_buffer_append_string(buffer, "\"body\":", 7); |
1246 | 1.98k | if (cast->body != NULL) { Branch (1246:17): [True: 1.42k, False: 554]
|
1247 | 1.42k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->body); |
1248 | 1.42k | } else { |
1249 | 554 | pm_buffer_append_string(buffer, "null", 4); |
1250 | 554 | } |
1251 | | |
1252 | | // Dump the end_keyword_loc field |
1253 | 1.98k | pm_buffer_append_byte(buffer, ','); |
1254 | 1.98k | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
1255 | 1.98k | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
1256 | | |
1257 | | // Dump the name field |
1258 | 1.98k | pm_buffer_append_byte(buffer, ','); |
1259 | 1.98k | pm_buffer_append_string(buffer, "\"name\":", 7); |
1260 | 1.98k | pm_dump_json_constant(buffer, parser, cast->name); |
1261 | | |
1262 | 1.98k | pm_buffer_append_byte(buffer, '}'); |
1263 | 1.98k | break; |
1264 | 0 | } |
1265 | 4 | case PM_CLASS_VARIABLE_AND_WRITE_NODE: { Branch (1265:9): [True: 4, False: 725k]
|
1266 | 4 | pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableAndWriteNode\",\"location\":", 47); |
1267 | | |
1268 | 4 | const pm_class_variable_and_write_node_t *cast = (const pm_class_variable_and_write_node_t *) node; |
1269 | 4 | pm_dump_json_location(buffer, &cast->base.location); |
1270 | | |
1271 | | // Dump the name field |
1272 | 4 | pm_buffer_append_byte(buffer, ','); |
1273 | 4 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1274 | 4 | pm_dump_json_constant(buffer, parser, cast->name); |
1275 | | |
1276 | | // Dump the name_loc field |
1277 | 4 | pm_buffer_append_byte(buffer, ','); |
1278 | 4 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1279 | 4 | pm_dump_json_location(buffer, &cast->name_loc); |
1280 | | |
1281 | | // Dump the operator_loc field |
1282 | 4 | pm_buffer_append_byte(buffer, ','); |
1283 | 4 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1284 | 4 | pm_dump_json_location(buffer, &cast->operator_loc); |
1285 | | |
1286 | | // Dump the value field |
1287 | 4 | pm_buffer_append_byte(buffer, ','); |
1288 | 4 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1289 | 4 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1290 | | |
1291 | 4 | pm_buffer_append_byte(buffer, '}'); |
1292 | 4 | break; |
1293 | 0 | } |
1294 | 18 | case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: { Branch (1294:9): [True: 18, False: 725k]
|
1295 | 18 | pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableOperatorWriteNode\",\"location\":", 52); |
1296 | | |
1297 | 18 | const pm_class_variable_operator_write_node_t *cast = (const pm_class_variable_operator_write_node_t *) node; |
1298 | 18 | pm_dump_json_location(buffer, &cast->base.location); |
1299 | | |
1300 | | // Dump the name field |
1301 | 18 | pm_buffer_append_byte(buffer, ','); |
1302 | 18 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1303 | 18 | pm_dump_json_constant(buffer, parser, cast->name); |
1304 | | |
1305 | | // Dump the name_loc field |
1306 | 18 | pm_buffer_append_byte(buffer, ','); |
1307 | 18 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1308 | 18 | pm_dump_json_location(buffer, &cast->name_loc); |
1309 | | |
1310 | | // Dump the binary_operator_loc field |
1311 | 18 | pm_buffer_append_byte(buffer, ','); |
1312 | 18 | pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22); |
1313 | 18 | pm_dump_json_location(buffer, &cast->binary_operator_loc); |
1314 | | |
1315 | | // Dump the value field |
1316 | 18 | pm_buffer_append_byte(buffer, ','); |
1317 | 18 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1318 | 18 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1319 | | |
1320 | | // Dump the binary_operator field |
1321 | 18 | pm_buffer_append_byte(buffer, ','); |
1322 | 18 | pm_buffer_append_string(buffer, "\"binary_operator\":", 18); |
1323 | 18 | pm_dump_json_constant(buffer, parser, cast->binary_operator); |
1324 | | |
1325 | 18 | pm_buffer_append_byte(buffer, '}'); |
1326 | 18 | break; |
1327 | 0 | } |
1328 | 1 | case PM_CLASS_VARIABLE_OR_WRITE_NODE: { Branch (1328:9): [True: 1, False: 725k]
|
1329 | 1 | pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableOrWriteNode\",\"location\":", 46); |
1330 | | |
1331 | 1 | const pm_class_variable_or_write_node_t *cast = (const pm_class_variable_or_write_node_t *) node; |
1332 | 1 | pm_dump_json_location(buffer, &cast->base.location); |
1333 | | |
1334 | | // Dump the name field |
1335 | 1 | pm_buffer_append_byte(buffer, ','); |
1336 | 1 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1337 | 1 | pm_dump_json_constant(buffer, parser, cast->name); |
1338 | | |
1339 | | // Dump the name_loc field |
1340 | 1 | pm_buffer_append_byte(buffer, ','); |
1341 | 1 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1342 | 1 | pm_dump_json_location(buffer, &cast->name_loc); |
1343 | | |
1344 | | // Dump the operator_loc field |
1345 | 1 | pm_buffer_append_byte(buffer, ','); |
1346 | 1 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1347 | 1 | pm_dump_json_location(buffer, &cast->operator_loc); |
1348 | | |
1349 | | // Dump the value field |
1350 | 1 | pm_buffer_append_byte(buffer, ','); |
1351 | 1 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1352 | 1 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1353 | | |
1354 | 1 | pm_buffer_append_byte(buffer, '}'); |
1355 | 1 | break; |
1356 | 0 | } |
1357 | 870 | case PM_CLASS_VARIABLE_READ_NODE: { Branch (1357:9): [True: 870, False: 724k]
|
1358 | 870 | pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableReadNode\",\"location\":", 43); |
1359 | | |
1360 | 870 | const pm_class_variable_read_node_t *cast = (const pm_class_variable_read_node_t *) node; |
1361 | 870 | pm_dump_json_location(buffer, &cast->base.location); |
1362 | | |
1363 | | // Dump the name field |
1364 | 870 | pm_buffer_append_byte(buffer, ','); |
1365 | 870 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1366 | 870 | pm_dump_json_constant(buffer, parser, cast->name); |
1367 | | |
1368 | 870 | pm_buffer_append_byte(buffer, '}'); |
1369 | 870 | break; |
1370 | 0 | } |
1371 | 328 | case PM_CLASS_VARIABLE_TARGET_NODE: { Branch (1371:9): [True: 328, False: 724k]
|
1372 | 328 | pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableTargetNode\",\"location\":", 45); |
1373 | | |
1374 | 328 | const pm_class_variable_target_node_t *cast = (const pm_class_variable_target_node_t *) node; |
1375 | 328 | pm_dump_json_location(buffer, &cast->base.location); |
1376 | | |
1377 | | // Dump the name field |
1378 | 328 | pm_buffer_append_byte(buffer, ','); |
1379 | 328 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1380 | 328 | pm_dump_json_constant(buffer, parser, cast->name); |
1381 | | |
1382 | 328 | pm_buffer_append_byte(buffer, '}'); |
1383 | 328 | break; |
1384 | 0 | } |
1385 | 365 | case PM_CLASS_VARIABLE_WRITE_NODE: { Branch (1385:9): [True: 365, False: 724k]
|
1386 | 365 | pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableWriteNode\",\"location\":", 44); |
1387 | | |
1388 | 365 | const pm_class_variable_write_node_t *cast = (const pm_class_variable_write_node_t *) node; |
1389 | 365 | pm_dump_json_location(buffer, &cast->base.location); |
1390 | | |
1391 | | // Dump the name field |
1392 | 365 | pm_buffer_append_byte(buffer, ','); |
1393 | 365 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1394 | 365 | pm_dump_json_constant(buffer, parser, cast->name); |
1395 | | |
1396 | | // Dump the name_loc field |
1397 | 365 | pm_buffer_append_byte(buffer, ','); |
1398 | 365 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1399 | 365 | pm_dump_json_location(buffer, &cast->name_loc); |
1400 | | |
1401 | | // Dump the value field |
1402 | 365 | pm_buffer_append_byte(buffer, ','); |
1403 | 365 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1404 | 365 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1405 | | |
1406 | | // Dump the operator_loc field |
1407 | 365 | pm_buffer_append_byte(buffer, ','); |
1408 | 365 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1409 | 365 | pm_dump_json_location(buffer, &cast->operator_loc); |
1410 | | |
1411 | 365 | pm_buffer_append_byte(buffer, '}'); |
1412 | 365 | break; |
1413 | 0 | } |
1414 | 53 | case PM_CONSTANT_AND_WRITE_NODE: { Branch (1414:9): [True: 53, False: 725k]
|
1415 | 53 | pm_buffer_append_string(buffer, "{\"type\":\"ConstantAndWriteNode\",\"location\":", 42); |
1416 | | |
1417 | 53 | const pm_constant_and_write_node_t *cast = (const pm_constant_and_write_node_t *) node; |
1418 | 53 | pm_dump_json_location(buffer, &cast->base.location); |
1419 | | |
1420 | | // Dump the name field |
1421 | 53 | pm_buffer_append_byte(buffer, ','); |
1422 | 53 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1423 | 53 | pm_dump_json_constant(buffer, parser, cast->name); |
1424 | | |
1425 | | // Dump the name_loc field |
1426 | 53 | pm_buffer_append_byte(buffer, ','); |
1427 | 53 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1428 | 53 | pm_dump_json_location(buffer, &cast->name_loc); |
1429 | | |
1430 | | // Dump the operator_loc field |
1431 | 53 | pm_buffer_append_byte(buffer, ','); |
1432 | 53 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1433 | 53 | pm_dump_json_location(buffer, &cast->operator_loc); |
1434 | | |
1435 | | // Dump the value field |
1436 | 53 | pm_buffer_append_byte(buffer, ','); |
1437 | 53 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1438 | 53 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1439 | | |
1440 | 53 | pm_buffer_append_byte(buffer, '}'); |
1441 | 53 | break; |
1442 | 0 | } |
1443 | 80 | case PM_CONSTANT_OPERATOR_WRITE_NODE: { Branch (1443:9): [True: 80, False: 725k]
|
1444 | 80 | pm_buffer_append_string(buffer, "{\"type\":\"ConstantOperatorWriteNode\",\"location\":", 47); |
1445 | | |
1446 | 80 | const pm_constant_operator_write_node_t *cast = (const pm_constant_operator_write_node_t *) node; |
1447 | 80 | pm_dump_json_location(buffer, &cast->base.location); |
1448 | | |
1449 | | // Dump the name field |
1450 | 80 | pm_buffer_append_byte(buffer, ','); |
1451 | 80 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1452 | 80 | pm_dump_json_constant(buffer, parser, cast->name); |
1453 | | |
1454 | | // Dump the name_loc field |
1455 | 80 | pm_buffer_append_byte(buffer, ','); |
1456 | 80 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1457 | 80 | pm_dump_json_location(buffer, &cast->name_loc); |
1458 | | |
1459 | | // Dump the binary_operator_loc field |
1460 | 80 | pm_buffer_append_byte(buffer, ','); |
1461 | 80 | pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22); |
1462 | 80 | pm_dump_json_location(buffer, &cast->binary_operator_loc); |
1463 | | |
1464 | | // Dump the value field |
1465 | 80 | pm_buffer_append_byte(buffer, ','); |
1466 | 80 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1467 | 80 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1468 | | |
1469 | | // Dump the binary_operator field |
1470 | 80 | pm_buffer_append_byte(buffer, ','); |
1471 | 80 | pm_buffer_append_string(buffer, "\"binary_operator\":", 18); |
1472 | 80 | pm_dump_json_constant(buffer, parser, cast->binary_operator); |
1473 | | |
1474 | 80 | pm_buffer_append_byte(buffer, '}'); |
1475 | 80 | break; |
1476 | 0 | } |
1477 | 47 | case PM_CONSTANT_OR_WRITE_NODE: { Branch (1477:9): [True: 47, False: 725k]
|
1478 | 47 | pm_buffer_append_string(buffer, "{\"type\":\"ConstantOrWriteNode\",\"location\":", 41); |
1479 | | |
1480 | 47 | const pm_constant_or_write_node_t *cast = (const pm_constant_or_write_node_t *) node; |
1481 | 47 | pm_dump_json_location(buffer, &cast->base.location); |
1482 | | |
1483 | | // Dump the name field |
1484 | 47 | pm_buffer_append_byte(buffer, ','); |
1485 | 47 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1486 | 47 | pm_dump_json_constant(buffer, parser, cast->name); |
1487 | | |
1488 | | // Dump the name_loc field |
1489 | 47 | pm_buffer_append_byte(buffer, ','); |
1490 | 47 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1491 | 47 | pm_dump_json_location(buffer, &cast->name_loc); |
1492 | | |
1493 | | // Dump the operator_loc field |
1494 | 47 | pm_buffer_append_byte(buffer, ','); |
1495 | 47 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1496 | 47 | pm_dump_json_location(buffer, &cast->operator_loc); |
1497 | | |
1498 | | // Dump the value field |
1499 | 47 | pm_buffer_append_byte(buffer, ','); |
1500 | 47 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1501 | 47 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1502 | | |
1503 | 47 | pm_buffer_append_byte(buffer, '}'); |
1504 | 47 | break; |
1505 | 0 | } |
1506 | 25 | case PM_CONSTANT_PATH_AND_WRITE_NODE: { Branch (1506:9): [True: 25, False: 725k]
|
1507 | 25 | pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathAndWriteNode\",\"location\":", 46); |
1508 | | |
1509 | 25 | const pm_constant_path_and_write_node_t *cast = (const pm_constant_path_and_write_node_t *) node; |
1510 | 25 | pm_dump_json_location(buffer, &cast->base.location); |
1511 | | |
1512 | | // Dump the target field |
1513 | 25 | pm_buffer_append_byte(buffer, ','); |
1514 | 25 | pm_buffer_append_string(buffer, "\"target\":", 9); |
1515 | 25 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->target); |
1516 | | |
1517 | | // Dump the operator_loc field |
1518 | 25 | pm_buffer_append_byte(buffer, ','); |
1519 | 25 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1520 | 25 | pm_dump_json_location(buffer, &cast->operator_loc); |
1521 | | |
1522 | | // Dump the value field |
1523 | 25 | pm_buffer_append_byte(buffer, ','); |
1524 | 25 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1525 | 25 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1526 | | |
1527 | 25 | pm_buffer_append_byte(buffer, '}'); |
1528 | 25 | break; |
1529 | 0 | } |
1530 | 12.1k | case PM_CONSTANT_PATH_NODE: { Branch (1530:9): [True: 12.1k, False: 713k]
|
1531 | 12.1k | pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathNode\",\"location\":", 38); |
1532 | | |
1533 | 12.1k | const pm_constant_path_node_t *cast = (const pm_constant_path_node_t *) node; |
1534 | 12.1k | pm_dump_json_location(buffer, &cast->base.location); |
1535 | | |
1536 | | // Dump the parent field |
1537 | 12.1k | pm_buffer_append_byte(buffer, ','); |
1538 | 12.1k | pm_buffer_append_string(buffer, "\"parent\":", 9); |
1539 | 12.1k | if (cast->parent != NULL) { Branch (1539:17): [True: 8.36k, False: 3.80k]
|
1540 | 8.36k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->parent); |
1541 | 8.36k | } else { |
1542 | 3.80k | pm_buffer_append_string(buffer, "null", 4); |
1543 | 3.80k | } |
1544 | | |
1545 | | // Dump the name field |
1546 | 12.1k | pm_buffer_append_byte(buffer, ','); |
1547 | 12.1k | pm_buffer_append_string(buffer, "\"name\":", 7); |
1548 | 12.1k | if (cast->name != PM_CONSTANT_ID_UNSET) { Branch (1548:17): [True: 10.6k, False: 1.54k]
|
1549 | 10.6k | pm_dump_json_constant(buffer, parser, cast->name); |
1550 | 10.6k | } else { |
1551 | 1.54k | pm_buffer_append_string(buffer, "null", 4); |
1552 | 1.54k | } |
1553 | | |
1554 | | // Dump the delimiter_loc field |
1555 | 12.1k | pm_buffer_append_byte(buffer, ','); |
1556 | 12.1k | pm_buffer_append_string(buffer, "\"delimiter_loc\":", 16); |
1557 | 12.1k | pm_dump_json_location(buffer, &cast->delimiter_loc); |
1558 | | |
1559 | | // Dump the name_loc field |
1560 | 12.1k | pm_buffer_append_byte(buffer, ','); |
1561 | 12.1k | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1562 | 12.1k | pm_dump_json_location(buffer, &cast->name_loc); |
1563 | | |
1564 | 12.1k | pm_buffer_append_byte(buffer, '}'); |
1565 | 12.1k | break; |
1566 | 0 | } |
1567 | 18 | case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: { Branch (1567:9): [True: 18, False: 725k]
|
1568 | 18 | pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathOperatorWriteNode\",\"location\":", 51); |
1569 | | |
1570 | 18 | const pm_constant_path_operator_write_node_t *cast = (const pm_constant_path_operator_write_node_t *) node; |
1571 | 18 | pm_dump_json_location(buffer, &cast->base.location); |
1572 | | |
1573 | | // Dump the target field |
1574 | 18 | pm_buffer_append_byte(buffer, ','); |
1575 | 18 | pm_buffer_append_string(buffer, "\"target\":", 9); |
1576 | 18 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->target); |
1577 | | |
1578 | | // Dump the binary_operator_loc field |
1579 | 18 | pm_buffer_append_byte(buffer, ','); |
1580 | 18 | pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22); |
1581 | 18 | pm_dump_json_location(buffer, &cast->binary_operator_loc); |
1582 | | |
1583 | | // Dump the value field |
1584 | 18 | pm_buffer_append_byte(buffer, ','); |
1585 | 18 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1586 | 18 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1587 | | |
1588 | | // Dump the binary_operator field |
1589 | 18 | pm_buffer_append_byte(buffer, ','); |
1590 | 18 | pm_buffer_append_string(buffer, "\"binary_operator\":", 18); |
1591 | 18 | pm_dump_json_constant(buffer, parser, cast->binary_operator); |
1592 | | |
1593 | 18 | pm_buffer_append_byte(buffer, '}'); |
1594 | 18 | break; |
1595 | 0 | } |
1596 | 87 | case PM_CONSTANT_PATH_OR_WRITE_NODE: { Branch (1596:9): [True: 87, False: 725k]
|
1597 | 87 | pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathOrWriteNode\",\"location\":", 45); |
1598 | | |
1599 | 87 | const pm_constant_path_or_write_node_t *cast = (const pm_constant_path_or_write_node_t *) node; |
1600 | 87 | pm_dump_json_location(buffer, &cast->base.location); |
1601 | | |
1602 | | // Dump the target field |
1603 | 87 | pm_buffer_append_byte(buffer, ','); |
1604 | 87 | pm_buffer_append_string(buffer, "\"target\":", 9); |
1605 | 87 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->target); |
1606 | | |
1607 | | // Dump the operator_loc field |
1608 | 87 | pm_buffer_append_byte(buffer, ','); |
1609 | 87 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1610 | 87 | pm_dump_json_location(buffer, &cast->operator_loc); |
1611 | | |
1612 | | // Dump the value field |
1613 | 87 | pm_buffer_append_byte(buffer, ','); |
1614 | 87 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1615 | 87 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1616 | | |
1617 | 87 | pm_buffer_append_byte(buffer, '}'); |
1618 | 87 | break; |
1619 | 0 | } |
1620 | 106 | case PM_CONSTANT_PATH_TARGET_NODE: { Branch (1620:9): [True: 106, False: 725k]
|
1621 | 106 | pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathTargetNode\",\"location\":", 44); |
1622 | | |
1623 | 106 | const pm_constant_path_target_node_t *cast = (const pm_constant_path_target_node_t *) node; |
1624 | 106 | pm_dump_json_location(buffer, &cast->base.location); |
1625 | | |
1626 | | // Dump the parent field |
1627 | 106 | pm_buffer_append_byte(buffer, ','); |
1628 | 106 | pm_buffer_append_string(buffer, "\"parent\":", 9); |
1629 | 106 | if (cast->parent != NULL) { Branch (1629:17): [True: 40, False: 66]
|
1630 | 40 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->parent); |
1631 | 66 | } else { |
1632 | 66 | pm_buffer_append_string(buffer, "null", 4); |
1633 | 66 | } |
1634 | | |
1635 | | // Dump the name field |
1636 | 106 | pm_buffer_append_byte(buffer, ','); |
1637 | 106 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1638 | 106 | if (cast->name != PM_CONSTANT_ID_UNSET) { Branch (1638:17): [True: 53, False: 53]
|
1639 | 53 | pm_dump_json_constant(buffer, parser, cast->name); |
1640 | 53 | } else { |
1641 | 53 | pm_buffer_append_string(buffer, "null", 4); |
1642 | 53 | } |
1643 | | |
1644 | | // Dump the delimiter_loc field |
1645 | 106 | pm_buffer_append_byte(buffer, ','); |
1646 | 106 | pm_buffer_append_string(buffer, "\"delimiter_loc\":", 16); |
1647 | 106 | pm_dump_json_location(buffer, &cast->delimiter_loc); |
1648 | | |
1649 | | // Dump the name_loc field |
1650 | 106 | pm_buffer_append_byte(buffer, ','); |
1651 | 106 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1652 | 106 | pm_dump_json_location(buffer, &cast->name_loc); |
1653 | | |
1654 | 106 | pm_buffer_append_byte(buffer, '}'); |
1655 | 106 | break; |
1656 | 0 | } |
1657 | 1.87k | case PM_CONSTANT_PATH_WRITE_NODE: { Branch (1657:9): [True: 1.87k, False: 723k]
|
1658 | 1.87k | pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathWriteNode\",\"location\":", 43); |
1659 | | |
1660 | 1.87k | const pm_constant_path_write_node_t *cast = (const pm_constant_path_write_node_t *) node; |
1661 | 1.87k | pm_dump_json_location(buffer, &cast->base.location); |
1662 | | |
1663 | | // Dump the target field |
1664 | 1.87k | pm_buffer_append_byte(buffer, ','); |
1665 | 1.87k | pm_buffer_append_string(buffer, "\"target\":", 9); |
1666 | 1.87k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->target); |
1667 | | |
1668 | | // Dump the operator_loc field |
1669 | 1.87k | pm_buffer_append_byte(buffer, ','); |
1670 | 1.87k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1671 | 1.87k | pm_dump_json_location(buffer, &cast->operator_loc); |
1672 | | |
1673 | | // Dump the value field |
1674 | 1.87k | pm_buffer_append_byte(buffer, ','); |
1675 | 1.87k | pm_buffer_append_string(buffer, "\"value\":", 8); |
1676 | 1.87k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1677 | | |
1678 | 1.87k | pm_buffer_append_byte(buffer, '}'); |
1679 | 1.87k | break; |
1680 | 0 | } |
1681 | 52.8k | case PM_CONSTANT_READ_NODE: { Branch (1681:9): [True: 52.8k, False: 672k]
|
1682 | 52.8k | pm_buffer_append_string(buffer, "{\"type\":\"ConstantReadNode\",\"location\":", 38); |
1683 | | |
1684 | 52.8k | const pm_constant_read_node_t *cast = (const pm_constant_read_node_t *) node; |
1685 | 52.8k | pm_dump_json_location(buffer, &cast->base.location); |
1686 | | |
1687 | | // Dump the name field |
1688 | 52.8k | pm_buffer_append_byte(buffer, ','); |
1689 | 52.8k | pm_buffer_append_string(buffer, "\"name\":", 7); |
1690 | 52.8k | pm_dump_json_constant(buffer, parser, cast->name); |
1691 | | |
1692 | 52.8k | pm_buffer_append_byte(buffer, '}'); |
1693 | 52.8k | break; |
1694 | 0 | } |
1695 | 339 | case PM_CONSTANT_TARGET_NODE: { Branch (1695:9): [True: 339, False: 724k]
|
1696 | 339 | pm_buffer_append_string(buffer, "{\"type\":\"ConstantTargetNode\",\"location\":", 40); |
1697 | | |
1698 | 339 | const pm_constant_target_node_t *cast = (const pm_constant_target_node_t *) node; |
1699 | 339 | pm_dump_json_location(buffer, &cast->base.location); |
1700 | | |
1701 | | // Dump the name field |
1702 | 339 | pm_buffer_append_byte(buffer, ','); |
1703 | 339 | pm_buffer_append_string(buffer, "\"name\":", 7); |
1704 | 339 | pm_dump_json_constant(buffer, parser, cast->name); |
1705 | | |
1706 | 339 | pm_buffer_append_byte(buffer, '}'); |
1707 | 339 | break; |
1708 | 0 | } |
1709 | 1.13k | case PM_CONSTANT_WRITE_NODE: { Branch (1709:9): [True: 1.13k, False: 724k]
|
1710 | 1.13k | pm_buffer_append_string(buffer, "{\"type\":\"ConstantWriteNode\",\"location\":", 39); |
1711 | | |
1712 | 1.13k | const pm_constant_write_node_t *cast = (const pm_constant_write_node_t *) node; |
1713 | 1.13k | pm_dump_json_location(buffer, &cast->base.location); |
1714 | | |
1715 | | // Dump the name field |
1716 | 1.13k | pm_buffer_append_byte(buffer, ','); |
1717 | 1.13k | pm_buffer_append_string(buffer, "\"name\":", 7); |
1718 | 1.13k | pm_dump_json_constant(buffer, parser, cast->name); |
1719 | | |
1720 | | // Dump the name_loc field |
1721 | 1.13k | pm_buffer_append_byte(buffer, ','); |
1722 | 1.13k | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1723 | 1.13k | pm_dump_json_location(buffer, &cast->name_loc); |
1724 | | |
1725 | | // Dump the value field |
1726 | 1.13k | pm_buffer_append_byte(buffer, ','); |
1727 | 1.13k | pm_buffer_append_string(buffer, "\"value\":", 8); |
1728 | 1.13k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1729 | | |
1730 | | // Dump the operator_loc field |
1731 | 1.13k | pm_buffer_append_byte(buffer, ','); |
1732 | 1.13k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1733 | 1.13k | pm_dump_json_location(buffer, &cast->operator_loc); |
1734 | | |
1735 | 1.13k | pm_buffer_append_byte(buffer, '}'); |
1736 | 1.13k | break; |
1737 | 0 | } |
1738 | 10.0k | case PM_DEF_NODE: { Branch (1738:9): [True: 10.0k, False: 715k]
|
1739 | 10.0k | pm_buffer_append_string(buffer, "{\"type\":\"DefNode\",\"location\":", 29); |
1740 | | |
1741 | 10.0k | const pm_def_node_t *cast = (const pm_def_node_t *) node; |
1742 | 10.0k | pm_dump_json_location(buffer, &cast->base.location); |
1743 | | |
1744 | | // Dump the name field |
1745 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1746 | 10.0k | pm_buffer_append_string(buffer, "\"name\":", 7); |
1747 | 10.0k | pm_dump_json_constant(buffer, parser, cast->name); |
1748 | | |
1749 | | // Dump the name_loc field |
1750 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1751 | 10.0k | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
1752 | 10.0k | pm_dump_json_location(buffer, &cast->name_loc); |
1753 | | |
1754 | | // Dump the receiver field |
1755 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1756 | 10.0k | pm_buffer_append_string(buffer, "\"receiver\":", 11); |
1757 | 10.0k | if (cast->receiver != NULL) { Branch (1757:17): [True: 1.18k, False: 8.83k]
|
1758 | 1.18k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver); |
1759 | 8.83k | } else { |
1760 | 8.83k | pm_buffer_append_string(buffer, "null", 4); |
1761 | 8.83k | } |
1762 | | |
1763 | | // Dump the parameters field |
1764 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1765 | 10.0k | pm_buffer_append_string(buffer, "\"parameters\":", 13); |
1766 | 10.0k | if (cast->parameters != NULL) { Branch (1766:17): [True: 5.25k, False: 4.76k]
|
1767 | 5.25k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters); |
1768 | 5.25k | } else { |
1769 | 4.76k | pm_buffer_append_string(buffer, "null", 4); |
1770 | 4.76k | } |
1771 | | |
1772 | | // Dump the body field |
1773 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1774 | 10.0k | pm_buffer_append_string(buffer, "\"body\":", 7); |
1775 | 10.0k | if (cast->body != NULL) { Branch (1775:17): [True: 4.05k, False: 5.96k]
|
1776 | 4.05k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->body); |
1777 | 5.96k | } else { |
1778 | 5.96k | pm_buffer_append_string(buffer, "null", 4); |
1779 | 5.96k | } |
1780 | | |
1781 | | // Dump the locals field |
1782 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1783 | 10.0k | pm_buffer_append_string(buffer, "\"locals\":", 9); |
1784 | 10.0k | const pm_constant_id_list_t *locals = &cast->locals; |
1785 | 10.0k | pm_buffer_append_byte(buffer, '['); |
1786 | | |
1787 | 18.2k | for (size_t index = 0; index < locals->size; index++8.26k ) { Branch (1787:36): [True: 8.26k, False: 10.0k]
|
1788 | 8.26k | if (index != 0) pm_buffer_append_byte(buffer, ',')4.07k ; Branch (1788:21): [True: 4.07k, False: 4.18k]
|
1789 | 8.26k | pm_dump_json_constant(buffer, parser, locals->ids[index]); |
1790 | 8.26k | } |
1791 | 10.0k | pm_buffer_append_byte(buffer, ']'); |
1792 | | |
1793 | | // Dump the def_keyword_loc field |
1794 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1795 | 10.0k | pm_buffer_append_string(buffer, "\"def_keyword_loc\":", 18); |
1796 | 10.0k | pm_dump_json_location(buffer, &cast->def_keyword_loc); |
1797 | | |
1798 | | // Dump the operator_loc field |
1799 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1800 | 10.0k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1801 | 10.0k | if (cast->operator_loc.length != 0) { Branch (1801:17): [True: 1.09k, False: 8.92k]
|
1802 | 1.09k | pm_dump_json_location(buffer, &cast->operator_loc); |
1803 | 8.92k | } else { |
1804 | 8.92k | pm_buffer_append_string(buffer, "null", 4); |
1805 | 8.92k | } |
1806 | | |
1807 | | // Dump the lparen_loc field |
1808 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1809 | 10.0k | pm_buffer_append_string(buffer, "\"lparen_loc\":", 13); |
1810 | 10.0k | if (cast->lparen_loc.length != 0) { Branch (1810:17): [True: 3.63k, False: 6.38k]
|
1811 | 3.63k | pm_dump_json_location(buffer, &cast->lparen_loc); |
1812 | 6.38k | } else { |
1813 | 6.38k | pm_buffer_append_string(buffer, "null", 4); |
1814 | 6.38k | } |
1815 | | |
1816 | | // Dump the rparen_loc field |
1817 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1818 | 10.0k | pm_buffer_append_string(buffer, "\"rparen_loc\":", 13); |
1819 | 10.0k | if (cast->rparen_loc.length != 0) { Branch (1819:17): [True: 3.25k, False: 6.75k]
|
1820 | 3.25k | pm_dump_json_location(buffer, &cast->rparen_loc); |
1821 | 6.75k | } else { |
1822 | 6.75k | pm_buffer_append_string(buffer, "null", 4); |
1823 | 6.75k | } |
1824 | | |
1825 | | // Dump the equal_loc field |
1826 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1827 | 10.0k | pm_buffer_append_string(buffer, "\"equal_loc\":", 12); |
1828 | 10.0k | if (cast->equal_loc.length != 0) { Branch (1828:17): [True: 775, False: 9.24k]
|
1829 | 775 | pm_dump_json_location(buffer, &cast->equal_loc); |
1830 | 9.24k | } else { |
1831 | 9.24k | pm_buffer_append_string(buffer, "null", 4); |
1832 | 9.24k | } |
1833 | | |
1834 | | // Dump the end_keyword_loc field |
1835 | 10.0k | pm_buffer_append_byte(buffer, ','); |
1836 | 10.0k | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
1837 | 10.0k | if (cast->end_keyword_loc.length != 0) { Branch (1837:17): [True: 8.08k, False: 1.93k]
|
1838 | 8.08k | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
1839 | 8.08k | } else { |
1840 | 1.93k | pm_buffer_append_string(buffer, "null", 4); |
1841 | 1.93k | } |
1842 | | |
1843 | 10.0k | pm_buffer_append_byte(buffer, '}'); |
1844 | 10.0k | break; |
1845 | 0 | } |
1846 | 169 | case PM_DEFINED_NODE: { Branch (1846:9): [True: 169, False: 725k]
|
1847 | 169 | pm_buffer_append_string(buffer, "{\"type\":\"DefinedNode\",\"location\":", 33); |
1848 | | |
1849 | 169 | const pm_defined_node_t *cast = (const pm_defined_node_t *) node; |
1850 | 169 | pm_dump_json_location(buffer, &cast->base.location); |
1851 | | |
1852 | | // Dump the lparen_loc field |
1853 | 169 | pm_buffer_append_byte(buffer, ','); |
1854 | 169 | pm_buffer_append_string(buffer, "\"lparen_loc\":", 13); |
1855 | 169 | if (cast->lparen_loc.length != 0) { Branch (1855:17): [True: 66, False: 103]
|
1856 | 66 | pm_dump_json_location(buffer, &cast->lparen_loc); |
1857 | 103 | } else { |
1858 | 103 | pm_buffer_append_string(buffer, "null", 4); |
1859 | 103 | } |
1860 | | |
1861 | | // Dump the value field |
1862 | 169 | pm_buffer_append_byte(buffer, ','); |
1863 | 169 | pm_buffer_append_string(buffer, "\"value\":", 8); |
1864 | 169 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
1865 | | |
1866 | | // Dump the rparen_loc field |
1867 | 169 | pm_buffer_append_byte(buffer, ','); |
1868 | 169 | pm_buffer_append_string(buffer, "\"rparen_loc\":", 13); |
1869 | 169 | if (cast->rparen_loc.length != 0) { Branch (1869:17): [True: 49, False: 120]
|
1870 | 49 | pm_dump_json_location(buffer, &cast->rparen_loc); |
1871 | 120 | } else { |
1872 | 120 | pm_buffer_append_string(buffer, "null", 4); |
1873 | 120 | } |
1874 | | |
1875 | | // Dump the keyword_loc field |
1876 | 169 | pm_buffer_append_byte(buffer, ','); |
1877 | 169 | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
1878 | 169 | pm_dump_json_location(buffer, &cast->keyword_loc); |
1879 | | |
1880 | 169 | pm_buffer_append_byte(buffer, '}'); |
1881 | 169 | break; |
1882 | 0 | } |
1883 | 2.84k | case PM_ELSE_NODE: { Branch (1883:9): [True: 2.84k, False: 722k]
|
1884 | 2.84k | pm_buffer_append_string(buffer, "{\"type\":\"ElseNode\",\"location\":", 30); |
1885 | | |
1886 | 2.84k | const pm_else_node_t *cast = (const pm_else_node_t *) node; |
1887 | 2.84k | pm_dump_json_location(buffer, &cast->base.location); |
1888 | | |
1889 | | // Dump the else_keyword_loc field |
1890 | 2.84k | pm_buffer_append_byte(buffer, ','); |
1891 | 2.84k | pm_buffer_append_string(buffer, "\"else_keyword_loc\":", 19); |
1892 | 2.84k | pm_dump_json_location(buffer, &cast->else_keyword_loc); |
1893 | | |
1894 | | // Dump the statements field |
1895 | 2.84k | pm_buffer_append_byte(buffer, ','); |
1896 | 2.84k | pm_buffer_append_string(buffer, "\"statements\":", 13); |
1897 | 2.84k | if (cast->statements != NULL) { Branch (1897:17): [True: 1.73k, False: 1.11k]
|
1898 | 1.73k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
1899 | 1.73k | } else { |
1900 | 1.11k | pm_buffer_append_string(buffer, "null", 4); |
1901 | 1.11k | } |
1902 | | |
1903 | | // Dump the end_keyword_loc field |
1904 | 2.84k | pm_buffer_append_byte(buffer, ','); |
1905 | 2.84k | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
1906 | 2.84k | if (cast->end_keyword_loc.length != 0) { Branch (1906:17): [True: 2.03k, False: 814]
|
1907 | 2.03k | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
1908 | 2.03k | } else { |
1909 | 814 | pm_buffer_append_string(buffer, "null", 4); |
1910 | 814 | } |
1911 | | |
1912 | 2.84k | pm_buffer_append_byte(buffer, '}'); |
1913 | 2.84k | break; |
1914 | 0 | } |
1915 | 4.42k | case PM_EMBEDDED_STATEMENTS_NODE: { Branch (1915:9): [True: 4.42k, False: 720k]
|
1916 | 4.42k | pm_buffer_append_string(buffer, "{\"type\":\"EmbeddedStatementsNode\",\"location\":", 44); |
1917 | | |
1918 | 4.42k | const pm_embedded_statements_node_t *cast = (const pm_embedded_statements_node_t *) node; |
1919 | 4.42k | pm_dump_json_location(buffer, &cast->base.location); |
1920 | | |
1921 | | // Dump the opening_loc field |
1922 | 4.42k | pm_buffer_append_byte(buffer, ','); |
1923 | 4.42k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
1924 | 4.42k | pm_dump_json_location(buffer, &cast->opening_loc); |
1925 | | |
1926 | | // Dump the statements field |
1927 | 4.42k | pm_buffer_append_byte(buffer, ','); |
1928 | 4.42k | pm_buffer_append_string(buffer, "\"statements\":", 13); |
1929 | 4.42k | if (cast->statements != NULL) { Branch (1929:17): [True: 3.27k, False: 1.14k]
|
1930 | 3.27k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
1931 | 3.27k | } else { |
1932 | 1.14k | pm_buffer_append_string(buffer, "null", 4); |
1933 | 1.14k | } |
1934 | | |
1935 | | // Dump the closing_loc field |
1936 | 4.42k | pm_buffer_append_byte(buffer, ','); |
1937 | 4.42k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
1938 | 4.42k | pm_dump_json_location(buffer, &cast->closing_loc); |
1939 | | |
1940 | 4.42k | pm_buffer_append_byte(buffer, '}'); |
1941 | 4.42k | break; |
1942 | 0 | } |
1943 | 600 | case PM_EMBEDDED_VARIABLE_NODE: { Branch (1943:9): [True: 600, False: 724k]
|
1944 | 600 | pm_buffer_append_string(buffer, "{\"type\":\"EmbeddedVariableNode\",\"location\":", 42); |
1945 | | |
1946 | 600 | const pm_embedded_variable_node_t *cast = (const pm_embedded_variable_node_t *) node; |
1947 | 600 | pm_dump_json_location(buffer, &cast->base.location); |
1948 | | |
1949 | | // Dump the operator_loc field |
1950 | 600 | pm_buffer_append_byte(buffer, ','); |
1951 | 600 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
1952 | 600 | pm_dump_json_location(buffer, &cast->operator_loc); |
1953 | | |
1954 | | // Dump the variable field |
1955 | 600 | pm_buffer_append_byte(buffer, ','); |
1956 | 600 | pm_buffer_append_string(buffer, "\"variable\":", 11); |
1957 | 600 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->variable); |
1958 | | |
1959 | 600 | pm_buffer_append_byte(buffer, '}'); |
1960 | 600 | break; |
1961 | 0 | } |
1962 | 936 | case PM_ENSURE_NODE: { Branch (1962:9): [True: 936, False: 724k]
|
1963 | 936 | pm_buffer_append_string(buffer, "{\"type\":\"EnsureNode\",\"location\":", 32); |
1964 | | |
1965 | 936 | const pm_ensure_node_t *cast = (const pm_ensure_node_t *) node; |
1966 | 936 | pm_dump_json_location(buffer, &cast->base.location); |
1967 | | |
1968 | | // Dump the ensure_keyword_loc field |
1969 | 936 | pm_buffer_append_byte(buffer, ','); |
1970 | 936 | pm_buffer_append_string(buffer, "\"ensure_keyword_loc\":", 21); |
1971 | 936 | pm_dump_json_location(buffer, &cast->ensure_keyword_loc); |
1972 | | |
1973 | | // Dump the statements field |
1974 | 936 | pm_buffer_append_byte(buffer, ','); |
1975 | 936 | pm_buffer_append_string(buffer, "\"statements\":", 13); |
1976 | 936 | if (cast->statements != NULL) { Branch (1976:17): [True: 223, False: 713]
|
1977 | 223 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
1978 | 713 | } else { |
1979 | 713 | pm_buffer_append_string(buffer, "null", 4); |
1980 | 713 | } |
1981 | | |
1982 | | // Dump the end_keyword_loc field |
1983 | 936 | pm_buffer_append_byte(buffer, ','); |
1984 | 936 | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
1985 | 936 | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
1986 | | |
1987 | 936 | pm_buffer_append_byte(buffer, '}'); |
1988 | 936 | break; |
1989 | 0 | } |
1990 | 54.6k | case PM_ERROR_RECOVERY_NODE: { Branch (1990:9): [True: 54.6k, False: 670k]
|
1991 | 54.6k | pm_buffer_append_string(buffer, "{\"type\":\"ErrorRecoveryNode\",\"location\":", 39); |
1992 | | |
1993 | 54.6k | const pm_error_recovery_node_t *cast = (const pm_error_recovery_node_t *) node; |
1994 | 54.6k | pm_dump_json_location(buffer, &cast->base.location); |
1995 | | |
1996 | | // Dump the unexpected field |
1997 | 54.6k | pm_buffer_append_byte(buffer, ','); |
1998 | 54.6k | pm_buffer_append_string(buffer, "\"unexpected\":", 13); |
1999 | 54.6k | if (cast->unexpected != NULL) { Branch (1999:17): [True: 284, False: 54.3k]
|
2000 | 284 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->unexpected); |
2001 | 54.3k | } else { |
2002 | 54.3k | pm_buffer_append_string(buffer, "null", 4); |
2003 | 54.3k | } |
2004 | | |
2005 | 54.6k | pm_buffer_append_byte(buffer, '}'); |
2006 | 54.6k | break; |
2007 | 0 | } |
2008 | 1.26k | case PM_FALSE_NODE: { Branch (2008:9): [True: 1.26k, False: 723k]
|
2009 | 1.26k | pm_buffer_append_string(buffer, "{\"type\":\"FalseNode\",\"location\":", 31); |
2010 | | |
2011 | 1.26k | const pm_false_node_t *cast = (const pm_false_node_t *) node; |
2012 | 1.26k | pm_dump_json_location(buffer, &cast->base.location); |
2013 | | |
2014 | 1.26k | pm_buffer_append_byte(buffer, '}'); |
2015 | 1.26k | break; |
2016 | 0 | } |
2017 | 219 | case PM_FIND_PATTERN_NODE: { Branch (2017:9): [True: 219, False: 724k]
|
2018 | 219 | pm_buffer_append_string(buffer, "{\"type\":\"FindPatternNode\",\"location\":", 37); |
2019 | | |
2020 | 219 | const pm_find_pattern_node_t *cast = (const pm_find_pattern_node_t *) node; |
2021 | 219 | pm_dump_json_location(buffer, &cast->base.location); |
2022 | | |
2023 | | // Dump the constant field |
2024 | 219 | pm_buffer_append_byte(buffer, ','); |
2025 | 219 | pm_buffer_append_string(buffer, "\"constant\":", 11); |
2026 | 219 | if (cast->constant != NULL) { Branch (2026:17): [True: 96, False: 123]
|
2027 | 96 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant); |
2028 | 123 | } else { |
2029 | 123 | pm_buffer_append_string(buffer, "null", 4); |
2030 | 123 | } |
2031 | | |
2032 | | // Dump the left field |
2033 | 219 | pm_buffer_append_byte(buffer, ','); |
2034 | 219 | pm_buffer_append_string(buffer, "\"left\":", 7); |
2035 | 219 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->left); |
2036 | | |
2037 | | // Dump the requireds field |
2038 | 219 | pm_buffer_append_byte(buffer, ','); |
2039 | 219 | pm_buffer_append_string(buffer, "\"requireds\":", 12); |
2040 | 219 | const pm_node_list_t *requireds = &cast->requireds; |
2041 | 219 | pm_buffer_append_byte(buffer, '['); |
2042 | | |
2043 | 453 | for (size_t index = 0; index < requireds->size; index++234 ) { Branch (2043:36): [True: 234, False: 219]
|
2044 | 234 | if (index != 0) pm_buffer_append_byte(buffer, ',')19 ; Branch (2044:21): [True: 19, False: 215]
|
2045 | 234 | pm_dump_json(buffer, parser, requireds->nodes[index]); |
2046 | 234 | } |
2047 | 219 | pm_buffer_append_byte(buffer, ']'); |
2048 | | |
2049 | | // Dump the right field |
2050 | 219 | pm_buffer_append_byte(buffer, ','); |
2051 | 219 | pm_buffer_append_string(buffer, "\"right\":", 8); |
2052 | 219 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->right); |
2053 | | |
2054 | | // Dump the opening_loc field |
2055 | 219 | pm_buffer_append_byte(buffer, ','); |
2056 | 219 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
2057 | 219 | if (cast->opening_loc.length != 0) { Branch (2057:17): [True: 158, False: 61]
|
2058 | 158 | pm_dump_json_location(buffer, &cast->opening_loc); |
2059 | 158 | } else { |
2060 | 61 | pm_buffer_append_string(buffer, "null", 4); |
2061 | 61 | } |
2062 | | |
2063 | | // Dump the closing_loc field |
2064 | 219 | pm_buffer_append_byte(buffer, ','); |
2065 | 219 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
2066 | 219 | if (cast->closing_loc.length != 0) { Branch (2066:17): [True: 136, False: 83]
|
2067 | 136 | pm_dump_json_location(buffer, &cast->closing_loc); |
2068 | 136 | } else { |
2069 | 83 | pm_buffer_append_string(buffer, "null", 4); |
2070 | 83 | } |
2071 | | |
2072 | 219 | pm_buffer_append_byte(buffer, '}'); |
2073 | 219 | break; |
2074 | 0 | } |
2075 | 172 | case PM_FLIP_FLOP_NODE: { Branch (2075:9): [True: 172, False: 725k]
|
2076 | 172 | pm_buffer_append_string(buffer, "{\"type\":\"FlipFlopNode\",\"location\":", 34); |
2077 | | |
2078 | 172 | const pm_flip_flop_node_t *cast = (const pm_flip_flop_node_t *) node; |
2079 | 172 | pm_dump_json_location(buffer, &cast->base.location); |
2080 | | |
2081 | | // Dump the RangeFlags field |
2082 | 172 | pm_buffer_append_byte(buffer, ','); |
2083 | 172 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
2084 | 172 | size_t flags = 0; |
2085 | 172 | pm_buffer_append_byte(buffer, '['); |
2086 | 172 | if (PM_NODE_FLAG_P(cast, PM_RANGE_FLAGS_EXCLUDE_END)) { |
2087 | 93 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (2087:21): [True: 0, False: 93]
|
2088 | 93 | pm_buffer_append_string(buffer, "\"EXCLUDE_END\"", 13); |
2089 | 93 | flags++; |
2090 | 93 | } |
2091 | 172 | pm_buffer_append_byte(buffer, ']'); |
2092 | | |
2093 | | // Dump the left field |
2094 | 172 | pm_buffer_append_byte(buffer, ','); |
2095 | 172 | pm_buffer_append_string(buffer, "\"left\":", 7); |
2096 | 172 | if (cast->left != NULL) { Branch (2096:17): [True: 67, False: 105]
|
2097 | 67 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->left); |
2098 | 105 | } else { |
2099 | 105 | pm_buffer_append_string(buffer, "null", 4); |
2100 | 105 | } |
2101 | | |
2102 | | // Dump the right field |
2103 | 172 | pm_buffer_append_byte(buffer, ','); |
2104 | 172 | pm_buffer_append_string(buffer, "\"right\":", 8); |
2105 | 172 | if (cast->right != NULL) { Branch (2105:17): [True: 158, False: 14]
|
2106 | 158 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->right); |
2107 | 158 | } else { |
2108 | 14 | pm_buffer_append_string(buffer, "null", 4); |
2109 | 14 | } |
2110 | | |
2111 | | // Dump the operator_loc field |
2112 | 172 | pm_buffer_append_byte(buffer, ','); |
2113 | 172 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
2114 | 172 | pm_dump_json_location(buffer, &cast->operator_loc); |
2115 | | |
2116 | 172 | pm_buffer_append_byte(buffer, '}'); |
2117 | 172 | break; |
2118 | 0 | } |
2119 | 1.53k | case PM_FLOAT_NODE: { Branch (2119:9): [True: 1.53k, False: 723k]
|
2120 | 1.53k | pm_buffer_append_string(buffer, "{\"type\":\"FloatNode\",\"location\":", 31); |
2121 | | |
2122 | 1.53k | const pm_float_node_t *cast = (const pm_float_node_t *) node; |
2123 | 1.53k | pm_dump_json_location(buffer, &cast->base.location); |
2124 | | |
2125 | | // Dump the value field |
2126 | 1.53k | pm_buffer_append_byte(buffer, ','); |
2127 | 1.53k | pm_buffer_append_string(buffer, "\"value\":", 8); |
2128 | 1.53k | pm_buffer_append_format(buffer, "%f", cast->value); |
2129 | | |
2130 | 1.53k | pm_buffer_append_byte(buffer, '}'); |
2131 | 1.53k | break; |
2132 | 0 | } |
2133 | 178 | case PM_FOR_NODE: { Branch (2133:9): [True: 178, False: 725k]
|
2134 | 178 | pm_buffer_append_string(buffer, "{\"type\":\"ForNode\",\"location\":", 29); |
2135 | | |
2136 | 178 | const pm_for_node_t *cast = (const pm_for_node_t *) node; |
2137 | 178 | pm_dump_json_location(buffer, &cast->base.location); |
2138 | | |
2139 | | // Dump the index field |
2140 | 178 | pm_buffer_append_byte(buffer, ','); |
2141 | 178 | pm_buffer_append_string(buffer, "\"index\":", 8); |
2142 | 178 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->index); |
2143 | | |
2144 | | // Dump the collection field |
2145 | 178 | pm_buffer_append_byte(buffer, ','); |
2146 | 178 | pm_buffer_append_string(buffer, "\"collection\":", 13); |
2147 | 178 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->collection); |
2148 | | |
2149 | | // Dump the statements field |
2150 | 178 | pm_buffer_append_byte(buffer, ','); |
2151 | 178 | pm_buffer_append_string(buffer, "\"statements\":", 13); |
2152 | 178 | if (cast->statements != NULL) { Branch (2152:17): [True: 151, False: 27]
|
2153 | 151 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
2154 | 151 | } else { |
2155 | 27 | pm_buffer_append_string(buffer, "null", 4); |
2156 | 27 | } |
2157 | | |
2158 | | // Dump the for_keyword_loc field |
2159 | 178 | pm_buffer_append_byte(buffer, ','); |
2160 | 178 | pm_buffer_append_string(buffer, "\"for_keyword_loc\":", 18); |
2161 | 178 | pm_dump_json_location(buffer, &cast->for_keyword_loc); |
2162 | | |
2163 | | // Dump the in_keyword_loc field |
2164 | 178 | pm_buffer_append_byte(buffer, ','); |
2165 | 178 | pm_buffer_append_string(buffer, "\"in_keyword_loc\":", 17); |
2166 | 178 | pm_dump_json_location(buffer, &cast->in_keyword_loc); |
2167 | | |
2168 | | // Dump the do_keyword_loc field |
2169 | 178 | pm_buffer_append_byte(buffer, ','); |
2170 | 178 | pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17); |
2171 | 178 | if (cast->do_keyword_loc.length != 0) { Branch (2171:17): [True: 23, False: 155]
|
2172 | 23 | pm_dump_json_location(buffer, &cast->do_keyword_loc); |
2173 | 155 | } else { |
2174 | 155 | pm_buffer_append_string(buffer, "null", 4); |
2175 | 155 | } |
2176 | | |
2177 | | // Dump the end_keyword_loc field |
2178 | 178 | pm_buffer_append_byte(buffer, ','); |
2179 | 178 | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
2180 | 178 | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
2181 | | |
2182 | 178 | pm_buffer_append_byte(buffer, '}'); |
2183 | 178 | break; |
2184 | 0 | } |
2185 | 184 | case PM_FORWARDING_ARGUMENTS_NODE: { Branch (2185:9): [True: 184, False: 725k]
|
2186 | 184 | pm_buffer_append_string(buffer, "{\"type\":\"ForwardingArgumentsNode\",\"location\":", 45); |
2187 | | |
2188 | 184 | const pm_forwarding_arguments_node_t *cast = (const pm_forwarding_arguments_node_t *) node; |
2189 | 184 | pm_dump_json_location(buffer, &cast->base.location); |
2190 | | |
2191 | 184 | pm_buffer_append_byte(buffer, '}'); |
2192 | 184 | break; |
2193 | 0 | } |
2194 | 204 | case PM_FORWARDING_PARAMETER_NODE: { Branch (2194:9): [True: 204, False: 724k]
|
2195 | 204 | pm_buffer_append_string(buffer, "{\"type\":\"ForwardingParameterNode\",\"location\":", 45); |
2196 | | |
2197 | 204 | const pm_forwarding_parameter_node_t *cast = (const pm_forwarding_parameter_node_t *) node; |
2198 | 204 | pm_dump_json_location(buffer, &cast->base.location); |
2199 | | |
2200 | 204 | pm_buffer_append_byte(buffer, '}'); |
2201 | 204 | break; |
2202 | 0 | } |
2203 | 51 | case PM_FORWARDING_SUPER_NODE: { Branch (2203:9): [True: 51, False: 725k]
|
2204 | 51 | pm_buffer_append_string(buffer, "{\"type\":\"ForwardingSuperNode\",\"location\":", 41); |
2205 | | |
2206 | 51 | const pm_forwarding_super_node_t *cast = (const pm_forwarding_super_node_t *) node; |
2207 | 51 | pm_dump_json_location(buffer, &cast->base.location); |
2208 | | |
2209 | | // Dump the keyword_loc field |
2210 | 51 | pm_buffer_append_byte(buffer, ','); |
2211 | 51 | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
2212 | 51 | pm_dump_json_location(buffer, &cast->keyword_loc); |
2213 | | |
2214 | | // Dump the block field |
2215 | 51 | pm_buffer_append_byte(buffer, ','); |
2216 | 51 | pm_buffer_append_string(buffer, "\"block\":", 8); |
2217 | 51 | if (cast->block != NULL) { Branch (2217:17): [True: 23, False: 28]
|
2218 | 23 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->block); |
2219 | 28 | } else { |
2220 | 28 | pm_buffer_append_string(buffer, "null", 4); |
2221 | 28 | } |
2222 | | |
2223 | 51 | pm_buffer_append_byte(buffer, '}'); |
2224 | 51 | break; |
2225 | 0 | } |
2226 | 20 | case PM_GLOBAL_VARIABLE_AND_WRITE_NODE: { Branch (2226:9): [True: 20, False: 725k]
|
2227 | 20 | pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableAndWriteNode\",\"location\":", 48); |
2228 | | |
2229 | 20 | const pm_global_variable_and_write_node_t *cast = (const pm_global_variable_and_write_node_t *) node; |
2230 | 20 | pm_dump_json_location(buffer, &cast->base.location); |
2231 | | |
2232 | | // Dump the name field |
2233 | 20 | pm_buffer_append_byte(buffer, ','); |
2234 | 20 | pm_buffer_append_string(buffer, "\"name\":", 7); |
2235 | 20 | pm_dump_json_constant(buffer, parser, cast->name); |
2236 | | |
2237 | | // Dump the name_loc field |
2238 | 20 | pm_buffer_append_byte(buffer, ','); |
2239 | 20 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
2240 | 20 | pm_dump_json_location(buffer, &cast->name_loc); |
2241 | | |
2242 | | // Dump the operator_loc field |
2243 | 20 | pm_buffer_append_byte(buffer, ','); |
2244 | 20 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
2245 | 20 | pm_dump_json_location(buffer, &cast->operator_loc); |
2246 | | |
2247 | | // Dump the value field |
2248 | 20 | pm_buffer_append_byte(buffer, ','); |
2249 | 20 | pm_buffer_append_string(buffer, "\"value\":", 8); |
2250 | 20 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
2251 | | |
2252 | 20 | pm_buffer_append_byte(buffer, '}'); |
2253 | 20 | break; |
2254 | 0 | } |
2255 | 18 | case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: { Branch (2255:9): [True: 18, False: 725k]
|
2256 | 18 | pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableOperatorWriteNode\",\"location\":", 53); |
2257 | | |
2258 | 18 | const pm_global_variable_operator_write_node_t *cast = (const pm_global_variable_operator_write_node_t *) node; |
2259 | 18 | pm_dump_json_location(buffer, &cast->base.location); |
2260 | | |
2261 | | // Dump the name field |
2262 | 18 | pm_buffer_append_byte(buffer, ','); |
2263 | 18 | pm_buffer_append_string(buffer, "\"name\":", 7); |
2264 | 18 | pm_dump_json_constant(buffer, parser, cast->name); |
2265 | | |
2266 | | // Dump the name_loc field |
2267 | 18 | pm_buffer_append_byte(buffer, ','); |
2268 | 18 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
2269 | 18 | pm_dump_json_location(buffer, &cast->name_loc); |
2270 | | |
2271 | | // Dump the binary_operator_loc field |
2272 | 18 | pm_buffer_append_byte(buffer, ','); |
2273 | 18 | pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22); |
2274 | 18 | pm_dump_json_location(buffer, &cast->binary_operator_loc); |
2275 | | |
2276 | | // Dump the value field |
2277 | 18 | pm_buffer_append_byte(buffer, ','); |
2278 | 18 | pm_buffer_append_string(buffer, "\"value\":", 8); |
2279 | 18 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
2280 | | |
2281 | | // Dump the binary_operator field |
2282 | 18 | pm_buffer_append_byte(buffer, ','); |
2283 | 18 | pm_buffer_append_string(buffer, "\"binary_operator\":", 18); |
2284 | 18 | pm_dump_json_constant(buffer, parser, cast->binary_operator); |
2285 | | |
2286 | 18 | pm_buffer_append_byte(buffer, '}'); |
2287 | 18 | break; |
2288 | 0 | } |
2289 | 7 | case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: { Branch (2289:9): [True: 7, False: 725k]
|
2290 | 7 | pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableOrWriteNode\",\"location\":", 47); |
2291 | | |
2292 | 7 | const pm_global_variable_or_write_node_t *cast = (const pm_global_variable_or_write_node_t *) node; |
2293 | 7 | pm_dump_json_location(buffer, &cast->base.location); |
2294 | | |
2295 | | // Dump the name field |
2296 | 7 | pm_buffer_append_byte(buffer, ','); |
2297 | 7 | pm_buffer_append_string(buffer, "\"name\":", 7); |
2298 | 7 | pm_dump_json_constant(buffer, parser, cast->name); |
2299 | | |
2300 | | // Dump the name_loc field |
2301 | 7 | pm_buffer_append_byte(buffer, ','); |
2302 | 7 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
2303 | 7 | pm_dump_json_location(buffer, &cast->name_loc); |
2304 | | |
2305 | | // Dump the operator_loc field |
2306 | 7 | pm_buffer_append_byte(buffer, ','); |
2307 | 7 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
2308 | 7 | pm_dump_json_location(buffer, &cast->operator_loc); |
2309 | | |
2310 | | // Dump the value field |
2311 | 7 | pm_buffer_append_byte(buffer, ','); |
2312 | 7 | pm_buffer_append_string(buffer, "\"value\":", 8); |
2313 | 7 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
2314 | | |
2315 | 7 | pm_buffer_append_byte(buffer, '}'); |
2316 | 7 | break; |
2317 | 0 | } |
2318 | 4.57k | case PM_GLOBAL_VARIABLE_READ_NODE: { Branch (2318:9): [True: 4.57k, False: 720k]
|
2319 | 4.57k | pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableReadNode\",\"location\":", 44); |
2320 | | |
2321 | 4.57k | const pm_global_variable_read_node_t *cast = (const pm_global_variable_read_node_t *) node; |
2322 | 4.57k | pm_dump_json_location(buffer, &cast->base.location); |
2323 | | |
2324 | | // Dump the name field |
2325 | 4.57k | pm_buffer_append_byte(buffer, ','); |
2326 | 4.57k | pm_buffer_append_string(buffer, "\"name\":", 7); |
2327 | 4.57k | pm_dump_json_constant(buffer, parser, cast->name); |
2328 | | |
2329 | 4.57k | pm_buffer_append_byte(buffer, '}'); |
2330 | 4.57k | break; |
2331 | 0 | } |
2332 | 362 | case PM_GLOBAL_VARIABLE_TARGET_NODE: { Branch (2332:9): [True: 362, False: 724k]
|
2333 | 362 | pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableTargetNode\",\"location\":", 46); |
2334 | | |
2335 | 362 | const pm_global_variable_target_node_t *cast = (const pm_global_variable_target_node_t *) node; |
2336 | 362 | pm_dump_json_location(buffer, &cast->base.location); |
2337 | | |
2338 | | // Dump the name field |
2339 | 362 | pm_buffer_append_byte(buffer, ','); |
2340 | 362 | pm_buffer_append_string(buffer, "\"name\":", 7); |
2341 | 362 | pm_dump_json_constant(buffer, parser, cast->name); |
2342 | | |
2343 | 362 | pm_buffer_append_byte(buffer, '}'); |
2344 | 362 | break; |
2345 | 0 | } |
2346 | 947 | case PM_GLOBAL_VARIABLE_WRITE_NODE: { Branch (2346:9): [True: 947, False: 724k]
|
2347 | 947 | pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableWriteNode\",\"location\":", 45); |
2348 | | |
2349 | 947 | const pm_global_variable_write_node_t *cast = (const pm_global_variable_write_node_t *) node; |
2350 | 947 | pm_dump_json_location(buffer, &cast->base.location); |
2351 | | |
2352 | | // Dump the name field |
2353 | 947 | pm_buffer_append_byte(buffer, ','); |
2354 | 947 | pm_buffer_append_string(buffer, "\"name\":", 7); |
2355 | 947 | pm_dump_json_constant(buffer, parser, cast->name); |
2356 | | |
2357 | | // Dump the name_loc field |
2358 | 947 | pm_buffer_append_byte(buffer, ','); |
2359 | 947 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
2360 | 947 | pm_dump_json_location(buffer, &cast->name_loc); |
2361 | | |
2362 | | // Dump the value field |
2363 | 947 | pm_buffer_append_byte(buffer, ','); |
2364 | 947 | pm_buffer_append_string(buffer, "\"value\":", 8); |
2365 | 947 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
2366 | | |
2367 | | // Dump the operator_loc field |
2368 | 947 | pm_buffer_append_byte(buffer, ','); |
2369 | 947 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
2370 | 947 | pm_dump_json_location(buffer, &cast->operator_loc); |
2371 | | |
2372 | 947 | pm_buffer_append_byte(buffer, '}'); |
2373 | 947 | break; |
2374 | 0 | } |
2375 | 10.2k | case PM_HASH_NODE: { Branch (2375:9): [True: 10.2k, False: 714k]
|
2376 | 10.2k | pm_buffer_append_string(buffer, "{\"type\":\"HashNode\",\"location\":", 30); |
2377 | | |
2378 | 10.2k | const pm_hash_node_t *cast = (const pm_hash_node_t *) node; |
2379 | 10.2k | pm_dump_json_location(buffer, &cast->base.location); |
2380 | | |
2381 | | // Dump the opening_loc field |
2382 | 10.2k | pm_buffer_append_byte(buffer, ','); |
2383 | 10.2k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
2384 | 10.2k | pm_dump_json_location(buffer, &cast->opening_loc); |
2385 | | |
2386 | | // Dump the elements field |
2387 | 10.2k | pm_buffer_append_byte(buffer, ','); |
2388 | 10.2k | pm_buffer_append_string(buffer, "\"elements\":", 11); |
2389 | 10.2k | const pm_node_list_t *elements = &cast->elements; |
2390 | 10.2k | pm_buffer_append_byte(buffer, '['); |
2391 | | |
2392 | 20.6k | for (size_t index = 0; index < elements->size; index++10.4k ) { Branch (2392:36): [True: 10.4k, False: 10.2k]
|
2393 | 10.4k | if (index != 0) pm_buffer_append_byte(buffer, ',')698 ; Branch (2393:21): [True: 698, False: 9.77k]
|
2394 | 10.4k | pm_dump_json(buffer, parser, elements->nodes[index]); |
2395 | 10.4k | } |
2396 | 10.2k | pm_buffer_append_byte(buffer, ']'); |
2397 | | |
2398 | | // Dump the closing_loc field |
2399 | 10.2k | pm_buffer_append_byte(buffer, ','); |
2400 | 10.2k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
2401 | 10.2k | pm_dump_json_location(buffer, &cast->closing_loc); |
2402 | | |
2403 | 10.2k | pm_buffer_append_byte(buffer, '}'); |
2404 | 10.2k | break; |
2405 | 0 | } |
2406 | 993 | case PM_HASH_PATTERN_NODE: { Branch (2406:9): [True: 993, False: 724k]
|
2407 | 993 | pm_buffer_append_string(buffer, "{\"type\":\"HashPatternNode\",\"location\":", 37); |
2408 | | |
2409 | 993 | const pm_hash_pattern_node_t *cast = (const pm_hash_pattern_node_t *) node; |
2410 | 993 | pm_dump_json_location(buffer, &cast->base.location); |
2411 | | |
2412 | | // Dump the constant field |
2413 | 993 | pm_buffer_append_byte(buffer, ','); |
2414 | 993 | pm_buffer_append_string(buffer, "\"constant\":", 11); |
2415 | 993 | if (cast->constant != NULL) { Branch (2415:17): [True: 118, False: 875]
|
2416 | 118 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant); |
2417 | 875 | } else { |
2418 | 875 | pm_buffer_append_string(buffer, "null", 4); |
2419 | 875 | } |
2420 | | |
2421 | | // Dump the elements field |
2422 | 993 | pm_buffer_append_byte(buffer, ','); |
2423 | 993 | pm_buffer_append_string(buffer, "\"elements\":", 11); |
2424 | 993 | const pm_node_list_t *elements = &cast->elements; |
2425 | 993 | pm_buffer_append_byte(buffer, '['); |
2426 | | |
2427 | 3.11k | for (size_t index = 0; index < elements->size; index++2.12k ) { Branch (2427:36): [True: 2.12k, False: 993]
|
2428 | 2.12k | if (index != 0) pm_buffer_append_byte(buffer, ',')1.47k ; Branch (2428:21): [True: 1.47k, False: 651]
|
2429 | 2.12k | pm_dump_json(buffer, parser, elements->nodes[index]); |
2430 | 2.12k | } |
2431 | 993 | pm_buffer_append_byte(buffer, ']'); |
2432 | | |
2433 | | // Dump the rest field |
2434 | 993 | pm_buffer_append_byte(buffer, ','); |
2435 | 993 | pm_buffer_append_string(buffer, "\"rest\":", 7); |
2436 | 993 | if (cast->rest != NULL) { Branch (2436:17): [True: 263, False: 730]
|
2437 | 263 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest); |
2438 | 730 | } else { |
2439 | 730 | pm_buffer_append_string(buffer, "null", 4); |
2440 | 730 | } |
2441 | | |
2442 | | // Dump the opening_loc field |
2443 | 993 | pm_buffer_append_byte(buffer, ','); |
2444 | 993 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
2445 | 993 | if (cast->opening_loc.length != 0) { Branch (2445:17): [True: 916, False: 77]
|
2446 | 916 | pm_dump_json_location(buffer, &cast->opening_loc); |
2447 | 916 | } else { |
2448 | 77 | pm_buffer_append_string(buffer, "null", 4); |
2449 | 77 | } |
2450 | | |
2451 | | // Dump the closing_loc field |
2452 | 993 | pm_buffer_append_byte(buffer, ','); |
2453 | 993 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
2454 | 993 | if (cast->closing_loc.length != 0) { Branch (2454:17): [True: 675, False: 318]
|
2455 | 675 | pm_dump_json_location(buffer, &cast->closing_loc); |
2456 | 675 | } else { |
2457 | 318 | pm_buffer_append_string(buffer, "null", 4); |
2458 | 318 | } |
2459 | | |
2460 | 993 | pm_buffer_append_byte(buffer, '}'); |
2461 | 993 | break; |
2462 | 0 | } |
2463 | 2.17k | case PM_IF_NODE: { Branch (2463:9): [True: 2.17k, False: 723k]
|
2464 | 2.17k | pm_buffer_append_string(buffer, "{\"type\":\"IfNode\",\"location\":", 28); |
2465 | | |
2466 | 2.17k | const pm_if_node_t *cast = (const pm_if_node_t *) node; |
2467 | 2.17k | pm_dump_json_location(buffer, &cast->base.location); |
2468 | | |
2469 | | // Dump the if_keyword_loc field |
2470 | 2.17k | pm_buffer_append_byte(buffer, ','); |
2471 | 2.17k | pm_buffer_append_string(buffer, "\"if_keyword_loc\":", 17); |
2472 | 2.17k | if (cast->if_keyword_loc.length != 0) { Branch (2472:17): [True: 1.43k, False: 737]
|
2473 | 1.43k | pm_dump_json_location(buffer, &cast->if_keyword_loc); |
2474 | 1.43k | } else { |
2475 | 737 | pm_buffer_append_string(buffer, "null", 4); |
2476 | 737 | } |
2477 | | |
2478 | | // Dump the predicate field |
2479 | 2.17k | pm_buffer_append_byte(buffer, ','); |
2480 | 2.17k | pm_buffer_append_string(buffer, "\"predicate\":", 12); |
2481 | 2.17k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate); |
2482 | | |
2483 | | // Dump the then_keyword_loc field |
2484 | 2.17k | pm_buffer_append_byte(buffer, ','); |
2485 | 2.17k | pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19); |
2486 | 2.17k | if (cast->then_keyword_loc.length != 0) { Branch (2486:17): [True: 868, False: 1.30k]
|
2487 | 868 | pm_dump_json_location(buffer, &cast->then_keyword_loc); |
2488 | 1.30k | } else { |
2489 | 1.30k | pm_buffer_append_string(buffer, "null", 4); |
2490 | 1.30k | } |
2491 | | |
2492 | | // Dump the statements field |
2493 | 2.17k | pm_buffer_append_byte(buffer, ','); |
2494 | 2.17k | pm_buffer_append_string(buffer, "\"statements\":", 13); |
2495 | 2.17k | if (cast->statements != NULL) { Branch (2495:17): [True: 2.06k, False: 113]
|
2496 | 2.06k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
2497 | 2.06k | } else { |
2498 | 113 | pm_buffer_append_string(buffer, "null", 4); |
2499 | 113 | } |
2500 | | |
2501 | | // Dump the subsequent field |
2502 | 2.17k | pm_buffer_append_byte(buffer, ','); |
2503 | 2.17k | pm_buffer_append_string(buffer, "\"subsequent\":", 13); |
2504 | 2.17k | if (cast->subsequent != NULL) { Branch (2504:17): [True: 1.00k, False: 1.17k]
|
2505 | 1.00k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->subsequent); |
2506 | 1.17k | } else { |
2507 | 1.17k | pm_buffer_append_string(buffer, "null", 4); |
2508 | 1.17k | } |
2509 | | |
2510 | | // Dump the end_keyword_loc field |
2511 | 2.17k | pm_buffer_append_byte(buffer, ','); |
2512 | 2.17k | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
2513 | 2.17k | if (cast->end_keyword_loc.length != 0) { Branch (2513:17): [True: 506, False: 1.66k]
|
2514 | 506 | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
2515 | 1.66k | } else { |
2516 | 1.66k | pm_buffer_append_string(buffer, "null", 4); |
2517 | 1.66k | } |
2518 | | |
2519 | 2.17k | pm_buffer_append_byte(buffer, '}'); |
2520 | 2.17k | break; |
2521 | 0 | } |
2522 | 1.17k | case PM_IMAGINARY_NODE: { Branch (2522:9): [True: 1.17k, False: 724k]
|
2523 | 1.17k | pm_buffer_append_string(buffer, "{\"type\":\"ImaginaryNode\",\"location\":", 35); |
2524 | | |
2525 | 1.17k | const pm_imaginary_node_t *cast = (const pm_imaginary_node_t *) node; |
2526 | 1.17k | pm_dump_json_location(buffer, &cast->base.location); |
2527 | | |
2528 | | // Dump the numeric field |
2529 | 1.17k | pm_buffer_append_byte(buffer, ','); |
2530 | 1.17k | pm_buffer_append_string(buffer, "\"numeric\":", 10); |
2531 | 1.17k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->numeric); |
2532 | | |
2533 | 1.17k | pm_buffer_append_byte(buffer, '}'); |
2534 | 1.17k | break; |
2535 | 0 | } |
2536 | 2.19k | case PM_IMPLICIT_NODE: { Branch (2536:9): [True: 2.19k, False: 723k]
|
2537 | 2.19k | pm_buffer_append_string(buffer, "{\"type\":\"ImplicitNode\",\"location\":", 34); |
2538 | | |
2539 | 2.19k | const pm_implicit_node_t *cast = (const pm_implicit_node_t *) node; |
2540 | 2.19k | pm_dump_json_location(buffer, &cast->base.location); |
2541 | | |
2542 | | // Dump the value field |
2543 | 2.19k | pm_buffer_append_byte(buffer, ','); |
2544 | 2.19k | pm_buffer_append_string(buffer, "\"value\":", 8); |
2545 | 2.19k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
2546 | | |
2547 | 2.19k | pm_buffer_append_byte(buffer, '}'); |
2548 | 2.19k | break; |
2549 | 0 | } |
2550 | 1.21k | case PM_IMPLICIT_REST_NODE: { Branch (2550:9): [True: 1.21k, False: 723k]
|
2551 | 1.21k | pm_buffer_append_string(buffer, "{\"type\":\"ImplicitRestNode\",\"location\":", 38); |
2552 | | |
2553 | 1.21k | const pm_implicit_rest_node_t *cast = (const pm_implicit_rest_node_t *) node; |
2554 | 1.21k | pm_dump_json_location(buffer, &cast->base.location); |
2555 | | |
2556 | 1.21k | pm_buffer_append_byte(buffer, '}'); |
2557 | 1.21k | break; |
2558 | 0 | } |
2559 | 4.20k | case PM_IN_NODE: { Branch (2559:9): [True: 4.20k, False: 721k]
|
2560 | 4.20k | pm_buffer_append_string(buffer, "{\"type\":\"InNode\",\"location\":", 28); |
2561 | | |
2562 | 4.20k | const pm_in_node_t *cast = (const pm_in_node_t *) node; |
2563 | 4.20k | pm_dump_json_location(buffer, &cast->base.location); |
2564 | | |
2565 | | // Dump the pattern field |
2566 | 4.20k | pm_buffer_append_byte(buffer, ','); |
2567 | 4.20k | pm_buffer_append_string(buffer, "\"pattern\":", 10); |
2568 | 4.20k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern); |
2569 | | |
2570 | | // Dump the statements field |
2571 | 4.20k | pm_buffer_append_byte(buffer, ','); |
2572 | 4.20k | pm_buffer_append_string(buffer, "\"statements\":", 13); |
2573 | 4.20k | if (cast->statements != NULL) { Branch (2573:17): [True: 2.56k, False: 1.63k]
|
2574 | 2.56k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
2575 | 2.56k | } else { |
2576 | 1.63k | pm_buffer_append_string(buffer, "null", 4); |
2577 | 1.63k | } |
2578 | | |
2579 | | // Dump the in_keyword_loc field |
2580 | 4.20k | pm_buffer_append_byte(buffer, ','); |
2581 | 4.20k | pm_buffer_append_string(buffer, "\"in_keyword_loc\":", 17); |
2582 | 4.20k | pm_dump_json_location(buffer, &cast->in_keyword_loc); |
2583 | | |
2584 | | // Dump the then_keyword_loc field |
2585 | 4.20k | pm_buffer_append_byte(buffer, ','); |
2586 | 4.20k | pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19); |
2587 | 4.20k | if (cast->then_keyword_loc.length != 0) { Branch (2587:17): [True: 1.16k, False: 3.03k]
|
2588 | 1.16k | pm_dump_json_location(buffer, &cast->then_keyword_loc); |
2589 | 3.03k | } else { |
2590 | 3.03k | pm_buffer_append_string(buffer, "null", 4); |
2591 | 3.03k | } |
2592 | | |
2593 | 4.20k | pm_buffer_append_byte(buffer, '}'); |
2594 | 4.20k | break; |
2595 | 0 | } |
2596 | 640 | case PM_INDEX_AND_WRITE_NODE: { Branch (2596:9): [True: 640, False: 724k]
|
2597 | 640 | pm_buffer_append_string(buffer, "{\"type\":\"IndexAndWriteNode\",\"location\":", 39); |
2598 | | |
2599 | 640 | const pm_index_and_write_node_t *cast = (const pm_index_and_write_node_t *) node; |
2600 | 640 | pm_dump_json_location(buffer, &cast->base.location); |
2601 | | |
2602 | | // Dump the CallNodeFlags field |
2603 | 640 | pm_buffer_append_byte(buffer, ','); |
2604 | 640 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
2605 | 640 | size_t flags = 0; |
2606 | 640 | pm_buffer_append_byte(buffer, '['); |
2607 | 640 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) { |
2608 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2608:21): [True: 0, False: 0]
|
2609 | 0 | pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17); |
2610 | 0 | flags++; |
2611 | 0 | } |
2612 | 640 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) { |
2613 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2613:21): [True: 0, False: 0]
|
2614 | 0 | pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15); |
2615 | 0 | flags++; |
2616 | 0 | } |
2617 | 640 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) { |
2618 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2618:21): [True: 0, False: 0]
|
2619 | 0 | pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17); |
2620 | 0 | flags++; |
2621 | 0 | } |
2622 | 640 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) { |
2623 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2623:21): [True: 0, False: 0]
|
2624 | 0 | pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19); |
2625 | 0 | flags++; |
2626 | 0 | } |
2627 | 640 | pm_buffer_append_byte(buffer, ']'); |
2628 | | |
2629 | | // Dump the receiver field |
2630 | 640 | pm_buffer_append_byte(buffer, ','); |
2631 | 640 | pm_buffer_append_string(buffer, "\"receiver\":", 11); |
2632 | 640 | if (cast->receiver != NULL) { Branch (2632:17): [True: 640, False: 0]
|
2633 | 640 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver); |
2634 | 640 | } else { |
2635 | 0 | pm_buffer_append_string(buffer, "null", 4); |
2636 | 0 | } |
2637 | | |
2638 | | // Dump the call_operator_loc field |
2639 | 640 | pm_buffer_append_byte(buffer, ','); |
2640 | 640 | pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20); |
2641 | 640 | if (cast->call_operator_loc.length != 0) { Branch (2641:17): [True: 0, False: 640]
|
2642 | 0 | pm_dump_json_location(buffer, &cast->call_operator_loc); |
2643 | 640 | } else { |
2644 | 640 | pm_buffer_append_string(buffer, "null", 4); |
2645 | 640 | } |
2646 | | |
2647 | | // Dump the opening_loc field |
2648 | 640 | pm_buffer_append_byte(buffer, ','); |
2649 | 640 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
2650 | 640 | pm_dump_json_location(buffer, &cast->opening_loc); |
2651 | | |
2652 | | // Dump the arguments field |
2653 | 640 | pm_buffer_append_byte(buffer, ','); |
2654 | 640 | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
2655 | 640 | if (cast->arguments != NULL) { Branch (2655:17): [True: 379, False: 261]
|
2656 | 379 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments); |
2657 | 379 | } else { |
2658 | 261 | pm_buffer_append_string(buffer, "null", 4); |
2659 | 261 | } |
2660 | | |
2661 | | // Dump the closing_loc field |
2662 | 640 | pm_buffer_append_byte(buffer, ','); |
2663 | 640 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
2664 | 640 | pm_dump_json_location(buffer, &cast->closing_loc); |
2665 | | |
2666 | | // Dump the block field |
2667 | 640 | pm_buffer_append_byte(buffer, ','); |
2668 | 640 | pm_buffer_append_string(buffer, "\"block\":", 8); |
2669 | 640 | if (cast->block != NULL) { Branch (2669:17): [True: 4, False: 636]
|
2670 | 4 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->block); |
2671 | 636 | } else { |
2672 | 636 | pm_buffer_append_string(buffer, "null", 4); |
2673 | 636 | } |
2674 | | |
2675 | | // Dump the operator_loc field |
2676 | 640 | pm_buffer_append_byte(buffer, ','); |
2677 | 640 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
2678 | 640 | pm_dump_json_location(buffer, &cast->operator_loc); |
2679 | | |
2680 | | // Dump the value field |
2681 | 640 | pm_buffer_append_byte(buffer, ','); |
2682 | 640 | pm_buffer_append_string(buffer, "\"value\":", 8); |
2683 | 640 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
2684 | | |
2685 | 640 | pm_buffer_append_byte(buffer, '}'); |
2686 | 640 | break; |
2687 | 0 | } |
2688 | 814 | case PM_INDEX_OPERATOR_WRITE_NODE: { Branch (2688:9): [True: 814, False: 724k]
|
2689 | 814 | pm_buffer_append_string(buffer, "{\"type\":\"IndexOperatorWriteNode\",\"location\":", 44); |
2690 | | |
2691 | 814 | const pm_index_operator_write_node_t *cast = (const pm_index_operator_write_node_t *) node; |
2692 | 814 | pm_dump_json_location(buffer, &cast->base.location); |
2693 | | |
2694 | | // Dump the CallNodeFlags field |
2695 | 814 | pm_buffer_append_byte(buffer, ','); |
2696 | 814 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
2697 | 814 | size_t flags = 0; |
2698 | 814 | pm_buffer_append_byte(buffer, '['); |
2699 | 814 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) { |
2700 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2700:21): [True: 0, False: 0]
|
2701 | 0 | pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17); |
2702 | 0 | flags++; |
2703 | 0 | } |
2704 | 814 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) { |
2705 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2705:21): [True: 0, False: 0]
|
2706 | 0 | pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15); |
2707 | 0 | flags++; |
2708 | 0 | } |
2709 | 814 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) { |
2710 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2710:21): [True: 0, False: 0]
|
2711 | 0 | pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17); |
2712 | 0 | flags++; |
2713 | 0 | } |
2714 | 814 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) { |
2715 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2715:21): [True: 0, False: 0]
|
2716 | 0 | pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19); |
2717 | 0 | flags++; |
2718 | 0 | } |
2719 | 814 | pm_buffer_append_byte(buffer, ']'); |
2720 | | |
2721 | | // Dump the receiver field |
2722 | 814 | pm_buffer_append_byte(buffer, ','); |
2723 | 814 | pm_buffer_append_string(buffer, "\"receiver\":", 11); |
2724 | 814 | if (cast->receiver != NULL) { Branch (2724:17): [True: 814, False: 0]
|
2725 | 814 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver); |
2726 | 814 | } else { |
2727 | 0 | pm_buffer_append_string(buffer, "null", 4); |
2728 | 0 | } |
2729 | | |
2730 | | // Dump the call_operator_loc field |
2731 | 814 | pm_buffer_append_byte(buffer, ','); |
2732 | 814 | pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20); |
2733 | 814 | if (cast->call_operator_loc.length != 0) { Branch (2733:17): [True: 0, False: 814]
|
2734 | 0 | pm_dump_json_location(buffer, &cast->call_operator_loc); |
2735 | 814 | } else { |
2736 | 814 | pm_buffer_append_string(buffer, "null", 4); |
2737 | 814 | } |
2738 | | |
2739 | | // Dump the opening_loc field |
2740 | 814 | pm_buffer_append_byte(buffer, ','); |
2741 | 814 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
2742 | 814 | pm_dump_json_location(buffer, &cast->opening_loc); |
2743 | | |
2744 | | // Dump the arguments field |
2745 | 814 | pm_buffer_append_byte(buffer, ','); |
2746 | 814 | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
2747 | 814 | if (cast->arguments != NULL) { Branch (2747:17): [True: 536, False: 278]
|
2748 | 536 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments); |
2749 | 536 | } else { |
2750 | 278 | pm_buffer_append_string(buffer, "null", 4); |
2751 | 278 | } |
2752 | | |
2753 | | // Dump the closing_loc field |
2754 | 814 | pm_buffer_append_byte(buffer, ','); |
2755 | 814 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
2756 | 814 | pm_dump_json_location(buffer, &cast->closing_loc); |
2757 | | |
2758 | | // Dump the block field |
2759 | 814 | pm_buffer_append_byte(buffer, ','); |
2760 | 814 | pm_buffer_append_string(buffer, "\"block\":", 8); |
2761 | 814 | if (cast->block != NULL) { Branch (2761:17): [True: 7, False: 807]
|
2762 | 7 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->block); |
2763 | 807 | } else { |
2764 | 807 | pm_buffer_append_string(buffer, "null", 4); |
2765 | 807 | } |
2766 | | |
2767 | | // Dump the binary_operator field |
2768 | 814 | pm_buffer_append_byte(buffer, ','); |
2769 | 814 | pm_buffer_append_string(buffer, "\"binary_operator\":", 18); |
2770 | 814 | pm_dump_json_constant(buffer, parser, cast->binary_operator); |
2771 | | |
2772 | | // Dump the binary_operator_loc field |
2773 | 814 | pm_buffer_append_byte(buffer, ','); |
2774 | 814 | pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22); |
2775 | 814 | pm_dump_json_location(buffer, &cast->binary_operator_loc); |
2776 | | |
2777 | | // Dump the value field |
2778 | 814 | pm_buffer_append_byte(buffer, ','); |
2779 | 814 | pm_buffer_append_string(buffer, "\"value\":", 8); |
2780 | 814 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
2781 | | |
2782 | 814 | pm_buffer_append_byte(buffer, '}'); |
2783 | 814 | break; |
2784 | 0 | } |
2785 | 532 | case PM_INDEX_OR_WRITE_NODE: { Branch (2785:9): [True: 532, False: 724k]
|
2786 | 532 | pm_buffer_append_string(buffer, "{\"type\":\"IndexOrWriteNode\",\"location\":", 38); |
2787 | | |
2788 | 532 | const pm_index_or_write_node_t *cast = (const pm_index_or_write_node_t *) node; |
2789 | 532 | pm_dump_json_location(buffer, &cast->base.location); |
2790 | | |
2791 | | // Dump the CallNodeFlags field |
2792 | 532 | pm_buffer_append_byte(buffer, ','); |
2793 | 532 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
2794 | 532 | size_t flags = 0; |
2795 | 532 | pm_buffer_append_byte(buffer, '['); |
2796 | 532 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) { |
2797 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2797:21): [True: 0, False: 0]
|
2798 | 0 | pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17); |
2799 | 0 | flags++; |
2800 | 0 | } |
2801 | 532 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) { |
2802 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2802:21): [True: 0, False: 0]
|
2803 | 0 | pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15); |
2804 | 0 | flags++; |
2805 | 0 | } |
2806 | 532 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) { |
2807 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2807:21): [True: 0, False: 0]
|
2808 | 0 | pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17); |
2809 | 0 | flags++; |
2810 | 0 | } |
2811 | 532 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) { |
2812 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2812:21): [True: 0, False: 0]
|
2813 | 0 | pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19); |
2814 | 0 | flags++; |
2815 | 0 | } |
2816 | 532 | pm_buffer_append_byte(buffer, ']'); |
2817 | | |
2818 | | // Dump the receiver field |
2819 | 532 | pm_buffer_append_byte(buffer, ','); |
2820 | 532 | pm_buffer_append_string(buffer, "\"receiver\":", 11); |
2821 | 532 | if (cast->receiver != NULL) { Branch (2821:17): [True: 532, False: 0]
|
2822 | 532 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver); |
2823 | 532 | } else { |
2824 | 0 | pm_buffer_append_string(buffer, "null", 4); |
2825 | 0 | } |
2826 | | |
2827 | | // Dump the call_operator_loc field |
2828 | 532 | pm_buffer_append_byte(buffer, ','); |
2829 | 532 | pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20); |
2830 | 532 | if (cast->call_operator_loc.length != 0) { Branch (2830:17): [True: 0, False: 532]
|
2831 | 0 | pm_dump_json_location(buffer, &cast->call_operator_loc); |
2832 | 532 | } else { |
2833 | 532 | pm_buffer_append_string(buffer, "null", 4); |
2834 | 532 | } |
2835 | | |
2836 | | // Dump the opening_loc field |
2837 | 532 | pm_buffer_append_byte(buffer, ','); |
2838 | 532 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
2839 | 532 | pm_dump_json_location(buffer, &cast->opening_loc); |
2840 | | |
2841 | | // Dump the arguments field |
2842 | 532 | pm_buffer_append_byte(buffer, ','); |
2843 | 532 | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
2844 | 532 | if (cast->arguments != NULL) { Branch (2844:17): [True: 266, False: 266]
|
2845 | 266 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments); |
2846 | 266 | } else { |
2847 | 266 | pm_buffer_append_string(buffer, "null", 4); |
2848 | 266 | } |
2849 | | |
2850 | | // Dump the closing_loc field |
2851 | 532 | pm_buffer_append_byte(buffer, ','); |
2852 | 532 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
2853 | 532 | pm_dump_json_location(buffer, &cast->closing_loc); |
2854 | | |
2855 | | // Dump the block field |
2856 | 532 | pm_buffer_append_byte(buffer, ','); |
2857 | 532 | pm_buffer_append_string(buffer, "\"block\":", 8); |
2858 | 532 | if (cast->block != NULL) { Branch (2858:17): [True: 2, False: 530]
|
2859 | 2 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->block); |
2860 | 530 | } else { |
2861 | 530 | pm_buffer_append_string(buffer, "null", 4); |
2862 | 530 | } |
2863 | | |
2864 | | // Dump the operator_loc field |
2865 | 532 | pm_buffer_append_byte(buffer, ','); |
2866 | 532 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
2867 | 532 | pm_dump_json_location(buffer, &cast->operator_loc); |
2868 | | |
2869 | | // Dump the value field |
2870 | 532 | pm_buffer_append_byte(buffer, ','); |
2871 | 532 | pm_buffer_append_string(buffer, "\"value\":", 8); |
2872 | 532 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
2873 | | |
2874 | 532 | pm_buffer_append_byte(buffer, '}'); |
2875 | 532 | break; |
2876 | 0 | } |
2877 | 496 | case PM_INDEX_TARGET_NODE: { Branch (2877:9): [True: 496, False: 724k]
|
2878 | 496 | pm_buffer_append_string(buffer, "{\"type\":\"IndexTargetNode\",\"location\":", 37); |
2879 | | |
2880 | 496 | const pm_index_target_node_t *cast = (const pm_index_target_node_t *) node; |
2881 | 496 | pm_dump_json_location(buffer, &cast->base.location); |
2882 | | |
2883 | | // Dump the CallNodeFlags field |
2884 | 496 | pm_buffer_append_byte(buffer, ','); |
2885 | 496 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
2886 | 496 | size_t flags = 0; |
2887 | 496 | pm_buffer_append_byte(buffer, '['); |
2888 | 496 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) { |
2889 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2889:21): [True: 0, False: 0]
|
2890 | 0 | pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17); |
2891 | 0 | flags++; |
2892 | 0 | } |
2893 | 496 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) { |
2894 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2894:21): [True: 0, False: 0]
|
2895 | 0 | pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15); |
2896 | 0 | flags++; |
2897 | 0 | } |
2898 | 496 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) { |
2899 | 496 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (2899:21): [True: 0, False: 496]
|
2900 | 496 | pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17); |
2901 | 496 | flags++; |
2902 | 496 | } |
2903 | 496 | if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) { |
2904 | 2 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (2904:21): [True: 2, False: 0]
|
2905 | 2 | pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19); |
2906 | 2 | flags++; |
2907 | 2 | } |
2908 | 496 | pm_buffer_append_byte(buffer, ']'); |
2909 | | |
2910 | | // Dump the receiver field |
2911 | 496 | pm_buffer_append_byte(buffer, ','); |
2912 | 496 | pm_buffer_append_string(buffer, "\"receiver\":", 11); |
2913 | 496 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver); |
2914 | | |
2915 | | // Dump the opening_loc field |
2916 | 496 | pm_buffer_append_byte(buffer, ','); |
2917 | 496 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
2918 | 496 | pm_dump_json_location(buffer, &cast->opening_loc); |
2919 | | |
2920 | | // Dump the arguments field |
2921 | 496 | pm_buffer_append_byte(buffer, ','); |
2922 | 496 | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
2923 | 496 | if (cast->arguments != NULL) { Branch (2923:17): [True: 487, False: 9]
|
2924 | 487 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments); |
2925 | 487 | } else { |
2926 | 9 | pm_buffer_append_string(buffer, "null", 4); |
2927 | 9 | } |
2928 | | |
2929 | | // Dump the closing_loc field |
2930 | 496 | pm_buffer_append_byte(buffer, ','); |
2931 | 496 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
2932 | 496 | pm_dump_json_location(buffer, &cast->closing_loc); |
2933 | | |
2934 | | // Dump the block field |
2935 | 496 | pm_buffer_append_byte(buffer, ','); |
2936 | 496 | pm_buffer_append_string(buffer, "\"block\":", 8); |
2937 | 496 | if (cast->block != NULL) { Branch (2937:17): [True: 3, False: 493]
|
2938 | 3 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->block); |
2939 | 493 | } else { |
2940 | 493 | pm_buffer_append_string(buffer, "null", 4); |
2941 | 493 | } |
2942 | | |
2943 | 496 | pm_buffer_append_byte(buffer, '}'); |
2944 | 496 | break; |
2945 | 0 | } |
2946 | 18 | case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: { Branch (2946:9): [True: 18, False: 725k]
|
2947 | 18 | pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableAndWriteNode\",\"location\":", 50); |
2948 | | |
2949 | 18 | const pm_instance_variable_and_write_node_t *cast = (const pm_instance_variable_and_write_node_t *) node; |
2950 | 18 | pm_dump_json_location(buffer, &cast->base.location); |
2951 | | |
2952 | | // Dump the name field |
2953 | 18 | pm_buffer_append_byte(buffer, ','); |
2954 | 18 | pm_buffer_append_string(buffer, "\"name\":", 7); |
2955 | 18 | pm_dump_json_constant(buffer, parser, cast->name); |
2956 | | |
2957 | | // Dump the name_loc field |
2958 | 18 | pm_buffer_append_byte(buffer, ','); |
2959 | 18 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
2960 | 18 | pm_dump_json_location(buffer, &cast->name_loc); |
2961 | | |
2962 | | // Dump the operator_loc field |
2963 | 18 | pm_buffer_append_byte(buffer, ','); |
2964 | 18 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
2965 | 18 | pm_dump_json_location(buffer, &cast->operator_loc); |
2966 | | |
2967 | | // Dump the value field |
2968 | 18 | pm_buffer_append_byte(buffer, ','); |
2969 | 18 | pm_buffer_append_string(buffer, "\"value\":", 8); |
2970 | 18 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
2971 | | |
2972 | 18 | pm_buffer_append_byte(buffer, '}'); |
2973 | 18 | break; |
2974 | 0 | } |
2975 | 16 | case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: { Branch (2975:9): [True: 16, False: 725k]
|
2976 | 16 | pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableOperatorWriteNode\",\"location\":", 55); |
2977 | | |
2978 | 16 | const pm_instance_variable_operator_write_node_t *cast = (const pm_instance_variable_operator_write_node_t *) node; |
2979 | 16 | pm_dump_json_location(buffer, &cast->base.location); |
2980 | | |
2981 | | // Dump the name field |
2982 | 16 | pm_buffer_append_byte(buffer, ','); |
2983 | 16 | pm_buffer_append_string(buffer, "\"name\":", 7); |
2984 | 16 | pm_dump_json_constant(buffer, parser, cast->name); |
2985 | | |
2986 | | // Dump the name_loc field |
2987 | 16 | pm_buffer_append_byte(buffer, ','); |
2988 | 16 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
2989 | 16 | pm_dump_json_location(buffer, &cast->name_loc); |
2990 | | |
2991 | | // Dump the binary_operator_loc field |
2992 | 16 | pm_buffer_append_byte(buffer, ','); |
2993 | 16 | pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22); |
2994 | 16 | pm_dump_json_location(buffer, &cast->binary_operator_loc); |
2995 | | |
2996 | | // Dump the value field |
2997 | 16 | pm_buffer_append_byte(buffer, ','); |
2998 | 16 | pm_buffer_append_string(buffer, "\"value\":", 8); |
2999 | 16 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
3000 | | |
3001 | | // Dump the binary_operator field |
3002 | 16 | pm_buffer_append_byte(buffer, ','); |
3003 | 16 | pm_buffer_append_string(buffer, "\"binary_operator\":", 18); |
3004 | 16 | pm_dump_json_constant(buffer, parser, cast->binary_operator); |
3005 | | |
3006 | 16 | pm_buffer_append_byte(buffer, '}'); |
3007 | 16 | break; |
3008 | 0 | } |
3009 | 7 | case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: { Branch (3009:9): [True: 7, False: 725k]
|
3010 | 7 | pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableOrWriteNode\",\"location\":", 49); |
3011 | | |
3012 | 7 | const pm_instance_variable_or_write_node_t *cast = (const pm_instance_variable_or_write_node_t *) node; |
3013 | 7 | pm_dump_json_location(buffer, &cast->base.location); |
3014 | | |
3015 | | // Dump the name field |
3016 | 7 | pm_buffer_append_byte(buffer, ','); |
3017 | 7 | pm_buffer_append_string(buffer, "\"name\":", 7); |
3018 | 7 | pm_dump_json_constant(buffer, parser, cast->name); |
3019 | | |
3020 | | // Dump the name_loc field |
3021 | 7 | pm_buffer_append_byte(buffer, ','); |
3022 | 7 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
3023 | 7 | pm_dump_json_location(buffer, &cast->name_loc); |
3024 | | |
3025 | | // Dump the operator_loc field |
3026 | 7 | pm_buffer_append_byte(buffer, ','); |
3027 | 7 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
3028 | 7 | pm_dump_json_location(buffer, &cast->operator_loc); |
3029 | | |
3030 | | // Dump the value field |
3031 | 7 | pm_buffer_append_byte(buffer, ','); |
3032 | 7 | pm_buffer_append_string(buffer, "\"value\":", 8); |
3033 | 7 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
3034 | | |
3035 | 7 | pm_buffer_append_byte(buffer, '}'); |
3036 | 7 | break; |
3037 | 0 | } |
3038 | 1.65k | case PM_INSTANCE_VARIABLE_READ_NODE: { Branch (3038:9): [True: 1.65k, False: 723k]
|
3039 | 1.65k | pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableReadNode\",\"location\":", 46); |
3040 | | |
3041 | 1.65k | const pm_instance_variable_read_node_t *cast = (const pm_instance_variable_read_node_t *) node; |
3042 | 1.65k | pm_dump_json_location(buffer, &cast->base.location); |
3043 | | |
3044 | | // Dump the name field |
3045 | 1.65k | pm_buffer_append_byte(buffer, ','); |
3046 | 1.65k | pm_buffer_append_string(buffer, "\"name\":", 7); |
3047 | 1.65k | pm_dump_json_constant(buffer, parser, cast->name); |
3048 | | |
3049 | 1.65k | pm_buffer_append_byte(buffer, '}'); |
3050 | 1.65k | break; |
3051 | 0 | } |
3052 | 378 | case PM_INSTANCE_VARIABLE_TARGET_NODE: { Branch (3052:9): [True: 378, False: 724k]
|
3053 | 378 | pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableTargetNode\",\"location\":", 48); |
3054 | | |
3055 | 378 | const pm_instance_variable_target_node_t *cast = (const pm_instance_variable_target_node_t *) node; |
3056 | 378 | pm_dump_json_location(buffer, &cast->base.location); |
3057 | | |
3058 | | // Dump the name field |
3059 | 378 | pm_buffer_append_byte(buffer, ','); |
3060 | 378 | pm_buffer_append_string(buffer, "\"name\":", 7); |
3061 | 378 | pm_dump_json_constant(buffer, parser, cast->name); |
3062 | | |
3063 | 378 | pm_buffer_append_byte(buffer, '}'); |
3064 | 378 | break; |
3065 | 0 | } |
3066 | 453 | case PM_INSTANCE_VARIABLE_WRITE_NODE: { Branch (3066:9): [True: 453, False: 724k]
|
3067 | 453 | pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableWriteNode\",\"location\":", 47); |
3068 | | |
3069 | 453 | const pm_instance_variable_write_node_t *cast = (const pm_instance_variable_write_node_t *) node; |
3070 | 453 | pm_dump_json_location(buffer, &cast->base.location); |
3071 | | |
3072 | | // Dump the name field |
3073 | 453 | pm_buffer_append_byte(buffer, ','); |
3074 | 453 | pm_buffer_append_string(buffer, "\"name\":", 7); |
3075 | 453 | pm_dump_json_constant(buffer, parser, cast->name); |
3076 | | |
3077 | | // Dump the name_loc field |
3078 | 453 | pm_buffer_append_byte(buffer, ','); |
3079 | 453 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
3080 | 453 | pm_dump_json_location(buffer, &cast->name_loc); |
3081 | | |
3082 | | // Dump the value field |
3083 | 453 | pm_buffer_append_byte(buffer, ','); |
3084 | 453 | pm_buffer_append_string(buffer, "\"value\":", 8); |
3085 | 453 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
3086 | | |
3087 | | // Dump the operator_loc field |
3088 | 453 | pm_buffer_append_byte(buffer, ','); |
3089 | 453 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
3090 | 453 | pm_dump_json_location(buffer, &cast->operator_loc); |
3091 | | |
3092 | 453 | pm_buffer_append_byte(buffer, '}'); |
3093 | 453 | break; |
3094 | 0 | } |
3095 | 38.0k | case PM_INTEGER_NODE: { Branch (3095:9): [True: 38.0k, False: 687k]
|
3096 | 38.0k | pm_buffer_append_string(buffer, "{\"type\":\"IntegerNode\",\"location\":", 33); |
3097 | | |
3098 | 38.0k | const pm_integer_node_t *cast = (const pm_integer_node_t *) node; |
3099 | 38.0k | pm_dump_json_location(buffer, &cast->base.location); |
3100 | | |
3101 | | // Dump the IntegerBaseFlags field |
3102 | 38.0k | pm_buffer_append_byte(buffer, ','); |
3103 | 38.0k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
3104 | 38.0k | size_t flags = 0; |
3105 | 38.0k | pm_buffer_append_byte(buffer, '['); |
3106 | 38.0k | if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_BINARY)) { |
3107 | 278 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3107:21): [True: 0, False: 278]
|
3108 | 278 | pm_buffer_append_string(buffer, "\"BINARY\"", 8); |
3109 | 278 | flags++; |
3110 | 278 | } |
3111 | 38.0k | if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_DECIMAL)) { |
3112 | 36.5k | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3112:21): [True: 0, False: 36.5k]
|
3113 | 36.5k | pm_buffer_append_string(buffer, "\"DECIMAL\"", 9); |
3114 | 36.5k | flags++; |
3115 | 36.5k | } |
3116 | 38.0k | if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_OCTAL)) { |
3117 | 890 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3117:21): [True: 0, False: 890]
|
3118 | 890 | pm_buffer_append_string(buffer, "\"OCTAL\"", 7); |
3119 | 890 | flags++; |
3120 | 890 | } |
3121 | 38.0k | if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_HEXADECIMAL)) { |
3122 | 361 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3122:21): [True: 0, False: 361]
|
3123 | 361 | pm_buffer_append_string(buffer, "\"HEXADECIMAL\"", 13); |
3124 | 361 | flags++; |
3125 | 361 | } |
3126 | 38.0k | pm_buffer_append_byte(buffer, ']'); |
3127 | | |
3128 | | // Dump the value field |
3129 | 38.0k | pm_buffer_append_byte(buffer, ','); |
3130 | 38.0k | pm_buffer_append_string(buffer, "\"value\":", 8); |
3131 | 38.0k | pm_integer_string(buffer, &cast->value); |
3132 | | |
3133 | 38.0k | pm_buffer_append_byte(buffer, '}'); |
3134 | 38.0k | break; |
3135 | 0 | } |
3136 | 22 | case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: { Branch (3136:9): [True: 22, False: 725k]
|
3137 | 22 | pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedMatchLastLineNode\",\"location\":", 51); |
3138 | | |
3139 | 22 | const pm_interpolated_match_last_line_node_t *cast = (const pm_interpolated_match_last_line_node_t *) node; |
3140 | 22 | pm_dump_json_location(buffer, &cast->base.location); |
3141 | | |
3142 | | // Dump the RegularExpressionFlags field |
3143 | 22 | pm_buffer_append_byte(buffer, ','); |
3144 | 22 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
3145 | 22 | size_t flags = 0; |
3146 | 22 | pm_buffer_append_byte(buffer, '['); |
3147 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) { |
3148 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3148:21): [True: 0, False: 0]
|
3149 | 0 | pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13); |
3150 | 0 | flags++; |
3151 | 0 | } |
3152 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) { |
3153 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3153:21): [True: 0, False: 0]
|
3154 | 0 | pm_buffer_append_string(buffer, "\"EXTENDED\"", 10); |
3155 | 0 | flags++; |
3156 | 0 | } |
3157 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) { |
3158 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3158:21): [True: 0, False: 0]
|
3159 | 0 | pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12); |
3160 | 0 | flags++; |
3161 | 0 | } |
3162 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) { |
3163 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3163:21): [True: 0, False: 0]
|
3164 | 0 | pm_buffer_append_string(buffer, "\"ONCE\"", 6); |
3165 | 0 | flags++; |
3166 | 0 | } |
3167 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) { |
3168 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3168:21): [True: 0, False: 0]
|
3169 | 0 | pm_buffer_append_string(buffer, "\"EUC_JP\"", 8); |
3170 | 0 | flags++; |
3171 | 0 | } |
3172 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) { |
3173 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3173:21): [True: 0, False: 0]
|
3174 | 0 | pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12); |
3175 | 0 | flags++; |
3176 | 0 | } |
3177 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) { |
3178 | 1 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; ★ main-7: BR: False (1x) Branch (3178:21): [True: 0, False: 1]
|
3179 | 1 | pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13); |
3180 | 1 | flags++; |
3181 | 1 | } |
3182 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) { |
3183 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3183:21): [True: 0, False: 0]
|
3184 | 0 | pm_buffer_append_string(buffer, "\"UTF_8\"", 7); |
3185 | 0 | flags++; |
3186 | 0 | } |
3187 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) { |
3188 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3188:21): [True: 0, False: 0]
|
3189 | 0 | pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22); |
3190 | 0 | flags++; |
3191 | 0 | } |
3192 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) { |
3193 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3193:21): [True: 0, False: 0]
|
3194 | 0 | pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24); |
3195 | 0 | flags++; |
3196 | 0 | } |
3197 | 22 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) { |
3198 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3198:21): [True: 0, False: 0]
|
3199 | 0 | pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26); |
3200 | 0 | flags++; |
3201 | 0 | } |
3202 | 22 | pm_buffer_append_byte(buffer, ']'); |
3203 | | |
3204 | | // Dump the opening_loc field |
3205 | 22 | pm_buffer_append_byte(buffer, ','); |
3206 | 22 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
3207 | 22 | pm_dump_json_location(buffer, &cast->opening_loc); |
3208 | | |
3209 | | // Dump the parts field |
3210 | 22 | pm_buffer_append_byte(buffer, ','); |
3211 | 22 | pm_buffer_append_string(buffer, "\"parts\":", 8); |
3212 | 22 | const pm_node_list_t *parts = &cast->parts; |
3213 | 22 | pm_buffer_append_byte(buffer, '['); |
3214 | | |
3215 | 159 | for (size_t index = 0; index < parts->size; index++137 ) { Branch (3215:36): [True: 137, False: 22]
|
3216 | 137 | if (index != 0) pm_buffer_append_byte(buffer, ',')117 ; Branch (3216:21): [True: 117, False: 20]
|
3217 | 137 | pm_dump_json(buffer, parser, parts->nodes[index]); |
3218 | 137 | } |
3219 | 22 | pm_buffer_append_byte(buffer, ']'); |
3220 | | |
3221 | | // Dump the closing_loc field |
3222 | 22 | pm_buffer_append_byte(buffer, ','); |
3223 | 22 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
3224 | 22 | pm_dump_json_location(buffer, &cast->closing_loc); |
3225 | | |
3226 | 22 | pm_buffer_append_byte(buffer, '}'); |
3227 | 22 | break; |
3228 | 0 | } |
3229 | 1.10k | case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: { Branch (3229:9): [True: 1.10k, False: 724k]
|
3230 | 1.10k | pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedRegularExpressionNode\",\"location\":", 55); |
3231 | | |
3232 | 1.10k | const pm_interpolated_regular_expression_node_t *cast = (const pm_interpolated_regular_expression_node_t *) node; |
3233 | 1.10k | pm_dump_json_location(buffer, &cast->base.location); |
3234 | | |
3235 | | // Dump the RegularExpressionFlags field |
3236 | 1.10k | pm_buffer_append_byte(buffer, ','); |
3237 | 1.10k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
3238 | 1.10k | size_t flags = 0; |
3239 | 1.10k | pm_buffer_append_byte(buffer, '['); |
3240 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) { |
3241 | 35 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3241:21): [True: 0, False: 35]
|
3242 | 35 | pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13); |
3243 | 35 | flags++; |
3244 | 35 | } |
3245 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) { |
3246 | 33 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3246:21): [True: 33, False: 0]
|
3247 | 33 | pm_buffer_append_string(buffer, "\"EXTENDED\"", 10); |
3248 | 33 | flags++; |
3249 | 33 | } |
3250 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) { |
3251 | 34 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3251:21): [True: 34, False: 0]
|
3252 | 34 | pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12); |
3253 | 34 | flags++; |
3254 | 34 | } |
3255 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) { |
3256 | 134 | if (flags != 0) pm_buffer_append_byte(buffer, ',')1 ; Branch (3256:21): [True: 1, False: 133]
|
3257 | 134 | pm_buffer_append_string(buffer, "\"ONCE\"", 6); |
3258 | 134 | flags++; |
3259 | 134 | } |
3260 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) { |
3261 | 1 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3261:21): [True: 0, False: 1]
|
3262 | 1 | pm_buffer_append_string(buffer, "\"EUC_JP\"", 8); |
3263 | 1 | flags++; |
3264 | 1 | } |
3265 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) { |
3266 | 4 | if (flags != 0) pm_buffer_append_byte(buffer, ',')1 ; Branch (3266:21): [True: 1, False: 3]
|
3267 | 4 | pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12); |
3268 | 4 | flags++; |
3269 | 4 | } |
3270 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) { |
3271 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3271:21): [True: 0, False: 0]
|
3272 | 0 | pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13); |
3273 | 0 | flags++; |
3274 | 0 | } |
3275 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) { |
3276 | 2 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3276:21): [True: 0, False: 2]
|
3277 | 2 | pm_buffer_append_string(buffer, "\"UTF_8\"", 7); |
3278 | 2 | flags++; |
3279 | 2 | } |
3280 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) { |
3281 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3281:21): [True: 0, False: 0]
|
3282 | 0 | pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22); |
3283 | 0 | flags++; |
3284 | 0 | } |
3285 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) { |
3286 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3286:21): [True: 0, False: 0]
|
3287 | 0 | pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24); |
3288 | 0 | flags++; |
3289 | 0 | } |
3290 | 1.10k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) { |
3291 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3291:21): [True: 0, False: 0]
|
3292 | 0 | pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26); |
3293 | 0 | flags++; |
3294 | 0 | } |
3295 | 1.10k | pm_buffer_append_byte(buffer, ']'); |
3296 | | |
3297 | | // Dump the opening_loc field |
3298 | 1.10k | pm_buffer_append_byte(buffer, ','); |
3299 | 1.10k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
3300 | 1.10k | pm_dump_json_location(buffer, &cast->opening_loc); |
3301 | | |
3302 | | // Dump the parts field |
3303 | 1.10k | pm_buffer_append_byte(buffer, ','); |
3304 | 1.10k | pm_buffer_append_string(buffer, "\"parts\":", 8); |
3305 | 1.10k | const pm_node_list_t *parts = &cast->parts; |
3306 | 1.10k | pm_buffer_append_byte(buffer, '['); |
3307 | | |
3308 | 3.35k | for (size_t index = 0; index < parts->size; index++2.25k ) { Branch (3308:36): [True: 2.25k, False: 1.10k]
|
3309 | 2.25k | if (index != 0) pm_buffer_append_byte(buffer, ',')1.14k ; Branch (3309:21): [True: 1.14k, False: 1.10k]
|
3310 | 2.25k | pm_dump_json(buffer, parser, parts->nodes[index]); |
3311 | 2.25k | } |
3312 | 1.10k | pm_buffer_append_byte(buffer, ']'); |
3313 | | |
3314 | | // Dump the closing_loc field |
3315 | 1.10k | pm_buffer_append_byte(buffer, ','); |
3316 | 1.10k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
3317 | 1.10k | pm_dump_json_location(buffer, &cast->closing_loc); |
3318 | | |
3319 | 1.10k | pm_buffer_append_byte(buffer, '}'); |
3320 | 1.10k | break; |
3321 | 0 | } |
3322 | 3.70k | case PM_INTERPOLATED_STRING_NODE: { Branch (3322:9): [True: 3.70k, False: 721k]
|
3323 | 3.70k | pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedStringNode\",\"location\":", 44); |
3324 | | |
3325 | 3.70k | const pm_interpolated_string_node_t *cast = (const pm_interpolated_string_node_t *) node; |
3326 | 3.70k | pm_dump_json_location(buffer, &cast->base.location); |
3327 | | |
3328 | | // Dump the InterpolatedStringNodeFlags field |
3329 | 3.70k | pm_buffer_append_byte(buffer, ','); |
3330 | 3.70k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
3331 | 3.70k | size_t flags = 0; |
3332 | 3.70k | pm_buffer_append_byte(buffer, '['); |
3333 | 3.70k | if (PM_NODE_FLAG_P(cast, PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN)) { |
3334 | 71 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3334:21): [True: 0, False: 71]
|
3335 | 71 | pm_buffer_append_string(buffer, "\"FROZEN\"", 8); |
3336 | 71 | flags++; |
3337 | 71 | } |
3338 | 3.70k | if (PM_NODE_FLAG_P(cast, PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE)) { |
3339 | 392 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3339:21): [True: 0, False: 392]
|
3340 | 392 | pm_buffer_append_string(buffer, "\"MUTABLE\"", 9); |
3341 | 392 | flags++; |
3342 | 392 | } |
3343 | 3.70k | pm_buffer_append_byte(buffer, ']'); |
3344 | | |
3345 | | // Dump the opening_loc field |
3346 | 3.70k | pm_buffer_append_byte(buffer, ','); |
3347 | 3.70k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
3348 | 3.70k | if (cast->opening_loc.length != 0) { Branch (3348:17): [True: 2.82k, False: 873]
|
3349 | 2.82k | pm_dump_json_location(buffer, &cast->opening_loc); |
3350 | 2.82k | } else { |
3351 | 873 | pm_buffer_append_string(buffer, "null", 4); |
3352 | 873 | } |
3353 | | |
3354 | | // Dump the parts field |
3355 | 3.70k | pm_buffer_append_byte(buffer, ','); |
3356 | 3.70k | pm_buffer_append_string(buffer, "\"parts\":", 8); |
3357 | 3.70k | const pm_node_list_t *parts = &cast->parts; |
3358 | 3.70k | pm_buffer_append_byte(buffer, '['); |
3359 | | |
3360 | 17.7k | for (size_t index = 0; index < parts->size; index++14.0k ) { Branch (3360:36): [True: 14.0k, False: 3.70k]
|
3361 | 14.0k | if (index != 0) pm_buffer_append_byte(buffer, ',')10.3k ; Branch (3361:21): [True: 10.3k, False: 3.70k]
|
3362 | 14.0k | pm_dump_json(buffer, parser, parts->nodes[index]); |
3363 | 14.0k | } |
3364 | 3.70k | pm_buffer_append_byte(buffer, ']'); |
3365 | | |
3366 | | // Dump the closing_loc field |
3367 | 3.70k | pm_buffer_append_byte(buffer, ','); |
3368 | 3.70k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
3369 | 3.70k | if (cast->closing_loc.length != 0) { Branch (3369:17): [True: 2.21k, False: 1.48k]
|
3370 | 2.21k | pm_dump_json_location(buffer, &cast->closing_loc); |
3371 | 2.21k | } else { |
3372 | 1.48k | pm_buffer_append_string(buffer, "null", 4); |
3373 | 1.48k | } |
3374 | | |
3375 | 3.70k | pm_buffer_append_byte(buffer, '}'); |
3376 | 3.70k | break; |
3377 | 0 | } |
3378 | 645 | case PM_INTERPOLATED_SYMBOL_NODE: { Branch (3378:9): [True: 645, False: 724k]
|
3379 | 645 | pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedSymbolNode\",\"location\":", 44); |
3380 | | |
3381 | 645 | const pm_interpolated_symbol_node_t *cast = (const pm_interpolated_symbol_node_t *) node; |
3382 | 645 | pm_dump_json_location(buffer, &cast->base.location); |
3383 | | |
3384 | | // Dump the opening_loc field |
3385 | 645 | pm_buffer_append_byte(buffer, ','); |
3386 | 645 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
3387 | 645 | if (cast->opening_loc.length != 0) { Branch (3387:17): [True: 308, False: 337]
|
3388 | 308 | pm_dump_json_location(buffer, &cast->opening_loc); |
3389 | 337 | } else { |
3390 | 337 | pm_buffer_append_string(buffer, "null", 4); |
3391 | 337 | } |
3392 | | |
3393 | | // Dump the parts field |
3394 | 645 | pm_buffer_append_byte(buffer, ','); |
3395 | 645 | pm_buffer_append_string(buffer, "\"parts\":", 8); |
3396 | 645 | const pm_node_list_t *parts = &cast->parts; |
3397 | 645 | pm_buffer_append_byte(buffer, '['); |
3398 | | |
3399 | 2.02k | for (size_t index = 0; index < parts->size; index++1.38k ) { Branch (3399:36): [True: 1.38k, False: 645]
|
3400 | 1.38k | if (index != 0) pm_buffer_append_byte(buffer, ',')742 ; Branch (3400:21): [True: 742, False: 642]
|
3401 | 1.38k | pm_dump_json(buffer, parser, parts->nodes[index]); |
3402 | 1.38k | } |
3403 | 645 | pm_buffer_append_byte(buffer, ']'); |
3404 | | |
3405 | | // Dump the closing_loc field |
3406 | 645 | pm_buffer_append_byte(buffer, ','); |
3407 | 645 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
3408 | 645 | if (cast->closing_loc.length != 0) { Branch (3408:17): [True: 283, False: 362]
|
3409 | 283 | pm_dump_json_location(buffer, &cast->closing_loc); |
3410 | 362 | } else { |
3411 | 362 | pm_buffer_append_string(buffer, "null", 4); |
3412 | 362 | } |
3413 | | |
3414 | 645 | pm_buffer_append_byte(buffer, '}'); |
3415 | 645 | break; |
3416 | 0 | } |
3417 | 288 | case PM_INTERPOLATED_X_STRING_NODE: { Branch (3417:9): [True: 288, False: 724k]
|
3418 | 288 | pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedXStringNode\",\"location\":", 45); |
3419 | | |
3420 | 288 | const pm_interpolated_x_string_node_t *cast = (const pm_interpolated_x_string_node_t *) node; |
3421 | 288 | pm_dump_json_location(buffer, &cast->base.location); |
3422 | | |
3423 | | // Dump the opening_loc field |
3424 | 288 | pm_buffer_append_byte(buffer, ','); |
3425 | 288 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
3426 | 288 | pm_dump_json_location(buffer, &cast->opening_loc); |
3427 | | |
3428 | | // Dump the parts field |
3429 | 288 | pm_buffer_append_byte(buffer, ','); |
3430 | 288 | pm_buffer_append_string(buffer, "\"parts\":", 8); |
3431 | 288 | const pm_node_list_t *parts = &cast->parts; |
3432 | 288 | pm_buffer_append_byte(buffer, '['); |
3433 | | |
3434 | 1.32k | for (size_t index = 0; index < parts->size; index++1.04k ) { Branch (3434:36): [True: 1.04k, False: 288]
|
3435 | 1.04k | if (index != 0) pm_buffer_append_byte(buffer, ',')757 ; Branch (3435:21): [True: 757, False: 284]
|
3436 | 1.04k | pm_dump_json(buffer, parser, parts->nodes[index]); |
3437 | 1.04k | } |
3438 | 288 | pm_buffer_append_byte(buffer, ']'); |
3439 | | |
3440 | | // Dump the closing_loc field |
3441 | 288 | pm_buffer_append_byte(buffer, ','); |
3442 | 288 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
3443 | 288 | pm_dump_json_location(buffer, &cast->closing_loc); |
3444 | | |
3445 | 288 | pm_buffer_append_byte(buffer, '}'); |
3446 | 288 | break; |
3447 | 0 | } |
3448 | 173 | case PM_IT_LOCAL_VARIABLE_READ_NODE: { Branch (3448:9): [True: 173, False: 725k]
|
3449 | 173 | pm_buffer_append_string(buffer, "{\"type\":\"ItLocalVariableReadNode\",\"location\":", 45); |
3450 | | |
3451 | 173 | const pm_it_local_variable_read_node_t *cast = (const pm_it_local_variable_read_node_t *) node; |
3452 | 173 | pm_dump_json_location(buffer, &cast->base.location); |
3453 | | |
3454 | 173 | pm_buffer_append_byte(buffer, '}'); |
3455 | 173 | break; |
3456 | 0 | } |
3457 | 98 | case PM_IT_PARAMETERS_NODE: { Branch (3457:9): [True: 98, False: 725k]
|
3458 | 98 | pm_buffer_append_string(buffer, "{\"type\":\"ItParametersNode\",\"location\":", 38); |
3459 | | |
3460 | 98 | const pm_it_parameters_node_t *cast = (const pm_it_parameters_node_t *) node; |
3461 | 98 | pm_dump_json_location(buffer, &cast->base.location); |
3462 | | |
3463 | 98 | pm_buffer_append_byte(buffer, '}'); |
3464 | 98 | break; |
3465 | 0 | } |
3466 | 4.06k | case PM_KEYWORD_HASH_NODE: { Branch (3466:9): [True: 4.06k, False: 721k]
|
3467 | 4.06k | pm_buffer_append_string(buffer, "{\"type\":\"KeywordHashNode\",\"location\":", 37); |
3468 | | |
3469 | 4.06k | const pm_keyword_hash_node_t *cast = (const pm_keyword_hash_node_t *) node; |
3470 | 4.06k | pm_dump_json_location(buffer, &cast->base.location); |
3471 | | |
3472 | | // Dump the KeywordHashNodeFlags field |
3473 | 4.06k | pm_buffer_append_byte(buffer, ','); |
3474 | 4.06k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
3475 | 4.06k | size_t flags = 0; |
3476 | 4.06k | pm_buffer_append_byte(buffer, '['); |
3477 | 4.06k | if (PM_NODE_FLAG_P(cast, PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS)) { |
3478 | 1.35k | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3478:21): [True: 0, False: 1.35k]
|
3479 | 1.35k | pm_buffer_append_string(buffer, "\"SYMBOL_KEYS\"", 13); |
3480 | 1.35k | flags++; |
3481 | 1.35k | } |
3482 | 4.06k | pm_buffer_append_byte(buffer, ']'); |
3483 | | |
3484 | | // Dump the elements field |
3485 | 4.06k | pm_buffer_append_byte(buffer, ','); |
3486 | 4.06k | pm_buffer_append_string(buffer, "\"elements\":", 11); |
3487 | 4.06k | const pm_node_list_t *elements = &cast->elements; |
3488 | 4.06k | pm_buffer_append_byte(buffer, '['); |
3489 | | |
3490 | 8.72k | for (size_t index = 0; index < elements->size; index++4.66k ) { Branch (3490:36): [True: 4.66k, False: 4.06k]
|
3491 | 4.66k | if (index != 0) pm_buffer_append_byte(buffer, ',')594 ; Branch (3491:21): [True: 594, False: 4.06k]
|
3492 | 4.66k | pm_dump_json(buffer, parser, elements->nodes[index]); |
3493 | 4.66k | } |
3494 | 4.06k | pm_buffer_append_byte(buffer, ']'); |
3495 | | |
3496 | 4.06k | pm_buffer_append_byte(buffer, '}'); |
3497 | 4.06k | break; |
3498 | 0 | } |
3499 | 529 | case PM_KEYWORD_REST_PARAMETER_NODE: { Branch (3499:9): [True: 529, False: 724k]
|
3500 | 529 | pm_buffer_append_string(buffer, "{\"type\":\"KeywordRestParameterNode\",\"location\":", 46); |
3501 | | |
3502 | 529 | const pm_keyword_rest_parameter_node_t *cast = (const pm_keyword_rest_parameter_node_t *) node; |
3503 | 529 | pm_dump_json_location(buffer, &cast->base.location); |
3504 | | |
3505 | | // Dump the ParameterFlags field |
3506 | 529 | pm_buffer_append_byte(buffer, ','); |
3507 | 529 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
3508 | 529 | size_t flags = 0; |
3509 | 529 | pm_buffer_append_byte(buffer, '['); |
3510 | 529 | if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) { |
3511 | 42 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3511:21): [True: 0, False: 42]
|
3512 | 42 | pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20); |
3513 | 42 | flags++; |
3514 | 42 | } |
3515 | 529 | pm_buffer_append_byte(buffer, ']'); |
3516 | | |
3517 | | // Dump the name field |
3518 | 529 | pm_buffer_append_byte(buffer, ','); |
3519 | 529 | pm_buffer_append_string(buffer, "\"name\":", 7); |
3520 | 529 | if (cast->name != PM_CONSTANT_ID_UNSET) { Branch (3520:17): [True: 371, False: 158]
|
3521 | 371 | pm_dump_json_constant(buffer, parser, cast->name); |
3522 | 371 | } else { |
3523 | 158 | pm_buffer_append_string(buffer, "null", 4); |
3524 | 158 | } |
3525 | | |
3526 | | // Dump the name_loc field |
3527 | 529 | pm_buffer_append_byte(buffer, ','); |
3528 | 529 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
3529 | 529 | if (cast->name_loc.length != 0) { Branch (3529:17): [True: 371, False: 158]
|
3530 | 371 | pm_dump_json_location(buffer, &cast->name_loc); |
3531 | 371 | } else { |
3532 | 158 | pm_buffer_append_string(buffer, "null", 4); |
3533 | 158 | } |
3534 | | |
3535 | | // Dump the operator_loc field |
3536 | 529 | pm_buffer_append_byte(buffer, ','); |
3537 | 529 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
3538 | 529 | pm_dump_json_location(buffer, &cast->operator_loc); |
3539 | | |
3540 | 529 | pm_buffer_append_byte(buffer, '}'); |
3541 | 529 | break; |
3542 | 0 | } |
3543 | 1.45k | case PM_LAMBDA_NODE: { Branch (3543:9): [True: 1.45k, False: 723k]
|
3544 | 1.45k | pm_buffer_append_string(buffer, "{\"type\":\"LambdaNode\",\"location\":", 32); |
3545 | | |
3546 | 1.45k | const pm_lambda_node_t *cast = (const pm_lambda_node_t *) node; |
3547 | 1.45k | pm_dump_json_location(buffer, &cast->base.location); |
3548 | | |
3549 | | // Dump the locals field |
3550 | 1.45k | pm_buffer_append_byte(buffer, ','); |
3551 | 1.45k | pm_buffer_append_string(buffer, "\"locals\":", 9); |
3552 | 1.45k | const pm_constant_id_list_t *locals = &cast->locals; |
3553 | 1.45k | pm_buffer_append_byte(buffer, '['); |
3554 | | |
3555 | 3.67k | for (size_t index = 0; index < locals->size; index++2.21k ) { Branch (3555:36): [True: 2.21k, False: 1.45k]
|
3556 | 2.21k | if (index != 0) pm_buffer_append_byte(buffer, ',')1.44k ; Branch (3556:21): [True: 1.44k, False: 769]
|
3557 | 2.21k | pm_dump_json_constant(buffer, parser, locals->ids[index]); |
3558 | 2.21k | } |
3559 | 1.45k | pm_buffer_append_byte(buffer, ']'); |
3560 | | |
3561 | | // Dump the operator_loc field |
3562 | 1.45k | pm_buffer_append_byte(buffer, ','); |
3563 | 1.45k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
3564 | 1.45k | pm_dump_json_location(buffer, &cast->operator_loc); |
3565 | | |
3566 | | // Dump the opening_loc field |
3567 | 1.45k | pm_buffer_append_byte(buffer, ','); |
3568 | 1.45k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
3569 | 1.45k | pm_dump_json_location(buffer, &cast->opening_loc); |
3570 | | |
3571 | | // Dump the closing_loc field |
3572 | 1.45k | pm_buffer_append_byte(buffer, ','); |
3573 | 1.45k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
3574 | 1.45k | pm_dump_json_location(buffer, &cast->closing_loc); |
3575 | | |
3576 | | // Dump the parameters field |
3577 | 1.45k | pm_buffer_append_byte(buffer, ','); |
3578 | 1.45k | pm_buffer_append_string(buffer, "\"parameters\":", 13); |
3579 | 1.45k | if (cast->parameters != NULL) { Branch (3579:17): [True: 747, False: 708]
|
3580 | 747 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters); |
3581 | 747 | } else { |
3582 | 708 | pm_buffer_append_string(buffer, "null", 4); |
3583 | 708 | } |
3584 | | |
3585 | | // Dump the body field |
3586 | 1.45k | pm_buffer_append_byte(buffer, ','); |
3587 | 1.45k | pm_buffer_append_string(buffer, "\"body\":", 7); |
3588 | 1.45k | if (cast->body != NULL) { Branch (3588:17): [True: 1.29k, False: 165]
|
3589 | 1.29k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->body); |
3590 | 1.29k | } else { |
3591 | 165 | pm_buffer_append_string(buffer, "null", 4); |
3592 | 165 | } |
3593 | | |
3594 | 1.45k | pm_buffer_append_byte(buffer, '}'); |
3595 | 1.45k | break; |
3596 | 0 | } |
3597 | 78 | case PM_LOCAL_VARIABLE_AND_WRITE_NODE: { Branch (3597:9): [True: 78, False: 725k]
|
3598 | 78 | pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableAndWriteNode\",\"location\":", 47); |
3599 | | |
3600 | 78 | const pm_local_variable_and_write_node_t *cast = (const pm_local_variable_and_write_node_t *) node; |
3601 | 78 | pm_dump_json_location(buffer, &cast->base.location); |
3602 | | |
3603 | | // Dump the name_loc field |
3604 | 78 | pm_buffer_append_byte(buffer, ','); |
3605 | 78 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
3606 | 78 | pm_dump_json_location(buffer, &cast->name_loc); |
3607 | | |
3608 | | // Dump the operator_loc field |
3609 | 78 | pm_buffer_append_byte(buffer, ','); |
3610 | 78 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
3611 | 78 | pm_dump_json_location(buffer, &cast->operator_loc); |
3612 | | |
3613 | | // Dump the value field |
3614 | 78 | pm_buffer_append_byte(buffer, ','); |
3615 | 78 | pm_buffer_append_string(buffer, "\"value\":", 8); |
3616 | 78 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
3617 | | |
3618 | | // Dump the name field |
3619 | 78 | pm_buffer_append_byte(buffer, ','); |
3620 | 78 | pm_buffer_append_string(buffer, "\"name\":", 7); |
3621 | 78 | pm_dump_json_constant(buffer, parser, cast->name); |
3622 | | |
3623 | | // Dump the depth field |
3624 | 78 | pm_buffer_append_byte(buffer, ','); |
3625 | 78 | pm_buffer_append_string(buffer, "\"depth\":", 8); |
3626 | 78 | pm_buffer_append_format(buffer, "%" PRIu32, cast->depth); |
3627 | | |
3628 | 78 | pm_buffer_append_byte(buffer, '}'); |
3629 | 78 | break; |
3630 | 0 | } |
3631 | 384 | case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: { Branch (3631:9): [True: 384, False: 724k]
|
3632 | 384 | pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableOperatorWriteNode\",\"location\":", 52); |
3633 | | |
3634 | 384 | const pm_local_variable_operator_write_node_t *cast = (const pm_local_variable_operator_write_node_t *) node; |
3635 | 384 | pm_dump_json_location(buffer, &cast->base.location); |
3636 | | |
3637 | | // Dump the name_loc field |
3638 | 384 | pm_buffer_append_byte(buffer, ','); |
3639 | 384 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
3640 | 384 | pm_dump_json_location(buffer, &cast->name_loc); |
3641 | | |
3642 | | // Dump the binary_operator_loc field |
3643 | 384 | pm_buffer_append_byte(buffer, ','); |
3644 | 384 | pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22); |
3645 | 384 | pm_dump_json_location(buffer, &cast->binary_operator_loc); |
3646 | | |
3647 | | // Dump the value field |
3648 | 384 | pm_buffer_append_byte(buffer, ','); |
3649 | 384 | pm_buffer_append_string(buffer, "\"value\":", 8); |
3650 | 384 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
3651 | | |
3652 | | // Dump the name field |
3653 | 384 | pm_buffer_append_byte(buffer, ','); |
3654 | 384 | pm_buffer_append_string(buffer, "\"name\":", 7); |
3655 | 384 | pm_dump_json_constant(buffer, parser, cast->name); |
3656 | | |
3657 | | // Dump the binary_operator field |
3658 | 384 | pm_buffer_append_byte(buffer, ','); |
3659 | 384 | pm_buffer_append_string(buffer, "\"binary_operator\":", 18); |
3660 | 384 | pm_dump_json_constant(buffer, parser, cast->binary_operator); |
3661 | | |
3662 | | // Dump the depth field |
3663 | 384 | pm_buffer_append_byte(buffer, ','); |
3664 | 384 | pm_buffer_append_string(buffer, "\"depth\":", 8); |
3665 | 384 | pm_buffer_append_format(buffer, "%" PRIu32, cast->depth); |
3666 | | |
3667 | 384 | pm_buffer_append_byte(buffer, '}'); |
3668 | 384 | break; |
3669 | 0 | } |
3670 | 77 | case PM_LOCAL_VARIABLE_OR_WRITE_NODE: { Branch (3670:9): [True: 77, False: 725k]
|
3671 | 77 | pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableOrWriteNode\",\"location\":", 46); |
3672 | | |
3673 | 77 | const pm_local_variable_or_write_node_t *cast = (const pm_local_variable_or_write_node_t *) node; |
3674 | 77 | pm_dump_json_location(buffer, &cast->base.location); |
3675 | | |
3676 | | // Dump the name_loc field |
3677 | 77 | pm_buffer_append_byte(buffer, ','); |
3678 | 77 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
3679 | 77 | pm_dump_json_location(buffer, &cast->name_loc); |
3680 | | |
3681 | | // Dump the operator_loc field |
3682 | 77 | pm_buffer_append_byte(buffer, ','); |
3683 | 77 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
3684 | 77 | pm_dump_json_location(buffer, &cast->operator_loc); |
3685 | | |
3686 | | // Dump the value field |
3687 | 77 | pm_buffer_append_byte(buffer, ','); |
3688 | 77 | pm_buffer_append_string(buffer, "\"value\":", 8); |
3689 | 77 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
3690 | | |
3691 | | // Dump the name field |
3692 | 77 | pm_buffer_append_byte(buffer, ','); |
3693 | 77 | pm_buffer_append_string(buffer, "\"name\":", 7); |
3694 | 77 | pm_dump_json_constant(buffer, parser, cast->name); |
3695 | | |
3696 | | // Dump the depth field |
3697 | 77 | pm_buffer_append_byte(buffer, ','); |
3698 | 77 | pm_buffer_append_string(buffer, "\"depth\":", 8); |
3699 | 77 | pm_buffer_append_format(buffer, "%" PRIu32, cast->depth); |
3700 | | |
3701 | 77 | pm_buffer_append_byte(buffer, '}'); |
3702 | 77 | break; |
3703 | 0 | } |
3704 | 8.91k | case PM_LOCAL_VARIABLE_READ_NODE: { Branch (3704:9): [True: 8.91k, False: 716k]
|
3705 | 8.91k | pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableReadNode\",\"location\":", 43); |
3706 | | |
3707 | 8.91k | const pm_local_variable_read_node_t *cast = (const pm_local_variable_read_node_t *) node; |
3708 | 8.91k | pm_dump_json_location(buffer, &cast->base.location); |
3709 | | |
3710 | | // Dump the name field |
3711 | 8.91k | pm_buffer_append_byte(buffer, ','); |
3712 | 8.91k | pm_buffer_append_string(buffer, "\"name\":", 7); |
3713 | 8.91k | pm_dump_json_constant(buffer, parser, cast->name); |
3714 | | |
3715 | | // Dump the depth field |
3716 | 8.91k | pm_buffer_append_byte(buffer, ','); |
3717 | 8.91k | pm_buffer_append_string(buffer, "\"depth\":", 8); |
3718 | 8.91k | pm_buffer_append_format(buffer, "%" PRIu32, cast->depth); |
3719 | | |
3720 | 8.91k | pm_buffer_append_byte(buffer, '}'); |
3721 | 8.91k | break; |
3722 | 0 | } |
3723 | 13.5k | case PM_LOCAL_VARIABLE_TARGET_NODE: { Branch (3723:9): [True: 13.5k, False: 711k]
|
3724 | 13.5k | pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableTargetNode\",\"location\":", 45); |
3725 | | |
3726 | 13.5k | const pm_local_variable_target_node_t *cast = (const pm_local_variable_target_node_t *) node; |
3727 | 13.5k | pm_dump_json_location(buffer, &cast->base.location); |
3728 | | |
3729 | | // Dump the name field |
3730 | 13.5k | pm_buffer_append_byte(buffer, ','); |
3731 | 13.5k | pm_buffer_append_string(buffer, "\"name\":", 7); |
3732 | 13.5k | pm_dump_json_constant(buffer, parser, cast->name); |
3733 | | |
3734 | | // Dump the depth field |
3735 | 13.5k | pm_buffer_append_byte(buffer, ','); |
3736 | 13.5k | pm_buffer_append_string(buffer, "\"depth\":", 8); |
3737 | 13.5k | pm_buffer_append_format(buffer, "%" PRIu32, cast->depth); |
3738 | | |
3739 | 13.5k | pm_buffer_append_byte(buffer, '}'); |
3740 | 13.5k | break; |
3741 | 0 | } |
3742 | 10.3k | case PM_LOCAL_VARIABLE_WRITE_NODE: { Branch (3742:9): [True: 10.3k, False: 714k]
|
3743 | 10.3k | pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableWriteNode\",\"location\":", 44); |
3744 | | |
3745 | 10.3k | const pm_local_variable_write_node_t *cast = (const pm_local_variable_write_node_t *) node; |
3746 | 10.3k | pm_dump_json_location(buffer, &cast->base.location); |
3747 | | |
3748 | | // Dump the name field |
3749 | 10.3k | pm_buffer_append_byte(buffer, ','); |
3750 | 10.3k | pm_buffer_append_string(buffer, "\"name\":", 7); |
3751 | 10.3k | pm_dump_json_constant(buffer, parser, cast->name); |
3752 | | |
3753 | | // Dump the depth field |
3754 | 10.3k | pm_buffer_append_byte(buffer, ','); |
3755 | 10.3k | pm_buffer_append_string(buffer, "\"depth\":", 8); |
3756 | 10.3k | pm_buffer_append_format(buffer, "%" PRIu32, cast->depth); |
3757 | | |
3758 | | // Dump the name_loc field |
3759 | 10.3k | pm_buffer_append_byte(buffer, ','); |
3760 | 10.3k | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
3761 | 10.3k | pm_dump_json_location(buffer, &cast->name_loc); |
3762 | | |
3763 | | // Dump the value field |
3764 | 10.3k | pm_buffer_append_byte(buffer, ','); |
3765 | 10.3k | pm_buffer_append_string(buffer, "\"value\":", 8); |
3766 | 10.3k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
3767 | | |
3768 | | // Dump the operator_loc field |
3769 | 10.3k | pm_buffer_append_byte(buffer, ','); |
3770 | 10.3k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
3771 | 10.3k | pm_dump_json_location(buffer, &cast->operator_loc); |
3772 | | |
3773 | 10.3k | pm_buffer_append_byte(buffer, '}'); |
3774 | 10.3k | break; |
3775 | 0 | } |
3776 | 27 | case PM_MATCH_LAST_LINE_NODE: { Branch (3776:9): [True: 27, False: 725k]
|
3777 | 27 | pm_buffer_append_string(buffer, "{\"type\":\"MatchLastLineNode\",\"location\":", 39); |
3778 | | |
3779 | 27 | const pm_match_last_line_node_t *cast = (const pm_match_last_line_node_t *) node; |
3780 | 27 | pm_dump_json_location(buffer, &cast->base.location); |
3781 | | |
3782 | | // Dump the RegularExpressionFlags field |
3783 | 27 | pm_buffer_append_byte(buffer, ','); |
3784 | 27 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
3785 | 27 | size_t flags = 0; |
3786 | 27 | pm_buffer_append_byte(buffer, '['); |
3787 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) { |
3788 | 9 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (3788:21): [True: 0, False: 9]
|
3789 | 9 | pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13); |
3790 | 9 | flags++; |
3791 | 9 | } |
3792 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) { |
3793 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3793:21): [True: 0, False: 0]
|
3794 | 0 | pm_buffer_append_string(buffer, "\"EXTENDED\"", 10); |
3795 | 0 | flags++; |
3796 | 0 | } |
3797 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) { |
3798 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3798:21): [True: 0, False: 0]
|
3799 | 0 | pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12); |
3800 | 0 | flags++; |
3801 | 0 | } |
3802 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) { |
3803 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3803:21): [True: 0, False: 0]
|
3804 | 0 | pm_buffer_append_string(buffer, "\"ONCE\"", 6); |
3805 | 0 | flags++; |
3806 | 0 | } |
3807 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) { |
3808 | 1 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3808:21): [True: 1, False: 0]
|
3809 | 1 | pm_buffer_append_string(buffer, "\"EUC_JP\"", 8); |
3810 | 1 | flags++; |
3811 | 1 | } |
3812 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) { |
3813 | 2 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3813:21): [True: 2, False: 0]
|
3814 | 2 | pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12); |
3815 | 2 | flags++; |
3816 | 2 | } |
3817 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) { |
3818 | 10 | if (flags != 0) pm_buffer_append_byte(buffer, ',')1 ; Branch (3818:21): [True: 1, False: 9]
|
3819 | 10 | pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13); |
3820 | 10 | flags++; |
3821 | 10 | } |
3822 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) { |
3823 | 1 | if (flags != 0) pm_buffer_append_byte(buffer, ','); ★ main-7: BR: True (1x) Branch (3823:21): [True: 1, False: 0]
|
3824 | 1 | pm_buffer_append_string(buffer, "\"UTF_8\"", 7); |
3825 | 1 | flags++; |
3826 | 1 | } |
3827 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) { |
3828 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3828:21): [True: 0, False: 0]
|
3829 | 0 | pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22); |
3830 | 0 | flags++; |
3831 | 0 | } |
3832 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) { |
3833 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (3833:21): [True: 0, False: 0]
|
3834 | 0 | pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24); |
3835 | 0 | flags++; |
3836 | 0 | } |
3837 | 27 | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) { |
3838 | 15 | if (flags != 0) pm_buffer_append_byte(buffer, ',')6 ; Branch (3838:21): [True: 6, False: 9]
|
3839 | 15 | pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26); |
3840 | 15 | flags++; |
3841 | 15 | } |
3842 | 27 | pm_buffer_append_byte(buffer, ']'); |
3843 | | |
3844 | | // Dump the opening_loc field |
3845 | 27 | pm_buffer_append_byte(buffer, ','); |
3846 | 27 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
3847 | 27 | pm_dump_json_location(buffer, &cast->opening_loc); |
3848 | | |
3849 | | // Dump the content_loc field |
3850 | 27 | pm_buffer_append_byte(buffer, ','); |
3851 | 27 | pm_buffer_append_string(buffer, "\"content_loc\":", 14); |
3852 | 27 | pm_dump_json_location(buffer, &cast->content_loc); |
3853 | | |
3854 | | // Dump the closing_loc field |
3855 | 27 | pm_buffer_append_byte(buffer, ','); |
3856 | 27 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
3857 | 27 | pm_dump_json_location(buffer, &cast->closing_loc); |
3858 | | |
3859 | | // Dump the unescaped field |
3860 | 27 | pm_buffer_append_byte(buffer, ','); |
3861 | 27 | pm_buffer_append_string(buffer, "\"unescaped\":", 12); |
3862 | 27 | const pm_string_t *unescaped = &cast->unescaped; |
3863 | 27 | pm_buffer_append_byte(buffer, '"'); |
3864 | 27 | pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON); |
3865 | 27 | pm_buffer_append_byte(buffer, '"'); |
3866 | | |
3867 | 27 | pm_buffer_append_byte(buffer, '}'); |
3868 | 27 | break; |
3869 | 0 | } |
3870 | 1.88k | case PM_MATCH_PREDICATE_NODE: { Branch (3870:9): [True: 1.88k, False: 723k]
|
3871 | 1.88k | pm_buffer_append_string(buffer, "{\"type\":\"MatchPredicateNode\",\"location\":", 40); |
3872 | | |
3873 | 1.88k | const pm_match_predicate_node_t *cast = (const pm_match_predicate_node_t *) node; |
3874 | 1.88k | pm_dump_json_location(buffer, &cast->base.location); |
3875 | | |
3876 | | // Dump the value field |
3877 | 1.88k | pm_buffer_append_byte(buffer, ','); |
3878 | 1.88k | pm_buffer_append_string(buffer, "\"value\":", 8); |
3879 | 1.88k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
3880 | | |
3881 | | // Dump the pattern field |
3882 | 1.88k | pm_buffer_append_byte(buffer, ','); |
3883 | 1.88k | pm_buffer_append_string(buffer, "\"pattern\":", 10); |
3884 | 1.88k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern); |
3885 | | |
3886 | | // Dump the keyword_loc field |
3887 | 1.88k | pm_buffer_append_byte(buffer, ','); |
3888 | 1.88k | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
3889 | 1.88k | pm_dump_json_location(buffer, &cast->keyword_loc); |
3890 | | |
3891 | 1.88k | pm_buffer_append_byte(buffer, '}'); |
3892 | 1.88k | break; |
3893 | 0 | } |
3894 | 3.76k | case PM_MATCH_REQUIRED_NODE: { Branch (3894:9): [True: 3.76k, False: 721k]
|
3895 | 3.76k | pm_buffer_append_string(buffer, "{\"type\":\"MatchRequiredNode\",\"location\":", 39); |
3896 | | |
3897 | 3.76k | const pm_match_required_node_t *cast = (const pm_match_required_node_t *) node; |
3898 | 3.76k | pm_dump_json_location(buffer, &cast->base.location); |
3899 | | |
3900 | | // Dump the value field |
3901 | 3.76k | pm_buffer_append_byte(buffer, ','); |
3902 | 3.76k | pm_buffer_append_string(buffer, "\"value\":", 8); |
3903 | 3.76k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
3904 | | |
3905 | | // Dump the pattern field |
3906 | 3.76k | pm_buffer_append_byte(buffer, ','); |
3907 | 3.76k | pm_buffer_append_string(buffer, "\"pattern\":", 10); |
3908 | 3.76k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern); |
3909 | | |
3910 | | // Dump the operator_loc field |
3911 | 3.76k | pm_buffer_append_byte(buffer, ','); |
3912 | 3.76k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
3913 | 3.76k | pm_dump_json_location(buffer, &cast->operator_loc); |
3914 | | |
3915 | 3.76k | pm_buffer_append_byte(buffer, '}'); |
3916 | 3.76k | break; |
3917 | 0 | } |
3918 | 915 | case PM_MATCH_WRITE_NODE: { Branch (3918:9): [True: 915, False: 724k]
|
3919 | 915 | pm_buffer_append_string(buffer, "{\"type\":\"MatchWriteNode\",\"location\":", 36); |
3920 | | |
3921 | 915 | const pm_match_write_node_t *cast = (const pm_match_write_node_t *) node; |
3922 | 915 | pm_dump_json_location(buffer, &cast->base.location); |
3923 | | |
3924 | | // Dump the call field |
3925 | 915 | pm_buffer_append_byte(buffer, ','); |
3926 | 915 | pm_buffer_append_string(buffer, "\"call\":", 7); |
3927 | 915 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->call); |
3928 | | |
3929 | | // Dump the targets field |
3930 | 915 | pm_buffer_append_byte(buffer, ','); |
3931 | 915 | pm_buffer_append_string(buffer, "\"targets\":", 10); |
3932 | 915 | const pm_node_list_t *targets = &cast->targets; |
3933 | 915 | pm_buffer_append_byte(buffer, '['); |
3934 | | |
3935 | 3.22k | for (size_t index = 0; index < targets->size; index++2.30k ) { Branch (3935:36): [True: 2.30k, False: 915]
|
3936 | 2.30k | if (index != 0) pm_buffer_append_byte(buffer, ',')1.39k ; Branch (3936:21): [True: 1.39k, False: 915]
|
3937 | 2.30k | pm_dump_json(buffer, parser, targets->nodes[index]); |
3938 | 2.30k | } |
3939 | 915 | pm_buffer_append_byte(buffer, ']'); |
3940 | | |
3941 | 915 | pm_buffer_append_byte(buffer, '}'); |
3942 | 915 | break; |
3943 | 0 | } |
3944 | 1.09k | case PM_MODULE_NODE: { Branch (3944:9): [True: 1.09k, False: 724k]
|
3945 | 1.09k | pm_buffer_append_string(buffer, "{\"type\":\"ModuleNode\",\"location\":", 32); |
3946 | | |
3947 | 1.09k | const pm_module_node_t *cast = (const pm_module_node_t *) node; |
3948 | 1.09k | pm_dump_json_location(buffer, &cast->base.location); |
3949 | | |
3950 | | // Dump the locals field |
3951 | 1.09k | pm_buffer_append_byte(buffer, ','); |
3952 | 1.09k | pm_buffer_append_string(buffer, "\"locals\":", 9); |
3953 | 1.09k | const pm_constant_id_list_t *locals = &cast->locals; |
3954 | 1.09k | pm_buffer_append_byte(buffer, '['); |
3955 | | |
3956 | 1.60k | for (size_t index = 0; index < locals->size; index++513 ) { Branch (3956:36): [True: 513, False: 1.09k]
|
3957 | 513 | if (index != 0) pm_buffer_append_byte(buffer, ',')20 ; Branch (3957:21): [True: 20, False: 493]
|
3958 | 513 | pm_dump_json_constant(buffer, parser, locals->ids[index]); |
3959 | 513 | } |
3960 | 1.09k | pm_buffer_append_byte(buffer, ']'); |
3961 | | |
3962 | | // Dump the module_keyword_loc field |
3963 | 1.09k | pm_buffer_append_byte(buffer, ','); |
3964 | 1.09k | pm_buffer_append_string(buffer, "\"module_keyword_loc\":", 21); |
3965 | 1.09k | pm_dump_json_location(buffer, &cast->module_keyword_loc); |
3966 | | |
3967 | | // Dump the constant_path field |
3968 | 1.09k | pm_buffer_append_byte(buffer, ','); |
3969 | 1.09k | pm_buffer_append_string(buffer, "\"constant_path\":", 16); |
3970 | 1.09k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant_path); |
3971 | | |
3972 | | // Dump the body field |
3973 | 1.09k | pm_buffer_append_byte(buffer, ','); |
3974 | 1.09k | pm_buffer_append_string(buffer, "\"body\":", 7); |
3975 | 1.09k | if (cast->body != NULL) { Branch (3975:17): [True: 1.00k, False: 90]
|
3976 | 1.00k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->body); |
3977 | 1.00k | } else { |
3978 | 90 | pm_buffer_append_string(buffer, "null", 4); |
3979 | 90 | } |
3980 | | |
3981 | | // Dump the end_keyword_loc field |
3982 | 1.09k | pm_buffer_append_byte(buffer, ','); |
3983 | 1.09k | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
3984 | 1.09k | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
3985 | | |
3986 | | // Dump the name field |
3987 | 1.09k | pm_buffer_append_byte(buffer, ','); |
3988 | 1.09k | pm_buffer_append_string(buffer, "\"name\":", 7); |
3989 | 1.09k | pm_dump_json_constant(buffer, parser, cast->name); |
3990 | | |
3991 | 1.09k | pm_buffer_append_byte(buffer, '}'); |
3992 | 1.09k | break; |
3993 | 0 | } |
3994 | 3.94k | case PM_MULTI_TARGET_NODE: { Branch (3994:9): [True: 3.94k, False: 721k]
|
3995 | 3.94k | pm_buffer_append_string(buffer, "{\"type\":\"MultiTargetNode\",\"location\":", 37); |
3996 | | |
3997 | 3.94k | const pm_multi_target_node_t *cast = (const pm_multi_target_node_t *) node; |
3998 | 3.94k | pm_dump_json_location(buffer, &cast->base.location); |
3999 | | |
4000 | | // Dump the lefts field |
4001 | 3.94k | pm_buffer_append_byte(buffer, ','); |
4002 | 3.94k | pm_buffer_append_string(buffer, "\"lefts\":", 8); |
4003 | 3.94k | const pm_node_list_t *lefts = &cast->lefts; |
4004 | 3.94k | pm_buffer_append_byte(buffer, '['); |
4005 | | |
4006 | 9.99k | for (size_t index = 0; index < lefts->size; index++6.04k ) { Branch (4006:36): [True: 6.04k, False: 3.94k]
|
4007 | 6.04k | if (index != 0) pm_buffer_append_byte(buffer, ',')2.59k ; Branch (4007:21): [True: 2.59k, False: 3.45k]
|
4008 | 6.04k | pm_dump_json(buffer, parser, lefts->nodes[index]); |
4009 | 6.04k | } |
4010 | 3.94k | pm_buffer_append_byte(buffer, ']'); |
4011 | | |
4012 | | // Dump the rest field |
4013 | 3.94k | pm_buffer_append_byte(buffer, ','); |
4014 | 3.94k | pm_buffer_append_string(buffer, "\"rest\":", 7); |
4015 | 3.94k | if (cast->rest != NULL) { Branch (4015:17): [True: 1.56k, False: 2.38k]
|
4016 | 1.56k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest); |
4017 | 2.38k | } else { |
4018 | 2.38k | pm_buffer_append_string(buffer, "null", 4); |
4019 | 2.38k | } |
4020 | | |
4021 | | // Dump the rights field |
4022 | 3.94k | pm_buffer_append_byte(buffer, ','); |
4023 | 3.94k | pm_buffer_append_string(buffer, "\"rights\":", 9); |
4024 | 3.94k | const pm_node_list_t *rights = &cast->rights; |
4025 | 3.94k | pm_buffer_append_byte(buffer, '['); |
4026 | | |
4027 | 4.93k | for (size_t index = 0; index < rights->size; index++985 ) { Branch (4027:36): [True: 985, False: 3.94k]
|
4028 | 985 | if (index != 0) pm_buffer_append_byte(buffer, ',')362 ; Branch (4028:21): [True: 362, False: 623]
|
4029 | 985 | pm_dump_json(buffer, parser, rights->nodes[index]); |
4030 | 985 | } |
4031 | 3.94k | pm_buffer_append_byte(buffer, ']'); |
4032 | | |
4033 | | // Dump the lparen_loc field |
4034 | 3.94k | pm_buffer_append_byte(buffer, ','); |
4035 | 3.94k | pm_buffer_append_string(buffer, "\"lparen_loc\":", 13); |
4036 | 3.94k | if (cast->lparen_loc.length != 0) { Branch (4036:17): [True: 2.19k, False: 1.75k]
|
4037 | 2.19k | pm_dump_json_location(buffer, &cast->lparen_loc); |
4038 | 2.19k | } else { |
4039 | 1.75k | pm_buffer_append_string(buffer, "null", 4); |
4040 | 1.75k | } |
4041 | | |
4042 | | // Dump the rparen_loc field |
4043 | 3.94k | pm_buffer_append_byte(buffer, ','); |
4044 | 3.94k | pm_buffer_append_string(buffer, "\"rparen_loc\":", 13); |
4045 | 3.94k | if (cast->rparen_loc.length != 0) { Branch (4045:17): [True: 1.89k, False: 2.05k]
|
4046 | 1.89k | pm_dump_json_location(buffer, &cast->rparen_loc); |
4047 | 2.05k | } else { |
4048 | 2.05k | pm_buffer_append_string(buffer, "null", 4); |
4049 | 2.05k | } |
4050 | | |
4051 | 3.94k | pm_buffer_append_byte(buffer, '}'); |
4052 | 3.94k | break; |
4053 | 0 | } |
4054 | 1.94k | case PM_MULTI_WRITE_NODE: { Branch (4054:9): [True: 1.94k, False: 723k]
|
4055 | 1.94k | pm_buffer_append_string(buffer, "{\"type\":\"MultiWriteNode\",\"location\":", 36); |
4056 | | |
4057 | 1.94k | const pm_multi_write_node_t *cast = (const pm_multi_write_node_t *) node; |
4058 | 1.94k | pm_dump_json_location(buffer, &cast->base.location); |
4059 | | |
4060 | | // Dump the lefts field |
4061 | 1.94k | pm_buffer_append_byte(buffer, ','); |
4062 | 1.94k | pm_buffer_append_string(buffer, "\"lefts\":", 8); |
4063 | 1.94k | const pm_node_list_t *lefts = &cast->lefts; |
4064 | 1.94k | pm_buffer_append_byte(buffer, '['); |
4065 | | |
4066 | 5.20k | for (size_t index = 0; index < lefts->size; index++3.26k ) { Branch (4066:36): [True: 3.26k, False: 1.94k]
|
4067 | 3.26k | if (index != 0) pm_buffer_append_byte(buffer, ',')1.38k ; Branch (4067:21): [True: 1.38k, False: 1.88k]
|
4068 | 3.26k | pm_dump_json(buffer, parser, lefts->nodes[index]); |
4069 | 3.26k | } |
4070 | 1.94k | pm_buffer_append_byte(buffer, ']'); |
4071 | | |
4072 | | // Dump the rest field |
4073 | 1.94k | pm_buffer_append_byte(buffer, ','); |
4074 | 1.94k | pm_buffer_append_string(buffer, "\"rest\":", 7); |
4075 | 1.94k | if (cast->rest != NULL) { Branch (4075:17): [True: 739, False: 1.20k]
|
4076 | 739 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest); |
4077 | 1.20k | } else { |
4078 | 1.20k | pm_buffer_append_string(buffer, "null", 4); |
4079 | 1.20k | } |
4080 | | |
4081 | | // Dump the rights field |
4082 | 1.94k | pm_buffer_append_byte(buffer, ','); |
4083 | 1.94k | pm_buffer_append_string(buffer, "\"rights\":", 9); |
4084 | 1.94k | const pm_node_list_t *rights = &cast->rights; |
4085 | 1.94k | pm_buffer_append_byte(buffer, '['); |
4086 | | |
4087 | 2.00k | for (size_t index = 0; index < rights->size; index++58 ) { Branch (4087:36): [True: 58, False: 1.94k]
|
4088 | 58 | if (index != 0) pm_buffer_append_byte(buffer, ',')25 ; Branch (4088:21): [True: 25, False: 33]
|
4089 | 58 | pm_dump_json(buffer, parser, rights->nodes[index]); |
4090 | 58 | } |
4091 | 1.94k | pm_buffer_append_byte(buffer, ']'); |
4092 | | |
4093 | | // Dump the lparen_loc field |
4094 | 1.94k | pm_buffer_append_byte(buffer, ','); |
4095 | 1.94k | pm_buffer_append_string(buffer, "\"lparen_loc\":", 13); |
4096 | 1.94k | if (cast->lparen_loc.length != 0) { Branch (4096:17): [True: 26, False: 1.91k]
|
4097 | 26 | pm_dump_json_location(buffer, &cast->lparen_loc); |
4098 | 1.91k | } else { |
4099 | 1.91k | pm_buffer_append_string(buffer, "null", 4); |
4100 | 1.91k | } |
4101 | | |
4102 | | // Dump the rparen_loc field |
4103 | 1.94k | pm_buffer_append_byte(buffer, ','); |
4104 | 1.94k | pm_buffer_append_string(buffer, "\"rparen_loc\":", 13); |
4105 | 1.94k | if (cast->rparen_loc.length != 0) { Branch (4105:17): [True: 26, False: 1.91k]
|
4106 | 26 | pm_dump_json_location(buffer, &cast->rparen_loc); |
4107 | 1.91k | } else { |
4108 | 1.91k | pm_buffer_append_string(buffer, "null", 4); |
4109 | 1.91k | } |
4110 | | |
4111 | | // Dump the operator_loc field |
4112 | 1.94k | pm_buffer_append_byte(buffer, ','); |
4113 | 1.94k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
4114 | 1.94k | pm_dump_json_location(buffer, &cast->operator_loc); |
4115 | | |
4116 | | // Dump the value field |
4117 | 1.94k | pm_buffer_append_byte(buffer, ','); |
4118 | 1.94k | pm_buffer_append_string(buffer, "\"value\":", 8); |
4119 | 1.94k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
4120 | | |
4121 | 1.94k | pm_buffer_append_byte(buffer, '}'); |
4122 | 1.94k | break; |
4123 | 0 | } |
4124 | 1.00k | case PM_NEXT_NODE: { Branch (4124:9): [True: 1.00k, False: 724k]
|
4125 | 1.00k | pm_buffer_append_string(buffer, "{\"type\":\"NextNode\",\"location\":", 30); |
4126 | | |
4127 | 1.00k | const pm_next_node_t *cast = (const pm_next_node_t *) node; |
4128 | 1.00k | pm_dump_json_location(buffer, &cast->base.location); |
4129 | | |
4130 | | // Dump the arguments field |
4131 | 1.00k | pm_buffer_append_byte(buffer, ','); |
4132 | 1.00k | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
4133 | 1.00k | if (cast->arguments != NULL) { Branch (4133:17): [True: 69, False: 939]
|
4134 | 69 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments); |
4135 | 939 | } else { |
4136 | 939 | pm_buffer_append_string(buffer, "null", 4); |
4137 | 939 | } |
4138 | | |
4139 | | // Dump the keyword_loc field |
4140 | 1.00k | pm_buffer_append_byte(buffer, ','); |
4141 | 1.00k | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
4142 | 1.00k | pm_dump_json_location(buffer, &cast->keyword_loc); |
4143 | | |
4144 | 1.00k | pm_buffer_append_byte(buffer, '}'); |
4145 | 1.00k | break; |
4146 | 0 | } |
4147 | 1.17k | case PM_NIL_NODE: { Branch (4147:9): [True: 1.17k, False: 724k]
|
4148 | 1.17k | pm_buffer_append_string(buffer, "{\"type\":\"NilNode\",\"location\":", 29); |
4149 | | |
4150 | 1.17k | const pm_nil_node_t *cast = (const pm_nil_node_t *) node; |
4151 | 1.17k | pm_dump_json_location(buffer, &cast->base.location); |
4152 | | |
4153 | 1.17k | pm_buffer_append_byte(buffer, '}'); |
4154 | 1.17k | break; |
4155 | 0 | } |
4156 | 7 | case PM_NO_BLOCK_PARAMETER_NODE: { Branch (4156:9): [True: 7, False: 725k]
|
4157 | 7 | pm_buffer_append_string(buffer, "{\"type\":\"NoBlockParameterNode\",\"location\":", 42); |
4158 | | |
4159 | 7 | const pm_no_block_parameter_node_t *cast = (const pm_no_block_parameter_node_t *) node; |
4160 | 7 | pm_dump_json_location(buffer, &cast->base.location); |
4161 | | |
4162 | | // Dump the operator_loc field |
4163 | 7 | pm_buffer_append_byte(buffer, ','); |
4164 | 7 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
4165 | 7 | pm_dump_json_location(buffer, &cast->operator_loc); |
4166 | | |
4167 | | // Dump the keyword_loc field |
4168 | 7 | pm_buffer_append_byte(buffer, ','); |
4169 | 7 | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
4170 | 7 | pm_dump_json_location(buffer, &cast->keyword_loc); |
4171 | | |
4172 | 7 | pm_buffer_append_byte(buffer, '}'); |
4173 | 7 | break; |
4174 | 0 | } |
4175 | 63 | case PM_NO_KEYWORDS_PARAMETER_NODE: { Branch (4175:9): [True: 63, False: 725k]
|
4176 | 63 | pm_buffer_append_string(buffer, "{\"type\":\"NoKeywordsParameterNode\",\"location\":", 45); |
4177 | | |
4178 | 63 | const pm_no_keywords_parameter_node_t *cast = (const pm_no_keywords_parameter_node_t *) node; |
4179 | 63 | pm_dump_json_location(buffer, &cast->base.location); |
4180 | | |
4181 | | // Dump the operator_loc field |
4182 | 63 | pm_buffer_append_byte(buffer, ','); |
4183 | 63 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
4184 | 63 | pm_dump_json_location(buffer, &cast->operator_loc); |
4185 | | |
4186 | | // Dump the keyword_loc field |
4187 | 63 | pm_buffer_append_byte(buffer, ','); |
4188 | 63 | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
4189 | 63 | pm_dump_json_location(buffer, &cast->keyword_loc); |
4190 | | |
4191 | 63 | pm_buffer_append_byte(buffer, '}'); |
4192 | 63 | break; |
4193 | 0 | } |
4194 | 321 | case PM_NUMBERED_PARAMETERS_NODE: { Branch (4194:9): [True: 321, False: 724k]
|
4195 | 321 | pm_buffer_append_string(buffer, "{\"type\":\"NumberedParametersNode\",\"location\":", 44); |
4196 | | |
4197 | 321 | const pm_numbered_parameters_node_t *cast = (const pm_numbered_parameters_node_t *) node; |
4198 | 321 | pm_dump_json_location(buffer, &cast->base.location); |
4199 | | |
4200 | | // Dump the maximum field |
4201 | 321 | pm_buffer_append_byte(buffer, ','); |
4202 | 321 | pm_buffer_append_string(buffer, "\"maximum\":", 10); |
4203 | 321 | pm_buffer_append_format(buffer, "%" PRIu8, cast->maximum); |
4204 | | |
4205 | 321 | pm_buffer_append_byte(buffer, '}'); |
4206 | 321 | break; |
4207 | 0 | } |
4208 | 108 | case PM_NUMBERED_REFERENCE_READ_NODE: { Branch (4208:9): [True: 108, False: 725k]
|
4209 | 108 | pm_buffer_append_string(buffer, "{\"type\":\"NumberedReferenceReadNode\",\"location\":", 47); |
4210 | | |
4211 | 108 | const pm_numbered_reference_read_node_t *cast = (const pm_numbered_reference_read_node_t *) node; |
4212 | 108 | pm_dump_json_location(buffer, &cast->base.location); |
4213 | | |
4214 | | // Dump the number field |
4215 | 108 | pm_buffer_append_byte(buffer, ','); |
4216 | 108 | pm_buffer_append_string(buffer, "\"number\":", 9); |
4217 | 108 | pm_buffer_append_format(buffer, "%" PRIu32, cast->number); |
4218 | | |
4219 | 108 | pm_buffer_append_byte(buffer, '}'); |
4220 | 108 | break; |
4221 | 0 | } |
4222 | 563 | case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: { Branch (4222:9): [True: 563, False: 724k]
|
4223 | 563 | pm_buffer_append_string(buffer, "{\"type\":\"OptionalKeywordParameterNode\",\"location\":", 50); |
4224 | | |
4225 | 563 | const pm_optional_keyword_parameter_node_t *cast = (const pm_optional_keyword_parameter_node_t *) node; |
4226 | 563 | pm_dump_json_location(buffer, &cast->base.location); |
4227 | | |
4228 | | // Dump the ParameterFlags field |
4229 | 563 | pm_buffer_append_byte(buffer, ','); |
4230 | 563 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
4231 | 563 | size_t flags = 0; |
4232 | 563 | pm_buffer_append_byte(buffer, '['); |
4233 | 563 | if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) { |
4234 | 34 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4234:21): [True: 0, False: 34]
|
4235 | 34 | pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20); |
4236 | 34 | flags++; |
4237 | 34 | } |
4238 | 563 | pm_buffer_append_byte(buffer, ']'); |
4239 | | |
4240 | | // Dump the name field |
4241 | 563 | pm_buffer_append_byte(buffer, ','); |
4242 | 563 | pm_buffer_append_string(buffer, "\"name\":", 7); |
4243 | 563 | pm_dump_json_constant(buffer, parser, cast->name); |
4244 | | |
4245 | | // Dump the name_loc field |
4246 | 563 | pm_buffer_append_byte(buffer, ','); |
4247 | 563 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
4248 | 563 | pm_dump_json_location(buffer, &cast->name_loc); |
4249 | | |
4250 | | // Dump the value field |
4251 | 563 | pm_buffer_append_byte(buffer, ','); |
4252 | 563 | pm_buffer_append_string(buffer, "\"value\":", 8); |
4253 | 563 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
4254 | | |
4255 | 563 | pm_buffer_append_byte(buffer, '}'); |
4256 | 563 | break; |
4257 | 0 | } |
4258 | 1.16k | case PM_OPTIONAL_PARAMETER_NODE: { Branch (4258:9): [True: 1.16k, False: 724k]
|
4259 | 1.16k | pm_buffer_append_string(buffer, "{\"type\":\"OptionalParameterNode\",\"location\":", 43); |
4260 | | |
4261 | 1.16k | const pm_optional_parameter_node_t *cast = (const pm_optional_parameter_node_t *) node; |
4262 | 1.16k | pm_dump_json_location(buffer, &cast->base.location); |
4263 | | |
4264 | | // Dump the ParameterFlags field |
4265 | 1.16k | pm_buffer_append_byte(buffer, ','); |
4266 | 1.16k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
4267 | 1.16k | size_t flags = 0; |
4268 | 1.16k | pm_buffer_append_byte(buffer, '['); |
4269 | 1.16k | if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) { |
4270 | 43 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4270:21): [True: 0, False: 43]
|
4271 | 43 | pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20); |
4272 | 43 | flags++; |
4273 | 43 | } |
4274 | 1.16k | pm_buffer_append_byte(buffer, ']'); |
4275 | | |
4276 | | // Dump the name field |
4277 | 1.16k | pm_buffer_append_byte(buffer, ','); |
4278 | 1.16k | pm_buffer_append_string(buffer, "\"name\":", 7); |
4279 | 1.16k | pm_dump_json_constant(buffer, parser, cast->name); |
4280 | | |
4281 | | // Dump the name_loc field |
4282 | 1.16k | pm_buffer_append_byte(buffer, ','); |
4283 | 1.16k | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
4284 | 1.16k | pm_dump_json_location(buffer, &cast->name_loc); |
4285 | | |
4286 | | // Dump the operator_loc field |
4287 | 1.16k | pm_buffer_append_byte(buffer, ','); |
4288 | 1.16k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
4289 | 1.16k | pm_dump_json_location(buffer, &cast->operator_loc); |
4290 | | |
4291 | | // Dump the value field |
4292 | 1.16k | pm_buffer_append_byte(buffer, ','); |
4293 | 1.16k | pm_buffer_append_string(buffer, "\"value\":", 8); |
4294 | 1.16k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->value); |
4295 | | |
4296 | 1.16k | pm_buffer_append_byte(buffer, '}'); |
4297 | 1.16k | break; |
4298 | 0 | } |
4299 | 125 | case PM_OR_NODE: { Branch (4299:9): [True: 125, False: 725k]
|
4300 | 125 | pm_buffer_append_string(buffer, "{\"type\":\"OrNode\",\"location\":", 28); |
4301 | | |
4302 | 125 | const pm_or_node_t *cast = (const pm_or_node_t *) node; |
4303 | 125 | pm_dump_json_location(buffer, &cast->base.location); |
4304 | | |
4305 | | // Dump the left field |
4306 | 125 | pm_buffer_append_byte(buffer, ','); |
4307 | 125 | pm_buffer_append_string(buffer, "\"left\":", 7); |
4308 | 125 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->left); |
4309 | | |
4310 | | // Dump the right field |
4311 | 125 | pm_buffer_append_byte(buffer, ','); |
4312 | 125 | pm_buffer_append_string(buffer, "\"right\":", 8); |
4313 | 125 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->right); |
4314 | | |
4315 | | // Dump the operator_loc field |
4316 | 125 | pm_buffer_append_byte(buffer, ','); |
4317 | 125 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
4318 | 125 | pm_dump_json_location(buffer, &cast->operator_loc); |
4319 | | |
4320 | 125 | pm_buffer_append_byte(buffer, '}'); |
4321 | 125 | break; |
4322 | 0 | } |
4323 | 7.05k | case PM_PARAMETERS_NODE: { Branch (4323:9): [True: 7.05k, False: 718k]
|
4324 | 7.05k | pm_buffer_append_string(buffer, "{\"type\":\"ParametersNode\",\"location\":", 36); |
4325 | | |
4326 | 7.05k | const pm_parameters_node_t *cast = (const pm_parameters_node_t *) node; |
4327 | 7.05k | pm_dump_json_location(buffer, &cast->base.location); |
4328 | | |
4329 | | // Dump the requireds field |
4330 | 7.05k | pm_buffer_append_byte(buffer, ','); |
4331 | 7.05k | pm_buffer_append_string(buffer, "\"requireds\":", 12); |
4332 | 7.05k | const pm_node_list_t *requireds = &cast->requireds; |
4333 | 7.05k | pm_buffer_append_byte(buffer, '['); |
4334 | | |
4335 | 11.8k | for (size_t index = 0; index < requireds->size; index++4.81k ) { Branch (4335:36): [True: 4.81k, False: 7.05k]
|
4336 | 4.81k | if (index != 0) pm_buffer_append_byte(buffer, ',')1.03k ; Branch (4336:21): [True: 1.03k, False: 3.77k]
|
4337 | 4.81k | pm_dump_json(buffer, parser, requireds->nodes[index]); |
4338 | 4.81k | } |
4339 | 7.05k | pm_buffer_append_byte(buffer, ']'); |
4340 | | |
4341 | | // Dump the optionals field |
4342 | 7.05k | pm_buffer_append_byte(buffer, ','); |
4343 | 7.05k | pm_buffer_append_string(buffer, "\"optionals\":", 12); |
4344 | 7.05k | const pm_node_list_t *optionals = &cast->optionals; |
4345 | 7.05k | pm_buffer_append_byte(buffer, '['); |
4346 | | |
4347 | 8.22k | for (size_t index = 0; index < optionals->size; index++1.16k ) { Branch (4347:36): [True: 1.16k, False: 7.05k]
|
4348 | 1.16k | if (index != 0) pm_buffer_append_byte(buffer, ',')93 ; Branch (4348:21): [True: 93, False: 1.07k]
|
4349 | 1.16k | pm_dump_json(buffer, parser, optionals->nodes[index]); |
4350 | 1.16k | } |
4351 | 7.05k | pm_buffer_append_byte(buffer, ']'); |
4352 | | |
4353 | | // Dump the rest field |
4354 | 7.05k | pm_buffer_append_byte(buffer, ','); |
4355 | 7.05k | pm_buffer_append_string(buffer, "\"rest\":", 7); |
4356 | 7.05k | if (cast->rest != NULL) { Branch (4356:17): [True: 2.00k, False: 5.05k]
|
4357 | 2.00k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest); |
4358 | 5.05k | } else { |
4359 | 5.05k | pm_buffer_append_string(buffer, "null", 4); |
4360 | 5.05k | } |
4361 | | |
4362 | | // Dump the posts field |
4363 | 7.05k | pm_buffer_append_byte(buffer, ','); |
4364 | 7.05k | pm_buffer_append_string(buffer, "\"posts\":", 8); |
4365 | 7.05k | const pm_node_list_t *posts = &cast->posts; |
4366 | 7.05k | pm_buffer_append_byte(buffer, '['); |
4367 | | |
4368 | 7.59k | for (size_t index = 0; index < posts->size; index++536 ) { Branch (4368:36): [True: 536, False: 7.05k]
|
4369 | 536 | if (index != 0) pm_buffer_append_byte(buffer, ',')56 ; Branch (4369:21): [True: 56, False: 480]
|
4370 | 536 | pm_dump_json(buffer, parser, posts->nodes[index]); |
4371 | 536 | } |
4372 | 7.05k | pm_buffer_append_byte(buffer, ']'); |
4373 | | |
4374 | | // Dump the keywords field |
4375 | 7.05k | pm_buffer_append_byte(buffer, ','); |
4376 | 7.05k | pm_buffer_append_string(buffer, "\"keywords\":", 11); |
4377 | 7.05k | const pm_node_list_t *keywords = &cast->keywords; |
4378 | 7.05k | pm_buffer_append_byte(buffer, '['); |
4379 | | |
4380 | 8.48k | for (size_t index = 0; index < keywords->size; index++1.43k ) { Branch (4380:36): [True: 1.43k, False: 7.05k]
|
4381 | 1.43k | if (index != 0) pm_buffer_append_byte(buffer, ',')459 ; Branch (4381:21): [True: 459, False: 971]
|
4382 | 1.43k | pm_dump_json(buffer, parser, keywords->nodes[index]); |
4383 | 1.43k | } |
4384 | 7.05k | pm_buffer_append_byte(buffer, ']'); |
4385 | | |
4386 | | // Dump the keyword_rest field |
4387 | 7.05k | pm_buffer_append_byte(buffer, ','); |
4388 | 7.05k | pm_buffer_append_string(buffer, "\"keyword_rest\":", 15); |
4389 | 7.05k | if (cast->keyword_rest != NULL) { Branch (4389:17): [True: 726, False: 6.33k]
|
4390 | 726 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->keyword_rest); |
4391 | 6.33k | } else { |
4392 | 6.33k | pm_buffer_append_string(buffer, "null", 4); |
4393 | 6.33k | } |
4394 | | |
4395 | | // Dump the block field |
4396 | 7.05k | pm_buffer_append_byte(buffer, ','); |
4397 | 7.05k | pm_buffer_append_string(buffer, "\"block\":", 8); |
4398 | 7.05k | if (cast->block != NULL) { Branch (4398:17): [True: 1.27k, False: 5.78k]
|
4399 | 1.27k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->block); |
4400 | 5.78k | } else { |
4401 | 5.78k | pm_buffer_append_string(buffer, "null", 4); |
4402 | 5.78k | } |
4403 | | |
4404 | 7.05k | pm_buffer_append_byte(buffer, '}'); |
4405 | 7.05k | break; |
4406 | 0 | } |
4407 | 5.98k | case PM_PARENTHESES_NODE: { Branch (4407:9): [True: 5.98k, False: 719k]
|
4408 | 5.98k | pm_buffer_append_string(buffer, "{\"type\":\"ParenthesesNode\",\"location\":", 37); |
4409 | | |
4410 | 5.98k | const pm_parentheses_node_t *cast = (const pm_parentheses_node_t *) node; |
4411 | 5.98k | pm_dump_json_location(buffer, &cast->base.location); |
4412 | | |
4413 | | // Dump the ParenthesesNodeFlags field |
4414 | 5.98k | pm_buffer_append_byte(buffer, ','); |
4415 | 5.98k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
4416 | 5.98k | size_t flags = 0; |
4417 | 5.98k | pm_buffer_append_byte(buffer, '['); |
4418 | 5.98k | if (PM_NODE_FLAG_P(cast, PM_PARENTHESES_NODE_FLAGS_MULTIPLE_STATEMENTS)) { |
4419 | 4.45k | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4419:21): [True: 0, False: 4.45k]
|
4420 | 4.45k | pm_buffer_append_string(buffer, "\"MULTIPLE_STATEMENTS\"", 21); |
4421 | 4.45k | flags++; |
4422 | 4.45k | } |
4423 | 5.98k | pm_buffer_append_byte(buffer, ']'); |
4424 | | |
4425 | | // Dump the body field |
4426 | 5.98k | pm_buffer_append_byte(buffer, ','); |
4427 | 5.98k | pm_buffer_append_string(buffer, "\"body\":", 7); |
4428 | 5.98k | if (cast->body != NULL) { Branch (4428:17): [True: 5.78k, False: 201]
|
4429 | 5.78k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->body); |
4430 | 5.78k | } else { |
4431 | 201 | pm_buffer_append_string(buffer, "null", 4); |
4432 | 201 | } |
4433 | | |
4434 | | // Dump the opening_loc field |
4435 | 5.98k | pm_buffer_append_byte(buffer, ','); |
4436 | 5.98k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
4437 | 5.98k | pm_dump_json_location(buffer, &cast->opening_loc); |
4438 | | |
4439 | | // Dump the closing_loc field |
4440 | 5.98k | pm_buffer_append_byte(buffer, ','); |
4441 | 5.98k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
4442 | 5.98k | pm_dump_json_location(buffer, &cast->closing_loc); |
4443 | | |
4444 | 5.98k | pm_buffer_append_byte(buffer, '}'); |
4445 | 5.98k | break; |
4446 | 0 | } |
4447 | 81 | case PM_PINNED_EXPRESSION_NODE: { Branch (4447:9): [True: 81, False: 725k]
|
4448 | 81 | pm_buffer_append_string(buffer, "{\"type\":\"PinnedExpressionNode\",\"location\":", 42); |
4449 | | |
4450 | 81 | const pm_pinned_expression_node_t *cast = (const pm_pinned_expression_node_t *) node; |
4451 | 81 | pm_dump_json_location(buffer, &cast->base.location); |
4452 | | |
4453 | | // Dump the expression field |
4454 | 81 | pm_buffer_append_byte(buffer, ','); |
4455 | 81 | pm_buffer_append_string(buffer, "\"expression\":", 13); |
4456 | 81 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression); |
4457 | | |
4458 | | // Dump the operator_loc field |
4459 | 81 | pm_buffer_append_byte(buffer, ','); |
4460 | 81 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
4461 | 81 | pm_dump_json_location(buffer, &cast->operator_loc); |
4462 | | |
4463 | | // Dump the lparen_loc field |
4464 | 81 | pm_buffer_append_byte(buffer, ','); |
4465 | 81 | pm_buffer_append_string(buffer, "\"lparen_loc\":", 13); |
4466 | 81 | pm_dump_json_location(buffer, &cast->lparen_loc); |
4467 | | |
4468 | | // Dump the rparen_loc field |
4469 | 81 | pm_buffer_append_byte(buffer, ','); |
4470 | 81 | pm_buffer_append_string(buffer, "\"rparen_loc\":", 13); |
4471 | 81 | pm_dump_json_location(buffer, &cast->rparen_loc); |
4472 | | |
4473 | 81 | pm_buffer_append_byte(buffer, '}'); |
4474 | 81 | break; |
4475 | 0 | } |
4476 | 584 | case PM_PINNED_VARIABLE_NODE: { Branch (4476:9): [True: 584, False: 724k]
|
4477 | 584 | pm_buffer_append_string(buffer, "{\"type\":\"PinnedVariableNode\",\"location\":", 40); |
4478 | | |
4479 | 584 | const pm_pinned_variable_node_t *cast = (const pm_pinned_variable_node_t *) node; |
4480 | 584 | pm_dump_json_location(buffer, &cast->base.location); |
4481 | | |
4482 | | // Dump the variable field |
4483 | 584 | pm_buffer_append_byte(buffer, ','); |
4484 | 584 | pm_buffer_append_string(buffer, "\"variable\":", 11); |
4485 | 584 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->variable); |
4486 | | |
4487 | | // Dump the operator_loc field |
4488 | 584 | pm_buffer_append_byte(buffer, ','); |
4489 | 584 | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
4490 | 584 | pm_dump_json_location(buffer, &cast->operator_loc); |
4491 | | |
4492 | 584 | pm_buffer_append_byte(buffer, '}'); |
4493 | 584 | break; |
4494 | 0 | } |
4495 | 3.17k | case PM_POST_EXECUTION_NODE: { Branch (4495:9): [True: 3.17k, False: 722k]
|
4496 | 3.17k | pm_buffer_append_string(buffer, "{\"type\":\"PostExecutionNode\",\"location\":", 39); |
4497 | | |
4498 | 3.17k | const pm_post_execution_node_t *cast = (const pm_post_execution_node_t *) node; |
4499 | 3.17k | pm_dump_json_location(buffer, &cast->base.location); |
4500 | | |
4501 | | // Dump the statements field |
4502 | 3.17k | pm_buffer_append_byte(buffer, ','); |
4503 | 3.17k | pm_buffer_append_string(buffer, "\"statements\":", 13); |
4504 | 3.17k | if (cast->statements != NULL) { Branch (4504:17): [True: 3.12k, False: 46]
|
4505 | 3.12k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
4506 | 3.12k | } else { |
4507 | 46 | pm_buffer_append_string(buffer, "null", 4); |
4508 | 46 | } |
4509 | | |
4510 | | // Dump the keyword_loc field |
4511 | 3.17k | pm_buffer_append_byte(buffer, ','); |
4512 | 3.17k | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
4513 | 3.17k | pm_dump_json_location(buffer, &cast->keyword_loc); |
4514 | | |
4515 | | // Dump the opening_loc field |
4516 | 3.17k | pm_buffer_append_byte(buffer, ','); |
4517 | 3.17k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
4518 | 3.17k | pm_dump_json_location(buffer, &cast->opening_loc); |
4519 | | |
4520 | | // Dump the closing_loc field |
4521 | 3.17k | pm_buffer_append_byte(buffer, ','); |
4522 | 3.17k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
4523 | 3.17k | pm_dump_json_location(buffer, &cast->closing_loc); |
4524 | | |
4525 | 3.17k | pm_buffer_append_byte(buffer, '}'); |
4526 | 3.17k | break; |
4527 | 0 | } |
4528 | 68 | case PM_PRE_EXECUTION_NODE: { Branch (4528:9): [True: 68, False: 725k]
|
4529 | 68 | pm_buffer_append_string(buffer, "{\"type\":\"PreExecutionNode\",\"location\":", 38); |
4530 | | |
4531 | 68 | const pm_pre_execution_node_t *cast = (const pm_pre_execution_node_t *) node; |
4532 | 68 | pm_dump_json_location(buffer, &cast->base.location); |
4533 | | |
4534 | | // Dump the statements field |
4535 | 68 | pm_buffer_append_byte(buffer, ','); |
4536 | 68 | pm_buffer_append_string(buffer, "\"statements\":", 13); |
4537 | 68 | if (cast->statements != NULL) { Branch (4537:17): [True: 56, False: 12]
|
4538 | 56 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
4539 | 56 | } else { |
4540 | 12 | pm_buffer_append_string(buffer, "null", 4); |
4541 | 12 | } |
4542 | | |
4543 | | // Dump the keyword_loc field |
4544 | 68 | pm_buffer_append_byte(buffer, ','); |
4545 | 68 | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
4546 | 68 | pm_dump_json_location(buffer, &cast->keyword_loc); |
4547 | | |
4548 | | // Dump the opening_loc field |
4549 | 68 | pm_buffer_append_byte(buffer, ','); |
4550 | 68 | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
4551 | 68 | pm_dump_json_location(buffer, &cast->opening_loc); |
4552 | | |
4553 | | // Dump the closing_loc field |
4554 | 68 | pm_buffer_append_byte(buffer, ','); |
4555 | 68 | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
4556 | 68 | pm_dump_json_location(buffer, &cast->closing_loc); |
4557 | | |
4558 | 68 | pm_buffer_append_byte(buffer, '}'); |
4559 | 68 | break; |
4560 | 0 | } |
4561 | 12.3k | case PM_PROGRAM_NODE: { Branch (4561:9): [True: 12.3k, False: 712k]
|
4562 | 12.3k | pm_buffer_append_string(buffer, "{\"type\":\"ProgramNode\",\"location\":", 33); |
4563 | | |
4564 | 12.3k | const pm_program_node_t *cast = (const pm_program_node_t *) node; |
4565 | 12.3k | pm_dump_json_location(buffer, &cast->base.location); |
4566 | | |
4567 | | // Dump the locals field |
4568 | 12.3k | pm_buffer_append_byte(buffer, ','); |
4569 | 12.3k | pm_buffer_append_string(buffer, "\"locals\":", 9); |
4570 | 12.3k | const pm_constant_id_list_t *locals = &cast->locals; |
4571 | 12.3k | pm_buffer_append_byte(buffer, '['); |
4572 | | |
4573 | 31.4k | for (size_t index = 0; index < locals->size; index++19.1k ) { Branch (4573:36): [True: 19.1k, False: 12.3k]
|
4574 | 19.1k | if (index != 0) pm_buffer_append_byte(buffer, ',')13.2k ; Branch (4574:21): [True: 13.2k, False: 5.87k]
|
4575 | 19.1k | pm_dump_json_constant(buffer, parser, locals->ids[index]); |
4576 | 19.1k | } |
4577 | 12.3k | pm_buffer_append_byte(buffer, ']'); |
4578 | | |
4579 | | // Dump the statements field |
4580 | 12.3k | pm_buffer_append_byte(buffer, ','); |
4581 | 12.3k | pm_buffer_append_string(buffer, "\"statements\":", 13); |
4582 | 12.3k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
4583 | | |
4584 | 12.3k | pm_buffer_append_byte(buffer, '}'); |
4585 | 12.3k | break; |
4586 | 0 | } |
4587 | 3.28k | case PM_RANGE_NODE: { Branch (4587:9): [True: 3.28k, False: 721k]
|
4588 | 3.28k | pm_buffer_append_string(buffer, "{\"type\":\"RangeNode\",\"location\":", 31); |
4589 | | |
4590 | 3.28k | const pm_range_node_t *cast = (const pm_range_node_t *) node; |
4591 | 3.28k | pm_dump_json_location(buffer, &cast->base.location); |
4592 | | |
4593 | | // Dump the RangeFlags field |
4594 | 3.28k | pm_buffer_append_byte(buffer, ','); |
4595 | 3.28k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
4596 | 3.28k | size_t flags = 0; |
4597 | 3.28k | pm_buffer_append_byte(buffer, '['); |
4598 | 3.28k | if (PM_NODE_FLAG_P(cast, PM_RANGE_FLAGS_EXCLUDE_END)) { |
4599 | 932 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4599:21): [True: 0, False: 932]
|
4600 | 932 | pm_buffer_append_string(buffer, "\"EXCLUDE_END\"", 13); |
4601 | 932 | flags++; |
4602 | 932 | } |
4603 | 3.28k | pm_buffer_append_byte(buffer, ']'); |
4604 | | |
4605 | | // Dump the left field |
4606 | 3.28k | pm_buffer_append_byte(buffer, ','); |
4607 | 3.28k | pm_buffer_append_string(buffer, "\"left\":", 7); |
4608 | 3.28k | if (cast->left != NULL) { Branch (4608:17): [True: 2.33k, False: 952]
|
4609 | 2.33k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->left); |
4610 | 2.33k | } else { |
4611 | 952 | pm_buffer_append_string(buffer, "null", 4); |
4612 | 952 | } |
4613 | | |
4614 | | // Dump the right field |
4615 | 3.28k | pm_buffer_append_byte(buffer, ','); |
4616 | 3.28k | pm_buffer_append_string(buffer, "\"right\":", 8); |
4617 | 3.28k | if (cast->right != NULL) { Branch (4617:17): [True: 3.12k, False: 166]
|
4618 | 3.12k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->right); |
4619 | 3.12k | } else { |
4620 | 166 | pm_buffer_append_string(buffer, "null", 4); |
4621 | 166 | } |
4622 | | |
4623 | | // Dump the operator_loc field |
4624 | 3.28k | pm_buffer_append_byte(buffer, ','); |
4625 | 3.28k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
4626 | 3.28k | pm_dump_json_location(buffer, &cast->operator_loc); |
4627 | | |
4628 | 3.28k | pm_buffer_append_byte(buffer, '}'); |
4629 | 3.28k | break; |
4630 | 0 | } |
4631 | 1.41k | case PM_RATIONAL_NODE: { Branch (4631:9): [True: 1.41k, False: 723k]
|
4632 | 1.41k | pm_buffer_append_string(buffer, "{\"type\":\"RationalNode\",\"location\":", 34); |
4633 | | |
4634 | 1.41k | const pm_rational_node_t *cast = (const pm_rational_node_t *) node; |
4635 | 1.41k | pm_dump_json_location(buffer, &cast->base.location); |
4636 | | |
4637 | | // Dump the IntegerBaseFlags field |
4638 | 1.41k | pm_buffer_append_byte(buffer, ','); |
4639 | 1.41k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
4640 | 1.41k | size_t flags = 0; |
4641 | 1.41k | pm_buffer_append_byte(buffer, '['); |
4642 | 1.41k | if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_BINARY)) { |
4643 | 59 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4643:21): [True: 0, False: 59]
|
4644 | 59 | pm_buffer_append_string(buffer, "\"BINARY\"", 8); |
4645 | 59 | flags++; |
4646 | 59 | } |
4647 | 1.41k | if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_DECIMAL)) { |
4648 | 1.20k | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4648:21): [True: 0, False: 1.20k]
|
4649 | 1.20k | pm_buffer_append_string(buffer, "\"DECIMAL\"", 9); |
4650 | 1.20k | flags++; |
4651 | 1.20k | } |
4652 | 1.41k | if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_OCTAL)) { |
4653 | 138 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4653:21): [True: 0, False: 138]
|
4654 | 138 | pm_buffer_append_string(buffer, "\"OCTAL\"", 7); |
4655 | 138 | flags++; |
4656 | 138 | } |
4657 | 1.41k | if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_HEXADECIMAL)) { |
4658 | 10 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4658:21): [True: 0, False: 10]
|
4659 | 10 | pm_buffer_append_string(buffer, "\"HEXADECIMAL\"", 13); |
4660 | 10 | flags++; |
4661 | 10 | } |
4662 | 1.41k | pm_buffer_append_byte(buffer, ']'); |
4663 | | |
4664 | | // Dump the numerator field |
4665 | 1.41k | pm_buffer_append_byte(buffer, ','); |
4666 | 1.41k | pm_buffer_append_string(buffer, "\"numerator\":", 12); |
4667 | 1.41k | pm_integer_string(buffer, &cast->numerator); |
4668 | | |
4669 | | // Dump the denominator field |
4670 | 1.41k | pm_buffer_append_byte(buffer, ','); |
4671 | 1.41k | pm_buffer_append_string(buffer, "\"denominator\":", 14); |
4672 | 1.41k | pm_integer_string(buffer, &cast->denominator); |
4673 | | |
4674 | 1.41k | pm_buffer_append_byte(buffer, '}'); |
4675 | 1.41k | break; |
4676 | 0 | } |
4677 | 42 | case PM_REDO_NODE: { Branch (4677:9): [True: 42, False: 725k]
|
4678 | 42 | pm_buffer_append_string(buffer, "{\"type\":\"RedoNode\",\"location\":", 30); |
4679 | | |
4680 | 42 | const pm_redo_node_t *cast = (const pm_redo_node_t *) node; |
4681 | 42 | pm_dump_json_location(buffer, &cast->base.location); |
4682 | | |
4683 | 42 | pm_buffer_append_byte(buffer, '}'); |
4684 | 42 | break; |
4685 | 0 | } |
4686 | 5.11k | case PM_REGULAR_EXPRESSION_NODE: { Branch (4686:9): [True: 5.11k, False: 720k]
|
4687 | 5.11k | pm_buffer_append_string(buffer, "{\"type\":\"RegularExpressionNode\",\"location\":", 43); |
4688 | | |
4689 | 5.11k | const pm_regular_expression_node_t *cast = (const pm_regular_expression_node_t *) node; |
4690 | 5.11k | pm_dump_json_location(buffer, &cast->base.location); |
4691 | | |
4692 | | // Dump the RegularExpressionFlags field |
4693 | 5.11k | pm_buffer_append_byte(buffer, ','); |
4694 | 5.11k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
4695 | 5.11k | size_t flags = 0; |
4696 | 5.11k | pm_buffer_append_byte(buffer, '['); |
4697 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) { |
4698 | 820 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4698:21): [True: 0, False: 820]
|
4699 | 820 | pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13); |
4700 | 820 | flags++; |
4701 | 820 | } |
4702 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) { |
4703 | 206 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4703:21): [True: 0, False: 206]
|
4704 | 206 | pm_buffer_append_string(buffer, "\"EXTENDED\"", 10); |
4705 | 206 | flags++; |
4706 | 206 | } |
4707 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) { |
4708 | 42 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4708:21): [True: 0, False: 42]
|
4709 | 42 | pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12); |
4710 | 42 | flags++; |
4711 | 42 | } |
4712 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) { |
4713 | 81 | if (flags != 0) pm_buffer_append_byte(buffer, ',')20 ; Branch (4713:21): [True: 20, False: 61]
|
4714 | 81 | pm_buffer_append_string(buffer, "\"ONCE\"", 6); |
4715 | 81 | flags++; |
4716 | 81 | } |
4717 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) { |
4718 | 153 | if (flags != 0) pm_buffer_append_byte(buffer, ',')135 ; Branch (4718:21): [True: 135, False: 18]
|
4719 | 153 | pm_buffer_append_string(buffer, "\"EUC_JP\"", 8); |
4720 | 153 | flags++; |
4721 | 153 | } |
4722 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) { |
4723 | 62 | if (flags != 0) pm_buffer_append_byte(buffer, ',')25 ; Branch (4723:21): [True: 25, False: 37]
|
4724 | 62 | pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12); |
4725 | 62 | flags++; |
4726 | 62 | } |
4727 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) { |
4728 | 26 | if (flags != 0) pm_buffer_append_byte(buffer, ',')12 ; Branch (4728:21): [True: 12, False: 14]
|
4729 | 26 | pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13); |
4730 | 26 | flags++; |
4731 | 26 | } |
4732 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) { |
4733 | 14 | if (flags != 0) pm_buffer_append_byte(buffer, ',')5 ; Branch (4733:21): [True: 5, False: 9]
|
4734 | 14 | pm_buffer_append_string(buffer, "\"UTF_8\"", 7); |
4735 | 14 | flags++; |
4736 | 14 | } |
4737 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) { |
4738 | 134 | if (flags != 0) pm_buffer_append_byte(buffer, ',')2 ; Branch (4738:21): [True: 2, False: 132]
|
4739 | 134 | pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22); |
4740 | 134 | flags++; |
4741 | 134 | } |
4742 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) { |
4743 | 6 | if (flags != 0) pm_buffer_append_byte(buffer, ',')1 ; Branch (4743:21): [True: 1, False: 5]
|
4744 | 6 | pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24); |
4745 | 6 | flags++; |
4746 | 6 | } |
4747 | 5.11k | if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) { |
4748 | 4.57k | if (flags != 0) pm_buffer_append_byte(buffer, ',')969 ; Branch (4748:21): [True: 969, False: 3.61k]
|
4749 | 4.57k | pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26); |
4750 | 4.57k | flags++; |
4751 | 4.57k | } |
4752 | 5.11k | pm_buffer_append_byte(buffer, ']'); |
4753 | | |
4754 | | // Dump the opening_loc field |
4755 | 5.11k | pm_buffer_append_byte(buffer, ','); |
4756 | 5.11k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
4757 | 5.11k | pm_dump_json_location(buffer, &cast->opening_loc); |
4758 | | |
4759 | | // Dump the content_loc field |
4760 | 5.11k | pm_buffer_append_byte(buffer, ','); |
4761 | 5.11k | pm_buffer_append_string(buffer, "\"content_loc\":", 14); |
4762 | 5.11k | pm_dump_json_location(buffer, &cast->content_loc); |
4763 | | |
4764 | | // Dump the closing_loc field |
4765 | 5.11k | pm_buffer_append_byte(buffer, ','); |
4766 | 5.11k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
4767 | 5.11k | pm_dump_json_location(buffer, &cast->closing_loc); |
4768 | | |
4769 | | // Dump the unescaped field |
4770 | 5.11k | pm_buffer_append_byte(buffer, ','); |
4771 | 5.11k | pm_buffer_append_string(buffer, "\"unescaped\":", 12); |
4772 | 5.11k | const pm_string_t *unescaped = &cast->unescaped; |
4773 | 5.11k | pm_buffer_append_byte(buffer, '"'); |
4774 | 5.11k | pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON); |
4775 | 5.11k | pm_buffer_append_byte(buffer, '"'); |
4776 | | |
4777 | 5.11k | pm_buffer_append_byte(buffer, '}'); |
4778 | 5.11k | break; |
4779 | 0 | } |
4780 | 867 | case PM_REQUIRED_KEYWORD_PARAMETER_NODE: { Branch (4780:9): [True: 867, False: 724k]
|
4781 | 867 | pm_buffer_append_string(buffer, "{\"type\":\"RequiredKeywordParameterNode\",\"location\":", 50); |
4782 | | |
4783 | 867 | const pm_required_keyword_parameter_node_t *cast = (const pm_required_keyword_parameter_node_t *) node; |
4784 | 867 | pm_dump_json_location(buffer, &cast->base.location); |
4785 | | |
4786 | | // Dump the ParameterFlags field |
4787 | 867 | pm_buffer_append_byte(buffer, ','); |
4788 | 867 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
4789 | 867 | size_t flags = 0; |
4790 | 867 | pm_buffer_append_byte(buffer, '['); |
4791 | 867 | if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) { |
4792 | 42 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4792:21): [True: 0, False: 42]
|
4793 | 42 | pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20); |
4794 | 42 | flags++; |
4795 | 42 | } |
4796 | 867 | pm_buffer_append_byte(buffer, ']'); |
4797 | | |
4798 | | // Dump the name field |
4799 | 867 | pm_buffer_append_byte(buffer, ','); |
4800 | 867 | pm_buffer_append_string(buffer, "\"name\":", 7); |
4801 | 867 | pm_dump_json_constant(buffer, parser, cast->name); |
4802 | | |
4803 | | // Dump the name_loc field |
4804 | 867 | pm_buffer_append_byte(buffer, ','); |
4805 | 867 | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
4806 | 867 | pm_dump_json_location(buffer, &cast->name_loc); |
4807 | | |
4808 | 867 | pm_buffer_append_byte(buffer, '}'); |
4809 | 867 | break; |
4810 | 0 | } |
4811 | 6.54k | case PM_REQUIRED_PARAMETER_NODE: { Branch (4811:9): [True: 6.54k, False: 718k]
|
4812 | 6.54k | pm_buffer_append_string(buffer, "{\"type\":\"RequiredParameterNode\",\"location\":", 43); |
4813 | | |
4814 | 6.54k | const pm_required_parameter_node_t *cast = (const pm_required_parameter_node_t *) node; |
4815 | 6.54k | pm_dump_json_location(buffer, &cast->base.location); |
4816 | | |
4817 | | // Dump the ParameterFlags field |
4818 | 6.54k | pm_buffer_append_byte(buffer, ','); |
4819 | 6.54k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
4820 | 6.54k | size_t flags = 0; |
4821 | 6.54k | pm_buffer_append_byte(buffer, '['); |
4822 | 6.54k | if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) { |
4823 | 711 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4823:21): [True: 0, False: 711]
|
4824 | 711 | pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20); |
4825 | 711 | flags++; |
4826 | 711 | } |
4827 | 6.54k | pm_buffer_append_byte(buffer, ']'); |
4828 | | |
4829 | | // Dump the name field |
4830 | 6.54k | pm_buffer_append_byte(buffer, ','); |
4831 | 6.54k | pm_buffer_append_string(buffer, "\"name\":", 7); |
4832 | 6.54k | pm_dump_json_constant(buffer, parser, cast->name); |
4833 | | |
4834 | 6.54k | pm_buffer_append_byte(buffer, '}'); |
4835 | 6.54k | break; |
4836 | 0 | } |
4837 | 1.17k | case PM_RESCUE_MODIFIER_NODE: { Branch (4837:9): [True: 1.17k, False: 724k]
|
4838 | 1.17k | pm_buffer_append_string(buffer, "{\"type\":\"RescueModifierNode\",\"location\":", 40); |
4839 | | |
4840 | 1.17k | const pm_rescue_modifier_node_t *cast = (const pm_rescue_modifier_node_t *) node; |
4841 | 1.17k | pm_dump_json_location(buffer, &cast->base.location); |
4842 | | |
4843 | | // Dump the expression field |
4844 | 1.17k | pm_buffer_append_byte(buffer, ','); |
4845 | 1.17k | pm_buffer_append_string(buffer, "\"expression\":", 13); |
4846 | 1.17k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression); |
4847 | | |
4848 | | // Dump the keyword_loc field |
4849 | 1.17k | pm_buffer_append_byte(buffer, ','); |
4850 | 1.17k | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
4851 | 1.17k | pm_dump_json_location(buffer, &cast->keyword_loc); |
4852 | | |
4853 | | // Dump the rescue_expression field |
4854 | 1.17k | pm_buffer_append_byte(buffer, ','); |
4855 | 1.17k | pm_buffer_append_string(buffer, "\"rescue_expression\":", 20); |
4856 | 1.17k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->rescue_expression); |
4857 | | |
4858 | 1.17k | pm_buffer_append_byte(buffer, '}'); |
4859 | 1.17k | break; |
4860 | 0 | } |
4861 | 1.25k | case PM_RESCUE_NODE: { Branch (4861:9): [True: 1.25k, False: 723k]
|
4862 | 1.25k | pm_buffer_append_string(buffer, "{\"type\":\"RescueNode\",\"location\":", 32); |
4863 | | |
4864 | 1.25k | const pm_rescue_node_t *cast = (const pm_rescue_node_t *) node; |
4865 | 1.25k | pm_dump_json_location(buffer, &cast->base.location); |
4866 | | |
4867 | | // Dump the keyword_loc field |
4868 | 1.25k | pm_buffer_append_byte(buffer, ','); |
4869 | 1.25k | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
4870 | 1.25k | pm_dump_json_location(buffer, &cast->keyword_loc); |
4871 | | |
4872 | | // Dump the exceptions field |
4873 | 1.25k | pm_buffer_append_byte(buffer, ','); |
4874 | 1.25k | pm_buffer_append_string(buffer, "\"exceptions\":", 13); |
4875 | 1.25k | const pm_node_list_t *exceptions = &cast->exceptions; |
4876 | 1.25k | pm_buffer_append_byte(buffer, '['); |
4877 | | |
4878 | 1.64k | for (size_t index = 0; index < exceptions->size; index++389 ) { Branch (4878:36): [True: 389, False: 1.25k]
|
4879 | 389 | if (index != 0) pm_buffer_append_byte(buffer, ',')124 ; Branch (4879:21): [True: 124, False: 265]
|
4880 | 389 | pm_dump_json(buffer, parser, exceptions->nodes[index]); |
4881 | 389 | } |
4882 | 1.25k | pm_buffer_append_byte(buffer, ']'); |
4883 | | |
4884 | | // Dump the operator_loc field |
4885 | 1.25k | pm_buffer_append_byte(buffer, ','); |
4886 | 1.25k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
4887 | 1.25k | if (cast->operator_loc.length != 0) { Branch (4887:17): [True: 289, False: 966]
|
4888 | 289 | pm_dump_json_location(buffer, &cast->operator_loc); |
4889 | 966 | } else { |
4890 | 966 | pm_buffer_append_string(buffer, "null", 4); |
4891 | 966 | } |
4892 | | |
4893 | | // Dump the reference field |
4894 | 1.25k | pm_buffer_append_byte(buffer, ','); |
4895 | 1.25k | pm_buffer_append_string(buffer, "\"reference\":", 12); |
4896 | 1.25k | if (cast->reference != NULL) { Branch (4896:17): [True: 289, False: 966]
|
4897 | 289 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->reference); |
4898 | 966 | } else { |
4899 | 966 | pm_buffer_append_string(buffer, "null", 4); |
4900 | 966 | } |
4901 | | |
4902 | | // Dump the then_keyword_loc field |
4903 | 1.25k | pm_buffer_append_byte(buffer, ','); |
4904 | 1.25k | pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19); |
4905 | 1.25k | if (cast->then_keyword_loc.length != 0) { Branch (4905:17): [True: 5, False: 1.25k]
|
4906 | 5 | pm_dump_json_location(buffer, &cast->then_keyword_loc); |
4907 | 1.25k | } else { |
4908 | 1.25k | pm_buffer_append_string(buffer, "null", 4); |
4909 | 1.25k | } |
4910 | | |
4911 | | // Dump the statements field |
4912 | 1.25k | pm_buffer_append_byte(buffer, ','); |
4913 | 1.25k | pm_buffer_append_string(buffer, "\"statements\":", 13); |
4914 | 1.25k | if (cast->statements != NULL) { Branch (4914:17): [True: 494, False: 761]
|
4915 | 494 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
4916 | 761 | } else { |
4917 | 761 | pm_buffer_append_string(buffer, "null", 4); |
4918 | 761 | } |
4919 | | |
4920 | | // Dump the subsequent field |
4921 | 1.25k | pm_buffer_append_byte(buffer, ','); |
4922 | 1.25k | pm_buffer_append_string(buffer, "\"subsequent\":", 13); |
4923 | 1.25k | if (cast->subsequent != NULL) { Branch (4923:17): [True: 45, False: 1.21k]
|
4924 | 45 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->subsequent); |
4925 | 1.21k | } else { |
4926 | 1.21k | pm_buffer_append_string(buffer, "null", 4); |
4927 | 1.21k | } |
4928 | | |
4929 | 1.25k | pm_buffer_append_byte(buffer, '}'); |
4930 | 1.25k | break; |
4931 | 0 | } |
4932 | 1.95k | case PM_REST_PARAMETER_NODE: { Branch (4932:9): [True: 1.95k, False: 723k]
|
4933 | 1.95k | pm_buffer_append_string(buffer, "{\"type\":\"RestParameterNode\",\"location\":", 39); |
4934 | | |
4935 | 1.95k | const pm_rest_parameter_node_t *cast = (const pm_rest_parameter_node_t *) node; |
4936 | 1.95k | pm_dump_json_location(buffer, &cast->base.location); |
4937 | | |
4938 | | // Dump the ParameterFlags field |
4939 | 1.95k | pm_buffer_append_byte(buffer, ','); |
4940 | 1.95k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
4941 | 1.95k | size_t flags = 0; |
4942 | 1.95k | pm_buffer_append_byte(buffer, '['); |
4943 | 1.95k | if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) { |
4944 | 47 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (4944:21): [True: 0, False: 47]
|
4945 | 47 | pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20); |
4946 | 47 | flags++; |
4947 | 47 | } |
4948 | 1.95k | pm_buffer_append_byte(buffer, ']'); |
4949 | | |
4950 | | // Dump the name field |
4951 | 1.95k | pm_buffer_append_byte(buffer, ','); |
4952 | 1.95k | pm_buffer_append_string(buffer, "\"name\":", 7); |
4953 | 1.95k | if (cast->name != PM_CONSTANT_ID_UNSET) { Branch (4953:17): [True: 789, False: 1.16k]
|
4954 | 789 | pm_dump_json_constant(buffer, parser, cast->name); |
4955 | 1.16k | } else { |
4956 | 1.16k | pm_buffer_append_string(buffer, "null", 4); |
4957 | 1.16k | } |
4958 | | |
4959 | | // Dump the name_loc field |
4960 | 1.95k | pm_buffer_append_byte(buffer, ','); |
4961 | 1.95k | pm_buffer_append_string(buffer, "\"name_loc\":", 11); |
4962 | 1.95k | if (cast->name_loc.length != 0) { Branch (4962:17): [True: 789, False: 1.16k]
|
4963 | 789 | pm_dump_json_location(buffer, &cast->name_loc); |
4964 | 1.16k | } else { |
4965 | 1.16k | pm_buffer_append_string(buffer, "null", 4); |
4966 | 1.16k | } |
4967 | | |
4968 | | // Dump the operator_loc field |
4969 | 1.95k | pm_buffer_append_byte(buffer, ','); |
4970 | 1.95k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
4971 | 1.95k | pm_dump_json_location(buffer, &cast->operator_loc); |
4972 | | |
4973 | 1.95k | pm_buffer_append_byte(buffer, '}'); |
4974 | 1.95k | break; |
4975 | 0 | } |
4976 | 95 | case PM_RETRY_NODE: { Branch (4976:9): [True: 95, False: 725k]
|
4977 | 95 | pm_buffer_append_string(buffer, "{\"type\":\"RetryNode\",\"location\":", 31); |
4978 | | |
4979 | 95 | const pm_retry_node_t *cast = (const pm_retry_node_t *) node; |
4980 | 95 | pm_dump_json_location(buffer, &cast->base.location); |
4981 | | |
4982 | 95 | pm_buffer_append_byte(buffer, '}'); |
4983 | 95 | break; |
4984 | 0 | } |
4985 | 1.45k | case PM_RETURN_NODE: { Branch (4985:9): [True: 1.45k, False: 723k]
|
4986 | 1.45k | pm_buffer_append_string(buffer, "{\"type\":\"ReturnNode\",\"location\":", 32); |
4987 | | |
4988 | 1.45k | const pm_return_node_t *cast = (const pm_return_node_t *) node; |
4989 | 1.45k | pm_dump_json_location(buffer, &cast->base.location); |
4990 | | |
4991 | | // Dump the keyword_loc field |
4992 | 1.45k | pm_buffer_append_byte(buffer, ','); |
4993 | 1.45k | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
4994 | 1.45k | pm_dump_json_location(buffer, &cast->keyword_loc); |
4995 | | |
4996 | | // Dump the arguments field |
4997 | 1.45k | pm_buffer_append_byte(buffer, ','); |
4998 | 1.45k | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
4999 | 1.45k | if (cast->arguments != NULL) { Branch (4999:17): [True: 133, False: 1.32k]
|
5000 | 133 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments); |
5001 | 1.32k | } else { |
5002 | 1.32k | pm_buffer_append_string(buffer, "null", 4); |
5003 | 1.32k | } |
5004 | | |
5005 | 1.45k | pm_buffer_append_byte(buffer, '}'); |
5006 | 1.45k | break; |
5007 | 0 | } |
5008 | 1.55k | case PM_SELF_NODE: { Branch (5008:9): [True: 1.55k, False: 723k]
|
5009 | 1.55k | pm_buffer_append_string(buffer, "{\"type\":\"SelfNode\",\"location\":", 30); |
5010 | | |
5011 | 1.55k | const pm_self_node_t *cast = (const pm_self_node_t *) node; |
5012 | 1.55k | pm_dump_json_location(buffer, &cast->base.location); |
5013 | | |
5014 | 1.55k | pm_buffer_append_byte(buffer, '}'); |
5015 | 1.55k | break; |
5016 | 0 | } |
5017 | 0 | case PM_SHAREABLE_CONSTANT_NODE: { Branch (5017:9): [True: 0, False: 725k]
|
5018 | 0 | pm_buffer_append_string(buffer, "{\"type\":\"ShareableConstantNode\",\"location\":", 43); |
5019 | |
|
5020 | 0 | const pm_shareable_constant_node_t *cast = (const pm_shareable_constant_node_t *) node; |
5021 | 0 | pm_dump_json_location(buffer, &cast->base.location); |
5022 | | |
5023 | | // Dump the ShareableConstantNodeFlags field |
5024 | 0 | pm_buffer_append_byte(buffer, ','); |
5025 | 0 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
5026 | 0 | size_t flags = 0; |
5027 | 0 | pm_buffer_append_byte(buffer, '['); |
5028 | 0 | if (PM_NODE_FLAG_P(cast, PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL)) { |
5029 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (5029:21): [True: 0, False: 0]
|
5030 | 0 | pm_buffer_append_string(buffer, "\"LITERAL\"", 9); |
5031 | 0 | flags++; |
5032 | 0 | } |
5033 | 0 | if (PM_NODE_FLAG_P(cast, PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING)) { |
5034 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (5034:21): [True: 0, False: 0]
|
5035 | 0 | pm_buffer_append_string(buffer, "\"EXPERIMENTAL_EVERYTHING\"", 25); |
5036 | 0 | flags++; |
5037 | 0 | } |
5038 | 0 | if (PM_NODE_FLAG_P(cast, PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY)) { |
5039 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (5039:21): [True: 0, False: 0]
|
5040 | 0 | pm_buffer_append_string(buffer, "\"EXPERIMENTAL_COPY\"", 19); |
5041 | 0 | flags++; |
5042 | 0 | } |
5043 | 0 | pm_buffer_append_byte(buffer, ']'); |
5044 | | |
5045 | | // Dump the write field |
5046 | 0 | pm_buffer_append_byte(buffer, ','); |
5047 | 0 | pm_buffer_append_string(buffer, "\"write\":", 8); |
5048 | 0 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->write); |
5049 | |
|
5050 | 0 | pm_buffer_append_byte(buffer, '}'); |
5051 | 0 | break; |
5052 | 0 | } |
5053 | 1.44k | case PM_SINGLETON_CLASS_NODE: { Branch (5053:9): [True: 1.44k, False: 723k]
|
5054 | 1.44k | pm_buffer_append_string(buffer, "{\"type\":\"SingletonClassNode\",\"location\":", 40); |
5055 | | |
5056 | 1.44k | const pm_singleton_class_node_t *cast = (const pm_singleton_class_node_t *) node; |
5057 | 1.44k | pm_dump_json_location(buffer, &cast->base.location); |
5058 | | |
5059 | | // Dump the locals field |
5060 | 1.44k | pm_buffer_append_byte(buffer, ','); |
5061 | 1.44k | pm_buffer_append_string(buffer, "\"locals\":", 9); |
5062 | 1.44k | const pm_constant_id_list_t *locals = &cast->locals; |
5063 | 1.44k | pm_buffer_append_byte(buffer, '['); |
5064 | | |
5065 | 1.47k | for (size_t index = 0; index < locals->size; index++25 ) { Branch (5065:36): [True: 25, False: 1.44k]
|
5066 | 25 | if (index != 0) pm_buffer_append_byte(buffer, ',')8 ; Branch (5066:21): [True: 8, False: 17]
|
5067 | 25 | pm_dump_json_constant(buffer, parser, locals->ids[index]); |
5068 | 25 | } |
5069 | 1.44k | pm_buffer_append_byte(buffer, ']'); |
5070 | | |
5071 | | // Dump the class_keyword_loc field |
5072 | 1.44k | pm_buffer_append_byte(buffer, ','); |
5073 | 1.44k | pm_buffer_append_string(buffer, "\"class_keyword_loc\":", 20); |
5074 | 1.44k | pm_dump_json_location(buffer, &cast->class_keyword_loc); |
5075 | | |
5076 | | // Dump the operator_loc field |
5077 | 1.44k | pm_buffer_append_byte(buffer, ','); |
5078 | 1.44k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
5079 | 1.44k | pm_dump_json_location(buffer, &cast->operator_loc); |
5080 | | |
5081 | | // Dump the expression field |
5082 | 1.44k | pm_buffer_append_byte(buffer, ','); |
5083 | 1.44k | pm_buffer_append_string(buffer, "\"expression\":", 13); |
5084 | 1.44k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression); |
5085 | | |
5086 | | // Dump the body field |
5087 | 1.44k | pm_buffer_append_byte(buffer, ','); |
5088 | 1.44k | pm_buffer_append_string(buffer, "\"body\":", 7); |
5089 | 1.44k | if (cast->body != NULL) { Branch (5089:17): [True: 764, False: 683]
|
5090 | 764 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->body); |
5091 | 764 | } else { |
5092 | 683 | pm_buffer_append_string(buffer, "null", 4); |
5093 | 683 | } |
5094 | | |
5095 | | // Dump the end_keyword_loc field |
5096 | 1.44k | pm_buffer_append_byte(buffer, ','); |
5097 | 1.44k | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
5098 | 1.44k | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
5099 | | |
5100 | 1.44k | pm_buffer_append_byte(buffer, '}'); |
5101 | 1.44k | break; |
5102 | 0 | } |
5103 | 172 | case PM_SOURCE_ENCODING_NODE: { Branch (5103:9): [True: 172, False: 725k]
|
5104 | 172 | pm_buffer_append_string(buffer, "{\"type\":\"SourceEncodingNode\",\"location\":", 40); |
5105 | | |
5106 | 172 | const pm_source_encoding_node_t *cast = (const pm_source_encoding_node_t *) node; |
5107 | 172 | pm_dump_json_location(buffer, &cast->base.location); |
5108 | | |
5109 | 172 | pm_buffer_append_byte(buffer, '}'); |
5110 | 172 | break; |
5111 | 0 | } |
5112 | 183 | case PM_SOURCE_FILE_NODE: { Branch (5112:9): [True: 183, False: 725k]
|
5113 | 183 | pm_buffer_append_string(buffer, "{\"type\":\"SourceFileNode\",\"location\":", 36); |
5114 | | |
5115 | 183 | const pm_source_file_node_t *cast = (const pm_source_file_node_t *) node; |
5116 | 183 | pm_dump_json_location(buffer, &cast->base.location); |
5117 | | |
5118 | | // Dump the StringFlags field |
5119 | 183 | pm_buffer_append_byte(buffer, ','); |
5120 | 183 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
5121 | 183 | size_t flags = 0; |
5122 | 183 | pm_buffer_append_byte(buffer, '['); |
5123 | 183 | if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_UTF8_ENCODING)) { |
5124 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (5124:21): [True: 0, False: 0]
|
5125 | 0 | pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22); |
5126 | 0 | flags++; |
5127 | 0 | } |
5128 | 183 | if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_BINARY_ENCODING)) { |
5129 | 0 | if (flags != 0) pm_buffer_append_byte(buffer, ','); Branch (5129:21): [True: 0, False: 0]
|
5130 | 0 | pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24); |
5131 | 0 | flags++; |
5132 | 0 | } |
5133 | 183 | if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FROZEN)) { |
5134 | 5 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5134:21): [True: 0, False: 5]
|
5135 | 5 | pm_buffer_append_string(buffer, "\"FROZEN\"", 8); |
5136 | 5 | flags++; |
5137 | 5 | } |
5138 | 183 | if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_MUTABLE)) { |
5139 | 2 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5139:21): [True: 0, False: 2]
|
5140 | 2 | pm_buffer_append_string(buffer, "\"MUTABLE\"", 9); |
5141 | 2 | flags++; |
5142 | 2 | } |
5143 | 183 | pm_buffer_append_byte(buffer, ']'); |
5144 | | |
5145 | | // Dump the filepath field |
5146 | 183 | pm_buffer_append_byte(buffer, ','); |
5147 | 183 | pm_buffer_append_string(buffer, "\"filepath\":", 11); |
5148 | 183 | const pm_string_t *filepath = &cast->filepath; |
5149 | 183 | pm_buffer_append_byte(buffer, '"'); |
5150 | 183 | pm_buffer_append_source(buffer, pm_string_source(filepath), pm_string_length(filepath), PM_BUFFER_ESCAPING_JSON); |
5151 | 183 | pm_buffer_append_byte(buffer, '"'); |
5152 | | |
5153 | 183 | pm_buffer_append_byte(buffer, '}'); |
5154 | 183 | break; |
5155 | 0 | } |
5156 | 211 | case PM_SOURCE_LINE_NODE: { Branch (5156:9): [True: 211, False: 724k]
|
5157 | 211 | pm_buffer_append_string(buffer, "{\"type\":\"SourceLineNode\",\"location\":", 36); |
5158 | | |
5159 | 211 | const pm_source_line_node_t *cast = (const pm_source_line_node_t *) node; |
5160 | 211 | pm_dump_json_location(buffer, &cast->base.location); |
5161 | | |
5162 | 211 | pm_buffer_append_byte(buffer, '}'); |
5163 | 211 | break; |
5164 | 0 | } |
5165 | 6.60k | case PM_SPLAT_NODE: { Branch (5165:9): [True: 6.60k, False: 718k]
|
5166 | 6.60k | pm_buffer_append_string(buffer, "{\"type\":\"SplatNode\",\"location\":", 31); |
5167 | | |
5168 | 6.60k | const pm_splat_node_t *cast = (const pm_splat_node_t *) node; |
5169 | 6.60k | pm_dump_json_location(buffer, &cast->base.location); |
5170 | | |
5171 | | // Dump the operator_loc field |
5172 | 6.60k | pm_buffer_append_byte(buffer, ','); |
5173 | 6.60k | pm_buffer_append_string(buffer, "\"operator_loc\":", 15); |
5174 | 6.60k | pm_dump_json_location(buffer, &cast->operator_loc); |
5175 | | |
5176 | | // Dump the expression field |
5177 | 6.60k | pm_buffer_append_byte(buffer, ','); |
5178 | 6.60k | pm_buffer_append_string(buffer, "\"expression\":", 13); |
5179 | 6.60k | if (cast->expression != NULL) { Branch (5179:17): [True: 4.07k, False: 2.53k]
|
5180 | 4.07k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression); |
5181 | 4.07k | } else { |
5182 | 2.53k | pm_buffer_append_string(buffer, "null", 4); |
5183 | 2.53k | } |
5184 | | |
5185 | 6.60k | pm_buffer_append_byte(buffer, '}'); |
5186 | 6.60k | break; |
5187 | 0 | } |
5188 | 47.6k | case PM_STATEMENTS_NODE: { Branch (5188:9): [True: 47.6k, False: 677k]
|
5189 | 47.6k | pm_buffer_append_string(buffer, "{\"type\":\"StatementsNode\",\"location\":", 36); |
5190 | | |
5191 | 47.6k | const pm_statements_node_t *cast = (const pm_statements_node_t *) node; |
5192 | 47.6k | pm_dump_json_location(buffer, &cast->base.location); |
5193 | | |
5194 | | // Dump the body field |
5195 | 47.6k | pm_buffer_append_byte(buffer, ','); |
5196 | 47.6k | pm_buffer_append_string(buffer, "\"body\":", 7); |
5197 | 47.6k | const pm_node_list_t *body = &cast->body; |
5198 | 47.6k | pm_buffer_append_byte(buffer, '['); |
5199 | | |
5200 | 278k | for (size_t index = 0; index < body->size; index++230k ) { Branch (5200:36): [True: 230k, False: 47.6k]
|
5201 | 230k | if (index != 0) pm_buffer_append_byte(buffer, ',')182k ; Branch (5201:21): [True: 182k, False: 47.5k]
|
5202 | 230k | pm_dump_json(buffer, parser, body->nodes[index]); |
5203 | 230k | } |
5204 | 47.6k | pm_buffer_append_byte(buffer, ']'); |
5205 | | |
5206 | 47.6k | pm_buffer_append_byte(buffer, '}'); |
5207 | 47.6k | break; |
5208 | 0 | } |
5209 | 40.2k | case PM_STRING_NODE: { Branch (5209:9): [True: 40.2k, False: 684k]
|
5210 | 40.2k | pm_buffer_append_string(buffer, "{\"type\":\"StringNode\",\"location\":", 32); |
5211 | | |
5212 | 40.2k | const pm_string_node_t *cast = (const pm_string_node_t *) node; |
5213 | 40.2k | pm_dump_json_location(buffer, &cast->base.location); |
5214 | | |
5215 | | // Dump the StringFlags field |
5216 | 40.2k | pm_buffer_append_byte(buffer, ','); |
5217 | 40.2k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
5218 | 40.2k | size_t flags = 0; |
5219 | 40.2k | pm_buffer_append_byte(buffer, '['); |
5220 | 40.2k | if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_UTF8_ENCODING)) { |
5221 | 635 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5221:21): [True: 0, False: 635]
|
5222 | 635 | pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22); |
5223 | 635 | flags++; |
5224 | 635 | } |
5225 | 40.2k | if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_BINARY_ENCODING)) { |
5226 | 132 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5226:21): [True: 0, False: 132]
|
5227 | 132 | pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24); |
5228 | 132 | flags++; |
5229 | 132 | } |
5230 | 40.2k | if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FROZEN)) { |
5231 | 16.2k | if (flags != 0) pm_buffer_append_byte(buffer, ',')323 ; Branch (5231:21): [True: 323, False: 15.9k]
|
5232 | 16.2k | pm_buffer_append_string(buffer, "\"FROZEN\"", 8); |
5233 | 16.2k | flags++; |
5234 | 16.2k | } |
5235 | 40.2k | if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_MUTABLE)) { |
5236 | 799 | if (flags != 0) pm_buffer_append_byte(buffer, ',')108 ; Branch (5236:21): [True: 108, False: 691]
|
5237 | 799 | pm_buffer_append_string(buffer, "\"MUTABLE\"", 9); |
5238 | 799 | flags++; |
5239 | 799 | } |
5240 | 40.2k | pm_buffer_append_byte(buffer, ']'); |
5241 | | |
5242 | | // Dump the opening_loc field |
5243 | 40.2k | pm_buffer_append_byte(buffer, ','); |
5244 | 40.2k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
5245 | 40.2k | if (cast->opening_loc.length != 0) { Branch (5245:17): [True: 18.2k, False: 21.9k]
|
5246 | 18.2k | pm_dump_json_location(buffer, &cast->opening_loc); |
5247 | 21.9k | } else { |
5248 | 21.9k | pm_buffer_append_string(buffer, "null", 4); |
5249 | 21.9k | } |
5250 | | |
5251 | | // Dump the content_loc field |
5252 | 40.2k | pm_buffer_append_byte(buffer, ','); |
5253 | 40.2k | pm_buffer_append_string(buffer, "\"content_loc\":", 14); |
5254 | 40.2k | pm_dump_json_location(buffer, &cast->content_loc); |
5255 | | |
5256 | | // Dump the closing_loc field |
5257 | 40.2k | pm_buffer_append_byte(buffer, ','); |
5258 | 40.2k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
5259 | 40.2k | if (cast->closing_loc.length != 0) { Branch (5259:17): [True: 15.7k, False: 24.5k]
|
5260 | 15.7k | pm_dump_json_location(buffer, &cast->closing_loc); |
5261 | 24.5k | } else { |
5262 | 24.5k | pm_buffer_append_string(buffer, "null", 4); |
5263 | 24.5k | } |
5264 | | |
5265 | | // Dump the unescaped field |
5266 | 40.2k | pm_buffer_append_byte(buffer, ','); |
5267 | 40.2k | pm_buffer_append_string(buffer, "\"unescaped\":", 12); |
5268 | 40.2k | const pm_string_t *unescaped = &cast->unescaped; |
5269 | 40.2k | pm_buffer_append_byte(buffer, '"'); |
5270 | 40.2k | pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON); |
5271 | 40.2k | pm_buffer_append_byte(buffer, '"'); |
5272 | | |
5273 | 40.2k | pm_buffer_append_byte(buffer, '}'); |
5274 | 40.2k | break; |
5275 | 0 | } |
5276 | 215 | case PM_SUPER_NODE: { Branch (5276:9): [True: 215, False: 724k]
|
5277 | 215 | pm_buffer_append_string(buffer, "{\"type\":\"SuperNode\",\"location\":", 31); |
5278 | | |
5279 | 215 | const pm_super_node_t *cast = (const pm_super_node_t *) node; |
5280 | 215 | pm_dump_json_location(buffer, &cast->base.location); |
5281 | | |
5282 | | // Dump the keyword_loc field |
5283 | 215 | pm_buffer_append_byte(buffer, ','); |
5284 | 215 | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
5285 | 215 | pm_dump_json_location(buffer, &cast->keyword_loc); |
5286 | | |
5287 | | // Dump the lparen_loc field |
5288 | 215 | pm_buffer_append_byte(buffer, ','); |
5289 | 215 | pm_buffer_append_string(buffer, "\"lparen_loc\":", 13); |
5290 | 215 | if (cast->lparen_loc.length != 0) { Branch (5290:17): [True: 139, False: 76]
|
5291 | 139 | pm_dump_json_location(buffer, &cast->lparen_loc); |
5292 | 139 | } else { |
5293 | 76 | pm_buffer_append_string(buffer, "null", 4); |
5294 | 76 | } |
5295 | | |
5296 | | // Dump the arguments field |
5297 | 215 | pm_buffer_append_byte(buffer, ','); |
5298 | 215 | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
5299 | 215 | if (cast->arguments != NULL) { Branch (5299:17): [True: 150, False: 65]
|
5300 | 150 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments); |
5301 | 150 | } else { |
5302 | 65 | pm_buffer_append_string(buffer, "null", 4); |
5303 | 65 | } |
5304 | | |
5305 | | // Dump the rparen_loc field |
5306 | 215 | pm_buffer_append_byte(buffer, ','); |
5307 | 215 | pm_buffer_append_string(buffer, "\"rparen_loc\":", 13); |
5308 | 215 | if (cast->rparen_loc.length != 0) { Branch (5308:17): [True: 113, False: 102]
|
5309 | 113 | pm_dump_json_location(buffer, &cast->rparen_loc); |
5310 | 113 | } else { |
5311 | 102 | pm_buffer_append_string(buffer, "null", 4); |
5312 | 102 | } |
5313 | | |
5314 | | // Dump the block field |
5315 | 215 | pm_buffer_append_byte(buffer, ','); |
5316 | 215 | pm_buffer_append_string(buffer, "\"block\":", 8); |
5317 | 215 | if (cast->block != NULL) { Branch (5317:17): [True: 91, False: 124]
|
5318 | 91 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->block); |
5319 | 124 | } else { |
5320 | 124 | pm_buffer_append_string(buffer, "null", 4); |
5321 | 124 | } |
5322 | | |
5323 | 215 | pm_buffer_append_byte(buffer, '}'); |
5324 | 215 | break; |
5325 | 0 | } |
5326 | 23.2k | case PM_SYMBOL_NODE: { Branch (5326:9): [True: 23.2k, False: 701k]
|
5327 | 23.2k | pm_buffer_append_string(buffer, "{\"type\":\"SymbolNode\",\"location\":", 32); |
5328 | | |
5329 | 23.2k | const pm_symbol_node_t *cast = (const pm_symbol_node_t *) node; |
5330 | 23.2k | pm_dump_json_location(buffer, &cast->base.location); |
5331 | | |
5332 | | // Dump the SymbolFlags field |
5333 | 23.2k | pm_buffer_append_byte(buffer, ','); |
5334 | 23.2k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
5335 | 23.2k | size_t flags = 0; |
5336 | 23.2k | pm_buffer_append_byte(buffer, '['); |
5337 | 23.2k | if (PM_NODE_FLAG_P(cast, PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING)) { |
5338 | 52 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5338:21): [True: 0, False: 52]
|
5339 | 52 | pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22); |
5340 | 52 | flags++; |
5341 | 52 | } |
5342 | 23.2k | if (PM_NODE_FLAG_P(cast, PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING)) { |
5343 | 7 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5343:21): [True: 0, False: 7]
|
5344 | 7 | pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24); |
5345 | 7 | flags++; |
5346 | 7 | } |
5347 | 23.2k | if (PM_NODE_FLAG_P(cast, PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING)) { |
5348 | 22.4k | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5348:21): [True: 0, False: 22.4k]
|
5349 | 22.4k | pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26); |
5350 | 22.4k | flags++; |
5351 | 22.4k | } |
5352 | 23.2k | pm_buffer_append_byte(buffer, ']'); |
5353 | | |
5354 | | // Dump the opening_loc field |
5355 | 23.2k | pm_buffer_append_byte(buffer, ','); |
5356 | 23.2k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
5357 | 23.2k | if (cast->opening_loc.length != 0) { Branch (5357:17): [True: 12.9k, False: 10.3k]
|
5358 | 12.9k | pm_dump_json_location(buffer, &cast->opening_loc); |
5359 | 12.9k | } else { |
5360 | 10.3k | pm_buffer_append_string(buffer, "null", 4); |
5361 | 10.3k | } |
5362 | | |
5363 | | // Dump the content_loc field |
5364 | 23.2k | pm_buffer_append_byte(buffer, ','); |
5365 | 23.2k | pm_buffer_append_string(buffer, "\"content_loc\":", 14); |
5366 | 23.2k | pm_dump_json_location(buffer, &cast->content_loc); |
5367 | | |
5368 | | // Dump the closing_loc field |
5369 | 23.2k | pm_buffer_append_byte(buffer, ','); |
5370 | 23.2k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
5371 | 23.2k | if (cast->closing_loc.length != 0) { Branch (5371:17): [True: 4.35k, False: 18.9k]
|
5372 | 4.35k | pm_dump_json_location(buffer, &cast->closing_loc); |
5373 | 18.9k | } else { |
5374 | 18.9k | pm_buffer_append_string(buffer, "null", 4); |
5375 | 18.9k | } |
5376 | | |
5377 | | // Dump the unescaped field |
5378 | 23.2k | pm_buffer_append_byte(buffer, ','); |
5379 | 23.2k | pm_buffer_append_string(buffer, "\"unescaped\":", 12); |
5380 | 23.2k | const pm_string_t *unescaped = &cast->unescaped; |
5381 | 23.2k | pm_buffer_append_byte(buffer, '"'); |
5382 | 23.2k | pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON); |
5383 | 23.2k | pm_buffer_append_byte(buffer, '"'); |
5384 | | |
5385 | 23.2k | pm_buffer_append_byte(buffer, '}'); |
5386 | 23.2k | break; |
5387 | 0 | } |
5388 | 3.95k | case PM_TRUE_NODE: { Branch (5388:9): [True: 3.95k, False: 721k]
|
5389 | 3.95k | pm_buffer_append_string(buffer, "{\"type\":\"TrueNode\",\"location\":", 30); |
5390 | | |
5391 | 3.95k | const pm_true_node_t *cast = (const pm_true_node_t *) node; |
5392 | 3.95k | pm_dump_json_location(buffer, &cast->base.location); |
5393 | | |
5394 | 3.95k | pm_buffer_append_byte(buffer, '}'); |
5395 | 3.95k | break; |
5396 | 0 | } |
5397 | 783 | case PM_UNDEF_NODE: { Branch (5397:9): [True: 783, False: 724k]
|
5398 | 783 | pm_buffer_append_string(buffer, "{\"type\":\"UndefNode\",\"location\":", 31); |
5399 | | |
5400 | 783 | const pm_undef_node_t *cast = (const pm_undef_node_t *) node; |
5401 | 783 | pm_dump_json_location(buffer, &cast->base.location); |
5402 | | |
5403 | | // Dump the names field |
5404 | 783 | pm_buffer_append_byte(buffer, ','); |
5405 | 783 | pm_buffer_append_string(buffer, "\"names\":", 8); |
5406 | 783 | const pm_node_list_t *names = &cast->names; |
5407 | 783 | pm_buffer_append_byte(buffer, '['); |
5408 | | |
5409 | 1.75k | for (size_t index = 0; index < names->size; index++970 ) { Branch (5409:36): [True: 970, False: 783]
|
5410 | 970 | if (index != 0) pm_buffer_append_byte(buffer, ',')226 ; Branch (5410:21): [True: 226, False: 744]
|
5411 | 970 | pm_dump_json(buffer, parser, names->nodes[index]); |
5412 | 970 | } |
5413 | 783 | pm_buffer_append_byte(buffer, ']'); |
5414 | | |
5415 | | // Dump the keyword_loc field |
5416 | 783 | pm_buffer_append_byte(buffer, ','); |
5417 | 783 | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
5418 | 783 | pm_dump_json_location(buffer, &cast->keyword_loc); |
5419 | | |
5420 | 783 | pm_buffer_append_byte(buffer, '}'); |
5421 | 783 | break; |
5422 | 0 | } |
5423 | 82 | case PM_UNLESS_NODE: { Branch (5423:9): [True: 82, False: 725k]
|
5424 | 82 | pm_buffer_append_string(buffer, "{\"type\":\"UnlessNode\",\"location\":", 32); |
5425 | | |
5426 | 82 | const pm_unless_node_t *cast = (const pm_unless_node_t *) node; |
5427 | 82 | pm_dump_json_location(buffer, &cast->base.location); |
5428 | | |
5429 | | // Dump the unless_keyword_loc field |
5430 | 82 | pm_buffer_append_byte(buffer, ','); |
5431 | 82 | pm_buffer_append_string(buffer, "\"unless_keyword_loc\":", 21); |
5432 | 82 | pm_dump_json_location(buffer, &cast->unless_keyword_loc); |
5433 | | |
5434 | | // Dump the predicate field |
5435 | 82 | pm_buffer_append_byte(buffer, ','); |
5436 | 82 | pm_buffer_append_string(buffer, "\"predicate\":", 12); |
5437 | 82 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate); |
5438 | | |
5439 | | // Dump the then_keyword_loc field |
5440 | 82 | pm_buffer_append_byte(buffer, ','); |
5441 | 82 | pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19); |
5442 | 82 | if (cast->then_keyword_loc.length != 0) { Branch (5442:17): [True: 16, False: 66]
|
5443 | 16 | pm_dump_json_location(buffer, &cast->then_keyword_loc); |
5444 | 66 | } else { |
5445 | 66 | pm_buffer_append_string(buffer, "null", 4); |
5446 | 66 | } |
5447 | | |
5448 | | // Dump the statements field |
5449 | 82 | pm_buffer_append_byte(buffer, ','); |
5450 | 82 | pm_buffer_append_string(buffer, "\"statements\":", 13); |
5451 | 82 | if (cast->statements != NULL) { Branch (5451:17): [True: 67, False: 15]
|
5452 | 67 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
5453 | 67 | } else { |
5454 | 15 | pm_buffer_append_string(buffer, "null", 4); |
5455 | 15 | } |
5456 | | |
5457 | | // Dump the else_clause field |
5458 | 82 | pm_buffer_append_byte(buffer, ','); |
5459 | 82 | pm_buffer_append_string(buffer, "\"else_clause\":", 14); |
5460 | 82 | if (cast->else_clause != NULL) { Branch (5460:17): [True: 25, False: 57]
|
5461 | 25 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause); |
5462 | 57 | } else { |
5463 | 57 | pm_buffer_append_string(buffer, "null", 4); |
5464 | 57 | } |
5465 | | |
5466 | | // Dump the end_keyword_loc field |
5467 | 82 | pm_buffer_append_byte(buffer, ','); |
5468 | 82 | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
5469 | 82 | if (cast->end_keyword_loc.length != 0) { Branch (5469:17): [True: 31, False: 51]
|
5470 | 31 | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
5471 | 51 | } else { |
5472 | 51 | pm_buffer_append_string(buffer, "null", 4); |
5473 | 51 | } |
5474 | | |
5475 | 82 | pm_buffer_append_byte(buffer, '}'); |
5476 | 82 | break; |
5477 | 0 | } |
5478 | 731 | case PM_UNTIL_NODE: { Branch (5478:9): [True: 731, False: 724k]
|
5479 | 731 | pm_buffer_append_string(buffer, "{\"type\":\"UntilNode\",\"location\":", 31); |
5480 | | |
5481 | 731 | const pm_until_node_t *cast = (const pm_until_node_t *) node; |
5482 | 731 | pm_dump_json_location(buffer, &cast->base.location); |
5483 | | |
5484 | | // Dump the LoopFlags field |
5485 | 731 | pm_buffer_append_byte(buffer, ','); |
5486 | 731 | pm_buffer_append_string(buffer, "\"flags\":", 8); |
5487 | 731 | size_t flags = 0; |
5488 | 731 | pm_buffer_append_byte(buffer, '['); |
5489 | 731 | if (PM_NODE_FLAG_P(cast, PM_LOOP_FLAGS_BEGIN_MODIFIER)) { |
5490 | 114 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5490:21): [True: 0, False: 114]
|
5491 | 114 | pm_buffer_append_string(buffer, "\"BEGIN_MODIFIER\"", 16); |
5492 | 114 | flags++; |
5493 | 114 | } |
5494 | 731 | pm_buffer_append_byte(buffer, ']'); |
5495 | | |
5496 | | // Dump the until_keyword_loc field |
5497 | 731 | pm_buffer_append_byte(buffer, ','); |
5498 | 731 | pm_buffer_append_string(buffer, "\"until_keyword_loc\":", 20); |
5499 | 731 | pm_dump_json_location(buffer, &cast->until_keyword_loc); |
5500 | | |
5501 | | // Dump the do_keyword_loc field |
5502 | 731 | pm_buffer_append_byte(buffer, ','); |
5503 | 731 | pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17); |
5504 | 731 | if (cast->do_keyword_loc.length != 0) { Branch (5504:17): [True: 16, False: 715]
|
5505 | 16 | pm_dump_json_location(buffer, &cast->do_keyword_loc); |
5506 | 715 | } else { |
5507 | 715 | pm_buffer_append_string(buffer, "null", 4); |
5508 | 715 | } |
5509 | | |
5510 | | // Dump the end_keyword_loc field |
5511 | 731 | pm_buffer_append_byte(buffer, ','); |
5512 | 731 | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
5513 | 731 | if (cast->end_keyword_loc.length != 0) { Branch (5513:17): [True: 357, False: 374]
|
5514 | 357 | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
5515 | 374 | } else { |
5516 | 374 | pm_buffer_append_string(buffer, "null", 4); |
5517 | 374 | } |
5518 | | |
5519 | | // Dump the predicate field |
5520 | 731 | pm_buffer_append_byte(buffer, ','); |
5521 | 731 | pm_buffer_append_string(buffer, "\"predicate\":", 12); |
5522 | 731 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate); |
5523 | | |
5524 | | // Dump the statements field |
5525 | 731 | pm_buffer_append_byte(buffer, ','); |
5526 | 731 | pm_buffer_append_string(buffer, "\"statements\":", 13); |
5527 | 731 | if (cast->statements != NULL) { Branch (5527:17): [True: 604, False: 127]
|
5528 | 604 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
5529 | 604 | } else { |
5530 | 127 | pm_buffer_append_string(buffer, "null", 4); |
5531 | 127 | } |
5532 | | |
5533 | 731 | pm_buffer_append_byte(buffer, '}'); |
5534 | 731 | break; |
5535 | 0 | } |
5536 | 4.94k | case PM_WHEN_NODE: { Branch (5536:9): [True: 4.94k, False: 720k]
|
5537 | 4.94k | pm_buffer_append_string(buffer, "{\"type\":\"WhenNode\",\"location\":", 30); |
5538 | | |
5539 | 4.94k | const pm_when_node_t *cast = (const pm_when_node_t *) node; |
5540 | 4.94k | pm_dump_json_location(buffer, &cast->base.location); |
5541 | | |
5542 | | // Dump the when_keyword_loc field |
5543 | 4.94k | pm_buffer_append_byte(buffer, ','); |
5544 | 4.94k | pm_buffer_append_string(buffer, "\"when_keyword_loc\":", 19); |
5545 | 4.94k | pm_dump_json_location(buffer, &cast->when_keyword_loc); |
5546 | | |
5547 | | // Dump the conditions field |
5548 | 4.94k | pm_buffer_append_byte(buffer, ','); |
5549 | 4.94k | pm_buffer_append_string(buffer, "\"conditions\":", 13); |
5550 | 4.94k | const pm_node_list_t *conditions = &cast->conditions; |
5551 | 4.94k | pm_buffer_append_byte(buffer, '['); |
5552 | | |
5553 | 10.3k | for (size_t index = 0; index < conditions->size; index++5.38k ) { Branch (5553:36): [True: 5.38k, False: 4.94k]
|
5554 | 5.38k | if (index != 0) pm_buffer_append_byte(buffer, ',')437 ; Branch (5554:21): [True: 437, False: 4.94k]
|
5555 | 5.38k | pm_dump_json(buffer, parser, conditions->nodes[index]); |
5556 | 5.38k | } |
5557 | 4.94k | pm_buffer_append_byte(buffer, ']'); |
5558 | | |
5559 | | // Dump the then_keyword_loc field |
5560 | 4.94k | pm_buffer_append_byte(buffer, ','); |
5561 | 4.94k | pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19); |
5562 | 4.94k | if (cast->then_keyword_loc.length != 0) { Branch (5562:17): [True: 50, False: 4.89k]
|
5563 | 50 | pm_dump_json_location(buffer, &cast->then_keyword_loc); |
5564 | 4.89k | } else { |
5565 | 4.89k | pm_buffer_append_string(buffer, "null", 4); |
5566 | 4.89k | } |
5567 | | |
5568 | | // Dump the statements field |
5569 | 4.94k | pm_buffer_append_byte(buffer, ','); |
5570 | 4.94k | pm_buffer_append_string(buffer, "\"statements\":", 13); |
5571 | 4.94k | if (cast->statements != NULL) { Branch (5571:17): [True: 1.31k, False: 3.63k]
|
5572 | 1.31k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
5573 | 3.63k | } else { |
5574 | 3.63k | pm_buffer_append_string(buffer, "null", 4); |
5575 | 3.63k | } |
5576 | | |
5577 | 4.94k | pm_buffer_append_byte(buffer, '}'); |
5578 | 4.94k | break; |
5579 | 0 | } |
5580 | 2.49k | case PM_WHILE_NODE: { Branch (5580:9): [True: 2.49k, False: 722k]
|
5581 | 2.49k | pm_buffer_append_string(buffer, "{\"type\":\"WhileNode\",\"location\":", 31); |
5582 | | |
5583 | 2.49k | const pm_while_node_t *cast = (const pm_while_node_t *) node; |
5584 | 2.49k | pm_dump_json_location(buffer, &cast->base.location); |
5585 | | |
5586 | | // Dump the LoopFlags field |
5587 | 2.49k | pm_buffer_append_byte(buffer, ','); |
5588 | 2.49k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
5589 | 2.49k | size_t flags = 0; |
5590 | 2.49k | pm_buffer_append_byte(buffer, '['); |
5591 | 2.49k | if (PM_NODE_FLAG_P(cast, PM_LOOP_FLAGS_BEGIN_MODIFIER)) { |
5592 | 351 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5592:21): [True: 0, False: 351]
|
5593 | 351 | pm_buffer_append_string(buffer, "\"BEGIN_MODIFIER\"", 16); |
5594 | 351 | flags++; |
5595 | 351 | } |
5596 | 2.49k | pm_buffer_append_byte(buffer, ']'); |
5597 | | |
5598 | | // Dump the while_keyword_loc field |
5599 | 2.49k | pm_buffer_append_byte(buffer, ','); |
5600 | 2.49k | pm_buffer_append_string(buffer, "\"while_keyword_loc\":", 20); |
5601 | 2.49k | pm_dump_json_location(buffer, &cast->while_keyword_loc); |
5602 | | |
5603 | | // Dump the do_keyword_loc field |
5604 | 2.49k | pm_buffer_append_byte(buffer, ','); |
5605 | 2.49k | pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17); |
5606 | 2.49k | if (cast->do_keyword_loc.length != 0) { Branch (5606:17): [True: 6, False: 2.49k]
|
5607 | 6 | pm_dump_json_location(buffer, &cast->do_keyword_loc); |
5608 | 2.49k | } else { |
5609 | 2.49k | pm_buffer_append_string(buffer, "null", 4); |
5610 | 2.49k | } |
5611 | | |
5612 | | // Dump the end_keyword_loc field |
5613 | 2.49k | pm_buffer_append_byte(buffer, ','); |
5614 | 2.49k | pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18); |
5615 | 2.49k | if (cast->end_keyword_loc.length != 0) { Branch (5615:17): [True: 871, False: 1.62k]
|
5616 | 871 | pm_dump_json_location(buffer, &cast->end_keyword_loc); |
5617 | 1.62k | } else { |
5618 | 1.62k | pm_buffer_append_string(buffer, "null", 4); |
5619 | 1.62k | } |
5620 | | |
5621 | | // Dump the predicate field |
5622 | 2.49k | pm_buffer_append_byte(buffer, ','); |
5623 | 2.49k | pm_buffer_append_string(buffer, "\"predicate\":", 12); |
5624 | 2.49k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate); |
5625 | | |
5626 | | // Dump the statements field |
5627 | 2.49k | pm_buffer_append_byte(buffer, ','); |
5628 | 2.49k | pm_buffer_append_string(buffer, "\"statements\":", 13); |
5629 | 2.49k | if (cast->statements != NULL) { Branch (5629:17): [True: 2.36k, False: 134]
|
5630 | 2.36k | pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements); |
5631 | 2.36k | } else { |
5632 | 134 | pm_buffer_append_string(buffer, "null", 4); |
5633 | 134 | } |
5634 | | |
5635 | 2.49k | pm_buffer_append_byte(buffer, '}'); |
5636 | 2.49k | break; |
5637 | 0 | } |
5638 | 1.38k | case PM_X_STRING_NODE: { Branch (5638:9): [True: 1.38k, False: 723k]
|
5639 | 1.38k | pm_buffer_append_string(buffer, "{\"type\":\"XStringNode\",\"location\":", 33); |
5640 | | |
5641 | 1.38k | const pm_x_string_node_t *cast = (const pm_x_string_node_t *) node; |
5642 | 1.38k | pm_dump_json_location(buffer, &cast->base.location); |
5643 | | |
5644 | | // Dump the EncodingFlags field |
5645 | 1.38k | pm_buffer_append_byte(buffer, ','); |
5646 | 1.38k | pm_buffer_append_string(buffer, "\"flags\":", 8); |
5647 | 1.38k | size_t flags = 0; |
5648 | 1.38k | pm_buffer_append_byte(buffer, '['); |
5649 | 1.38k | if (PM_NODE_FLAG_P(cast, PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING)) { |
5650 | 10 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5650:21): [True: 0, False: 10]
|
5651 | 10 | pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22); |
5652 | 10 | flags++; |
5653 | 10 | } |
5654 | 1.38k | if (PM_NODE_FLAG_P(cast, PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING)) { |
5655 | 1 | if (flags != 0) pm_buffer_append_byte(buffer, ',')0 ; Branch (5655:21): [True: 0, False: 1]
|
5656 | 1 | pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24); |
5657 | 1 | flags++; |
5658 | 1 | } |
5659 | 1.38k | pm_buffer_append_byte(buffer, ']'); |
5660 | | |
5661 | | // Dump the opening_loc field |
5662 | 1.38k | pm_buffer_append_byte(buffer, ','); |
5663 | 1.38k | pm_buffer_append_string(buffer, "\"opening_loc\":", 14); |
5664 | 1.38k | pm_dump_json_location(buffer, &cast->opening_loc); |
5665 | | |
5666 | | // Dump the content_loc field |
5667 | 1.38k | pm_buffer_append_byte(buffer, ','); |
5668 | 1.38k | pm_buffer_append_string(buffer, "\"content_loc\":", 14); |
5669 | 1.38k | pm_dump_json_location(buffer, &cast->content_loc); |
5670 | | |
5671 | | // Dump the closing_loc field |
5672 | 1.38k | pm_buffer_append_byte(buffer, ','); |
5673 | 1.38k | pm_buffer_append_string(buffer, "\"closing_loc\":", 14); |
5674 | 1.38k | pm_dump_json_location(buffer, &cast->closing_loc); |
5675 | | |
5676 | | // Dump the unescaped field |
5677 | 1.38k | pm_buffer_append_byte(buffer, ','); |
5678 | 1.38k | pm_buffer_append_string(buffer, "\"unescaped\":", 12); |
5679 | 1.38k | const pm_string_t *unescaped = &cast->unescaped; |
5680 | 1.38k | pm_buffer_append_byte(buffer, '"'); |
5681 | 1.38k | pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON); |
5682 | 1.38k | pm_buffer_append_byte(buffer, '"'); |
5683 | | |
5684 | 1.38k | pm_buffer_append_byte(buffer, '}'); |
5685 | 1.38k | break; |
5686 | 0 | } |
5687 | 137 | case PM_YIELD_NODE: { Branch (5687:9): [True: 137, False: 725k]
|
5688 | 137 | pm_buffer_append_string(buffer, "{\"type\":\"YieldNode\",\"location\":", 31); |
5689 | | |
5690 | 137 | const pm_yield_node_t *cast = (const pm_yield_node_t *) node; |
5691 | 137 | pm_dump_json_location(buffer, &cast->base.location); |
5692 | | |
5693 | | // Dump the keyword_loc field |
5694 | 137 | pm_buffer_append_byte(buffer, ','); |
5695 | 137 | pm_buffer_append_string(buffer, "\"keyword_loc\":", 14); |
5696 | 137 | pm_dump_json_location(buffer, &cast->keyword_loc); |
5697 | | |
5698 | | // Dump the lparen_loc field |
5699 | 137 | pm_buffer_append_byte(buffer, ','); |
5700 | 137 | pm_buffer_append_string(buffer, "\"lparen_loc\":", 13); |
5701 | 137 | if (cast->lparen_loc.length != 0) { Branch (5701:17): [True: 64, False: 73]
|
5702 | 64 | pm_dump_json_location(buffer, &cast->lparen_loc); |
5703 | 73 | } else { |
5704 | 73 | pm_buffer_append_string(buffer, "null", 4); |
5705 | 73 | } |
5706 | | |
5707 | | // Dump the arguments field |
5708 | 137 | pm_buffer_append_byte(buffer, ','); |
5709 | 137 | pm_buffer_append_string(buffer, "\"arguments\":", 12); |
5710 | 137 | if (cast->arguments != NULL) { Branch (5710:17): [True: 53, False: 84]
|
5711 | 53 | pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments); |
5712 | 84 | } else { |
5713 | 84 | pm_buffer_append_string(buffer, "null", 4); |
5714 | 84 | } |
5715 | | |
5716 | | // Dump the rparen_loc field |
5717 | 137 | pm_buffer_append_byte(buffer, ','); |
5718 | 137 | pm_buffer_append_string(buffer, "\"rparen_loc\":", 13); |
5719 | 137 | if (cast->rparen_loc.length != 0) { Branch (5719:17): [True: 39, False: 98]
|
5720 | 39 | pm_dump_json_location(buffer, &cast->rparen_loc); |
5721 | 98 | } else { |
5722 | 98 | pm_buffer_append_string(buffer, "null", 4); |
5723 | 98 | } |
5724 | | |
5725 | 137 | pm_buffer_append_byte(buffer, '}'); |
5726 | 137 | break; |
5727 | 0 | } |
5728 | 0 | case PM_SCOPE_NODE: Branch (5728:9): [True: 0, False: 725k]
|
5729 | 0 | break; |
5730 | 725k | } |
5731 | 725k | } |
5732 | | |
5733 | | #endif |