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/node.c.erb */ |
5 | | /* if you are looking to modify the */ |
6 | | /* template */ |
7 | | /*----------------------------------------------------------------------------*/ |
8 | | |
9 | | #line 2 "prism/templates/src/node.c.erb" |
10 | | #include "prism/internal/node.h" |
11 | | |
12 | | #include "prism/internal/arena.h" |
13 | | #include "prism/internal/oom.h" |
14 | | |
15 | | /** |
16 | | * Attempts to grow the node list to the next size. If there is already |
17 | | * capacity in the list, this function does nothing. Otherwise it allocates a |
18 | | * new array from the arena (abandon-and-copy strategy) and copies the existing |
19 | | * data into it. |
20 | | */ |
21 | | static void |
22 | 297k | pm_node_list_grow(pm_arena_t *arena, pm_node_list_t *list, size_t size) { |
23 | 297k | size_t requested_size = list->size + size; |
24 | | |
25 | | // Guard against overflow on the addition. |
26 | 297k | if (requested_size < list->size) PRISM_OOM0 (); Branch (26:9): [True: 0, False: 297k]
|
27 | | |
28 | | // If the requested size is within the existing capacity, return. |
29 | 297k | if (requested_size <= list->capacity) return505 ; Branch (29:9): [True: 505, False: 297k]
|
30 | | |
31 | | // Otherwise, compute the next capacity by doubling. |
32 | 297k | size_t next_capacity = list->capacity == 0 ? 4256k : list->capacity * 240.3k ; Branch (32:28): [True: 256k, False: 40.3k]
|
33 | | |
34 | | // Guard against overflow on the doubling. |
35 | 297k | while (requested_size > next_capacity) { Branch (35:12): [True: 281, False: 297k]
|
36 | 281 | if (next_capacity == 0) PRISM_OOM0 (); Branch (36:13): [True: 0, False: 281]
|
37 | 281 | next_capacity *= 2; |
38 | 281 | } |
39 | | |
40 | | // Allocate a new array from the arena (old array is abandoned). |
41 | 297k | pm_node_t **nodes = (pm_node_t **) pm_arena_alloc(arena, sizeof(pm_node_t *) * next_capacity, PRISM_ALIGNOF(pm_node_t *)); |
42 | | |
43 | | // Copy old data into the new array. |
44 | 297k | if (list->size > 0) { Branch (44:9): [True: 40.3k, False: 256k]
|
45 | 40.3k | memcpy(nodes, list->nodes, list->size * sizeof(pm_node_t *)); |
46 | 40.3k | } |
47 | | |
48 | 297k | list->nodes = nodes; |
49 | 297k | list->capacity = next_capacity; |
50 | 297k | } |
51 | | |
52 | | /** |
53 | | * Slow path for pm_node_list_append_inline: grow the list and append the node. |
54 | | * Do not call directly - use pm_node_list_append_inline instead. |
55 | | */ |
56 | | void |
57 | 295k | pm_node_list_append_slow(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) { |
58 | 295k | pm_node_list_grow(arena, list, 1); |
59 | 295k | list->nodes[list->size++] = node; |
60 | 295k | } |
61 | | |
62 | | /** |
63 | | * Append a new node onto the end of the node list. |
64 | | */ |
65 | | void |
66 | | pm_node_list_append(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) { |
67 | | pm_node_list_append_inline(arena, list, node); |
68 | | } |
69 | | |
70 | | /** |
71 | | * Prepend a new node onto the beginning of the node list. |
72 | | */ |
73 | | void |
74 | 553 | pm_node_list_prepend(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) { |
75 | 553 | pm_node_list_grow(arena, list, 1); |
76 | 553 | memmove(list->nodes + 1, list->nodes, list->size * sizeof(pm_node_t *)); |
77 | 553 | list->nodes[0] = node; |
78 | 553 | list->size++; |
79 | 553 | } |
80 | | |
81 | | /** |
82 | | * Concatenate the given node list onto the end of the other node list. |
83 | | */ |
84 | | void |
85 | 48.2k | pm_node_list_concat(pm_arena_t *arena, pm_node_list_t *list, pm_node_list_t *other) { |
86 | 48.2k | if (other->size > 0) { Branch (86:9): [True: 1.31k, False: 46.9k]
|
87 | 1.31k | pm_node_list_grow(arena, list, other->size); |
88 | 1.31k | memcpy(list->nodes + list->size, other->nodes, other->size * sizeof(pm_node_t *)); |
89 | 1.31k | list->size += other->size; |
90 | 1.31k | } |
91 | 48.2k | } |
92 | | |
93 | | /** |
94 | | * Returns a string representation of the given node type. |
95 | | */ |
96 | | const char * |
97 | | pm_node_type(pm_node_type_t node_type) |
98 | | { |
99 | | switch (node_type) { |
100 | | case PM_ALIAS_GLOBAL_VARIABLE_NODE: |
101 | | return "PM_ALIAS_GLOBAL_VARIABLE_NODE"; |
102 | | case PM_ALIAS_METHOD_NODE: |
103 | | return "PM_ALIAS_METHOD_NODE"; |
104 | | case PM_ALTERNATION_PATTERN_NODE: |
105 | | return "PM_ALTERNATION_PATTERN_NODE"; |
106 | | case PM_AND_NODE: |
107 | | return "PM_AND_NODE"; |
108 | | case PM_ARGUMENTS_NODE: |
109 | | return "PM_ARGUMENTS_NODE"; |
110 | | case PM_ARRAY_NODE: |
111 | | return "PM_ARRAY_NODE"; |
112 | | case PM_ARRAY_PATTERN_NODE: |
113 | | return "PM_ARRAY_PATTERN_NODE"; |
114 | | case PM_ASSOC_NODE: |
115 | | return "PM_ASSOC_NODE"; |
116 | | case PM_ASSOC_SPLAT_NODE: |
117 | | return "PM_ASSOC_SPLAT_NODE"; |
118 | | case PM_BACK_REFERENCE_READ_NODE: |
119 | | return "PM_BACK_REFERENCE_READ_NODE"; |
120 | | case PM_BEGIN_NODE: |
121 | | return "PM_BEGIN_NODE"; |
122 | | case PM_BLOCK_ARGUMENT_NODE: |
123 | | return "PM_BLOCK_ARGUMENT_NODE"; |
124 | | case PM_BLOCK_LOCAL_VARIABLE_NODE: |
125 | | return "PM_BLOCK_LOCAL_VARIABLE_NODE"; |
126 | | case PM_BLOCK_NODE: |
127 | | return "PM_BLOCK_NODE"; |
128 | | case PM_BLOCK_PARAMETER_NODE: |
129 | | return "PM_BLOCK_PARAMETER_NODE"; |
130 | | case PM_BLOCK_PARAMETERS_NODE: |
131 | | return "PM_BLOCK_PARAMETERS_NODE"; |
132 | | case PM_BREAK_NODE: |
133 | | return "PM_BREAK_NODE"; |
134 | | case PM_CALL_AND_WRITE_NODE: |
135 | | return "PM_CALL_AND_WRITE_NODE"; |
136 | | case PM_CALL_NODE: |
137 | | return "PM_CALL_NODE"; |
138 | | case PM_CALL_OPERATOR_WRITE_NODE: |
139 | | return "PM_CALL_OPERATOR_WRITE_NODE"; |
140 | | case PM_CALL_OR_WRITE_NODE: |
141 | | return "PM_CALL_OR_WRITE_NODE"; |
142 | | case PM_CALL_TARGET_NODE: |
143 | | return "PM_CALL_TARGET_NODE"; |
144 | | case PM_CAPTURE_PATTERN_NODE: |
145 | | return "PM_CAPTURE_PATTERN_NODE"; |
146 | | case PM_CASE_MATCH_NODE: |
147 | | return "PM_CASE_MATCH_NODE"; |
148 | | case PM_CASE_NODE: |
149 | | return "PM_CASE_NODE"; |
150 | | case PM_CLASS_NODE: |
151 | | return "PM_CLASS_NODE"; |
152 | | case PM_CLASS_VARIABLE_AND_WRITE_NODE: |
153 | | return "PM_CLASS_VARIABLE_AND_WRITE_NODE"; |
154 | | case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: |
155 | | return "PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE"; |
156 | | case PM_CLASS_VARIABLE_OR_WRITE_NODE: |
157 | | return "PM_CLASS_VARIABLE_OR_WRITE_NODE"; |
158 | | case PM_CLASS_VARIABLE_READ_NODE: |
159 | | return "PM_CLASS_VARIABLE_READ_NODE"; |
160 | | case PM_CLASS_VARIABLE_TARGET_NODE: |
161 | | return "PM_CLASS_VARIABLE_TARGET_NODE"; |
162 | | case PM_CLASS_VARIABLE_WRITE_NODE: |
163 | | return "PM_CLASS_VARIABLE_WRITE_NODE"; |
164 | | case PM_CONSTANT_AND_WRITE_NODE: |
165 | | return "PM_CONSTANT_AND_WRITE_NODE"; |
166 | | case PM_CONSTANT_OPERATOR_WRITE_NODE: |
167 | | return "PM_CONSTANT_OPERATOR_WRITE_NODE"; |
168 | | case PM_CONSTANT_OR_WRITE_NODE: |
169 | | return "PM_CONSTANT_OR_WRITE_NODE"; |
170 | | case PM_CONSTANT_PATH_AND_WRITE_NODE: |
171 | | return "PM_CONSTANT_PATH_AND_WRITE_NODE"; |
172 | | case PM_CONSTANT_PATH_NODE: |
173 | | return "PM_CONSTANT_PATH_NODE"; |
174 | | case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: |
175 | | return "PM_CONSTANT_PATH_OPERATOR_WRITE_NODE"; |
176 | | case PM_CONSTANT_PATH_OR_WRITE_NODE: |
177 | | return "PM_CONSTANT_PATH_OR_WRITE_NODE"; |
178 | | case PM_CONSTANT_PATH_TARGET_NODE: |
179 | | return "PM_CONSTANT_PATH_TARGET_NODE"; |
180 | | case PM_CONSTANT_PATH_WRITE_NODE: |
181 | | return "PM_CONSTANT_PATH_WRITE_NODE"; |
182 | | case PM_CONSTANT_READ_NODE: |
183 | | return "PM_CONSTANT_READ_NODE"; |
184 | | case PM_CONSTANT_TARGET_NODE: |
185 | | return "PM_CONSTANT_TARGET_NODE"; |
186 | | case PM_CONSTANT_WRITE_NODE: |
187 | | return "PM_CONSTANT_WRITE_NODE"; |
188 | | case PM_DEF_NODE: |
189 | | return "PM_DEF_NODE"; |
190 | | case PM_DEFINED_NODE: |
191 | | return "PM_DEFINED_NODE"; |
192 | | case PM_ELSE_NODE: |
193 | | return "PM_ELSE_NODE"; |
194 | | case PM_EMBEDDED_STATEMENTS_NODE: |
195 | | return "PM_EMBEDDED_STATEMENTS_NODE"; |
196 | | case PM_EMBEDDED_VARIABLE_NODE: |
197 | | return "PM_EMBEDDED_VARIABLE_NODE"; |
198 | | case PM_ENSURE_NODE: |
199 | | return "PM_ENSURE_NODE"; |
200 | | case PM_ERROR_RECOVERY_NODE: |
201 | | return "PM_ERROR_RECOVERY_NODE"; |
202 | | case PM_FALSE_NODE: |
203 | | return "PM_FALSE_NODE"; |
204 | | case PM_FIND_PATTERN_NODE: |
205 | | return "PM_FIND_PATTERN_NODE"; |
206 | | case PM_FLIP_FLOP_NODE: |
207 | | return "PM_FLIP_FLOP_NODE"; |
208 | | case PM_FLOAT_NODE: |
209 | | return "PM_FLOAT_NODE"; |
210 | | case PM_FOR_NODE: |
211 | | return "PM_FOR_NODE"; |
212 | | case PM_FORWARDING_ARGUMENTS_NODE: |
213 | | return "PM_FORWARDING_ARGUMENTS_NODE"; |
214 | | case PM_FORWARDING_PARAMETER_NODE: |
215 | | return "PM_FORWARDING_PARAMETER_NODE"; |
216 | | case PM_FORWARDING_SUPER_NODE: |
217 | | return "PM_FORWARDING_SUPER_NODE"; |
218 | | case PM_GLOBAL_VARIABLE_AND_WRITE_NODE: |
219 | | return "PM_GLOBAL_VARIABLE_AND_WRITE_NODE"; |
220 | | case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: |
221 | | return "PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE"; |
222 | | case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: |
223 | | return "PM_GLOBAL_VARIABLE_OR_WRITE_NODE"; |
224 | | case PM_GLOBAL_VARIABLE_READ_NODE: |
225 | | return "PM_GLOBAL_VARIABLE_READ_NODE"; |
226 | | case PM_GLOBAL_VARIABLE_TARGET_NODE: |
227 | | return "PM_GLOBAL_VARIABLE_TARGET_NODE"; |
228 | | case PM_GLOBAL_VARIABLE_WRITE_NODE: |
229 | | return "PM_GLOBAL_VARIABLE_WRITE_NODE"; |
230 | | case PM_HASH_NODE: |
231 | | return "PM_HASH_NODE"; |
232 | | case PM_HASH_PATTERN_NODE: |
233 | | return "PM_HASH_PATTERN_NODE"; |
234 | | case PM_IF_NODE: |
235 | | return "PM_IF_NODE"; |
236 | | case PM_IMAGINARY_NODE: |
237 | | return "PM_IMAGINARY_NODE"; |
238 | | case PM_IMPLICIT_NODE: |
239 | | return "PM_IMPLICIT_NODE"; |
240 | | case PM_IMPLICIT_REST_NODE: |
241 | | return "PM_IMPLICIT_REST_NODE"; |
242 | | case PM_IN_NODE: |
243 | | return "PM_IN_NODE"; |
244 | | case PM_INDEX_AND_WRITE_NODE: |
245 | | return "PM_INDEX_AND_WRITE_NODE"; |
246 | | case PM_INDEX_OPERATOR_WRITE_NODE: |
247 | | return "PM_INDEX_OPERATOR_WRITE_NODE"; |
248 | | case PM_INDEX_OR_WRITE_NODE: |
249 | | return "PM_INDEX_OR_WRITE_NODE"; |
250 | | case PM_INDEX_TARGET_NODE: |
251 | | return "PM_INDEX_TARGET_NODE"; |
252 | | case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: |
253 | | return "PM_INSTANCE_VARIABLE_AND_WRITE_NODE"; |
254 | | case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: |
255 | | return "PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE"; |
256 | | case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: |
257 | | return "PM_INSTANCE_VARIABLE_OR_WRITE_NODE"; |
258 | | case PM_INSTANCE_VARIABLE_READ_NODE: |
259 | | return "PM_INSTANCE_VARIABLE_READ_NODE"; |
260 | | case PM_INSTANCE_VARIABLE_TARGET_NODE: |
261 | | return "PM_INSTANCE_VARIABLE_TARGET_NODE"; |
262 | | case PM_INSTANCE_VARIABLE_WRITE_NODE: |
263 | | return "PM_INSTANCE_VARIABLE_WRITE_NODE"; |
264 | | case PM_INTEGER_NODE: |
265 | | return "PM_INTEGER_NODE"; |
266 | | case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: |
267 | | return "PM_INTERPOLATED_MATCH_LAST_LINE_NODE"; |
268 | | case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: |
269 | | return "PM_INTERPOLATED_REGULAR_EXPRESSION_NODE"; |
270 | | case PM_INTERPOLATED_STRING_NODE: |
271 | | return "PM_INTERPOLATED_STRING_NODE"; |
272 | | case PM_INTERPOLATED_SYMBOL_NODE: |
273 | | return "PM_INTERPOLATED_SYMBOL_NODE"; |
274 | | case PM_INTERPOLATED_X_STRING_NODE: |
275 | | return "PM_INTERPOLATED_X_STRING_NODE"; |
276 | | case PM_IT_LOCAL_VARIABLE_READ_NODE: |
277 | | return "PM_IT_LOCAL_VARIABLE_READ_NODE"; |
278 | | case PM_IT_PARAMETERS_NODE: |
279 | | return "PM_IT_PARAMETERS_NODE"; |
280 | | case PM_KEYWORD_HASH_NODE: |
281 | | return "PM_KEYWORD_HASH_NODE"; |
282 | | case PM_KEYWORD_REST_PARAMETER_NODE: |
283 | | return "PM_KEYWORD_REST_PARAMETER_NODE"; |
284 | | case PM_LAMBDA_NODE: |
285 | | return "PM_LAMBDA_NODE"; |
286 | | case PM_LOCAL_VARIABLE_AND_WRITE_NODE: |
287 | | return "PM_LOCAL_VARIABLE_AND_WRITE_NODE"; |
288 | | case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: |
289 | | return "PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE"; |
290 | | case PM_LOCAL_VARIABLE_OR_WRITE_NODE: |
291 | | return "PM_LOCAL_VARIABLE_OR_WRITE_NODE"; |
292 | | case PM_LOCAL_VARIABLE_READ_NODE: |
293 | | return "PM_LOCAL_VARIABLE_READ_NODE"; |
294 | | case PM_LOCAL_VARIABLE_TARGET_NODE: |
295 | | return "PM_LOCAL_VARIABLE_TARGET_NODE"; |
296 | | case PM_LOCAL_VARIABLE_WRITE_NODE: |
297 | | return "PM_LOCAL_VARIABLE_WRITE_NODE"; |
298 | | case PM_MATCH_LAST_LINE_NODE: |
299 | | return "PM_MATCH_LAST_LINE_NODE"; |
300 | | case PM_MATCH_PREDICATE_NODE: |
301 | | return "PM_MATCH_PREDICATE_NODE"; |
302 | | case PM_MATCH_REQUIRED_NODE: |
303 | | return "PM_MATCH_REQUIRED_NODE"; |
304 | | case PM_MATCH_WRITE_NODE: |
305 | | return "PM_MATCH_WRITE_NODE"; |
306 | | case PM_MODULE_NODE: |
307 | | return "PM_MODULE_NODE"; |
308 | | case PM_MULTI_TARGET_NODE: |
309 | | return "PM_MULTI_TARGET_NODE"; |
310 | | case PM_MULTI_WRITE_NODE: |
311 | | return "PM_MULTI_WRITE_NODE"; |
312 | | case PM_NEXT_NODE: |
313 | | return "PM_NEXT_NODE"; |
314 | | case PM_NIL_NODE: |
315 | | return "PM_NIL_NODE"; |
316 | | case PM_NO_BLOCK_PARAMETER_NODE: |
317 | | return "PM_NO_BLOCK_PARAMETER_NODE"; |
318 | | case PM_NO_KEYWORDS_PARAMETER_NODE: |
319 | | return "PM_NO_KEYWORDS_PARAMETER_NODE"; |
320 | | case PM_NUMBERED_PARAMETERS_NODE: |
321 | | return "PM_NUMBERED_PARAMETERS_NODE"; |
322 | | case PM_NUMBERED_REFERENCE_READ_NODE: |
323 | | return "PM_NUMBERED_REFERENCE_READ_NODE"; |
324 | | case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: |
325 | | return "PM_OPTIONAL_KEYWORD_PARAMETER_NODE"; |
326 | | case PM_OPTIONAL_PARAMETER_NODE: |
327 | | return "PM_OPTIONAL_PARAMETER_NODE"; |
328 | | case PM_OR_NODE: |
329 | | return "PM_OR_NODE"; |
330 | | case PM_PARAMETERS_NODE: |
331 | | return "PM_PARAMETERS_NODE"; |
332 | | case PM_PARENTHESES_NODE: |
333 | | return "PM_PARENTHESES_NODE"; |
334 | | case PM_PINNED_EXPRESSION_NODE: |
335 | | return "PM_PINNED_EXPRESSION_NODE"; |
336 | | case PM_PINNED_VARIABLE_NODE: |
337 | | return "PM_PINNED_VARIABLE_NODE"; |
338 | | case PM_POST_EXECUTION_NODE: |
339 | | return "PM_POST_EXECUTION_NODE"; |
340 | | case PM_PRE_EXECUTION_NODE: |
341 | | return "PM_PRE_EXECUTION_NODE"; |
342 | | case PM_PROGRAM_NODE: |
343 | | return "PM_PROGRAM_NODE"; |
344 | | case PM_RANGE_NODE: |
345 | | return "PM_RANGE_NODE"; |
346 | | case PM_RATIONAL_NODE: |
347 | | return "PM_RATIONAL_NODE"; |
348 | | case PM_REDO_NODE: |
349 | | return "PM_REDO_NODE"; |
350 | | case PM_REGULAR_EXPRESSION_NODE: |
351 | | return "PM_REGULAR_EXPRESSION_NODE"; |
352 | | case PM_REQUIRED_KEYWORD_PARAMETER_NODE: |
353 | | return "PM_REQUIRED_KEYWORD_PARAMETER_NODE"; |
354 | | case PM_REQUIRED_PARAMETER_NODE: |
355 | | return "PM_REQUIRED_PARAMETER_NODE"; |
356 | | case PM_RESCUE_MODIFIER_NODE: |
357 | | return "PM_RESCUE_MODIFIER_NODE"; |
358 | | case PM_RESCUE_NODE: |
359 | | return "PM_RESCUE_NODE"; |
360 | | case PM_REST_PARAMETER_NODE: |
361 | | return "PM_REST_PARAMETER_NODE"; |
362 | | case PM_RETRY_NODE: |
363 | | return "PM_RETRY_NODE"; |
364 | | case PM_RETURN_NODE: |
365 | | return "PM_RETURN_NODE"; |
366 | | case PM_SELF_NODE: |
367 | | return "PM_SELF_NODE"; |
368 | | case PM_SHAREABLE_CONSTANT_NODE: |
369 | | return "PM_SHAREABLE_CONSTANT_NODE"; |
370 | | case PM_SINGLETON_CLASS_NODE: |
371 | | return "PM_SINGLETON_CLASS_NODE"; |
372 | | case PM_SOURCE_ENCODING_NODE: |
373 | | return "PM_SOURCE_ENCODING_NODE"; |
374 | | case PM_SOURCE_FILE_NODE: |
375 | | return "PM_SOURCE_FILE_NODE"; |
376 | | case PM_SOURCE_LINE_NODE: |
377 | | return "PM_SOURCE_LINE_NODE"; |
378 | | case PM_SPLAT_NODE: |
379 | | return "PM_SPLAT_NODE"; |
380 | | case PM_STATEMENTS_NODE: |
381 | | return "PM_STATEMENTS_NODE"; |
382 | | case PM_STRING_NODE: |
383 | | return "PM_STRING_NODE"; |
384 | | case PM_SUPER_NODE: |
385 | | return "PM_SUPER_NODE"; |
386 | | case PM_SYMBOL_NODE: |
387 | | return "PM_SYMBOL_NODE"; |
388 | | case PM_TRUE_NODE: |
389 | | return "PM_TRUE_NODE"; |
390 | | case PM_UNDEF_NODE: |
391 | | return "PM_UNDEF_NODE"; |
392 | | case PM_UNLESS_NODE: |
393 | | return "PM_UNLESS_NODE"; |
394 | | case PM_UNTIL_NODE: |
395 | | return "PM_UNTIL_NODE"; |
396 | | case PM_WHEN_NODE: |
397 | | return "PM_WHEN_NODE"; |
398 | | case PM_WHILE_NODE: |
399 | | return "PM_WHILE_NODE"; |
400 | | case PM_X_STRING_NODE: |
401 | | return "PM_X_STRING_NODE"; |
402 | | case PM_YIELD_NODE: |
403 | | return "PM_YIELD_NODE"; |
404 | | } |
405 | | return ""; |
406 | | } |
407 | | |
408 | | /** |
409 | | * Visit each of the nodes in this subtree using the given visitor callback. The |
410 | | * callback function will be called for each node in the subtree, and its |
411 | | * return value determines whether the walk visits that node's children, skips |
412 | | * them, or stops entirely. The data parameter is treated as an opaque pointer |
413 | | * and is passed to the visitor callback for consumers to use as they see fit. |
414 | | */ |
415 | | bool |
416 | 1.19M | pm_visit_node(const pm_node_t *node, pm_visit_callback_t visitor, void *data) { |
417 | 1.19M | pm_visit_result_t result = visitor(node, data); |
418 | 1.19M | if (result == PM_VISIT_DESCEND) return pm_visit_child_nodes(node, visitor, data)1.07M ; Branch (418:9): [True: 1.07M, False: 120k]
|
419 | 120k | return result != PM_VISIT_STOP; |
420 | 1.19M | } |
421 | | |
422 | | /** |
423 | | * Visit the children of the given node with the given callback. This is the |
424 | | * default behavior for walking the tree that is called from pm_visit_node if |
425 | | * the callback returns PM_VISIT_DESCEND. A stop from any child returns false |
426 | | * immediately, so that it propagates up through every enclosing call. |
427 | | */ |
428 | | bool |
429 | 1.19M | pm_visit_child_nodes(const pm_node_t *node, pm_visit_callback_t visitor, void *data) { |
430 | 1.19M | switch (PM_NODE_TYPE(node)) { |
431 | 326 | case PM_ALIAS_GLOBAL_VARIABLE_NODE: { Branch (431:9): [True: 326, False: 1.19M]
|
432 | 326 | const pm_alias_global_variable_node_t *cast = (const pm_alias_global_variable_node_t *) node; |
433 | | |
434 | | // Visit the new_name field |
435 | 326 | if (!pm_visit_node((const pm_node_t *) cast->new_name, visitor, data)) return 0 false0 ; Branch (435:17): [True: 0, False: 326]
|
436 | | |
437 | | // Visit the old_name field |
438 | 326 | if (!pm_visit_node((const pm_node_t *) cast->old_name, visitor, data)) return 0 false0 ; Branch (438:17): [True: 0, False: 326]
|
439 | | |
440 | 326 | break; |
441 | 326 | } |
442 | 2.15k | case PM_ALIAS_METHOD_NODE: { Branch (442:9): [True: 2.15k, False: 1.18M]
|
443 | 2.15k | const pm_alias_method_node_t *cast = (const pm_alias_method_node_t *) node; |
444 | | |
445 | | // Visit the new_name field |
446 | 2.15k | if (!pm_visit_node((const pm_node_t *) cast->new_name, visitor, data)) return 0 false0 ; Branch (446:17): [True: 0, False: 2.15k]
|
447 | | |
448 | | // Visit the old_name field |
449 | 2.15k | if (!pm_visit_node((const pm_node_t *) cast->old_name, visitor, data)) return 0 false0 ; Branch (449:17): [True: 0, False: 2.15k]
|
450 | | |
451 | 2.15k | break; |
452 | 2.15k | } |
453 | 2.15k | case PM_ALTERNATION_PATTERN_NODE: { Branch (453:9): [True: 1.20k, False: 1.18M]
|
454 | 1.20k | const pm_alternation_pattern_node_t *cast = (const pm_alternation_pattern_node_t *) node; |
455 | | |
456 | | // Visit the left field |
457 | 1.20k | if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return 0 false0 ; Branch (457:17): [True: 0, False: 1.20k]
|
458 | | |
459 | | // Visit the right field |
460 | 1.20k | if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return 0 false0 ; Branch (460:17): [True: 0, False: 1.20k]
|
461 | | |
462 | 1.20k | break; |
463 | 1.20k | } |
464 | 1.20k | case PM_AND_NODE: { Branch (464:9): [True: 526, False: 1.19M]
|
465 | 526 | const pm_and_node_t *cast = (const pm_and_node_t *) node; |
466 | | |
467 | | // Visit the left field |
468 | 526 | if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return 0 false0 ; Branch (468:17): [True: 0, False: 526]
|
469 | | |
470 | | // Visit the right field |
471 | 526 | if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return 0 false0 ; Branch (471:17): [True: 0, False: 526]
|
472 | | |
473 | 526 | break; |
474 | 526 | } |
475 | 75.2k | case PM_ARGUMENTS_NODE: { Branch (475:9): [True: 75.2k, False: 1.11M]
|
476 | 75.2k | const pm_arguments_node_t *cast = (const pm_arguments_node_t *) node; |
477 | | |
478 | | // Visit the arguments field |
479 | 75.2k | const pm_node_list_t *arguments = &cast->arguments; |
480 | 160k | for (size_t index = 0; index < arguments->size; index++84.9k ) { Branch (480:36): [True: 84.9k, False: 75.2k]
|
481 | 84.9k | if (!pm_visit_node(arguments->nodes[index], visitor, data)) return 0 false0 ; Branch (481:21): [True: 0, False: 84.9k]
|
482 | 84.9k | } |
483 | | |
484 | 75.2k | break; |
485 | 75.2k | } |
486 | 75.2k | case PM_ARRAY_NODE: { Branch (486:9): [True: 27.4k, False: 1.16M]
|
487 | 27.4k | const pm_array_node_t *cast = (const pm_array_node_t *) node; |
488 | | |
489 | | // Visit the elements field |
490 | 27.4k | const pm_node_list_t *elements = &cast->elements; |
491 | 102k | for (size_t index = 0; index < elements->size; index++74.9k ) { Branch (491:36): [True: 74.9k, False: 27.4k]
|
492 | 74.9k | if (!pm_visit_node(elements->nodes[index], visitor, data)) return 0 false0 ; Branch (492:21): [True: 0, False: 74.9k]
|
493 | 74.9k | } |
494 | | |
495 | 27.4k | break; |
496 | 27.4k | } |
497 | 27.4k | case PM_ARRAY_PATTERN_NODE: { Branch (497:9): [True: 5.42k, False: 1.18M]
|
498 | 5.42k | const pm_array_pattern_node_t *cast = (const pm_array_pattern_node_t *) node; |
499 | | |
500 | | // Visit the constant field |
501 | 5.42k | if (cast->constant != NULL && !pm_visit_node((const pm_node_t *) cast->constant, visitor, data)200 ) return 0 false0 ; Branch (501:17): [True: 200, False: 5.22k]
Branch (501:43): [True: 0, False: 200]
|
502 | | |
503 | | // Visit the requireds field |
504 | 5.42k | const pm_node_list_t *requireds = &cast->requireds; |
505 | 15.4k | for (size_t index = 0; index < requireds->size; index++10.0k ) { Branch (505:36): [True: 10.0k, False: 5.42k]
|
506 | 10.0k | if (!pm_visit_node(requireds->nodes[index], visitor, data)) return 0 false0 ; Branch (506:21): [True: 0, False: 10.0k]
|
507 | 10.0k | } |
508 | | |
509 | | // Visit the rest field |
510 | 5.42k | if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)882 ) return 0 false0 ; Branch (510:17): [True: 882, False: 4.53k]
Branch (510:39): [True: 0, False: 882]
|
511 | | |
512 | | // Visit the posts field |
513 | 5.42k | const pm_node_list_t *posts = &cast->posts; |
514 | 6.60k | for (size_t index = 0; index < posts->size; index++1.18k ) { Branch (514:36): [True: 1.18k, False: 5.42k]
|
515 | 1.18k | if (!pm_visit_node(posts->nodes[index], visitor, data)) return 0 false0 ; Branch (515:21): [True: 0, False: 1.18k]
|
516 | 1.18k | } |
517 | | |
518 | 5.42k | break; |
519 | 5.42k | } |
520 | 27.4k | case PM_ASSOC_NODE: { Branch (520:9): [True: 27.4k, False: 1.16M]
|
521 | 27.4k | const pm_assoc_node_t *cast = (const pm_assoc_node_t *) node; |
522 | | |
523 | | // Visit the key field |
524 | 27.4k | if (!pm_visit_node((const pm_node_t *) cast->key, visitor, data)) return 0 false0 ; Branch (524:17): [True: 0, False: 27.4k]
|
525 | | |
526 | | // Visit the value field |
527 | 27.4k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (527:17): [True: 0, False: 27.4k]
|
528 | | |
529 | 27.4k | break; |
530 | 27.4k | } |
531 | 27.4k | case PM_ASSOC_SPLAT_NODE: { Branch (531:9): [True: 3.37k, False: 1.18M]
|
532 | 3.37k | const pm_assoc_splat_node_t *cast = (const pm_assoc_splat_node_t *) node; |
533 | | |
534 | | // Visit the value field |
535 | 3.37k | if (cast->value != NULL && !pm_visit_node((const pm_node_t *) cast->value, visitor, data)2.78k ) return 0 false0 ; Branch (535:17): [True: 2.78k, False: 592]
Branch (535:40): [True: 0, False: 2.78k]
|
536 | | |
537 | 3.37k | break; |
538 | 3.37k | } |
539 | 3.37k | case PM_BACK_REFERENCE_READ_NODE: Branch (539:9): [True: 254, False: 1.19M]
|
540 | 254 | break; |
541 | 5.77k | case PM_BEGIN_NODE: { Branch (541:9): [True: 5.77k, False: 1.18M]
|
542 | 5.77k | const pm_begin_node_t *cast = (const pm_begin_node_t *) node; |
543 | | |
544 | | // Visit the statements field |
545 | 5.77k | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)4.60k ) return 0 false0 ; Branch (545:17): [True: 4.60k, False: 1.17k]
Branch (545:45): [True: 0, False: 4.60k]
|
546 | | |
547 | | // Visit the rescue_clause field |
548 | 5.77k | if (cast->rescue_clause != NULL && !pm_visit_node((const pm_node_t *) cast->rescue_clause, visitor, data)2.65k ) return 0 false0 ; Branch (548:17): [True: 2.65k, False: 3.12k]
Branch (548:48): [True: 0, False: 2.65k]
|
549 | | |
550 | | // Visit the else_clause field |
551 | 5.77k | if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)1.96k ) return 0 false0 ; Branch (551:17): [True: 1.96k, False: 3.80k]
Branch (551:46): [True: 0, False: 1.96k]
|
552 | | |
553 | | // Visit the ensure_clause field |
554 | 5.77k | if (cast->ensure_clause != NULL && !pm_visit_node((const pm_node_t *) cast->ensure_clause, visitor, data)1.04k ) return 0 false0 ; Branch (554:17): [True: 1.04k, False: 4.72k]
Branch (554:48): [True: 0, False: 1.04k]
|
555 | | |
556 | 5.77k | break; |
557 | 5.77k | } |
558 | 5.77k | case PM_BLOCK_ARGUMENT_NODE: { Branch (558:9): [True: 956, False: 1.18M]
|
559 | 956 | const pm_block_argument_node_t *cast = (const pm_block_argument_node_t *) node; |
560 | | |
561 | | // Visit the expression field |
562 | 956 | if (cast->expression != NULL && !pm_visit_node((const pm_node_t *) cast->expression, visitor, data)858 ) return 0 false0 ; Branch (562:17): [True: 858, False: 98]
Branch (562:45): [True: 0, False: 858]
|
563 | | |
564 | 956 | break; |
565 | 956 | } |
566 | 1.17k | case PM_BLOCK_LOCAL_VARIABLE_NODE: Branch (566:9): [True: 1.17k, False: 1.18M]
|
567 | 1.17k | break; |
568 | 8.92k | case PM_BLOCK_NODE: { Branch (568:9): [True: 8.92k, False: 1.18M]
|
569 | 8.92k | const pm_block_node_t *cast = (const pm_block_node_t *) node; |
570 | | |
571 | | // Visit the parameters field |
572 | 8.92k | if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)2.01k ) return 0 false0 ; Branch (572:17): [True: 2.01k, False: 6.91k]
Branch (572:45): [True: 0, False: 2.01k]
|
573 | | |
574 | | // Visit the body field |
575 | 8.92k | if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)5.71k ) return 0 false0 ; Branch (575:17): [True: 5.71k, False: 3.21k]
Branch (575:39): [True: 0, False: 5.71k]
|
576 | | |
577 | 8.92k | break; |
578 | 8.92k | } |
579 | 8.92k | case PM_BLOCK_PARAMETER_NODE: Branch (579:9): [True: 681, False: 1.19M]
|
580 | 681 | break; |
581 | 2.96k | case PM_BLOCK_PARAMETERS_NODE: { Branch (581:9): [True: 2.96k, False: 1.18M]
|
582 | 2.96k | const pm_block_parameters_node_t *cast = (const pm_block_parameters_node_t *) node; |
583 | | |
584 | | // Visit the parameters field |
585 | 2.96k | if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)2.71k ) return 0 false0 ; Branch (585:17): [True: 2.71k, False: 249]
Branch (585:45): [True: 0, False: 2.71k]
|
586 | | |
587 | | // Visit the locals field |
588 | 2.96k | const pm_node_list_t *locals = &cast->locals; |
589 | 4.14k | for (size_t index = 0; index < locals->size; index++1.17k ) { Branch (589:36): [True: 1.17k, False: 2.96k]
|
590 | 1.17k | if (!pm_visit_node(locals->nodes[index], visitor, data)) return 0 false0 ; Branch (590:21): [True: 0, False: 1.17k]
|
591 | 1.17k | } |
592 | | |
593 | 2.96k | break; |
594 | 2.96k | } |
595 | 2.96k | case PM_BREAK_NODE: { Branch (595:9): [True: 1.40k, False: 1.18M]
|
596 | 1.40k | const pm_break_node_t *cast = (const pm_break_node_t *) node; |
597 | | |
598 | | // Visit the arguments field |
599 | 1.40k | if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)236 ) return 0 false0 ; Branch (599:17): [True: 236, False: 1.16k]
Branch (599:44): [True: 0, False: 236]
|
600 | | |
601 | 1.40k | break; |
602 | 1.40k | } |
603 | 1.40k | case PM_CALL_AND_WRITE_NODE: { Branch (603:9): [True: 264, False: 1.19M]
|
604 | 264 | const pm_call_and_write_node_t *cast = (const pm_call_and_write_node_t *) node; |
605 | | |
606 | | // Visit the receiver field |
607 | 264 | if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)245 ) return 0 false0 ; Branch (607:17): [True: 245, False: 19]
Branch (607:43): [True: 0, False: 245]
|
608 | | |
609 | | // Visit the value field |
610 | 264 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (610:17): [True: 0, False: 264]
|
611 | | |
612 | 264 | break; |
613 | 264 | } |
614 | 196k | case PM_CALL_NODE: { Branch (614:9): [True: 196k, False: 994k]
|
615 | 196k | const pm_call_node_t *cast = (const pm_call_node_t *) node; |
616 | | |
617 | | // Visit the receiver field |
618 | 196k | if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)61.6k ) return 0 false0 ; Branch (618:17): [True: 61.6k, False: 134k]
Branch (618:43): [True: 0, False: 61.6k]
|
619 | | |
620 | | // Visit the arguments field |
621 | 196k | if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)69.4k ) return 0 false0 ; Branch (621:17): [True: 69.4k, False: 127k]
Branch (621:44): [True: 0, False: 69.4k]
|
622 | | |
623 | | // Visit the block field |
624 | 196k | if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)9.49k ) return 0 false0 ; Branch (624:17): [True: 9.49k, False: 187k]
Branch (624:40): [True: 0, False: 9.49k]
|
625 | | |
626 | 196k | break; |
627 | 196k | } |
628 | 196k | case PM_CALL_OPERATOR_WRITE_NODE: { Branch (628:9): [True: 1.45k, False: 1.18M]
|
629 | 1.45k | const pm_call_operator_write_node_t *cast = (const pm_call_operator_write_node_t *) node; |
630 | | |
631 | | // Visit the receiver field |
632 | 1.45k | if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)1.41k ) return 0 false0 ; Branch (632:17): [True: 1.41k, False: 43]
Branch (632:43): [True: 0, False: 1.41k]
|
633 | | |
634 | | // Visit the value field |
635 | 1.45k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (635:17): [True: 0, False: 1.45k]
|
636 | | |
637 | 1.45k | break; |
638 | 1.45k | } |
639 | 1.45k | case PM_CALL_OR_WRITE_NODE: { Branch (639:9): [True: 659, False: 1.19M]
|
640 | 659 | const pm_call_or_write_node_t *cast = (const pm_call_or_write_node_t *) node; |
641 | | |
642 | | // Visit the receiver field |
643 | 659 | if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)445 ) return 0 false0 ; Branch (643:17): [True: 445, False: 214]
Branch (643:43): [True: 0, False: 445]
|
644 | | |
645 | | // Visit the value field |
646 | 659 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (646:17): [True: 0, False: 659]
|
647 | | |
648 | 659 | break; |
649 | 659 | } |
650 | 1.43k | case PM_CALL_TARGET_NODE: { Branch (650:9): [True: 1.43k, False: 1.18M]
|
651 | 1.43k | const pm_call_target_node_t *cast = (const pm_call_target_node_t *) node; |
652 | | |
653 | | // Visit the receiver field |
654 | 1.43k | if (!pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return 0 false0 ; Branch (654:17): [True: 0, False: 1.43k]
|
655 | | |
656 | 1.43k | break; |
657 | 1.43k | } |
658 | 1.43k | case PM_CAPTURE_PATTERN_NODE: { Branch (658:9): [True: 657, False: 1.19M]
|
659 | 657 | const pm_capture_pattern_node_t *cast = (const pm_capture_pattern_node_t *) node; |
660 | | |
661 | | // Visit the value field |
662 | 657 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (662:17): [True: 0, False: 657]
|
663 | | |
664 | | // Visit the target field |
665 | 657 | if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return 0 false0 ; Branch (665:17): [True: 0, False: 657]
|
666 | | |
667 | 657 | break; |
668 | 657 | } |
669 | 5.20k | case PM_CASE_MATCH_NODE: { Branch (669:9): [True: 5.20k, False: 1.18M]
|
670 | 5.20k | const pm_case_match_node_t *cast = (const pm_case_match_node_t *) node; |
671 | | |
672 | | // Visit the predicate field |
673 | 5.20k | if (cast->predicate != NULL && !pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)5.07k ) return 0 false0 ; Branch (673:17): [True: 5.07k, False: 133]
Branch (673:44): [True: 0, False: 5.07k]
|
674 | | |
675 | | // Visit the conditions field |
676 | 5.20k | const pm_node_list_t *conditions = &cast->conditions; |
677 | 10.0k | for (size_t index = 0; index < conditions->size; index++4.85k ) { Branch (677:36): [True: 4.85k, False: 5.20k]
|
678 | 4.85k | if (!pm_visit_node(conditions->nodes[index], visitor, data)) return 0 false0 ; Branch (678:21): [True: 0, False: 4.85k]
|
679 | 4.85k | } |
680 | | |
681 | | // Visit the else_clause field |
682 | 5.20k | if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)1.46k ) return 0 false0 ; Branch (682:17): [True: 1.46k, False: 3.74k]
Branch (682:46): [True: 0, False: 1.46k]
|
683 | | |
684 | 5.20k | break; |
685 | 5.20k | } |
686 | 5.20k | case PM_CASE_NODE: { Branch (686:9): [True: 1.99k, False: 1.18M]
|
687 | 1.99k | const pm_case_node_t *cast = (const pm_case_node_t *) node; |
688 | | |
689 | | // Visit the predicate field |
690 | 1.99k | if (cast->predicate != NULL && !pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)395 ) return 0 false0 ; Branch (690:17): [True: 395, False: 1.60k]
Branch (690:44): [True: 0, False: 395]
|
691 | | |
692 | | // Visit the conditions field |
693 | 1.99k | const pm_node_list_t *conditions = &cast->conditions; |
694 | 3.94k | for (size_t index = 0; index < conditions->size; index++1.94k ) { Branch (694:36): [True: 1.94k, False: 1.99k]
|
695 | 1.94k | if (!pm_visit_node(conditions->nodes[index], visitor, data)) return 0 false0 ; Branch (695:21): [True: 0, False: 1.94k]
|
696 | 1.94k | } |
697 | | |
698 | | // Visit the else_clause field |
699 | 1.99k | if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)1.42k ) return 0 false0 ; Branch (699:17): [True: 1.42k, False: 571]
Branch (699:46): [True: 0, False: 1.42k]
|
700 | | |
701 | 1.99k | break; |
702 | 1.99k | } |
703 | 1.99k | case PM_CLASS_NODE: { Branch (703:9): [True: 1.38k, False: 1.18M]
|
704 | 1.38k | const pm_class_node_t *cast = (const pm_class_node_t *) node; |
705 | | |
706 | | // Visit the constant_path field |
707 | 1.38k | if (!pm_visit_node((const pm_node_t *) cast->constant_path, visitor, data)) return 0 false0 ; Branch (707:17): [True: 0, False: 1.38k]
|
708 | | |
709 | | // Visit the superclass field |
710 | 1.38k | if (cast->superclass != NULL && !pm_visit_node((const pm_node_t *) cast->superclass, visitor, data)182 ) return 0 false0 ; Branch (710:17): [True: 182, False: 1.20k]
Branch (710:45): [True: 0, False: 182]
|
711 | | |
712 | | // Visit the body field |
713 | 1.38k | if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)1.13k ) return 0 false0 ; Branch (713:17): [True: 1.13k, False: 251]
Branch (713:39): [True: 0, False: 1.13k]
|
714 | | |
715 | 1.38k | break; |
716 | 1.38k | } |
717 | 1.38k | case PM_CLASS_VARIABLE_AND_WRITE_NODE: { Branch (717:9): [True: 18, False: 1.19M]
|
718 | 18 | const pm_class_variable_and_write_node_t *cast = (const pm_class_variable_and_write_node_t *) node; |
719 | | |
720 | | // Visit the value field |
721 | 18 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (721:17): [True: 0, False: 18]
|
722 | | |
723 | 18 | break; |
724 | 18 | } |
725 | 64 | case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: { Branch (725:9): [True: 64, False: 1.19M]
|
726 | 64 | const pm_class_variable_operator_write_node_t *cast = (const pm_class_variable_operator_write_node_t *) node; |
727 | | |
728 | | // Visit the value field |
729 | 64 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (729:17): [True: 0, False: 64]
|
730 | | |
731 | 64 | break; |
732 | 64 | } |
733 | 64 | case PM_CLASS_VARIABLE_OR_WRITE_NODE: { Branch (733:9): [True: 8, False: 1.19M]
|
734 | 8 | const pm_class_variable_or_write_node_t *cast = (const pm_class_variable_or_write_node_t *) node; |
735 | | |
736 | | // Visit the value field |
737 | 8 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (737:17): [True: 0, False: 8]
|
738 | | |
739 | 8 | break; |
740 | 8 | } |
741 | 1.13k | case PM_CLASS_VARIABLE_READ_NODE: Branch (741:9): [True: 1.13k, False: 1.18M]
|
742 | 1.13k | break; |
743 | 1.08k | case PM_CLASS_VARIABLE_TARGET_NODE: Branch (743:9): [True: 1.08k, False: 1.18M]
|
744 | 1.08k | break; |
745 | 481 | case PM_CLASS_VARIABLE_WRITE_NODE: { Branch (745:9): [True: 481, False: 1.19M]
|
746 | 481 | const pm_class_variable_write_node_t *cast = (const pm_class_variable_write_node_t *) node; |
747 | | |
748 | | // Visit the value field |
749 | 481 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (749:17): [True: 0, False: 481]
|
750 | | |
751 | 481 | break; |
752 | 481 | } |
753 | 481 | case PM_CONSTANT_AND_WRITE_NODE: { Branch (753:9): [True: 79, False: 1.19M]
|
754 | 79 | const pm_constant_and_write_node_t *cast = (const pm_constant_and_write_node_t *) node; |
755 | | |
756 | | // Visit the value field |
757 | 79 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (757:17): [True: 0, False: 79]
|
758 | | |
759 | 79 | break; |
760 | 79 | } |
761 | 214 | case PM_CONSTANT_OPERATOR_WRITE_NODE: { Branch (761:9): [True: 214, False: 1.19M]
|
762 | 214 | const pm_constant_operator_write_node_t *cast = (const pm_constant_operator_write_node_t *) node; |
763 | | |
764 | | // Visit the value field |
765 | 214 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (765:17): [True: 0, False: 214]
|
766 | | |
767 | 214 | break; |
768 | 214 | } |
769 | 214 | case PM_CONSTANT_OR_WRITE_NODE: { Branch (769:9): [True: 119, False: 1.19M]
|
770 | 119 | const pm_constant_or_write_node_t *cast = (const pm_constant_or_write_node_t *) node; |
771 | | |
772 | | // Visit the value field |
773 | 119 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (773:17): [True: 0, False: 119]
|
774 | | |
775 | 119 | break; |
776 | 119 | } |
777 | 119 | case PM_CONSTANT_PATH_AND_WRITE_NODE: { Branch (777:9): [True: 33, False: 1.19M]
|
778 | 33 | const pm_constant_path_and_write_node_t *cast = (const pm_constant_path_and_write_node_t *) node; |
779 | | |
780 | | // Visit the target field |
781 | 33 | if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return 0 false0 ; Branch (781:17): [True: 0, False: 33]
|
782 | | |
783 | | // Visit the value field |
784 | 33 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (784:17): [True: 0, False: 33]
|
785 | | |
786 | 33 | break; |
787 | 33 | } |
788 | 8.26k | case PM_CONSTANT_PATH_NODE: { Branch (788:9): [True: 8.26k, False: 1.18M]
|
789 | 8.26k | const pm_constant_path_node_t *cast = (const pm_constant_path_node_t *) node; |
790 | | |
791 | | // Visit the parent field |
792 | 8.26k | if (cast->parent != NULL && !pm_visit_node((const pm_node_t *) cast->parent, visitor, data)5.46k ) return 0 false0 ; Branch (792:17): [True: 5.46k, False: 2.79k]
Branch (792:41): [True: 0, False: 5.46k]
|
793 | | |
794 | 8.26k | break; |
795 | 8.26k | } |
796 | 8.26k | case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: { Branch (796:9): [True: 18, False: 1.19M]
|
797 | 18 | const pm_constant_path_operator_write_node_t *cast = (const pm_constant_path_operator_write_node_t *) node; |
798 | | |
799 | | // Visit the target field |
800 | 18 | if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return 0 false0 ; Branch (800:17): [True: 0, False: 18]
|
801 | | |
802 | | // Visit the value field |
803 | 18 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (803:17): [True: 0, False: 18]
|
804 | | |
805 | 18 | break; |
806 | 18 | } |
807 | 38 | case PM_CONSTANT_PATH_OR_WRITE_NODE: { Branch (807:9): [True: 38, False: 1.19M]
|
808 | 38 | const pm_constant_path_or_write_node_t *cast = (const pm_constant_path_or_write_node_t *) node; |
809 | | |
810 | | // Visit the target field |
811 | 38 | if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return 0 false0 ; Branch (811:17): [True: 0, False: 38]
|
812 | | |
813 | | // Visit the value field |
814 | 38 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (814:17): [True: 0, False: 38]
|
815 | | |
816 | 38 | break; |
817 | 38 | } |
818 | 316 | case PM_CONSTANT_PATH_TARGET_NODE: { Branch (818:9): [True: 316, False: 1.19M]
|
819 | 316 | const pm_constant_path_target_node_t *cast = (const pm_constant_path_target_node_t *) node; |
820 | | |
821 | | // Visit the parent field |
822 | 316 | if (cast->parent != NULL && !pm_visit_node((const pm_node_t *) cast->parent, visitor, data)99 ) return 0 false0 ; Branch (822:17): [True: 99, False: 217]
Branch (822:41): [True: 0, False: 99]
|
823 | | |
824 | 316 | break; |
825 | 316 | } |
826 | 1.74k | case PM_CONSTANT_PATH_WRITE_NODE: { Branch (826:9): [True: 1.74k, False: 1.18M]
|
827 | 1.74k | const pm_constant_path_write_node_t *cast = (const pm_constant_path_write_node_t *) node; |
828 | | |
829 | | // Visit the target field |
830 | 1.74k | if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return 0 false0 ; Branch (830:17): [True: 0, False: 1.74k]
|
831 | | |
832 | | // Visit the value field |
833 | 1.74k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (833:17): [True: 0, False: 1.74k]
|
834 | | |
835 | 1.74k | break; |
836 | 1.74k | } |
837 | 29.1k | case PM_CONSTANT_READ_NODE: Branch (837:9): [True: 29.1k, False: 1.16M]
|
838 | 29.1k | break; |
839 | 1.58k | case PM_CONSTANT_TARGET_NODE: Branch (839:9): [True: 1.58k, False: 1.18M]
|
840 | 1.58k | break; |
841 | 2.01k | case PM_CONSTANT_WRITE_NODE: { Branch (841:9): [True: 2.01k, False: 1.18M]
|
842 | 2.01k | const pm_constant_write_node_t *cast = (const pm_constant_write_node_t *) node; |
843 | | |
844 | | // Visit the value field |
845 | 2.01k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (845:17): [True: 0, False: 2.01k]
|
846 | | |
847 | 2.01k | break; |
848 | 2.01k | } |
849 | 15.9k | case PM_DEF_NODE: { Branch (849:9): [True: 15.9k, False: 1.17M]
|
850 | 15.9k | const pm_def_node_t *cast = (const pm_def_node_t *) node; |
851 | | |
852 | | // Visit the receiver field |
853 | 15.9k | if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)2.54k ) return 0 false0 ; Branch (853:17): [True: 2.54k, False: 13.4k]
Branch (853:43): [True: 0, False: 2.54k]
|
854 | | |
855 | | // Visit the parameters field |
856 | 15.9k | if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)6.56k ) return 0 false0 ; Branch (856:17): [True: 6.56k, False: 9.39k]
Branch (856:45): [True: 0, False: 6.56k]
|
857 | | |
858 | | // Visit the body field |
859 | 15.9k | if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)9.09k ) return 0 false0 ; Branch (859:17): [True: 9.09k, False: 6.86k]
Branch (859:39): [True: 0, False: 9.09k]
|
860 | | |
861 | 15.9k | break; |
862 | 15.9k | } |
863 | 15.9k | case PM_DEFINED_NODE: { Branch (863:9): [True: 169, False: 1.19M]
|
864 | 169 | const pm_defined_node_t *cast = (const pm_defined_node_t *) node; |
865 | | |
866 | | // Visit the value field |
867 | 169 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (867:17): [True: 0, False: 169]
|
868 | | |
869 | 169 | break; |
870 | 169 | } |
871 | 6.72k | case PM_ELSE_NODE: { Branch (871:9): [True: 6.72k, False: 1.18M]
|
872 | 6.72k | const pm_else_node_t *cast = (const pm_else_node_t *) node; |
873 | | |
874 | | // Visit the statements field |
875 | 6.72k | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)6.47k ) return 0 false0 ; Branch (875:17): [True: 6.47k, False: 251]
Branch (875:45): [True: 0, False: 6.47k]
|
876 | | |
877 | 6.72k | break; |
878 | 6.72k | } |
879 | 8.43k | case PM_EMBEDDED_STATEMENTS_NODE: { Branch (879:9): [True: 8.43k, False: 1.18M]
|
880 | 8.43k | const pm_embedded_statements_node_t *cast = (const pm_embedded_statements_node_t *) node; |
881 | | |
882 | | // Visit the statements field |
883 | 8.43k | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)5.07k ) return 0 false0 ; Branch (883:17): [True: 5.07k, False: 3.36k]
Branch (883:45): [True: 0, False: 5.07k]
|
884 | | |
885 | 8.43k | break; |
886 | 8.43k | } |
887 | 8.43k | case PM_EMBEDDED_VARIABLE_NODE: { Branch (887:9): [True: 1.63k, False: 1.18M]
|
888 | 1.63k | const pm_embedded_variable_node_t *cast = (const pm_embedded_variable_node_t *) node; |
889 | | |
890 | | // Visit the variable field |
891 | 1.63k | if (!pm_visit_node((const pm_node_t *) cast->variable, visitor, data)) return 0 false0 ; Branch (891:17): [True: 0, False: 1.63k]
|
892 | | |
893 | 1.63k | break; |
894 | 1.63k | } |
895 | 1.63k | case PM_ENSURE_NODE: { Branch (895:9): [True: 1.04k, False: 1.18M]
|
896 | 1.04k | const pm_ensure_node_t *cast = (const pm_ensure_node_t *) node; |
897 | | |
898 | | // Visit the statements field |
899 | 1.04k | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)648 ) return 0 false0 ; Branch (899:17): [True: 648, False: 400]
Branch (899:45): [True: 0, False: 648]
|
900 | | |
901 | 1.04k | break; |
902 | 1.04k | } |
903 | 119k | case PM_ERROR_RECOVERY_NODE: { Branch (903:9): [True: 119k, False: 1.07M]
|
904 | 119k | const pm_error_recovery_node_t *cast = (const pm_error_recovery_node_t *) node; |
905 | | |
906 | | // Visit the unexpected field |
907 | 119k | if (cast->unexpected != NULL && !pm_visit_node((const pm_node_t *) cast->unexpected, visitor, data)870 ) return 0 false0 ; Branch (907:17): [True: 870, False: 118k]
Branch (907:45): [True: 0, False: 870]
|
908 | | |
909 | 119k | break; |
910 | 119k | } |
911 | 119k | case PM_FALSE_NODE: Branch (911:9): [True: 1.29k, False: 1.18M]
|
912 | 1.29k | break; |
913 | 62 | case PM_FIND_PATTERN_NODE: { Branch (913:9): [True: 62, False: 1.19M]
|
914 | 62 | const pm_find_pattern_node_t *cast = (const pm_find_pattern_node_t *) node; |
915 | | |
916 | | // Visit the constant field |
917 | 62 | if (cast->constant != NULL && !pm_visit_node((const pm_node_t *) cast->constant, visitor, data)10 ) return 0 false0 ; Branch (917:17): [True: 10, False: 52]
Branch (917:43): [True: 0, False: 10]
|
918 | | |
919 | | // Visit the left field |
920 | 62 | if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return 0 false0 ; Branch (920:17): [True: 0, False: 62]
|
921 | | |
922 | | // Visit the requireds field |
923 | 62 | const pm_node_list_t *requireds = &cast->requireds; |
924 | 390 | for (size_t index = 0; index < requireds->size; index++328 ) { Branch (924:36): [True: 328, False: 62]
|
925 | 328 | if (!pm_visit_node(requireds->nodes[index], visitor, data)) return 0 false0 ; Branch (925:21): [True: 0, False: 328]
|
926 | 328 | } |
927 | | |
928 | | // Visit the right field |
929 | 62 | if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return 0 false0 ; Branch (929:17): [True: 0, False: 62]
|
930 | | |
931 | 62 | break; |
932 | 62 | } |
933 | 170 | case PM_FLIP_FLOP_NODE: { Branch (933:9): [True: 170, False: 1.19M]
|
934 | 170 | const pm_flip_flop_node_t *cast = (const pm_flip_flop_node_t *) node; |
935 | | |
936 | | // Visit the left field |
937 | 170 | if (cast->left != NULL && !pm_visit_node((const pm_node_t *) cast->left, visitor, data)74 ) return 0 false0 ; Branch (937:17): [True: 74, False: 96]
Branch (937:39): [True: 0, False: 74]
|
938 | | |
939 | | // Visit the right field |
940 | 170 | if (cast->right != NULL && !pm_visit_node((const pm_node_t *) cast->right, visitor, data)135 ) return 0 false0 ; Branch (940:17): [True: 135, False: 35]
Branch (940:40): [True: 0, False: 135]
|
941 | | |
942 | 170 | break; |
943 | 170 | } |
944 | 4.93k | case PM_FLOAT_NODE: Branch (944:9): [True: 4.93k, False: 1.18M]
|
945 | 4.93k | break; |
946 | 185 | case PM_FOR_NODE: { Branch (946:9): [True: 185, False: 1.19M]
|
947 | 185 | const pm_for_node_t *cast = (const pm_for_node_t *) node; |
948 | | |
949 | | // Visit the index field |
950 | 185 | if (!pm_visit_node((const pm_node_t *) cast->index, visitor, data)) return 0 false0 ; Branch (950:17): [True: 0, False: 185]
|
951 | | |
952 | | // Visit the collection field |
953 | 185 | if (!pm_visit_node((const pm_node_t *) cast->collection, visitor, data)) return 0 false0 ; Branch (953:17): [True: 0, False: 185]
|
954 | | |
955 | | // Visit the statements field |
956 | 185 | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)176 ) return 0 false0 ; Branch (956:17): [True: 176, False: 9]
Branch (956:45): [True: 0, False: 176]
|
957 | | |
958 | 185 | break; |
959 | 185 | } |
960 | 461 | case PM_FORWARDING_ARGUMENTS_NODE: Branch (960:9): [True: 461, False: 1.19M]
|
961 | 461 | break; |
962 | 360 | case PM_FORWARDING_PARAMETER_NODE: Branch (962:9): [True: 360, False: 1.19M]
|
963 | 360 | break; |
964 | 63 | case PM_FORWARDING_SUPER_NODE: { Branch (964:9): [True: 63, False: 1.19M]
|
965 | 63 | const pm_forwarding_super_node_t *cast = (const pm_forwarding_super_node_t *) node; |
966 | | |
967 | | // Visit the block field |
968 | 63 | if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)27 ) return 0 false0 ; Branch (968:17): [True: 27, False: 36]
Branch (968:40): [True: 0, False: 27]
|
969 | | |
970 | 63 | break; |
971 | 63 | } |
972 | 63 | case PM_GLOBAL_VARIABLE_AND_WRITE_NODE: { Branch (972:9): [True: 25, False: 1.19M]
|
973 | 25 | const pm_global_variable_and_write_node_t *cast = (const pm_global_variable_and_write_node_t *) node; |
974 | | |
975 | | // Visit the value field |
976 | 25 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (976:17): [True: 0, False: 25]
|
977 | | |
978 | 25 | break; |
979 | 25 | } |
980 | 42 | case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: { Branch (980:9): [True: 42, False: 1.19M]
|
981 | 42 | const pm_global_variable_operator_write_node_t *cast = (const pm_global_variable_operator_write_node_t *) node; |
982 | | |
983 | | // Visit the value field |
984 | 42 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (984:17): [True: 0, False: 42]
|
985 | | |
986 | 42 | break; |
987 | 42 | } |
988 | 42 | case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: { Branch (988:9): [True: 19, False: 1.19M]
|
989 | 19 | const pm_global_variable_or_write_node_t *cast = (const pm_global_variable_or_write_node_t *) node; |
990 | | |
991 | | // Visit the value field |
992 | 19 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (992:17): [True: 0, False: 19]
|
993 | | |
994 | 19 | break; |
995 | 19 | } |
996 | 6.99k | case PM_GLOBAL_VARIABLE_READ_NODE: Branch (996:9): [True: 6.99k, False: 1.18M]
|
997 | 6.99k | break; |
998 | 1.14k | case PM_GLOBAL_VARIABLE_TARGET_NODE: Branch (998:9): [True: 1.14k, False: 1.18M]
|
999 | 1.14k | break; |
1000 | 1.36k | case PM_GLOBAL_VARIABLE_WRITE_NODE: { Branch (1000:9): [True: 1.36k, False: 1.18M]
|
1001 | 1.36k | const pm_global_variable_write_node_t *cast = (const pm_global_variable_write_node_t *) node; |
1002 | | |
1003 | | // Visit the value field |
1004 | 1.36k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1004:17): [True: 0, False: 1.36k]
|
1005 | | |
1006 | 1.36k | break; |
1007 | 1.36k | } |
1008 | 14.2k | case PM_HASH_NODE: { Branch (1008:9): [True: 14.2k, False: 1.17M]
|
1009 | 14.2k | const pm_hash_node_t *cast = (const pm_hash_node_t *) node; |
1010 | | |
1011 | | // Visit the elements field |
1012 | 14.2k | const pm_node_list_t *elements = &cast->elements; |
1013 | 34.3k | for (size_t index = 0; index < elements->size; index++20.0k ) { Branch (1013:36): [True: 20.0k, False: 14.2k]
|
1014 | 20.0k | if (!pm_visit_node(elements->nodes[index], visitor, data)) return 0 false0 ; Branch (1014:21): [True: 0, False: 20.0k]
|
1015 | 20.0k | } |
1016 | | |
1017 | 14.2k | break; |
1018 | 14.2k | } |
1019 | 14.2k | case PM_HASH_PATTERN_NODE: { Branch (1019:9): [True: 1.54k, False: 1.18M]
|
1020 | 1.54k | const pm_hash_pattern_node_t *cast = (const pm_hash_pattern_node_t *) node; |
1021 | | |
1022 | | // Visit the constant field |
1023 | 1.54k | if (cast->constant != NULL && !pm_visit_node((const pm_node_t *) cast->constant, visitor, data)65 ) return 0 false0 ; Branch (1023:17): [True: 65, False: 1.48k]
Branch (1023:43): [True: 0, False: 65]
|
1024 | | |
1025 | | // Visit the elements field |
1026 | 1.54k | const pm_node_list_t *elements = &cast->elements; |
1027 | 4.68k | for (size_t index = 0; index < elements->size; index++3.14k ) { Branch (1027:36): [True: 3.14k, False: 1.54k]
|
1028 | 3.14k | if (!pm_visit_node(elements->nodes[index], visitor, data)) return 0 false0 ; Branch (1028:21): [True: 0, False: 3.14k]
|
1029 | 3.14k | } |
1030 | | |
1031 | | // Visit the rest field |
1032 | 1.54k | if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)404 ) return 0 false0 ; Branch (1032:17): [True: 404, False: 1.14k]
Branch (1032:39): [True: 0, False: 404]
|
1033 | | |
1034 | 1.54k | break; |
1035 | 1.54k | } |
1036 | 3.08k | case PM_IF_NODE: { Branch (1036:9): [True: 3.08k, False: 1.18M]
|
1037 | 3.08k | const pm_if_node_t *cast = (const pm_if_node_t *) node; |
1038 | | |
1039 | | // Visit the predicate field |
1040 | 3.08k | if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return 0 false0 ; Branch (1040:17): [True: 0, False: 3.08k]
|
1041 | | |
1042 | | // Visit the statements field |
1043 | 3.08k | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)2.93k ) return 0 false0 ; Branch (1043:17): [True: 2.93k, False: 147]
Branch (1043:45): [True: 0, False: 2.93k]
|
1044 | | |
1045 | | // Visit the subsequent field |
1046 | 3.08k | if (cast->subsequent != NULL && !pm_visit_node((const pm_node_t *) cast->subsequent, visitor, data)1.90k ) return 0 false0 ; Branch (1046:17): [True: 1.90k, False: 1.17k]
Branch (1046:45): [True: 0, False: 1.90k]
|
1047 | | |
1048 | 3.08k | break; |
1049 | 3.08k | } |
1050 | 3.08k | case PM_IMAGINARY_NODE: { Branch (1050:9): [True: 2.33k, False: 1.18M]
|
1051 | 2.33k | const pm_imaginary_node_t *cast = (const pm_imaginary_node_t *) node; |
1052 | | |
1053 | | // Visit the numeric field |
1054 | 2.33k | if (!pm_visit_node((const pm_node_t *) cast->numeric, visitor, data)) return 0 false0 ; Branch (1054:17): [True: 0, False: 2.33k]
|
1055 | | |
1056 | 2.33k | break; |
1057 | 2.33k | } |
1058 | 5.03k | case PM_IMPLICIT_NODE: { Branch (1058:9): [True: 5.03k, False: 1.18M]
|
1059 | 5.03k | const pm_implicit_node_t *cast = (const pm_implicit_node_t *) node; |
1060 | | |
1061 | | // Visit the value field |
1062 | 5.03k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1062:17): [True: 0, False: 5.03k]
|
1063 | | |
1064 | 5.03k | break; |
1065 | 5.03k | } |
1066 | 5.03k | case PM_IMPLICIT_REST_NODE: Branch (1066:9): [True: 3.05k, False: 1.18M]
|
1067 | 3.05k | break; |
1068 | 4.85k | case PM_IN_NODE: { Branch (1068:9): [True: 4.85k, False: 1.18M]
|
1069 | 4.85k | const pm_in_node_t *cast = (const pm_in_node_t *) node; |
1070 | | |
1071 | | // Visit the pattern field |
1072 | 4.85k | if (!pm_visit_node((const pm_node_t *) cast->pattern, visitor, data)) return 0 false0 ; Branch (1072:17): [True: 0, False: 4.85k]
|
1073 | | |
1074 | | // Visit the statements field |
1075 | 4.85k | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)3.71k ) return 0 false0 ; Branch (1075:17): [True: 3.71k, False: 1.14k]
Branch (1075:45): [True: 0, False: 3.71k]
|
1076 | | |
1077 | 4.85k | break; |
1078 | 4.85k | } |
1079 | 4.85k | case PM_INDEX_AND_WRITE_NODE: { Branch (1079:9): [True: 404, False: 1.19M]
|
1080 | 404 | const pm_index_and_write_node_t *cast = (const pm_index_and_write_node_t *) node; |
1081 | | |
1082 | | // Visit the receiver field |
1083 | 404 | if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return 0 false0 ; Branch (1083:17): [True: 404, False: 0]
Branch (1083:43): [True: 0, False: 404]
|
1084 | | |
1085 | | // Visit the arguments field |
1086 | 404 | if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)272 ) return 0 false0 ; Branch (1086:17): [True: 272, False: 132]
Branch (1086:44): [True: 0, False: 272]
|
1087 | | |
1088 | | // Visit the block field |
1089 | 404 | if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)9 ) return 0 false0 ; Branch (1089:17): [True: 9, False: 395]
Branch (1089:40): [True: 0, False: 9]
|
1090 | | |
1091 | | // Visit the value field |
1092 | 404 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1092:17): [True: 0, False: 404]
|
1093 | | |
1094 | 404 | break; |
1095 | 404 | } |
1096 | 1.29k | case PM_INDEX_OPERATOR_WRITE_NODE: { Branch (1096:9): [True: 1.29k, False: 1.18M]
|
1097 | 1.29k | const pm_index_operator_write_node_t *cast = (const pm_index_operator_write_node_t *) node; |
1098 | | |
1099 | | // Visit the receiver field |
1100 | 1.29k | if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return 0 false0 ; Branch (1100:17): [True: 1.29k, False: 0]
Branch (1100:43): [True: 0, False: 1.29k]
|
1101 | | |
1102 | | // Visit the arguments field |
1103 | 1.29k | if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)1.14k ) return 0 false0 ; Branch (1103:17): [True: 1.14k, False: 150]
Branch (1103:44): [True: 0, False: 1.14k]
|
1104 | | |
1105 | | // Visit the block field |
1106 | 1.29k | if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)6 ) return 0 false0 ; Branch (1106:17): [True: 6, False: 1.29k]
Branch (1106:40): [True: 0, False: 6]
|
1107 | | |
1108 | | // Visit the value field |
1109 | 1.29k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1109:17): [True: 0, False: 1.29k]
|
1110 | | |
1111 | 1.29k | break; |
1112 | 1.29k | } |
1113 | 1.29k | case PM_INDEX_OR_WRITE_NODE: { Branch (1113:9): [True: 837, False: 1.19M]
|
1114 | 837 | const pm_index_or_write_node_t *cast = (const pm_index_or_write_node_t *) node; |
1115 | | |
1116 | | // Visit the receiver field |
1117 | 837 | if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return 0 false0 ; Branch (1117:17): [True: 837, False: 0]
Branch (1117:43): [True: 0, False: 837]
|
1118 | | |
1119 | | // Visit the arguments field |
1120 | 837 | if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)680 ) return 0 false0 ; Branch (1120:17): [True: 680, False: 157]
Branch (1120:44): [True: 0, False: 680]
|
1121 | | |
1122 | | // Visit the block field |
1123 | 837 | if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)25 ) return 0 false0 ; Branch (1123:17): [True: 25, False: 812]
Branch (1123:40): [True: 0, False: 25]
|
1124 | | |
1125 | | // Visit the value field |
1126 | 837 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1126:17): [True: 0, False: 837]
|
1127 | | |
1128 | 837 | break; |
1129 | 837 | } |
1130 | 2.09k | case PM_INDEX_TARGET_NODE: { Branch (1130:9): [True: 2.09k, False: 1.18M]
|
1131 | 2.09k | const pm_index_target_node_t *cast = (const pm_index_target_node_t *) node; |
1132 | | |
1133 | | // Visit the receiver field |
1134 | 2.09k | if (!pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return 0 false0 ; Branch (1134:17): [True: 0, False: 2.09k]
|
1135 | | |
1136 | | // Visit the arguments field |
1137 | 2.09k | if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)2.06k ) return 0 false0 ; Branch (1137:17): [True: 2.06k, False: 25]
Branch (1137:44): [True: 0, False: 2.06k]
|
1138 | | |
1139 | | // Visit the block field |
1140 | 2.09k | if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)6 ) return 0 false0 ; Branch (1140:17): [True: 6, False: 2.08k]
Branch (1140:40): [True: 0, False: 6]
|
1141 | | |
1142 | 2.09k | break; |
1143 | 2.09k | } |
1144 | 2.09k | case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: { Branch (1144:9): [True: 124, False: 1.19M]
|
1145 | 124 | const pm_instance_variable_and_write_node_t *cast = (const pm_instance_variable_and_write_node_t *) node; |
1146 | | |
1147 | | // Visit the value field |
1148 | 124 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1148:17): [True: 0, False: 124]
|
1149 | | |
1150 | 124 | break; |
1151 | 124 | } |
1152 | 124 | case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: { Branch (1152:9): [True: 80, False: 1.19M]
|
1153 | 80 | const pm_instance_variable_operator_write_node_t *cast = (const pm_instance_variable_operator_write_node_t *) node; |
1154 | | |
1155 | | // Visit the value field |
1156 | 80 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1156:17): [True: 0, False: 80]
|
1157 | | |
1158 | 80 | break; |
1159 | 80 | } |
1160 | 575 | case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: { Branch (1160:9): [True: 575, False: 1.19M]
|
1161 | 575 | const pm_instance_variable_or_write_node_t *cast = (const pm_instance_variable_or_write_node_t *) node; |
1162 | | |
1163 | | // Visit the value field |
1164 | 575 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1164:17): [True: 0, False: 575]
|
1165 | | |
1166 | 575 | break; |
1167 | 575 | } |
1168 | 3.44k | case PM_INSTANCE_VARIABLE_READ_NODE: Branch (1168:9): [True: 3.44k, False: 1.18M]
|
1169 | 3.44k | break; |
1170 | 1.08k | case PM_INSTANCE_VARIABLE_TARGET_NODE: Branch (1170:9): [True: 1.08k, False: 1.18M]
|
1171 | 1.08k | break; |
1172 | 652 | case PM_INSTANCE_VARIABLE_WRITE_NODE: { Branch (1172:9): [True: 652, False: 1.19M]
|
1173 | 652 | const pm_instance_variable_write_node_t *cast = (const pm_instance_variable_write_node_t *) node; |
1174 | | |
1175 | | // Visit the value field |
1176 | 652 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1176:17): [True: 0, False: 652]
|
1177 | | |
1178 | 652 | break; |
1179 | 652 | } |
1180 | 69.1k | case PM_INTEGER_NODE: Branch (1180:9): [True: 69.1k, False: 1.12M]
|
1181 | 69.1k | break; |
1182 | 39 | case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: { Branch (1182:9): [True: 39, False: 1.19M]
|
1183 | 39 | const pm_interpolated_match_last_line_node_t *cast = (const pm_interpolated_match_last_line_node_t *) node; |
1184 | | |
1185 | | // Visit the parts field |
1186 | 39 | const pm_node_list_t *parts = &cast->parts; |
1187 | 185 | for (size_t index = 0; index < parts->size; index++146 ) { Branch (1187:36): [True: 146, False: 39]
|
1188 | 146 | if (!pm_visit_node(parts->nodes[index], visitor, data)) return 0 false0 ; Branch (1188:21): [True: 0, False: 146]
|
1189 | 146 | } |
1190 | | |
1191 | 39 | break; |
1192 | 39 | } |
1193 | 1.58k | case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: { Branch (1193:9): [True: 1.58k, False: 1.18M]
|
1194 | 1.58k | const pm_interpolated_regular_expression_node_t *cast = (const pm_interpolated_regular_expression_node_t *) node; |
1195 | | |
1196 | | // Visit the parts field |
1197 | 1.58k | const pm_node_list_t *parts = &cast->parts; |
1198 | 5.05k | for (size_t index = 0; index < parts->size; index++3.47k ) { Branch (1198:36): [True: 3.47k, False: 1.58k]
|
1199 | 3.47k | if (!pm_visit_node(parts->nodes[index], visitor, data)) return 0 false0 ; Branch (1199:21): [True: 0, False: 3.47k]
|
1200 | 3.47k | } |
1201 | | |
1202 | 1.58k | break; |
1203 | 1.58k | } |
1204 | 7.58k | case PM_INTERPOLATED_STRING_NODE: { Branch (1204:9): [True: 7.58k, False: 1.18M]
|
1205 | 7.58k | const pm_interpolated_string_node_t *cast = (const pm_interpolated_string_node_t *) node; |
1206 | | |
1207 | | // Visit the parts field |
1208 | 7.58k | const pm_node_list_t *parts = &cast->parts; |
1209 | 31.7k | for (size_t index = 0; index < parts->size; index++24.1k ) { Branch (1209:36): [True: 24.1k, False: 7.58k]
|
1210 | 24.1k | if (!pm_visit_node(parts->nodes[index], visitor, data)) return 0 false0 ; Branch (1210:21): [True: 0, False: 24.1k]
|
1211 | 24.1k | } |
1212 | | |
1213 | 7.58k | break; |
1214 | 7.58k | } |
1215 | 7.58k | case PM_INTERPOLATED_SYMBOL_NODE: { Branch (1215:9): [True: 1.18k, False: 1.18M]
|
1216 | 1.18k | const pm_interpolated_symbol_node_t *cast = (const pm_interpolated_symbol_node_t *) node; |
1217 | | |
1218 | | // Visit the parts field |
1219 | 1.18k | const pm_node_list_t *parts = &cast->parts; |
1220 | 3.95k | for (size_t index = 0; index < parts->size; index++2.77k ) { Branch (1220:36): [True: 2.77k, False: 1.18k]
|
1221 | 2.77k | if (!pm_visit_node(parts->nodes[index], visitor, data)) return 0 false0 ; Branch (1221:21): [True: 0, False: 2.77k]
|
1222 | 2.77k | } |
1223 | | |
1224 | 1.18k | break; |
1225 | 1.18k | } |
1226 | 1.18k | case PM_INTERPOLATED_X_STRING_NODE: { Branch (1226:9): [True: 337, False: 1.19M]
|
1227 | 337 | const pm_interpolated_x_string_node_t *cast = (const pm_interpolated_x_string_node_t *) node; |
1228 | | |
1229 | | // Visit the parts field |
1230 | 337 | const pm_node_list_t *parts = &cast->parts; |
1231 | 1.76k | for (size_t index = 0; index < parts->size; index++1.42k ) { Branch (1231:36): [True: 1.42k, False: 337]
|
1232 | 1.42k | if (!pm_visit_node(parts->nodes[index], visitor, data)) return 0 false0 ; Branch (1232:21): [True: 0, False: 1.42k]
|
1233 | 1.42k | } |
1234 | | |
1235 | 337 | break; |
1236 | 337 | } |
1237 | 337 | case PM_IT_LOCAL_VARIABLE_READ_NODE: Branch (1237:9): [True: 265, False: 1.19M]
|
1238 | 265 | break; |
1239 | 225 | case PM_IT_PARAMETERS_NODE: Branch (1239:9): [True: 225, False: 1.19M]
|
1240 | 225 | break; |
1241 | 4.75k | case PM_KEYWORD_HASH_NODE: { Branch (1241:9): [True: 4.75k, False: 1.18M]
|
1242 | 4.75k | const pm_keyword_hash_node_t *cast = (const pm_keyword_hash_node_t *) node; |
1243 | | |
1244 | | // Visit the elements field |
1245 | 4.75k | const pm_node_list_t *elements = &cast->elements; |
1246 | 12.0k | for (size_t index = 0; index < elements->size; index++7.27k ) { Branch (1246:36): [True: 7.27k, False: 4.75k]
|
1247 | 7.27k | if (!pm_visit_node(elements->nodes[index], visitor, data)) return 0 false0 ; Branch (1247:21): [True: 0, False: 7.27k]
|
1248 | 7.27k | } |
1249 | | |
1250 | 4.75k | break; |
1251 | 4.75k | } |
1252 | 4.75k | case PM_KEYWORD_REST_PARAMETER_NODE: Branch (1252:9): [True: 613, False: 1.19M]
|
1253 | 613 | break; |
1254 | 2.66k | case PM_LAMBDA_NODE: { Branch (1254:9): [True: 2.66k, False: 1.18M]
|
1255 | 2.66k | const pm_lambda_node_t *cast = (const pm_lambda_node_t *) node; |
1256 | | |
1257 | | // Visit the parameters field |
1258 | 2.66k | if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)1.25k ) return 0 false0 ; Branch (1258:17): [True: 1.25k, False: 1.41k]
Branch (1258:45): [True: 0, False: 1.25k]
|
1259 | | |
1260 | | // Visit the body field |
1261 | 2.66k | if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)2.48k ) return 0 false0 ; Branch (1261:17): [True: 2.48k, False: 184]
Branch (1261:39): [True: 0, False: 2.48k]
|
1262 | | |
1263 | 2.66k | break; |
1264 | 2.66k | } |
1265 | 2.66k | case PM_LOCAL_VARIABLE_AND_WRITE_NODE: { Branch (1265:9): [True: 288, False: 1.19M]
|
1266 | 288 | const pm_local_variable_and_write_node_t *cast = (const pm_local_variable_and_write_node_t *) node; |
1267 | | |
1268 | | // Visit the value field |
1269 | 288 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1269:17): [True: 0, False: 288]
|
1270 | | |
1271 | 288 | break; |
1272 | 288 | } |
1273 | 2.03k | case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: { Branch (1273:9): [True: 2.03k, False: 1.18M]
|
1274 | 2.03k | const pm_local_variable_operator_write_node_t *cast = (const pm_local_variable_operator_write_node_t *) node; |
1275 | | |
1276 | | // Visit the value field |
1277 | 2.03k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1277:17): [True: 0, False: 2.03k]
|
1278 | | |
1279 | 2.03k | break; |
1280 | 2.03k | } |
1281 | 2.03k | case PM_LOCAL_VARIABLE_OR_WRITE_NODE: { Branch (1281:9): [True: 655, False: 1.19M]
|
1282 | 655 | const pm_local_variable_or_write_node_t *cast = (const pm_local_variable_or_write_node_t *) node; |
1283 | | |
1284 | | // Visit the value field |
1285 | 655 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1285:17): [True: 0, False: 655]
|
1286 | | |
1287 | 655 | break; |
1288 | 655 | } |
1289 | 26.8k | case PM_LOCAL_VARIABLE_READ_NODE: Branch (1289:9): [True: 26.8k, False: 1.16M]
|
1290 | 26.8k | break; |
1291 | 29.7k | case PM_LOCAL_VARIABLE_TARGET_NODE: Branch (1291:9): [True: 29.7k, False: 1.16M]
|
1292 | 29.7k | break; |
1293 | 19.8k | case PM_LOCAL_VARIABLE_WRITE_NODE: { Branch (1293:9): [True: 19.8k, False: 1.17M]
|
1294 | 19.8k | const pm_local_variable_write_node_t *cast = (const pm_local_variable_write_node_t *) node; |
1295 | | |
1296 | | // Visit the value field |
1297 | 19.8k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1297:17): [True: 0, False: 19.8k]
|
1298 | | |
1299 | 19.8k | break; |
1300 | 19.8k | } |
1301 | 19.8k | case PM_MATCH_LAST_LINE_NODE: Branch (1301:9): [True: 31, False: 1.19M]
|
1302 | 31 | break; |
1303 | 756 | case PM_MATCH_PREDICATE_NODE: { Branch (1303:9): [True: 756, False: 1.19M]
|
1304 | 756 | const pm_match_predicate_node_t *cast = (const pm_match_predicate_node_t *) node; |
1305 | | |
1306 | | // Visit the value field |
1307 | 756 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1307:17): [True: 0, False: 756]
|
1308 | | |
1309 | | // Visit the pattern field |
1310 | 756 | if (!pm_visit_node((const pm_node_t *) cast->pattern, visitor, data)) return 0 false0 ; Branch (1310:17): [True: 0, False: 756]
|
1311 | | |
1312 | 756 | break; |
1313 | 756 | } |
1314 | 20.1k | case PM_MATCH_REQUIRED_NODE: { Branch (1314:9): [True: 20.1k, False: 1.17M]
|
1315 | 20.1k | const pm_match_required_node_t *cast = (const pm_match_required_node_t *) node; |
1316 | | |
1317 | | // Visit the value field |
1318 | 20.1k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1318:17): [True: 0, False: 20.1k]
|
1319 | | |
1320 | | // Visit the pattern field |
1321 | 20.1k | if (!pm_visit_node((const pm_node_t *) cast->pattern, visitor, data)) return 0 false0 ; Branch (1321:17): [True: 0, False: 20.1k]
|
1322 | | |
1323 | 20.1k | break; |
1324 | 20.1k | } |
1325 | 20.1k | case PM_MATCH_WRITE_NODE: { Branch (1325:9): [True: 1.24k, False: 1.18M]
|
1326 | 1.24k | const pm_match_write_node_t *cast = (const pm_match_write_node_t *) node; |
1327 | | |
1328 | | // Visit the call field |
1329 | 1.24k | if (!pm_visit_node((const pm_node_t *) cast->call, visitor, data)) return 0 false0 ; Branch (1329:17): [True: 0, False: 1.24k]
|
1330 | | |
1331 | | // Visit the targets field |
1332 | 1.24k | const pm_node_list_t *targets = &cast->targets; |
1333 | 5.39k | for (size_t index = 0; index < targets->size; index++4.14k ) { Branch (1333:36): [True: 4.14k, False: 1.24k]
|
1334 | 4.14k | if (!pm_visit_node(targets->nodes[index], visitor, data)) return 0 false0 ; Branch (1334:21): [True: 0, False: 4.14k]
|
1335 | 4.14k | } |
1336 | | |
1337 | 1.24k | break; |
1338 | 1.24k | } |
1339 | 1.24k | case PM_MODULE_NODE: { Branch (1339:9): [True: 1.04k, False: 1.18M]
|
1340 | 1.04k | const pm_module_node_t *cast = (const pm_module_node_t *) node; |
1341 | | |
1342 | | // Visit the constant_path field |
1343 | 1.04k | if (!pm_visit_node((const pm_node_t *) cast->constant_path, visitor, data)) return 0 false0 ; Branch (1343:17): [True: 0, False: 1.04k]
|
1344 | | |
1345 | | // Visit the body field |
1346 | 1.04k | if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)868 ) return 0 false0 ; Branch (1346:17): [True: 868, False: 172]
Branch (1346:39): [True: 0, False: 868]
|
1347 | | |
1348 | 1.04k | break; |
1349 | 1.04k | } |
1350 | 7.80k | case PM_MULTI_TARGET_NODE: { Branch (1350:9): [True: 7.80k, False: 1.18M]
|
1351 | 7.80k | const pm_multi_target_node_t *cast = (const pm_multi_target_node_t *) node; |
1352 | | |
1353 | | // Visit the lefts field |
1354 | 7.80k | const pm_node_list_t *lefts = &cast->lefts; |
1355 | 25.0k | for (size_t index = 0; index < lefts->size; index++17.2k ) { Branch (1355:36): [True: 17.2k, False: 7.80k]
|
1356 | 17.2k | if (!pm_visit_node(lefts->nodes[index], visitor, data)) return 0 false0 ; Branch (1356:21): [True: 0, False: 17.2k]
|
1357 | 17.2k | } |
1358 | | |
1359 | | // Visit the rest field |
1360 | 7.80k | if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)3.17k ) return 0 false0 ; Branch (1360:17): [True: 3.17k, False: 4.62k]
Branch (1360:39): [True: 0, False: 3.17k]
|
1361 | | |
1362 | | // Visit the rights field |
1363 | 7.80k | const pm_node_list_t *rights = &cast->rights; |
1364 | 11.1k | for (size_t index = 0; index < rights->size; index++3.34k ) { Branch (1364:36): [True: 3.34k, False: 7.80k]
|
1365 | 3.34k | if (!pm_visit_node(rights->nodes[index], visitor, data)) return 0 false0 ; Branch (1365:21): [True: 0, False: 3.34k]
|
1366 | 3.34k | } |
1367 | | |
1368 | 7.80k | break; |
1369 | 7.80k | } |
1370 | 8.03k | case PM_MULTI_WRITE_NODE: { Branch (1370:9): [True: 8.03k, False: 1.18M]
|
1371 | 8.03k | const pm_multi_write_node_t *cast = (const pm_multi_write_node_t *) node; |
1372 | | |
1373 | | // Visit the lefts field |
1374 | 8.03k | const pm_node_list_t *lefts = &cast->lefts; |
1375 | 19.7k | for (size_t index = 0; index < lefts->size; index++11.7k ) { Branch (1375:36): [True: 11.7k, False: 8.03k]
|
1376 | 11.7k | if (!pm_visit_node(lefts->nodes[index], visitor, data)) return 0 false0 ; Branch (1376:21): [True: 0, False: 11.7k]
|
1377 | 11.7k | } |
1378 | | |
1379 | | // Visit the rest field |
1380 | 8.03k | if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)2.99k ) return 0 false0 ; Branch (1380:17): [True: 2.99k, False: 5.03k]
Branch (1380:39): [True: 0, False: 2.99k]
|
1381 | | |
1382 | | // Visit the rights field |
1383 | 8.03k | const pm_node_list_t *rights = &cast->rights; |
1384 | 8.14k | for (size_t index = 0; index < rights->size; index++115 ) { Branch (1384:36): [True: 115, False: 8.03k]
|
1385 | 115 | if (!pm_visit_node(rights->nodes[index], visitor, data)) return 0 false0 ; Branch (1385:21): [True: 0, False: 115]
|
1386 | 115 | } |
1387 | | |
1388 | | // Visit the value field |
1389 | 8.03k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1389:17): [True: 0, False: 8.03k]
|
1390 | | |
1391 | 8.03k | break; |
1392 | 8.03k | } |
1393 | 8.03k | case PM_NEXT_NODE: { Branch (1393:9): [True: 500, False: 1.19M]
|
1394 | 500 | const pm_next_node_t *cast = (const pm_next_node_t *) node; |
1395 | | |
1396 | | // Visit the arguments field |
1397 | 500 | if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)255 ) return 0 false0 ; Branch (1397:17): [True: 255, False: 245]
Branch (1397:44): [True: 0, False: 255]
|
1398 | | |
1399 | 500 | break; |
1400 | 500 | } |
1401 | 1.90k | case PM_NIL_NODE: Branch (1401:9): [True: 1.90k, False: 1.18M]
|
1402 | 1.90k | break; |
1403 | 1 | case PM_NO_BLOCK_PARAMETER_NODE: Branch (1403:9): [True: 1, False: 1.19M]
|
1404 | 1 | break; |
1405 | 154 | case PM_NO_KEYWORDS_PARAMETER_NODE: Branch (1405:9): [True: 154, False: 1.19M]
|
1406 | 154 | break; |
1407 | 67 | case PM_NUMBERED_PARAMETERS_NODE: Branch (1407:9): [True: 67, False: 1.19M]
|
1408 | 67 | break; |
1409 | 130 | case PM_NUMBERED_REFERENCE_READ_NODE: Branch (1409:9): [True: 130, False: 1.19M]
|
1410 | 130 | break; |
1411 | 756 | case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: { Branch (1411:9): [True: 756, False: 1.19M]
|
1412 | 756 | const pm_optional_keyword_parameter_node_t *cast = (const pm_optional_keyword_parameter_node_t *) node; |
1413 | | |
1414 | | // Visit the value field |
1415 | 756 | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1415:17): [True: 0, False: 756]
|
1416 | | |
1417 | 756 | break; |
1418 | 756 | } |
1419 | 1.85k | case PM_OPTIONAL_PARAMETER_NODE: { Branch (1419:9): [True: 1.85k, False: 1.18M]
|
1420 | 1.85k | const pm_optional_parameter_node_t *cast = (const pm_optional_parameter_node_t *) node; |
1421 | | |
1422 | | // Visit the value field |
1423 | 1.85k | if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return 0 false0 ; Branch (1423:17): [True: 0, False: 1.85k]
|
1424 | | |
1425 | 1.85k | break; |
1426 | 1.85k | } |
1427 | 1.85k | case PM_OR_NODE: { Branch (1427:9): [True: 369, False: 1.19M]
|
1428 | 369 | const pm_or_node_t *cast = (const pm_or_node_t *) node; |
1429 | | |
1430 | | // Visit the left field |
1431 | 369 | if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return 0 false0 ; Branch (1431:17): [True: 0, False: 369]
|
1432 | | |
1433 | | // Visit the right field |
1434 | 369 | if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return 0 false0 ; Branch (1434:17): [True: 0, False: 369]
|
1435 | | |
1436 | 369 | break; |
1437 | 369 | } |
1438 | 9.28k | case PM_PARAMETERS_NODE: { Branch (1438:9): [True: 9.28k, False: 1.18M]
|
1439 | 9.28k | const pm_parameters_node_t *cast = (const pm_parameters_node_t *) node; |
1440 | | |
1441 | | // Visit the requireds field |
1442 | 9.28k | const pm_node_list_t *requireds = &cast->requireds; |
1443 | 15.1k | for (size_t index = 0; index < requireds->size; index++5.84k ) { Branch (1443:36): [True: 5.84k, False: 9.28k]
|
1444 | 5.84k | if (!pm_visit_node(requireds->nodes[index], visitor, data)) return 0 false0 ; Branch (1444:21): [True: 0, False: 5.84k]
|
1445 | 5.84k | } |
1446 | | |
1447 | | // Visit the optionals field |
1448 | 9.28k | const pm_node_list_t *optionals = &cast->optionals; |
1449 | 11.1k | for (size_t index = 0; index < optionals->size; index++1.85k ) { Branch (1449:36): [True: 1.85k, False: 9.28k]
|
1450 | 1.85k | if (!pm_visit_node(optionals->nodes[index], visitor, data)) return 0 false0 ; Branch (1450:21): [True: 0, False: 1.85k]
|
1451 | 1.85k | } |
1452 | | |
1453 | | // Visit the rest field |
1454 | 9.28k | if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)1.65k ) return 0 false0 ; Branch (1454:17): [True: 1.65k, False: 7.62k]
Branch (1454:39): [True: 0, False: 1.65k]
|
1455 | | |
1456 | | // Visit the posts field |
1457 | 9.28k | const pm_node_list_t *posts = &cast->posts; |
1458 | 10.2k | for (size_t index = 0; index < posts->size; index++1.00k ) { Branch (1458:36): [True: 1.00k, False: 9.28k]
|
1459 | 1.00k | if (!pm_visit_node(posts->nodes[index], visitor, data)) return 0 false0 ; Branch (1459:21): [True: 0, False: 1.00k]
|
1460 | 1.00k | } |
1461 | | |
1462 | | // Visit the keywords field |
1463 | 9.28k | const pm_node_list_t *keywords = &cast->keywords; |
1464 | 12.0k | for (size_t index = 0; index < keywords->size; index++2.77k ) { Branch (1464:36): [True: 2.77k, False: 9.28k]
|
1465 | 2.77k | if (!pm_visit_node(keywords->nodes[index], visitor, data)) return 0 false0 ; Branch (1465:21): [True: 0, False: 2.77k]
|
1466 | 2.77k | } |
1467 | | |
1468 | | // Visit the keyword_rest field |
1469 | 9.28k | if (cast->keyword_rest != NULL && !pm_visit_node((const pm_node_t *) cast->keyword_rest, visitor, data)1.07k ) return 0 false0 ; Branch (1469:17): [True: 1.07k, False: 8.20k]
Branch (1469:47): [True: 0, False: 1.07k]
|
1470 | | |
1471 | | // Visit the block field |
1472 | 9.28k | if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)671 ) return 0 false0 ; Branch (1472:17): [True: 671, False: 8.61k]
Branch (1472:40): [True: 0, False: 671]
|
1473 | | |
1474 | 9.28k | break; |
1475 | 9.28k | } |
1476 | 24.7k | case PM_PARENTHESES_NODE: { Branch (1476:9): [True: 24.7k, False: 1.16M]
|
1477 | 24.7k | const pm_parentheses_node_t *cast = (const pm_parentheses_node_t *) node; |
1478 | | |
1479 | | // Visit the body field |
1480 | 24.7k | if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)24.0k ) return 0 false0 ; Branch (1480:17): [True: 24.0k, False: 653]
Branch (1480:39): [True: 0, False: 24.0k]
|
1481 | | |
1482 | 24.7k | break; |
1483 | 24.7k | } |
1484 | 24.7k | case PM_PINNED_EXPRESSION_NODE: { Branch (1484:9): [True: 189, False: 1.19M]
|
1485 | 189 | const pm_pinned_expression_node_t *cast = (const pm_pinned_expression_node_t *) node; |
1486 | | |
1487 | | // Visit the expression field |
1488 | 189 | if (!pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return 0 false0 ; Branch (1488:17): [True: 0, False: 189]
|
1489 | | |
1490 | 189 | break; |
1491 | 189 | } |
1492 | 917 | case PM_PINNED_VARIABLE_NODE: { Branch (1492:9): [True: 917, False: 1.18M]
|
1493 | 917 | const pm_pinned_variable_node_t *cast = (const pm_pinned_variable_node_t *) node; |
1494 | | |
1495 | | // Visit the variable field |
1496 | 917 | if (!pm_visit_node((const pm_node_t *) cast->variable, visitor, data)) return 0 false0 ; Branch (1496:17): [True: 0, False: 917]
|
1497 | | |
1498 | 917 | break; |
1499 | 917 | } |
1500 | 917 | case PM_POST_EXECUTION_NODE: { Branch (1500:9): [True: 376, False: 1.19M]
|
1501 | 376 | const pm_post_execution_node_t *cast = (const pm_post_execution_node_t *) node; |
1502 | | |
1503 | | // Visit the statements field |
1504 | 376 | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)364 ) return 0 false0 ; Branch (1504:17): [True: 364, False: 12]
Branch (1504:45): [True: 0, False: 364]
|
1505 | | |
1506 | 376 | break; |
1507 | 376 | } |
1508 | 376 | case PM_PRE_EXECUTION_NODE: { Branch (1508:9): [True: 173, False: 1.19M]
|
1509 | 173 | const pm_pre_execution_node_t *cast = (const pm_pre_execution_node_t *) node; |
1510 | | |
1511 | | // Visit the statements field |
1512 | 173 | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)135 ) return 0 false0 ; Branch (1512:17): [True: 135, False: 38]
Branch (1512:45): [True: 0, False: 135]
|
1513 | | |
1514 | 173 | break; |
1515 | 173 | } |
1516 | 15.6k | case PM_PROGRAM_NODE: { Branch (1516:9): [True: 15.6k, False: 1.17M]
|
1517 | 15.6k | const pm_program_node_t *cast = (const pm_program_node_t *) node; |
1518 | | |
1519 | | // Visit the statements field |
1520 | 15.6k | if (!pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return 0 false0 ; Branch (1520:17): [True: 0, False: 15.6k]
|
1521 | | |
1522 | 15.6k | break; |
1523 | 15.6k | } |
1524 | 15.6k | case PM_RANGE_NODE: { Branch (1524:9): [True: 10.3k, False: 1.18M]
|
1525 | 10.3k | const pm_range_node_t *cast = (const pm_range_node_t *) node; |
1526 | | |
1527 | | // Visit the left field |
1528 | 10.3k | if (cast->left != NULL && !pm_visit_node((const pm_node_t *) cast->left, visitor, data)9.17k ) return 0 false0 ; Branch (1528:17): [True: 9.17k, False: 1.20k]
Branch (1528:39): [True: 0, False: 9.17k]
|
1529 | | |
1530 | | // Visit the right field |
1531 | 10.3k | if (cast->right != NULL && !pm_visit_node((const pm_node_t *) cast->right, visitor, data)10.1k ) return 0 false0 ; Branch (1531:17): [True: 10.1k, False: 231]
Branch (1531:40): [True: 0, False: 10.1k]
|
1532 | | |
1533 | 10.3k | break; |
1534 | 10.3k | } |
1535 | 10.3k | case PM_RATIONAL_NODE: Branch (1535:9): [True: 2.81k, False: 1.18M]
|
1536 | 2.81k | break; |
1537 | 52 | case PM_REDO_NODE: Branch (1537:9): [True: 52, False: 1.19M]
|
1538 | 52 | break; |
1539 | 8.38k | case PM_REGULAR_EXPRESSION_NODE: Branch (1539:9): [True: 8.38k, False: 1.18M]
|
1540 | 8.38k | break; |
1541 | 2.02k | case PM_REQUIRED_KEYWORD_PARAMETER_NODE: Branch (1541:9): [True: 2.02k, False: 1.18M]
|
1542 | 2.02k | break; |
1543 | 14.0k | case PM_REQUIRED_PARAMETER_NODE: Branch (1543:9): [True: 14.0k, False: 1.17M]
|
1544 | 14.0k | break; |
1545 | 2.21k | case PM_RESCUE_MODIFIER_NODE: { Branch (1545:9): [True: 2.21k, False: 1.18M]
|
1546 | 2.21k | const pm_rescue_modifier_node_t *cast = (const pm_rescue_modifier_node_t *) node; |
1547 | | |
1548 | | // Visit the expression field |
1549 | 2.21k | if (!pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return 0 false0 ; Branch (1549:17): [True: 0, False: 2.21k]
|
1550 | | |
1551 | | // Visit the rescue_expression field |
1552 | 2.21k | if (!pm_visit_node((const pm_node_t *) cast->rescue_expression, visitor, data)) return 0 false0 ; Branch (1552:17): [True: 0, False: 2.21k]
|
1553 | | |
1554 | 2.21k | break; |
1555 | 2.21k | } |
1556 | 2.85k | case PM_RESCUE_NODE: { Branch (1556:9): [True: 2.85k, False: 1.18M]
|
1557 | 2.85k | const pm_rescue_node_t *cast = (const pm_rescue_node_t *) node; |
1558 | | |
1559 | | // Visit the exceptions field |
1560 | 2.85k | const pm_node_list_t *exceptions = &cast->exceptions; |
1561 | 3.70k | for (size_t index = 0; index < exceptions->size; index++846 ) { Branch (1561:36): [True: 846, False: 2.85k]
|
1562 | 846 | if (!pm_visit_node(exceptions->nodes[index], visitor, data)) return 0 false0 ; Branch (1562:21): [True: 0, False: 846]
|
1563 | 846 | } |
1564 | | |
1565 | | // Visit the reference field |
1566 | 2.85k | if (cast->reference != NULL && !pm_visit_node((const pm_node_t *) cast->reference, visitor, data)271 ) return 0 false0 ; Branch (1566:17): [True: 271, False: 2.58k]
Branch (1566:44): [True: 0, False: 271]
|
1567 | | |
1568 | | // Visit the statements field |
1569 | 2.85k | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)2.29k ) return 0 false0 ; Branch (1569:17): [True: 2.29k, False: 565]
Branch (1569:45): [True: 0, False: 2.29k]
|
1570 | | |
1571 | | // Visit the subsequent field |
1572 | 2.85k | if (cast->subsequent != NULL && !pm_visit_node((const pm_node_t *) cast->subsequent, visitor, data)201 ) return 0 false0 ; Branch (1572:17): [True: 201, False: 2.65k]
Branch (1572:45): [True: 0, False: 201]
|
1573 | | |
1574 | 2.85k | break; |
1575 | 2.85k | } |
1576 | 2.85k | case PM_REST_PARAMETER_NODE: Branch (1576:9): [True: 1.86k, False: 1.18M]
|
1577 | 1.86k | break; |
1578 | 337 | case PM_RETRY_NODE: Branch (1578:9): [True: 337, False: 1.19M]
|
1579 | 337 | break; |
1580 | 15.4k | case PM_RETURN_NODE: { Branch (1580:9): [True: 15.4k, False: 1.17M]
|
1581 | 15.4k | const pm_return_node_t *cast = (const pm_return_node_t *) node; |
1582 | | |
1583 | | // Visit the arguments field |
1584 | 15.4k | if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)446 ) return 0 false0 ; Branch (1584:17): [True: 446, False: 15.0k]
Branch (1584:44): [True: 0, False: 446]
|
1585 | | |
1586 | 15.4k | break; |
1587 | 15.4k | } |
1588 | 15.4k | case PM_SELF_NODE: Branch (1588:9): [True: 2.59k, False: 1.18M]
|
1589 | 2.59k | break; |
1590 | 0 | case PM_SHAREABLE_CONSTANT_NODE: { Branch (1590:9): [True: 0, False: 1.19M]
|
1591 | 0 | const pm_shareable_constant_node_t *cast = (const pm_shareable_constant_node_t *) node; |
1592 | | |
1593 | | // Visit the write field |
1594 | 0 | if (!pm_visit_node((const pm_node_t *) cast->write, visitor, data)) return false; Branch (1594:17): [True: 0, False: 0]
|
1595 | | |
1596 | 0 | break; |
1597 | 0 | } |
1598 | 899 | case PM_SINGLETON_CLASS_NODE: { Branch (1598:9): [True: 899, False: 1.18M]
|
1599 | 899 | const pm_singleton_class_node_t *cast = (const pm_singleton_class_node_t *) node; |
1600 | | |
1601 | | // Visit the expression field |
1602 | 899 | if (!pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return 0 false0 ; Branch (1602:17): [True: 0, False: 899]
|
1603 | | |
1604 | | // Visit the body field |
1605 | 899 | if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)820 ) return 0 false0 ; Branch (1605:17): [True: 820, False: 79]
Branch (1605:39): [True: 0, False: 820]
|
1606 | | |
1607 | 899 | break; |
1608 | 899 | } |
1609 | 930 | case PM_SOURCE_ENCODING_NODE: Branch (1609:9): [True: 930, False: 1.18M]
|
1610 | 930 | break; |
1611 | 1.00k | case PM_SOURCE_FILE_NODE: Branch (1611:9): [True: 1.00k, False: 1.18M]
|
1612 | 1.00k | break; |
1613 | 1.31k | case PM_SOURCE_LINE_NODE: Branch (1613:9): [True: 1.31k, False: 1.18M]
|
1614 | 1.31k | break; |
1615 | 8.97k | case PM_SPLAT_NODE: { Branch (1615:9): [True: 8.97k, False: 1.18M]
|
1616 | 8.97k | const pm_splat_node_t *cast = (const pm_splat_node_t *) node; |
1617 | | |
1618 | | // Visit the expression field |
1619 | 8.97k | if (cast->expression != NULL && !pm_visit_node((const pm_node_t *) cast->expression, visitor, data)5.99k ) return 0 false0 ; Branch (1619:17): [True: 5.99k, False: 2.97k]
Branch (1619:45): [True: 0, False: 5.99k]
|
1620 | | |
1621 | 8.97k | break; |
1622 | 8.97k | } |
1623 | 90.0k | case PM_STATEMENTS_NODE: { Branch (1623:9): [True: 90.0k, False: 1.10M]
|
1624 | 90.0k | const pm_statements_node_t *cast = (const pm_statements_node_t *) node; |
1625 | | |
1626 | | // Visit the body field |
1627 | 90.0k | const pm_node_list_t *body = &cast->body; |
1628 | 464k | for (size_t index = 0; index < body->size; index++373k ) { Branch (1628:36): [True: 373k, False: 90.0k]
|
1629 | 373k | if (!pm_visit_node(body->nodes[index], visitor, data)) return 0 false0 ; Branch (1629:21): [True: 0, False: 373k]
|
1630 | 373k | } |
1631 | | |
1632 | 90.0k | break; |
1633 | 90.0k | } |
1634 | 90.0k | case PM_STRING_NODE: Branch (1634:9): [True: 71.7k, False: 1.11M]
|
1635 | 71.7k | break; |
1636 | 300 | case PM_SUPER_NODE: { Branch (1636:9): [True: 300, False: 1.19M]
|
1637 | 300 | const pm_super_node_t *cast = (const pm_super_node_t *) node; |
1638 | | |
1639 | | // Visit the arguments field |
1640 | 300 | if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)193 ) return 0 false0 ; Branch (1640:17): [True: 193, False: 107]
Branch (1640:44): [True: 0, False: 193]
|
1641 | | |
1642 | | // Visit the block field |
1643 | 300 | if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)140 ) return 0 false0 ; Branch (1643:17): [True: 140, False: 160]
Branch (1643:40): [True: 0, False: 140]
|
1644 | | |
1645 | 300 | break; |
1646 | 300 | } |
1647 | 35.4k | case PM_SYMBOL_NODE: Branch (1647:9): [True: 35.4k, False: 1.15M]
|
1648 | 35.4k | break; |
1649 | 5.63k | case PM_TRUE_NODE: Branch (1649:9): [True: 5.63k, False: 1.18M]
|
1650 | 5.63k | break; |
1651 | 678 | case PM_UNDEF_NODE: { Branch (1651:9): [True: 678, False: 1.19M]
|
1652 | 678 | const pm_undef_node_t *cast = (const pm_undef_node_t *) node; |
1653 | | |
1654 | | // Visit the names field |
1655 | 678 | const pm_node_list_t *names = &cast->names; |
1656 | 1.50k | for (size_t index = 0; index < names->size; index++827 ) { Branch (1656:36): [True: 827, False: 678]
|
1657 | 827 | if (!pm_visit_node(names->nodes[index], visitor, data)) return 0 false0 ; Branch (1657:21): [True: 0, False: 827]
|
1658 | 827 | } |
1659 | | |
1660 | 678 | break; |
1661 | 678 | } |
1662 | 678 | case PM_UNLESS_NODE: { Branch (1662:9): [True: 101, False: 1.19M]
|
1663 | 101 | const pm_unless_node_t *cast = (const pm_unless_node_t *) node; |
1664 | | |
1665 | | // Visit the predicate field |
1666 | 101 | if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return 0 false0 ; Branch (1666:17): [True: 0, False: 101]
|
1667 | | |
1668 | | // Visit the statements field |
1669 | 101 | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)87 ) return 0 false0 ; Branch (1669:17): [True: 87, False: 14]
Branch (1669:45): [True: 0, False: 87]
|
1670 | | |
1671 | | // Visit the else_clause field |
1672 | 101 | if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)25 ) return 0 false0 ; Branch (1672:17): [True: 25, False: 76]
Branch (1672:46): [True: 0, False: 25]
|
1673 | | |
1674 | 101 | break; |
1675 | 101 | } |
1676 | 218 | case PM_UNTIL_NODE: { Branch (1676:9): [True: 218, False: 1.19M]
|
1677 | 218 | const pm_until_node_t *cast = (const pm_until_node_t *) node; |
1678 | | |
1679 | | // Visit the predicate field |
1680 | 218 | if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return 0 false0 ; Branch (1680:17): [True: 0, False: 218]
|
1681 | | |
1682 | | // Visit the statements field |
1683 | 218 | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)196 ) return 0 false0 ; Branch (1683:17): [True: 196, False: 22]
Branch (1683:45): [True: 0, False: 196]
|
1684 | | |
1685 | 218 | break; |
1686 | 218 | } |
1687 | 1.94k | case PM_WHEN_NODE: { Branch (1687:9): [True: 1.94k, False: 1.18M]
|
1688 | 1.94k | const pm_when_node_t *cast = (const pm_when_node_t *) node; |
1689 | | |
1690 | | // Visit the conditions field |
1691 | 1.94k | const pm_node_list_t *conditions = &cast->conditions; |
1692 | 3.93k | for (size_t index = 0; index < conditions->size; index++1.98k ) { Branch (1692:36): [True: 1.98k, False: 1.94k]
|
1693 | 1.98k | if (!pm_visit_node(conditions->nodes[index], visitor, data)) return 0 false0 ; Branch (1693:21): [True: 0, False: 1.98k]
|
1694 | 1.98k | } |
1695 | | |
1696 | | // Visit the statements field |
1697 | 1.94k | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)1.81k ) return 0 false0 ; Branch (1697:17): [True: 1.81k, False: 129]
Branch (1697:45): [True: 0, False: 1.81k]
|
1698 | | |
1699 | 1.94k | break; |
1700 | 1.94k | } |
1701 | 4.83k | case PM_WHILE_NODE: { Branch (1701:9): [True: 4.83k, False: 1.18M]
|
1702 | 4.83k | const pm_while_node_t *cast = (const pm_while_node_t *) node; |
1703 | | |
1704 | | // Visit the predicate field |
1705 | 4.83k | if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return 0 false0 ; Branch (1705:17): [True: 0, False: 4.83k]
|
1706 | | |
1707 | | // Visit the statements field |
1708 | 4.83k | if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)4.59k ) return 0 false0 ; Branch (1708:17): [True: 4.59k, False: 239]
Branch (1708:45): [True: 0, False: 4.59k]
|
1709 | | |
1710 | 4.83k | break; |
1711 | 4.83k | } |
1712 | 4.83k | case PM_X_STRING_NODE: Branch (1712:9): [True: 2.89k, False: 1.18M]
|
1713 | 2.89k | break; |
1714 | 253 | case PM_YIELD_NODE: { Branch (1714:9): [True: 253, False: 1.19M]
|
1715 | 253 | const pm_yield_node_t *cast = (const pm_yield_node_t *) node; |
1716 | | |
1717 | | // Visit the arguments field |
1718 | 253 | if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)134 ) return 0 false0 ; Branch (1718:17): [True: 134, False: 119]
Branch (1718:44): [True: 0, False: 134]
|
1719 | | |
1720 | 253 | break; |
1721 | 253 | } |
1722 | 253 | case PM_SCOPE_NODE: Branch (1722:9): [True: 0, False: 1.19M]
|
1723 | 0 | break; |
1724 | 1.19M | } |
1725 | | |
1726 | 1.17M | return true; |
1727 | 1.19M | } |
1728 | | |
1729 | | /** |
1730 | | * Allocate and initialize a new AliasGlobalVariableNode node. |
1731 | | */ |
1732 | | pm_alias_global_variable_node_t * |
1733 | 322 | pm_alias_global_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *new_name, struct pm_node *old_name, pm_location_t keyword_loc) { |
1734 | 322 | pm_alias_global_variable_node_t *node = (pm_alias_global_variable_node_t *) pm_arena_alloc(arena, sizeof(pm_alias_global_variable_node_t), PRISM_ALIGNOF(pm_alias_global_variable_node_t)); |
1735 | | |
1736 | 322 | *node = (pm_alias_global_variable_node_t) { |
1737 | 322 | .base = { .type = PM_ALIAS_GLOBAL_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1738 | 322 | .new_name = new_name, |
1739 | 322 | .old_name = old_name, |
1740 | 322 | .keyword_loc = keyword_loc |
1741 | 322 | }; |
1742 | | |
1743 | 322 | return node; |
1744 | 322 | } |
1745 | | |
1746 | | /** |
1747 | | * Allocate and initialize a new AliasMethodNode node. |
1748 | | */ |
1749 | | pm_alias_method_node_t * |
1750 | 2.10k | pm_alias_method_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *new_name, struct pm_node *old_name, pm_location_t keyword_loc) { |
1751 | 2.10k | pm_alias_method_node_t *node = (pm_alias_method_node_t *) pm_arena_alloc(arena, sizeof(pm_alias_method_node_t), PRISM_ALIGNOF(pm_alias_method_node_t)); |
1752 | | |
1753 | 2.10k | *node = (pm_alias_method_node_t) { |
1754 | 2.10k | .base = { .type = PM_ALIAS_METHOD_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1755 | 2.10k | .new_name = new_name, |
1756 | 2.10k | .old_name = old_name, |
1757 | 2.10k | .keyword_loc = keyword_loc |
1758 | 2.10k | }; |
1759 | | |
1760 | 2.10k | return node; |
1761 | 2.10k | } |
1762 | | |
1763 | | /** |
1764 | | * Allocate and initialize a new AlternationPatternNode node. |
1765 | | */ |
1766 | | pm_alternation_pattern_node_t * |
1767 | 984 | pm_alternation_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) { |
1768 | 984 | pm_alternation_pattern_node_t *node = (pm_alternation_pattern_node_t *) pm_arena_alloc(arena, sizeof(pm_alternation_pattern_node_t), PRISM_ALIGNOF(pm_alternation_pattern_node_t)); |
1769 | | |
1770 | 984 | *node = (pm_alternation_pattern_node_t) { |
1771 | 984 | .base = { .type = PM_ALTERNATION_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1772 | 984 | .left = left, |
1773 | 984 | .right = right, |
1774 | 984 | .operator_loc = operator_loc |
1775 | 984 | }; |
1776 | | |
1777 | 984 | return node; |
1778 | 984 | } |
1779 | | |
1780 | | /** |
1781 | | * Allocate and initialize a new AndNode node. |
1782 | | */ |
1783 | | pm_and_node_t * |
1784 | 511 | pm_and_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) { |
1785 | 511 | pm_and_node_t *node = (pm_and_node_t *) pm_arena_alloc(arena, sizeof(pm_and_node_t), PRISM_ALIGNOF(pm_and_node_t)); |
1786 | | |
1787 | 511 | *node = (pm_and_node_t) { |
1788 | 511 | .base = { .type = PM_AND_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1789 | 511 | .left = left, |
1790 | 511 | .right = right, |
1791 | 511 | .operator_loc = operator_loc |
1792 | 511 | }; |
1793 | | |
1794 | 511 | return node; |
1795 | 511 | } |
1796 | | |
1797 | | /** |
1798 | | * Allocate and initialize a new ArgumentsNode node. |
1799 | | */ |
1800 | | pm_arguments_node_t * |
1801 | 69.2k | pm_arguments_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t arguments) { |
1802 | 69.2k | pm_arguments_node_t *node = (pm_arguments_node_t *) pm_arena_alloc(arena, sizeof(pm_arguments_node_t), PRISM_ALIGNOF(pm_arguments_node_t)); |
1803 | | |
1804 | 69.2k | *node = (pm_arguments_node_t) { |
1805 | 69.2k | .base = { .type = PM_ARGUMENTS_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1806 | 69.2k | .arguments = arguments |
1807 | 69.2k | }; |
1808 | | |
1809 | 69.2k | return node; |
1810 | 69.2k | } |
1811 | | |
1812 | | /** |
1813 | | * Allocate and initialize a new ArrayNode node. |
1814 | | */ |
1815 | | pm_array_node_t * |
1816 | 25.9k | pm_array_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t elements, pm_location_t opening_loc, pm_location_t closing_loc) { |
1817 | 25.9k | pm_array_node_t *node = (pm_array_node_t *) pm_arena_alloc(arena, sizeof(pm_array_node_t), PRISM_ALIGNOF(pm_array_node_t)); |
1818 | | |
1819 | 25.9k | *node = (pm_array_node_t) { |
1820 | 25.9k | .base = { .type = PM_ARRAY_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1821 | 25.9k | .elements = elements, |
1822 | 25.9k | .opening_loc = opening_loc, |
1823 | 25.9k | .closing_loc = closing_loc |
1824 | 25.9k | }; |
1825 | | |
1826 | 25.9k | return node; |
1827 | 25.9k | } |
1828 | | |
1829 | | /** |
1830 | | * Allocate and initialize a new ArrayPatternNode node. |
1831 | | */ |
1832 | | pm_array_pattern_node_t * |
1833 | 3.81k | pm_array_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *constant, pm_node_list_t requireds, struct pm_node *rest, pm_node_list_t posts, pm_location_t opening_loc, pm_location_t closing_loc) { |
1834 | 3.81k | pm_array_pattern_node_t *node = (pm_array_pattern_node_t *) pm_arena_alloc(arena, sizeof(pm_array_pattern_node_t), PRISM_ALIGNOF(pm_array_pattern_node_t)); |
1835 | | |
1836 | 3.81k | *node = (pm_array_pattern_node_t) { |
1837 | 3.81k | .base = { .type = PM_ARRAY_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1838 | 3.81k | .constant = constant, |
1839 | 3.81k | .requireds = requireds, |
1840 | 3.81k | .rest = rest, |
1841 | 3.81k | .posts = posts, |
1842 | 3.81k | .opening_loc = opening_loc, |
1843 | 3.81k | .closing_loc = closing_loc |
1844 | 3.81k | }; |
1845 | | |
1846 | 3.81k | return node; |
1847 | 3.81k | } |
1848 | | |
1849 | | /** |
1850 | | * Allocate and initialize a new AssocNode node. |
1851 | | */ |
1852 | | pm_assoc_node_t * |
1853 | 27.6k | pm_assoc_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *key, struct pm_node *value, pm_location_t operator_loc) { |
1854 | 27.6k | pm_assoc_node_t *node = (pm_assoc_node_t *) pm_arena_alloc(arena, sizeof(pm_assoc_node_t), PRISM_ALIGNOF(pm_assoc_node_t)); |
1855 | | |
1856 | 27.6k | *node = (pm_assoc_node_t) { |
1857 | 27.6k | .base = { .type = PM_ASSOC_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1858 | 27.6k | .key = key, |
1859 | 27.6k | .value = value, |
1860 | 27.6k | .operator_loc = operator_loc |
1861 | 27.6k | }; |
1862 | | |
1863 | 27.6k | return node; |
1864 | 27.6k | } |
1865 | | |
1866 | | /** |
1867 | | * Allocate and initialize a new AssocSplatNode node. |
1868 | | */ |
1869 | | pm_assoc_splat_node_t * |
1870 | 2.99k | pm_assoc_splat_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, pm_location_t operator_loc) { |
1871 | 2.99k | pm_assoc_splat_node_t *node = (pm_assoc_splat_node_t *) pm_arena_alloc(arena, sizeof(pm_assoc_splat_node_t), PRISM_ALIGNOF(pm_assoc_splat_node_t)); |
1872 | | |
1873 | 2.99k | *node = (pm_assoc_splat_node_t) { |
1874 | 2.99k | .base = { .type = PM_ASSOC_SPLAT_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1875 | 2.99k | .value = value, |
1876 | 2.99k | .operator_loc = operator_loc |
1877 | 2.99k | }; |
1878 | | |
1879 | 2.99k | return node; |
1880 | 2.99k | } |
1881 | | |
1882 | | /** |
1883 | | * Allocate and initialize a new BackReferenceReadNode node. |
1884 | | */ |
1885 | | pm_back_reference_read_node_t * |
1886 | 297 | pm_back_reference_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
1887 | 297 | pm_back_reference_read_node_t *node = (pm_back_reference_read_node_t *) pm_arena_alloc(arena, sizeof(pm_back_reference_read_node_t), PRISM_ALIGNOF(pm_back_reference_read_node_t)); |
1888 | | |
1889 | 297 | *node = (pm_back_reference_read_node_t) { |
1890 | 297 | .base = { .type = PM_BACK_REFERENCE_READ_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1891 | 297 | .name = name |
1892 | 297 | }; |
1893 | | |
1894 | 297 | return node; |
1895 | 297 | } |
1896 | | |
1897 | | /** |
1898 | | * Allocate and initialize a new BeginNode node. |
1899 | | */ |
1900 | | pm_begin_node_t * |
1901 | 5.46k | pm_begin_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t begin_keyword_loc, struct pm_statements_node *statements, struct pm_rescue_node *rescue_clause, struct pm_else_node *else_clause, struct pm_ensure_node *ensure_clause, pm_location_t end_keyword_loc) { |
1902 | 5.46k | pm_begin_node_t *node = (pm_begin_node_t *) pm_arena_alloc(arena, sizeof(pm_begin_node_t), PRISM_ALIGNOF(pm_begin_node_t)); |
1903 | | |
1904 | 5.46k | *node = (pm_begin_node_t) { |
1905 | 5.46k | .base = { .type = PM_BEGIN_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1906 | 5.46k | .begin_keyword_loc = begin_keyword_loc, |
1907 | 5.46k | .statements = statements, |
1908 | 5.46k | .rescue_clause = rescue_clause, |
1909 | 5.46k | .else_clause = else_clause, |
1910 | 5.46k | .ensure_clause = ensure_clause, |
1911 | 5.46k | .end_keyword_loc = end_keyword_loc |
1912 | 5.46k | }; |
1913 | | |
1914 | 5.46k | return node; |
1915 | 5.46k | } |
1916 | | |
1917 | | /** |
1918 | | * Allocate and initialize a new BlockArgumentNode node. |
1919 | | */ |
1920 | | pm_block_argument_node_t * |
1921 | 764 | pm_block_argument_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *expression, pm_location_t operator_loc) { |
1922 | 764 | pm_block_argument_node_t *node = (pm_block_argument_node_t *) pm_arena_alloc(arena, sizeof(pm_block_argument_node_t), PRISM_ALIGNOF(pm_block_argument_node_t)); |
1923 | | |
1924 | 764 | *node = (pm_block_argument_node_t) { |
1925 | 764 | .base = { .type = PM_BLOCK_ARGUMENT_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1926 | 764 | .expression = expression, |
1927 | 764 | .operator_loc = operator_loc |
1928 | 764 | }; |
1929 | | |
1930 | 764 | return node; |
1931 | 764 | } |
1932 | | |
1933 | | /** |
1934 | | * Allocate and initialize a new BlockLocalVariableNode node. |
1935 | | */ |
1936 | | pm_block_local_variable_node_t * |
1937 | 820 | pm_block_local_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
1938 | 820 | pm_block_local_variable_node_t *node = (pm_block_local_variable_node_t *) pm_arena_alloc(arena, sizeof(pm_block_local_variable_node_t), PRISM_ALIGNOF(pm_block_local_variable_node_t)); |
1939 | | |
1940 | 820 | *node = (pm_block_local_variable_node_t) { |
1941 | 820 | .base = { .type = PM_BLOCK_LOCAL_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1942 | 820 | .name = name |
1943 | 820 | }; |
1944 | | |
1945 | 820 | return node; |
1946 | 820 | } |
1947 | | |
1948 | | /** |
1949 | | * Allocate and initialize a new BlockNode node. |
1950 | | */ |
1951 | | pm_block_node_t * |
1952 | 8.52k | pm_block_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, struct pm_node *parameters, struct pm_node *body, pm_location_t opening_loc, pm_location_t closing_loc) { |
1953 | 8.52k | pm_block_node_t *node = (pm_block_node_t *) pm_arena_alloc(arena, sizeof(pm_block_node_t), PRISM_ALIGNOF(pm_block_node_t)); |
1954 | | |
1955 | 8.52k | *node = (pm_block_node_t) { |
1956 | 8.52k | .base = { .type = PM_BLOCK_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1957 | 8.52k | .locals = locals, |
1958 | 8.52k | .parameters = parameters, |
1959 | 8.52k | .body = body, |
1960 | 8.52k | .opening_loc = opening_loc, |
1961 | 8.52k | .closing_loc = closing_loc |
1962 | 8.52k | }; |
1963 | | |
1964 | 8.52k | return node; |
1965 | 8.52k | } |
1966 | | |
1967 | | /** |
1968 | | * Allocate and initialize a new BlockParameterNode node. |
1969 | | */ |
1970 | | pm_block_parameter_node_t * |
1971 | 662 | pm_block_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc) { |
1972 | 662 | pm_block_parameter_node_t *node = (pm_block_parameter_node_t *) pm_arena_alloc(arena, sizeof(pm_block_parameter_node_t), PRISM_ALIGNOF(pm_block_parameter_node_t)); |
1973 | | |
1974 | 662 | *node = (pm_block_parameter_node_t) { |
1975 | 662 | .base = { .type = PM_BLOCK_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1976 | 662 | .name = name, |
1977 | 662 | .name_loc = name_loc, |
1978 | 662 | .operator_loc = operator_loc |
1979 | 662 | }; |
1980 | | |
1981 | 662 | return node; |
1982 | 662 | } |
1983 | | |
1984 | | /** |
1985 | | * Allocate and initialize a new BlockParametersNode node. |
1986 | | */ |
1987 | | pm_block_parameters_node_t * |
1988 | 2.68k | pm_block_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_parameters_node *parameters, pm_node_list_t locals, pm_location_t opening_loc, pm_location_t closing_loc) { |
1989 | 2.68k | pm_block_parameters_node_t *node = (pm_block_parameters_node_t *) pm_arena_alloc(arena, sizeof(pm_block_parameters_node_t), PRISM_ALIGNOF(pm_block_parameters_node_t)); |
1990 | | |
1991 | 2.68k | *node = (pm_block_parameters_node_t) { |
1992 | 2.68k | .base = { .type = PM_BLOCK_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location }, |
1993 | 2.68k | .parameters = parameters, |
1994 | 2.68k | .locals = locals, |
1995 | 2.68k | .opening_loc = opening_loc, |
1996 | 2.68k | .closing_loc = closing_loc |
1997 | 2.68k | }; |
1998 | | |
1999 | 2.68k | return node; |
2000 | 2.68k | } |
2001 | | |
2002 | | /** |
2003 | | * Allocate and initialize a new BreakNode node. |
2004 | | */ |
2005 | | pm_break_node_t * |
2006 | 1.29k | pm_break_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_arguments_node *arguments, pm_location_t keyword_loc) { |
2007 | 1.29k | pm_break_node_t *node = (pm_break_node_t *) pm_arena_alloc(arena, sizeof(pm_break_node_t), PRISM_ALIGNOF(pm_break_node_t)); |
2008 | | |
2009 | 1.29k | *node = (pm_break_node_t) { |
2010 | 1.29k | .base = { .type = PM_BREAK_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2011 | 1.29k | .arguments = arguments, |
2012 | 1.29k | .keyword_loc = keyword_loc |
2013 | 1.29k | }; |
2014 | | |
2015 | 1.29k | return node; |
2016 | 1.29k | } |
2017 | | |
2018 | | /** |
2019 | | * Allocate and initialize a new CallAndWriteNode node. |
2020 | | */ |
2021 | | pm_call_and_write_node_t * |
2022 | 217 | pm_call_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t message_loc, pm_constant_id_t read_name, pm_constant_id_t write_name, pm_location_t operator_loc, struct pm_node *value) { |
2023 | 217 | pm_call_and_write_node_t *node = (pm_call_and_write_node_t *) pm_arena_alloc(arena, sizeof(pm_call_and_write_node_t), PRISM_ALIGNOF(pm_call_and_write_node_t)); |
2024 | | |
2025 | 217 | *node = (pm_call_and_write_node_t) { |
2026 | 217 | .base = { .type = PM_CALL_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2027 | 217 | .receiver = receiver, |
2028 | 217 | .call_operator_loc = call_operator_loc, |
2029 | 217 | .message_loc = message_loc, |
2030 | 217 | .read_name = read_name, |
2031 | 217 | .write_name = write_name, |
2032 | 217 | .operator_loc = operator_loc, |
2033 | 217 | .value = value |
2034 | 217 | }; |
2035 | | |
2036 | 217 | return node; |
2037 | 217 | } |
2038 | | |
2039 | | /** |
2040 | | * Allocate and initialize a new CallNode node. |
2041 | | */ |
2042 | | pm_call_node_t * |
2043 | 206k | pm_call_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_constant_id_t name, pm_location_t message_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, pm_location_t equal_loc, struct pm_node *block) { |
2044 | 206k | pm_call_node_t *node = (pm_call_node_t *) pm_arena_alloc(arena, sizeof(pm_call_node_t), PRISM_ALIGNOF(pm_call_node_t)); |
2045 | | |
2046 | 206k | *node = (pm_call_node_t) { |
2047 | 206k | .base = { .type = PM_CALL_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2048 | 206k | .receiver = receiver, |
2049 | 206k | .call_operator_loc = call_operator_loc, |
2050 | 206k | .name = name, |
2051 | 206k | .message_loc = message_loc, |
2052 | 206k | .opening_loc = opening_loc, |
2053 | 206k | .arguments = arguments, |
2054 | 206k | .closing_loc = closing_loc, |
2055 | 206k | .equal_loc = equal_loc, |
2056 | 206k | .block = block |
2057 | 206k | }; |
2058 | | |
2059 | 206k | return node; |
2060 | 206k | } |
2061 | | |
2062 | | /** |
2063 | | * Allocate and initialize a new CallOperatorWriteNode node. |
2064 | | */ |
2065 | | pm_call_operator_write_node_t * |
2066 | 1.09k | pm_call_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t message_loc, pm_constant_id_t read_name, pm_constant_id_t write_name, pm_constant_id_t binary_operator, pm_location_t binary_operator_loc, struct pm_node *value) { |
2067 | 1.09k | pm_call_operator_write_node_t *node = (pm_call_operator_write_node_t *) pm_arena_alloc(arena, sizeof(pm_call_operator_write_node_t), PRISM_ALIGNOF(pm_call_operator_write_node_t)); |
2068 | | |
2069 | 1.09k | *node = (pm_call_operator_write_node_t) { |
2070 | 1.09k | .base = { .type = PM_CALL_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2071 | 1.09k | .receiver = receiver, |
2072 | 1.09k | .call_operator_loc = call_operator_loc, |
2073 | 1.09k | .message_loc = message_loc, |
2074 | 1.09k | .read_name = read_name, |
2075 | 1.09k | .write_name = write_name, |
2076 | 1.09k | .binary_operator = binary_operator, |
2077 | 1.09k | .binary_operator_loc = binary_operator_loc, |
2078 | 1.09k | .value = value |
2079 | 1.09k | }; |
2080 | | |
2081 | 1.09k | return node; |
2082 | 1.09k | } |
2083 | | |
2084 | | /** |
2085 | | * Allocate and initialize a new CallOrWriteNode node. |
2086 | | */ |
2087 | | pm_call_or_write_node_t * |
2088 | 512 | pm_call_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t message_loc, pm_constant_id_t read_name, pm_constant_id_t write_name, pm_location_t operator_loc, struct pm_node *value) { |
2089 | 512 | pm_call_or_write_node_t *node = (pm_call_or_write_node_t *) pm_arena_alloc(arena, sizeof(pm_call_or_write_node_t), PRISM_ALIGNOF(pm_call_or_write_node_t)); |
2090 | | |
2091 | 512 | *node = (pm_call_or_write_node_t) { |
2092 | 512 | .base = { .type = PM_CALL_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2093 | 512 | .receiver = receiver, |
2094 | 512 | .call_operator_loc = call_operator_loc, |
2095 | 512 | .message_loc = message_loc, |
2096 | 512 | .read_name = read_name, |
2097 | 512 | .write_name = write_name, |
2098 | 512 | .operator_loc = operator_loc, |
2099 | 512 | .value = value |
2100 | 512 | }; |
2101 | | |
2102 | 512 | return node; |
2103 | 512 | } |
2104 | | |
2105 | | /** |
2106 | | * Allocate and initialize a new CallTargetNode node. |
2107 | | */ |
2108 | | pm_call_target_node_t * |
2109 | 1.39k | pm_call_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_constant_id_t name, pm_location_t message_loc) { |
2110 | 1.39k | pm_call_target_node_t *node = (pm_call_target_node_t *) pm_arena_alloc(arena, sizeof(pm_call_target_node_t), PRISM_ALIGNOF(pm_call_target_node_t)); |
2111 | | |
2112 | 1.39k | *node = (pm_call_target_node_t) { |
2113 | 1.39k | .base = { .type = PM_CALL_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2114 | 1.39k | .receiver = receiver, |
2115 | 1.39k | .call_operator_loc = call_operator_loc, |
2116 | 1.39k | .name = name, |
2117 | 1.39k | .message_loc = message_loc |
2118 | 1.39k | }; |
2119 | | |
2120 | 1.39k | return node; |
2121 | 1.39k | } |
2122 | | |
2123 | | /** |
2124 | | * Allocate and initialize a new CapturePatternNode node. |
2125 | | */ |
2126 | | pm_capture_pattern_node_t * |
2127 | 535 | pm_capture_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, struct pm_local_variable_target_node *target, pm_location_t operator_loc) { |
2128 | 535 | pm_capture_pattern_node_t *node = (pm_capture_pattern_node_t *) pm_arena_alloc(arena, sizeof(pm_capture_pattern_node_t), PRISM_ALIGNOF(pm_capture_pattern_node_t)); |
2129 | | |
2130 | 535 | *node = (pm_capture_pattern_node_t) { |
2131 | 535 | .base = { .type = PM_CAPTURE_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2132 | 535 | .value = value, |
2133 | 535 | .target = target, |
2134 | 535 | .operator_loc = operator_loc |
2135 | 535 | }; |
2136 | | |
2137 | 535 | return node; |
2138 | 535 | } |
2139 | | |
2140 | | /** |
2141 | | * Allocate and initialize a new CaseMatchNode node. |
2142 | | */ |
2143 | | pm_case_match_node_t * |
2144 | 4.82k | pm_case_match_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *predicate, pm_node_list_t conditions, struct pm_else_node *else_clause, pm_location_t case_keyword_loc, pm_location_t end_keyword_loc) { |
2145 | 4.82k | pm_case_match_node_t *node = (pm_case_match_node_t *) pm_arena_alloc(arena, sizeof(pm_case_match_node_t), PRISM_ALIGNOF(pm_case_match_node_t)); |
2146 | | |
2147 | 4.82k | *node = (pm_case_match_node_t) { |
2148 | 4.82k | .base = { .type = PM_CASE_MATCH_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2149 | 4.82k | .predicate = predicate, |
2150 | 4.82k | .conditions = conditions, |
2151 | 4.82k | .else_clause = else_clause, |
2152 | 4.82k | .case_keyword_loc = case_keyword_loc, |
2153 | 4.82k | .end_keyword_loc = end_keyword_loc |
2154 | 4.82k | }; |
2155 | | |
2156 | 4.82k | return node; |
2157 | 4.82k | } |
2158 | | |
2159 | | /** |
2160 | | * Allocate and initialize a new CaseNode node. |
2161 | | */ |
2162 | | pm_case_node_t * |
2163 | 1.92k | pm_case_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *predicate, pm_node_list_t conditions, struct pm_else_node *else_clause, pm_location_t case_keyword_loc, pm_location_t end_keyword_loc) { |
2164 | 1.92k | pm_case_node_t *node = (pm_case_node_t *) pm_arena_alloc(arena, sizeof(pm_case_node_t), PRISM_ALIGNOF(pm_case_node_t)); |
2165 | | |
2166 | 1.92k | *node = (pm_case_node_t) { |
2167 | 1.92k | .base = { .type = PM_CASE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2168 | 1.92k | .predicate = predicate, |
2169 | 1.92k | .conditions = conditions, |
2170 | 1.92k | .else_clause = else_clause, |
2171 | 1.92k | .case_keyword_loc = case_keyword_loc, |
2172 | 1.92k | .end_keyword_loc = end_keyword_loc |
2173 | 1.92k | }; |
2174 | | |
2175 | 1.92k | return node; |
2176 | 1.92k | } |
2177 | | |
2178 | | /** |
2179 | | * Allocate and initialize a new ClassNode node. |
2180 | | */ |
2181 | | pm_class_node_t * |
2182 | 1.23k | pm_class_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t class_keyword_loc, struct pm_node *constant_path, pm_location_t inheritance_operator_loc, struct pm_node *superclass, struct pm_node *body, pm_location_t end_keyword_loc, pm_constant_id_t name) { |
2183 | 1.23k | pm_class_node_t *node = (pm_class_node_t *) pm_arena_alloc(arena, sizeof(pm_class_node_t), PRISM_ALIGNOF(pm_class_node_t)); |
2184 | | |
2185 | 1.23k | *node = (pm_class_node_t) { |
2186 | 1.23k | .base = { .type = PM_CLASS_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2187 | 1.23k | .locals = locals, |
2188 | 1.23k | .class_keyword_loc = class_keyword_loc, |
2189 | 1.23k | .constant_path = constant_path, |
2190 | 1.23k | .inheritance_operator_loc = inheritance_operator_loc, |
2191 | 1.23k | .superclass = superclass, |
2192 | 1.23k | .body = body, |
2193 | 1.23k | .end_keyword_loc = end_keyword_loc, |
2194 | 1.23k | .name = name |
2195 | 1.23k | }; |
2196 | | |
2197 | 1.23k | return node; |
2198 | 1.23k | } |
2199 | | |
2200 | | /** |
2201 | | * Allocate and initialize a new ClassVariableAndWriteNode node. |
2202 | | */ |
2203 | | pm_class_variable_and_write_node_t * |
2204 | 11 | pm_class_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) { |
2205 | 11 | pm_class_variable_and_write_node_t *node = (pm_class_variable_and_write_node_t *) pm_arena_alloc(arena, sizeof(pm_class_variable_and_write_node_t), PRISM_ALIGNOF(pm_class_variable_and_write_node_t)); |
2206 | | |
2207 | 11 | *node = (pm_class_variable_and_write_node_t) { |
2208 | 11 | .base = { .type = PM_CLASS_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2209 | 11 | .name = name, |
2210 | 11 | .name_loc = name_loc, |
2211 | 11 | .operator_loc = operator_loc, |
2212 | 11 | .value = value |
2213 | 11 | }; |
2214 | | |
2215 | 11 | return node; |
2216 | 11 | } |
2217 | | |
2218 | | /** |
2219 | | * Allocate and initialize a new ClassVariableOperatorWriteNode node. |
2220 | | */ |
2221 | | pm_class_variable_operator_write_node_t * |
2222 | 59 | pm_class_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) { |
2223 | 59 | pm_class_variable_operator_write_node_t *node = (pm_class_variable_operator_write_node_t *) pm_arena_alloc(arena, sizeof(pm_class_variable_operator_write_node_t), PRISM_ALIGNOF(pm_class_variable_operator_write_node_t)); |
2224 | | |
2225 | 59 | *node = (pm_class_variable_operator_write_node_t) { |
2226 | 59 | .base = { .type = PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2227 | 59 | .name = name, |
2228 | 59 | .name_loc = name_loc, |
2229 | 59 | .binary_operator_loc = binary_operator_loc, |
2230 | 59 | .value = value, |
2231 | 59 | .binary_operator = binary_operator |
2232 | 59 | }; |
2233 | | |
2234 | 59 | return node; |
2235 | 59 | } |
2236 | | |
2237 | | /** |
2238 | | * Allocate and initialize a new ClassVariableOrWriteNode node. |
2239 | | */ |
2240 | | pm_class_variable_or_write_node_t * |
2241 | 6 | pm_class_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) { |
2242 | 6 | pm_class_variable_or_write_node_t *node = (pm_class_variable_or_write_node_t *) pm_arena_alloc(arena, sizeof(pm_class_variable_or_write_node_t), PRISM_ALIGNOF(pm_class_variable_or_write_node_t)); |
2243 | | |
2244 | 6 | *node = (pm_class_variable_or_write_node_t) { |
2245 | 6 | .base = { .type = PM_CLASS_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2246 | 6 | .name = name, |
2247 | 6 | .name_loc = name_loc, |
2248 | 6 | .operator_loc = operator_loc, |
2249 | 6 | .value = value |
2250 | 6 | }; |
2251 | | |
2252 | 6 | return node; |
2253 | 6 | } |
2254 | | |
2255 | | /** |
2256 | | * Allocate and initialize a new ClassVariableReadNode node. |
2257 | | */ |
2258 | | pm_class_variable_read_node_t * |
2259 | 2.68k | pm_class_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
2260 | 2.68k | pm_class_variable_read_node_t *node = (pm_class_variable_read_node_t *) pm_arena_alloc(arena, sizeof(pm_class_variable_read_node_t), PRISM_ALIGNOF(pm_class_variable_read_node_t)); |
2261 | | |
2262 | 2.68k | *node = (pm_class_variable_read_node_t) { |
2263 | 2.68k | .base = { .type = PM_CLASS_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2264 | 2.68k | .name = name |
2265 | 2.68k | }; |
2266 | | |
2267 | 2.68k | return node; |
2268 | 2.68k | } |
2269 | | |
2270 | | /** |
2271 | | * Allocate and initialize a new ClassVariableTargetNode node. |
2272 | | */ |
2273 | | pm_class_variable_target_node_t * |
2274 | | pm_class_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
2275 | | pm_class_variable_target_node_t *node = (pm_class_variable_target_node_t *) pm_arena_alloc(arena, sizeof(pm_class_variable_target_node_t), PRISM_ALIGNOF(pm_class_variable_target_node_t)); |
2276 | | |
2277 | | *node = (pm_class_variable_target_node_t) { |
2278 | | .base = { .type = PM_CLASS_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2279 | | .name = name |
2280 | | }; |
2281 | | |
2282 | | return node; |
2283 | | } |
2284 | | |
2285 | | /** |
2286 | | * Allocate and initialize a new ClassVariableWriteNode node. |
2287 | | */ |
2288 | | pm_class_variable_write_node_t * |
2289 | 456 | pm_class_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) { |
2290 | 456 | pm_class_variable_write_node_t *node = (pm_class_variable_write_node_t *) pm_arena_alloc(arena, sizeof(pm_class_variable_write_node_t), PRISM_ALIGNOF(pm_class_variable_write_node_t)); |
2291 | | |
2292 | 456 | *node = (pm_class_variable_write_node_t) { |
2293 | 456 | .base = { .type = PM_CLASS_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2294 | 456 | .name = name, |
2295 | 456 | .name_loc = name_loc, |
2296 | 456 | .value = value, |
2297 | 456 | .operator_loc = operator_loc |
2298 | 456 | }; |
2299 | | |
2300 | 456 | return node; |
2301 | 456 | } |
2302 | | |
2303 | | /** |
2304 | | * Allocate and initialize a new ConstantAndWriteNode node. |
2305 | | */ |
2306 | | pm_constant_and_write_node_t * |
2307 | 69 | pm_constant_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) { |
2308 | 69 | pm_constant_and_write_node_t *node = (pm_constant_and_write_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_and_write_node_t), PRISM_ALIGNOF(pm_constant_and_write_node_t)); |
2309 | | |
2310 | 69 | *node = (pm_constant_and_write_node_t) { |
2311 | 69 | .base = { .type = PM_CONSTANT_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2312 | 69 | .name = name, |
2313 | 69 | .name_loc = name_loc, |
2314 | 69 | .operator_loc = operator_loc, |
2315 | 69 | .value = value |
2316 | 69 | }; |
2317 | | |
2318 | 69 | return node; |
2319 | 69 | } |
2320 | | |
2321 | | /** |
2322 | | * Allocate and initialize a new ConstantOperatorWriteNode node. |
2323 | | */ |
2324 | | pm_constant_operator_write_node_t * |
2325 | 202 | pm_constant_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) { |
2326 | 202 | pm_constant_operator_write_node_t *node = (pm_constant_operator_write_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_operator_write_node_t), PRISM_ALIGNOF(pm_constant_operator_write_node_t)); |
2327 | | |
2328 | 202 | *node = (pm_constant_operator_write_node_t) { |
2329 | 202 | .base = { .type = PM_CONSTANT_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2330 | 202 | .name = name, |
2331 | 202 | .name_loc = name_loc, |
2332 | 202 | .binary_operator_loc = binary_operator_loc, |
2333 | 202 | .value = value, |
2334 | 202 | .binary_operator = binary_operator |
2335 | 202 | }; |
2336 | | |
2337 | 202 | return node; |
2338 | 202 | } |
2339 | | |
2340 | | /** |
2341 | | * Allocate and initialize a new ConstantOrWriteNode node. |
2342 | | */ |
2343 | | pm_constant_or_write_node_t * |
2344 | 100 | pm_constant_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) { |
2345 | 100 | pm_constant_or_write_node_t *node = (pm_constant_or_write_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_or_write_node_t), PRISM_ALIGNOF(pm_constant_or_write_node_t)); |
2346 | | |
2347 | 100 | *node = (pm_constant_or_write_node_t) { |
2348 | 100 | .base = { .type = PM_CONSTANT_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2349 | 100 | .name = name, |
2350 | 100 | .name_loc = name_loc, |
2351 | 100 | .operator_loc = operator_loc, |
2352 | 100 | .value = value |
2353 | 100 | }; |
2354 | | |
2355 | 100 | return node; |
2356 | 100 | } |
2357 | | |
2358 | | /** |
2359 | | * Allocate and initialize a new ConstantPathAndWriteNode node. |
2360 | | */ |
2361 | | pm_constant_path_and_write_node_t * |
2362 | 17 | pm_constant_path_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t operator_loc, struct pm_node *value) { |
2363 | 17 | pm_constant_path_and_write_node_t *node = (pm_constant_path_and_write_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_path_and_write_node_t), PRISM_ALIGNOF(pm_constant_path_and_write_node_t)); |
2364 | | |
2365 | 17 | *node = (pm_constant_path_and_write_node_t) { |
2366 | 17 | .base = { .type = PM_CONSTANT_PATH_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2367 | 17 | .target = target, |
2368 | 17 | .operator_loc = operator_loc, |
2369 | 17 | .value = value |
2370 | 17 | }; |
2371 | | |
2372 | 17 | return node; |
2373 | 17 | } |
2374 | | |
2375 | | /** |
2376 | | * Allocate and initialize a new ConstantPathNode node. |
2377 | | */ |
2378 | | pm_constant_path_node_t * |
2379 | 6.86k | pm_constant_path_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *parent, pm_constant_id_t name, pm_location_t delimiter_loc, pm_location_t name_loc) { |
2380 | 6.86k | pm_constant_path_node_t *node = (pm_constant_path_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_path_node_t), PRISM_ALIGNOF(pm_constant_path_node_t)); |
2381 | | |
2382 | 6.86k | *node = (pm_constant_path_node_t) { |
2383 | 6.86k | .base = { .type = PM_CONSTANT_PATH_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2384 | 6.86k | .parent = parent, |
2385 | 6.86k | .name = name, |
2386 | 6.86k | .delimiter_loc = delimiter_loc, |
2387 | 6.86k | .name_loc = name_loc |
2388 | 6.86k | }; |
2389 | | |
2390 | 6.86k | return node; |
2391 | 6.86k | } |
2392 | | |
2393 | | /** |
2394 | | * Allocate and initialize a new ConstantPathOperatorWriteNode node. |
2395 | | */ |
2396 | | pm_constant_path_operator_write_node_t * |
2397 | 11 | pm_constant_path_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) { |
2398 | 11 | pm_constant_path_operator_write_node_t *node = (pm_constant_path_operator_write_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_path_operator_write_node_t), PRISM_ALIGNOF(pm_constant_path_operator_write_node_t)); |
2399 | | |
2400 | 11 | *node = (pm_constant_path_operator_write_node_t) { |
2401 | 11 | .base = { .type = PM_CONSTANT_PATH_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2402 | 11 | .target = target, |
2403 | 11 | .binary_operator_loc = binary_operator_loc, |
2404 | 11 | .value = value, |
2405 | 11 | .binary_operator = binary_operator |
2406 | 11 | }; |
2407 | | |
2408 | 11 | return node; |
2409 | 11 | } |
2410 | | |
2411 | | /** |
2412 | | * Allocate and initialize a new ConstantPathOrWriteNode node. |
2413 | | */ |
2414 | | pm_constant_path_or_write_node_t * |
2415 | 20 | pm_constant_path_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t operator_loc, struct pm_node *value) { |
2416 | 20 | pm_constant_path_or_write_node_t *node = (pm_constant_path_or_write_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_path_or_write_node_t), PRISM_ALIGNOF(pm_constant_path_or_write_node_t)); |
2417 | | |
2418 | 20 | *node = (pm_constant_path_or_write_node_t) { |
2419 | 20 | .base = { .type = PM_CONSTANT_PATH_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2420 | 20 | .target = target, |
2421 | 20 | .operator_loc = operator_loc, |
2422 | 20 | .value = value |
2423 | 20 | }; |
2424 | | |
2425 | 20 | return node; |
2426 | 20 | } |
2427 | | |
2428 | | /** |
2429 | | * Allocate and initialize a new ConstantPathTargetNode node. |
2430 | | */ |
2431 | | pm_constant_path_target_node_t * |
2432 | | pm_constant_path_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *parent, pm_constant_id_t name, pm_location_t delimiter_loc, pm_location_t name_loc) { |
2433 | | pm_constant_path_target_node_t *node = (pm_constant_path_target_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_path_target_node_t), PRISM_ALIGNOF(pm_constant_path_target_node_t)); |
2434 | | |
2435 | | *node = (pm_constant_path_target_node_t) { |
2436 | | .base = { .type = PM_CONSTANT_PATH_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2437 | | .parent = parent, |
2438 | | .name = name, |
2439 | | .delimiter_loc = delimiter_loc, |
2440 | | .name_loc = name_loc |
2441 | | }; |
2442 | | |
2443 | | return node; |
2444 | | } |
2445 | | |
2446 | | /** |
2447 | | * Allocate and initialize a new ConstantPathWriteNode node. |
2448 | | */ |
2449 | | pm_constant_path_write_node_t * |
2450 | 1.51k | pm_constant_path_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t operator_loc, struct pm_node *value) { |
2451 | 1.51k | pm_constant_path_write_node_t *node = (pm_constant_path_write_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_path_write_node_t), PRISM_ALIGNOF(pm_constant_path_write_node_t)); |
2452 | | |
2453 | 1.51k | *node = (pm_constant_path_write_node_t) { |
2454 | 1.51k | .base = { .type = PM_CONSTANT_PATH_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2455 | 1.51k | .target = target, |
2456 | 1.51k | .operator_loc = operator_loc, |
2457 | 1.51k | .value = value |
2458 | 1.51k | }; |
2459 | | |
2460 | 1.51k | return node; |
2461 | 1.51k | } |
2462 | | |
2463 | | /** |
2464 | | * Allocate and initialize a new ConstantReadNode node. |
2465 | | */ |
2466 | | pm_constant_read_node_t * |
2467 | 26.6k | pm_constant_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
2468 | 26.6k | pm_constant_read_node_t *node = (pm_constant_read_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_read_node_t), PRISM_ALIGNOF(pm_constant_read_node_t)); |
2469 | | |
2470 | 26.6k | *node = (pm_constant_read_node_t) { |
2471 | 26.6k | .base = { .type = PM_CONSTANT_READ_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2472 | 26.6k | .name = name |
2473 | 26.6k | }; |
2474 | | |
2475 | 26.6k | return node; |
2476 | 26.6k | } |
2477 | | |
2478 | | /** |
2479 | | * Allocate and initialize a new ConstantTargetNode node. |
2480 | | */ |
2481 | | pm_constant_target_node_t * |
2482 | | pm_constant_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
2483 | | pm_constant_target_node_t *node = (pm_constant_target_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_target_node_t), PRISM_ALIGNOF(pm_constant_target_node_t)); |
2484 | | |
2485 | | *node = (pm_constant_target_node_t) { |
2486 | | .base = { .type = PM_CONSTANT_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2487 | | .name = name |
2488 | | }; |
2489 | | |
2490 | | return node; |
2491 | | } |
2492 | | |
2493 | | /** |
2494 | | * Allocate and initialize a new ConstantWriteNode node. |
2495 | | */ |
2496 | | pm_constant_write_node_t * |
2497 | 1.82k | pm_constant_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) { |
2498 | 1.82k | pm_constant_write_node_t *node = (pm_constant_write_node_t *) pm_arena_alloc(arena, sizeof(pm_constant_write_node_t), PRISM_ALIGNOF(pm_constant_write_node_t)); |
2499 | | |
2500 | 1.82k | *node = (pm_constant_write_node_t) { |
2501 | 1.82k | .base = { .type = PM_CONSTANT_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2502 | 1.82k | .name = name, |
2503 | 1.82k | .name_loc = name_loc, |
2504 | 1.82k | .value = value, |
2505 | 1.82k | .operator_loc = operator_loc |
2506 | 1.82k | }; |
2507 | | |
2508 | 1.82k | return node; |
2509 | 1.82k | } |
2510 | | |
2511 | | /** |
2512 | | * Allocate and initialize a new DefNode node. |
2513 | | */ |
2514 | | pm_def_node_t * |
2515 | 14.6k | pm_def_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *receiver, struct pm_parameters_node *parameters, struct pm_node *body, pm_constant_id_list_t locals, pm_location_t def_keyword_loc, pm_location_t operator_loc, pm_location_t lparen_loc, pm_location_t rparen_loc, pm_location_t equal_loc, pm_location_t end_keyword_loc) { |
2516 | 14.6k | pm_def_node_t *node = (pm_def_node_t *) pm_arena_alloc(arena, sizeof(pm_def_node_t), PRISM_ALIGNOF(pm_def_node_t)); |
2517 | | |
2518 | 14.6k | *node = (pm_def_node_t) { |
2519 | 14.6k | .base = { .type = PM_DEF_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2520 | 14.6k | .name = name, |
2521 | 14.6k | .name_loc = name_loc, |
2522 | 14.6k | .receiver = receiver, |
2523 | 14.6k | .parameters = parameters, |
2524 | 14.6k | .body = body, |
2525 | 14.6k | .locals = locals, |
2526 | 14.6k | .def_keyword_loc = def_keyword_loc, |
2527 | 14.6k | .operator_loc = operator_loc, |
2528 | 14.6k | .lparen_loc = lparen_loc, |
2529 | 14.6k | .rparen_loc = rparen_loc, |
2530 | 14.6k | .equal_loc = equal_loc, |
2531 | 14.6k | .end_keyword_loc = end_keyword_loc |
2532 | 14.6k | }; |
2533 | | |
2534 | 14.6k | return node; |
2535 | 14.6k | } |
2536 | | |
2537 | | /** |
2538 | | * Allocate and initialize a new DefinedNode node. |
2539 | | */ |
2540 | | pm_defined_node_t * |
2541 | 157 | pm_defined_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t lparen_loc, struct pm_node *value, pm_location_t rparen_loc, pm_location_t keyword_loc) { |
2542 | 157 | pm_defined_node_t *node = (pm_defined_node_t *) pm_arena_alloc(arena, sizeof(pm_defined_node_t), PRISM_ALIGNOF(pm_defined_node_t)); |
2543 | | |
2544 | 157 | *node = (pm_defined_node_t) { |
2545 | 157 | .base = { .type = PM_DEFINED_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2546 | 157 | .lparen_loc = lparen_loc, |
2547 | 157 | .value = value, |
2548 | 157 | .rparen_loc = rparen_loc, |
2549 | 157 | .keyword_loc = keyword_loc |
2550 | 157 | }; |
2551 | | |
2552 | 157 | return node; |
2553 | 157 | } |
2554 | | |
2555 | | /** |
2556 | | * Allocate and initialize a new ElseNode node. |
2557 | | */ |
2558 | | pm_else_node_t * |
2559 | 6.59k | pm_else_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t else_keyword_loc, struct pm_statements_node *statements, pm_location_t end_keyword_loc) { |
2560 | 6.59k | pm_else_node_t *node = (pm_else_node_t *) pm_arena_alloc(arena, sizeof(pm_else_node_t), PRISM_ALIGNOF(pm_else_node_t)); |
2561 | | |
2562 | 6.59k | *node = (pm_else_node_t) { |
2563 | 6.59k | .base = { .type = PM_ELSE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2564 | 6.59k | .else_keyword_loc = else_keyword_loc, |
2565 | 6.59k | .statements = statements, |
2566 | 6.59k | .end_keyword_loc = end_keyword_loc |
2567 | 6.59k | }; |
2568 | | |
2569 | 6.59k | return node; |
2570 | 6.59k | } |
2571 | | |
2572 | | /** |
2573 | | * Allocate and initialize a new EmbeddedStatementsNode node. |
2574 | | */ |
2575 | | pm_embedded_statements_node_t * |
2576 | 10.7k | pm_embedded_statements_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, struct pm_statements_node *statements, pm_location_t closing_loc) { |
2577 | 10.7k | pm_embedded_statements_node_t *node = (pm_embedded_statements_node_t *) pm_arena_alloc(arena, sizeof(pm_embedded_statements_node_t), PRISM_ALIGNOF(pm_embedded_statements_node_t)); |
2578 | | |
2579 | 10.7k | *node = (pm_embedded_statements_node_t) { |
2580 | 10.7k | .base = { .type = PM_EMBEDDED_STATEMENTS_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2581 | 10.7k | .opening_loc = opening_loc, |
2582 | 10.7k | .statements = statements, |
2583 | 10.7k | .closing_loc = closing_loc |
2584 | 10.7k | }; |
2585 | | |
2586 | 10.7k | return node; |
2587 | 10.7k | } |
2588 | | |
2589 | | /** |
2590 | | * Allocate and initialize a new EmbeddedVariableNode node. |
2591 | | */ |
2592 | | pm_embedded_variable_node_t * |
2593 | 1.66k | pm_embedded_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, struct pm_node *variable) { |
2594 | 1.66k | pm_embedded_variable_node_t *node = (pm_embedded_variable_node_t *) pm_arena_alloc(arena, sizeof(pm_embedded_variable_node_t), PRISM_ALIGNOF(pm_embedded_variable_node_t)); |
2595 | | |
2596 | 1.66k | *node = (pm_embedded_variable_node_t) { |
2597 | 1.66k | .base = { .type = PM_EMBEDDED_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2598 | 1.66k | .operator_loc = operator_loc, |
2599 | 1.66k | .variable = variable |
2600 | 1.66k | }; |
2601 | | |
2602 | 1.66k | return node; |
2603 | 1.66k | } |
2604 | | |
2605 | | /** |
2606 | | * Allocate and initialize a new EnsureNode node. |
2607 | | */ |
2608 | | pm_ensure_node_t * |
2609 | 917 | pm_ensure_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t ensure_keyword_loc, struct pm_statements_node *statements, pm_location_t end_keyword_loc) { |
2610 | 917 | pm_ensure_node_t *node = (pm_ensure_node_t *) pm_arena_alloc(arena, sizeof(pm_ensure_node_t), PRISM_ALIGNOF(pm_ensure_node_t)); |
2611 | | |
2612 | 917 | *node = (pm_ensure_node_t) { |
2613 | 917 | .base = { .type = PM_ENSURE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2614 | 917 | .ensure_keyword_loc = ensure_keyword_loc, |
2615 | 917 | .statements = statements, |
2616 | 917 | .end_keyword_loc = end_keyword_loc |
2617 | 917 | }; |
2618 | | |
2619 | 917 | return node; |
2620 | 917 | } |
2621 | | |
2622 | | /** |
2623 | | * Allocate and initialize a new ErrorRecoveryNode node. |
2624 | | */ |
2625 | | pm_error_recovery_node_t * |
2626 | 116k | pm_error_recovery_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *unexpected) { |
2627 | 116k | pm_error_recovery_node_t *node = (pm_error_recovery_node_t *) pm_arena_alloc(arena, sizeof(pm_error_recovery_node_t), PRISM_ALIGNOF(pm_error_recovery_node_t)); |
2628 | | |
2629 | 116k | *node = (pm_error_recovery_node_t) { |
2630 | 116k | .base = { .type = PM_ERROR_RECOVERY_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2631 | 116k | .unexpected = unexpected |
2632 | 116k | }; |
2633 | | |
2634 | 116k | return node; |
2635 | 116k | } |
2636 | | |
2637 | | /** |
2638 | | * Allocate and initialize a new FalseNode node. |
2639 | | */ |
2640 | | pm_false_node_t * |
2641 | 1.33k | pm_false_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
2642 | 1.33k | pm_false_node_t *node = (pm_false_node_t *) pm_arena_alloc(arena, sizeof(pm_false_node_t), PRISM_ALIGNOF(pm_false_node_t)); |
2643 | | |
2644 | 1.33k | *node = (pm_false_node_t) { |
2645 | 1.33k | .base = { .type = PM_FALSE_NODE, .flags = flags, .node_id = node_id, .location = location } |
2646 | 1.33k | }; |
2647 | | |
2648 | 1.33k | return node; |
2649 | 1.33k | } |
2650 | | |
2651 | | /** |
2652 | | * Allocate and initialize a new FindPatternNode node. |
2653 | | */ |
2654 | | pm_find_pattern_node_t * |
2655 | 29 | pm_find_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *constant, struct pm_splat_node *left, pm_node_list_t requireds, struct pm_splat_node *right, pm_location_t opening_loc, pm_location_t closing_loc) { |
2656 | 29 | pm_find_pattern_node_t *node = (pm_find_pattern_node_t *) pm_arena_alloc(arena, sizeof(pm_find_pattern_node_t), PRISM_ALIGNOF(pm_find_pattern_node_t)); |
2657 | | |
2658 | 29 | *node = (pm_find_pattern_node_t) { |
2659 | 29 | .base = { .type = PM_FIND_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2660 | 29 | .constant = constant, |
2661 | 29 | .left = left, |
2662 | 29 | .requireds = requireds, |
2663 | 29 | .right = right, |
2664 | 29 | .opening_loc = opening_loc, |
2665 | 29 | .closing_loc = closing_loc |
2666 | 29 | }; |
2667 | | |
2668 | 29 | return node; |
2669 | 29 | } |
2670 | | |
2671 | | /** |
2672 | | * Allocate and initialize a new FlipFlopNode node. |
2673 | | */ |
2674 | | pm_flip_flop_node_t * |
2675 | | pm_flip_flop_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) { |
2676 | | pm_flip_flop_node_t *node = (pm_flip_flop_node_t *) pm_arena_alloc(arena, sizeof(pm_flip_flop_node_t), PRISM_ALIGNOF(pm_flip_flop_node_t)); |
2677 | | |
2678 | | *node = (pm_flip_flop_node_t) { |
2679 | | .base = { .type = PM_FLIP_FLOP_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2680 | | .left = left, |
2681 | | .right = right, |
2682 | | .operator_loc = operator_loc |
2683 | | }; |
2684 | | |
2685 | | return node; |
2686 | | } |
2687 | | |
2688 | | /** |
2689 | | * Allocate and initialize a new FloatNode node. |
2690 | | */ |
2691 | | pm_float_node_t * |
2692 | 5.61k | pm_float_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, double value) { |
2693 | 5.61k | pm_float_node_t *node = (pm_float_node_t *) pm_arena_alloc(arena, sizeof(pm_float_node_t), PRISM_ALIGNOF(pm_float_node_t)); |
2694 | | |
2695 | 5.61k | *node = (pm_float_node_t) { |
2696 | 5.61k | .base = { .type = PM_FLOAT_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2697 | 5.61k | .value = value |
2698 | 5.61k | }; |
2699 | | |
2700 | 5.61k | return node; |
2701 | 5.61k | } |
2702 | | |
2703 | | /** |
2704 | | * Allocate and initialize a new ForNode node. |
2705 | | */ |
2706 | | pm_for_node_t * |
2707 | 188 | pm_for_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *index, struct pm_node *collection, struct pm_statements_node *statements, pm_location_t for_keyword_loc, pm_location_t in_keyword_loc, pm_location_t do_keyword_loc, pm_location_t end_keyword_loc) { |
2708 | 188 | pm_for_node_t *node = (pm_for_node_t *) pm_arena_alloc(arena, sizeof(pm_for_node_t), PRISM_ALIGNOF(pm_for_node_t)); |
2709 | | |
2710 | 188 | *node = (pm_for_node_t) { |
2711 | 188 | .base = { .type = PM_FOR_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2712 | 188 | .index = index, |
2713 | 188 | .collection = collection, |
2714 | 188 | .statements = statements, |
2715 | 188 | .for_keyword_loc = for_keyword_loc, |
2716 | 188 | .in_keyword_loc = in_keyword_loc, |
2717 | 188 | .do_keyword_loc = do_keyword_loc, |
2718 | 188 | .end_keyword_loc = end_keyword_loc |
2719 | 188 | }; |
2720 | | |
2721 | 188 | return node; |
2722 | 188 | } |
2723 | | |
2724 | | /** |
2725 | | * Allocate and initialize a new ForwardingArgumentsNode node. |
2726 | | */ |
2727 | | pm_forwarding_arguments_node_t * |
2728 | 426 | pm_forwarding_arguments_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
2729 | 426 | pm_forwarding_arguments_node_t *node = (pm_forwarding_arguments_node_t *) pm_arena_alloc(arena, sizeof(pm_forwarding_arguments_node_t), PRISM_ALIGNOF(pm_forwarding_arguments_node_t)); |
2730 | | |
2731 | 426 | *node = (pm_forwarding_arguments_node_t) { |
2732 | 426 | .base = { .type = PM_FORWARDING_ARGUMENTS_NODE, .flags = flags, .node_id = node_id, .location = location } |
2733 | 426 | }; |
2734 | | |
2735 | 426 | return node; |
2736 | 426 | } |
2737 | | |
2738 | | /** |
2739 | | * Allocate and initialize a new ForwardingParameterNode node. |
2740 | | */ |
2741 | | pm_forwarding_parameter_node_t * |
2742 | 335 | pm_forwarding_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
2743 | 335 | pm_forwarding_parameter_node_t *node = (pm_forwarding_parameter_node_t *) pm_arena_alloc(arena, sizeof(pm_forwarding_parameter_node_t), PRISM_ALIGNOF(pm_forwarding_parameter_node_t)); |
2744 | | |
2745 | 335 | *node = (pm_forwarding_parameter_node_t) { |
2746 | 335 | .base = { .type = PM_FORWARDING_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location } |
2747 | 335 | }; |
2748 | | |
2749 | 335 | return node; |
2750 | 335 | } |
2751 | | |
2752 | | /** |
2753 | | * Allocate and initialize a new ForwardingSuperNode node. |
2754 | | */ |
2755 | | pm_forwarding_super_node_t * |
2756 | 57 | pm_forwarding_super_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, struct pm_block_node *block) { |
2757 | 57 | pm_forwarding_super_node_t *node = (pm_forwarding_super_node_t *) pm_arena_alloc(arena, sizeof(pm_forwarding_super_node_t), PRISM_ALIGNOF(pm_forwarding_super_node_t)); |
2758 | | |
2759 | 57 | *node = (pm_forwarding_super_node_t) { |
2760 | 57 | .base = { .type = PM_FORWARDING_SUPER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2761 | 57 | .keyword_loc = keyword_loc, |
2762 | 57 | .block = block |
2763 | 57 | }; |
2764 | | |
2765 | 57 | return node; |
2766 | 57 | } |
2767 | | |
2768 | | /** |
2769 | | * Allocate and initialize a new GlobalVariableAndWriteNode node. |
2770 | | */ |
2771 | | pm_global_variable_and_write_node_t * |
2772 | 19 | pm_global_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) { |
2773 | 19 | pm_global_variable_and_write_node_t *node = (pm_global_variable_and_write_node_t *) pm_arena_alloc(arena, sizeof(pm_global_variable_and_write_node_t), PRISM_ALIGNOF(pm_global_variable_and_write_node_t)); |
2774 | | |
2775 | 19 | *node = (pm_global_variable_and_write_node_t) { |
2776 | 19 | .base = { .type = PM_GLOBAL_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2777 | 19 | .name = name, |
2778 | 19 | .name_loc = name_loc, |
2779 | 19 | .operator_loc = operator_loc, |
2780 | 19 | .value = value |
2781 | 19 | }; |
2782 | | |
2783 | 19 | return node; |
2784 | 19 | } |
2785 | | |
2786 | | /** |
2787 | | * Allocate and initialize a new GlobalVariableOperatorWriteNode node. |
2788 | | */ |
2789 | | pm_global_variable_operator_write_node_t * |
2790 | 34 | pm_global_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) { |
2791 | 34 | pm_global_variable_operator_write_node_t *node = (pm_global_variable_operator_write_node_t *) pm_arena_alloc(arena, sizeof(pm_global_variable_operator_write_node_t), PRISM_ALIGNOF(pm_global_variable_operator_write_node_t)); |
2792 | | |
2793 | 34 | *node = (pm_global_variable_operator_write_node_t) { |
2794 | 34 | .base = { .type = PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2795 | 34 | .name = name, |
2796 | 34 | .name_loc = name_loc, |
2797 | 34 | .binary_operator_loc = binary_operator_loc, |
2798 | 34 | .value = value, |
2799 | 34 | .binary_operator = binary_operator |
2800 | 34 | }; |
2801 | | |
2802 | 34 | return node; |
2803 | 34 | } |
2804 | | |
2805 | | /** |
2806 | | * Allocate and initialize a new GlobalVariableOrWriteNode node. |
2807 | | */ |
2808 | | pm_global_variable_or_write_node_t * |
2809 | 14 | pm_global_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) { |
2810 | 14 | pm_global_variable_or_write_node_t *node = (pm_global_variable_or_write_node_t *) pm_arena_alloc(arena, sizeof(pm_global_variable_or_write_node_t), PRISM_ALIGNOF(pm_global_variable_or_write_node_t)); |
2811 | | |
2812 | 14 | *node = (pm_global_variable_or_write_node_t) { |
2813 | 14 | .base = { .type = PM_GLOBAL_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2814 | 14 | .name = name, |
2815 | 14 | .name_loc = name_loc, |
2816 | 14 | .operator_loc = operator_loc, |
2817 | 14 | .value = value |
2818 | 14 | }; |
2819 | | |
2820 | 14 | return node; |
2821 | 14 | } |
2822 | | |
2823 | | /** |
2824 | | * Allocate and initialize a new GlobalVariableReadNode node. |
2825 | | */ |
2826 | | pm_global_variable_read_node_t * |
2827 | 7.82k | pm_global_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
2828 | 7.82k | pm_global_variable_read_node_t *node = (pm_global_variable_read_node_t *) pm_arena_alloc(arena, sizeof(pm_global_variable_read_node_t), PRISM_ALIGNOF(pm_global_variable_read_node_t)); |
2829 | | |
2830 | 7.82k | *node = (pm_global_variable_read_node_t) { |
2831 | 7.82k | .base = { .type = PM_GLOBAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2832 | 7.82k | .name = name |
2833 | 7.82k | }; |
2834 | | |
2835 | 7.82k | return node; |
2836 | 7.82k | } |
2837 | | |
2838 | | /** |
2839 | | * Allocate and initialize a new GlobalVariableTargetNode node. |
2840 | | */ |
2841 | | pm_global_variable_target_node_t * |
2842 | | pm_global_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
2843 | | pm_global_variable_target_node_t *node = (pm_global_variable_target_node_t *) pm_arena_alloc(arena, sizeof(pm_global_variable_target_node_t), PRISM_ALIGNOF(pm_global_variable_target_node_t)); |
2844 | | |
2845 | | *node = (pm_global_variable_target_node_t) { |
2846 | | .base = { .type = PM_GLOBAL_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2847 | | .name = name |
2848 | | }; |
2849 | | |
2850 | | return node; |
2851 | | } |
2852 | | |
2853 | | /** |
2854 | | * Allocate and initialize a new GlobalVariableWriteNode node. |
2855 | | */ |
2856 | | pm_global_variable_write_node_t * |
2857 | 1.16k | pm_global_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) { |
2858 | 1.16k | pm_global_variable_write_node_t *node = (pm_global_variable_write_node_t *) pm_arena_alloc(arena, sizeof(pm_global_variable_write_node_t), PRISM_ALIGNOF(pm_global_variable_write_node_t)); |
2859 | | |
2860 | 1.16k | *node = (pm_global_variable_write_node_t) { |
2861 | 1.16k | .base = { .type = PM_GLOBAL_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2862 | 1.16k | .name = name, |
2863 | 1.16k | .name_loc = name_loc, |
2864 | 1.16k | .value = value, |
2865 | 1.16k | .operator_loc = operator_loc |
2866 | 1.16k | }; |
2867 | | |
2868 | 1.16k | return node; |
2869 | 1.16k | } |
2870 | | |
2871 | | /** |
2872 | | * Allocate and initialize a new HashNode node. |
2873 | | */ |
2874 | | pm_hash_node_t * |
2875 | 14.7k | pm_hash_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t elements, pm_location_t closing_loc) { |
2876 | 14.7k | pm_hash_node_t *node = (pm_hash_node_t *) pm_arena_alloc(arena, sizeof(pm_hash_node_t), PRISM_ALIGNOF(pm_hash_node_t)); |
2877 | | |
2878 | 14.7k | *node = (pm_hash_node_t) { |
2879 | 14.7k | .base = { .type = PM_HASH_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2880 | 14.7k | .opening_loc = opening_loc, |
2881 | 14.7k | .elements = elements, |
2882 | 14.7k | .closing_loc = closing_loc |
2883 | 14.7k | }; |
2884 | | |
2885 | 14.7k | return node; |
2886 | 14.7k | } |
2887 | | |
2888 | | /** |
2889 | | * Allocate and initialize a new HashPatternNode node. |
2890 | | */ |
2891 | | pm_hash_pattern_node_t * |
2892 | 1.33k | pm_hash_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *constant, pm_node_list_t elements, struct pm_node *rest, pm_location_t opening_loc, pm_location_t closing_loc) { |
2893 | 1.33k | pm_hash_pattern_node_t *node = (pm_hash_pattern_node_t *) pm_arena_alloc(arena, sizeof(pm_hash_pattern_node_t), PRISM_ALIGNOF(pm_hash_pattern_node_t)); |
2894 | | |
2895 | 1.33k | *node = (pm_hash_pattern_node_t) { |
2896 | 1.33k | .base = { .type = PM_HASH_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2897 | 1.33k | .constant = constant, |
2898 | 1.33k | .elements = elements, |
2899 | 1.33k | .rest = rest, |
2900 | 1.33k | .opening_loc = opening_loc, |
2901 | 1.33k | .closing_loc = closing_loc |
2902 | 1.33k | }; |
2903 | | |
2904 | 1.33k | return node; |
2905 | 1.33k | } |
2906 | | |
2907 | | /** |
2908 | | * Allocate and initialize a new IfNode node. |
2909 | | */ |
2910 | | pm_if_node_t * |
2911 | 2.99k | pm_if_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t if_keyword_loc, struct pm_node *predicate, pm_location_t then_keyword_loc, struct pm_statements_node *statements, struct pm_node *subsequent, pm_location_t end_keyword_loc) { |
2912 | 2.99k | pm_if_node_t *node = (pm_if_node_t *) pm_arena_alloc(arena, sizeof(pm_if_node_t), PRISM_ALIGNOF(pm_if_node_t)); |
2913 | | |
2914 | 2.99k | *node = (pm_if_node_t) { |
2915 | 2.99k | .base = { .type = PM_IF_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2916 | 2.99k | .if_keyword_loc = if_keyword_loc, |
2917 | 2.99k | .predicate = predicate, |
2918 | 2.99k | .then_keyword_loc = then_keyword_loc, |
2919 | 2.99k | .statements = statements, |
2920 | 2.99k | .subsequent = subsequent, |
2921 | 2.99k | .end_keyword_loc = end_keyword_loc |
2922 | 2.99k | }; |
2923 | | |
2924 | 2.99k | return node; |
2925 | 2.99k | } |
2926 | | |
2927 | | /** |
2928 | | * Allocate and initialize a new ImaginaryNode node. |
2929 | | */ |
2930 | | pm_imaginary_node_t * |
2931 | 2.64k | pm_imaginary_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *numeric) { |
2932 | 2.64k | pm_imaginary_node_t *node = (pm_imaginary_node_t *) pm_arena_alloc(arena, sizeof(pm_imaginary_node_t), PRISM_ALIGNOF(pm_imaginary_node_t)); |
2933 | | |
2934 | 2.64k | *node = (pm_imaginary_node_t) { |
2935 | 2.64k | .base = { .type = PM_IMAGINARY_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2936 | 2.64k | .numeric = numeric |
2937 | 2.64k | }; |
2938 | | |
2939 | 2.64k | return node; |
2940 | 2.64k | } |
2941 | | |
2942 | | /** |
2943 | | * Allocate and initialize a new ImplicitNode node. |
2944 | | */ |
2945 | | pm_implicit_node_t * |
2946 | 4.92k | pm_implicit_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value) { |
2947 | 4.92k | pm_implicit_node_t *node = (pm_implicit_node_t *) pm_arena_alloc(arena, sizeof(pm_implicit_node_t), PRISM_ALIGNOF(pm_implicit_node_t)); |
2948 | | |
2949 | 4.92k | *node = (pm_implicit_node_t) { |
2950 | 4.92k | .base = { .type = PM_IMPLICIT_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2951 | 4.92k | .value = value |
2952 | 4.92k | }; |
2953 | | |
2954 | 4.92k | return node; |
2955 | 4.92k | } |
2956 | | |
2957 | | /** |
2958 | | * Allocate and initialize a new ImplicitRestNode node. |
2959 | | */ |
2960 | | pm_implicit_rest_node_t * |
2961 | 2.36k | pm_implicit_rest_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
2962 | 2.36k | pm_implicit_rest_node_t *node = (pm_implicit_rest_node_t *) pm_arena_alloc(arena, sizeof(pm_implicit_rest_node_t), PRISM_ALIGNOF(pm_implicit_rest_node_t)); |
2963 | | |
2964 | 2.36k | *node = (pm_implicit_rest_node_t) { |
2965 | 2.36k | .base = { .type = PM_IMPLICIT_REST_NODE, .flags = flags, .node_id = node_id, .location = location } |
2966 | 2.36k | }; |
2967 | | |
2968 | 2.36k | return node; |
2969 | 2.36k | } |
2970 | | |
2971 | | /** |
2972 | | * Allocate and initialize a new InNode node. |
2973 | | */ |
2974 | | pm_in_node_t * |
2975 | 4.58k | pm_in_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *pattern, struct pm_statements_node *statements, pm_location_t in_keyword_loc, pm_location_t then_keyword_loc) { |
2976 | 4.58k | pm_in_node_t *node = (pm_in_node_t *) pm_arena_alloc(arena, sizeof(pm_in_node_t), PRISM_ALIGNOF(pm_in_node_t)); |
2977 | | |
2978 | 4.58k | *node = (pm_in_node_t) { |
2979 | 4.58k | .base = { .type = PM_IN_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2980 | 4.58k | .pattern = pattern, |
2981 | 4.58k | .statements = statements, |
2982 | 4.58k | .in_keyword_loc = in_keyword_loc, |
2983 | 4.58k | .then_keyword_loc = then_keyword_loc |
2984 | 4.58k | }; |
2985 | | |
2986 | 4.58k | return node; |
2987 | 4.58k | } |
2988 | | |
2989 | | /** |
2990 | | * Allocate and initialize a new IndexAndWriteNode node. |
2991 | | */ |
2992 | | pm_index_and_write_node_t * |
2993 | 366 | pm_index_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block, pm_location_t operator_loc, struct pm_node *value) { |
2994 | 366 | pm_index_and_write_node_t *node = (pm_index_and_write_node_t *) pm_arena_alloc(arena, sizeof(pm_index_and_write_node_t), PRISM_ALIGNOF(pm_index_and_write_node_t)); |
2995 | | |
2996 | 366 | *node = (pm_index_and_write_node_t) { |
2997 | 366 | .base = { .type = PM_INDEX_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
2998 | 366 | .receiver = receiver, |
2999 | 366 | .call_operator_loc = call_operator_loc, |
3000 | 366 | .opening_loc = opening_loc, |
3001 | 366 | .arguments = arguments, |
3002 | 366 | .closing_loc = closing_loc, |
3003 | 366 | .block = block, |
3004 | 366 | .operator_loc = operator_loc, |
3005 | 366 | .value = value |
3006 | 366 | }; |
3007 | | |
3008 | 366 | return node; |
3009 | 366 | } |
3010 | | |
3011 | | /** |
3012 | | * Allocate and initialize a new IndexOperatorWriteNode node. |
3013 | | */ |
3014 | | pm_index_operator_write_node_t * |
3015 | 1.02k | pm_index_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block, pm_constant_id_t binary_operator, pm_location_t binary_operator_loc, struct pm_node *value) { |
3016 | 1.02k | pm_index_operator_write_node_t *node = (pm_index_operator_write_node_t *) pm_arena_alloc(arena, sizeof(pm_index_operator_write_node_t), PRISM_ALIGNOF(pm_index_operator_write_node_t)); |
3017 | | |
3018 | 1.02k | *node = (pm_index_operator_write_node_t) { |
3019 | 1.02k | .base = { .type = PM_INDEX_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3020 | 1.02k | .receiver = receiver, |
3021 | 1.02k | .call_operator_loc = call_operator_loc, |
3022 | 1.02k | .opening_loc = opening_loc, |
3023 | 1.02k | .arguments = arguments, |
3024 | 1.02k | .closing_loc = closing_loc, |
3025 | 1.02k | .block = block, |
3026 | 1.02k | .binary_operator = binary_operator, |
3027 | 1.02k | .binary_operator_loc = binary_operator_loc, |
3028 | 1.02k | .value = value |
3029 | 1.02k | }; |
3030 | | |
3031 | 1.02k | return node; |
3032 | 1.02k | } |
3033 | | |
3034 | | /** |
3035 | | * Allocate and initialize a new IndexOrWriteNode node. |
3036 | | */ |
3037 | | pm_index_or_write_node_t * |
3038 | 925 | pm_index_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block, pm_location_t operator_loc, struct pm_node *value) { |
3039 | 925 | pm_index_or_write_node_t *node = (pm_index_or_write_node_t *) pm_arena_alloc(arena, sizeof(pm_index_or_write_node_t), PRISM_ALIGNOF(pm_index_or_write_node_t)); |
3040 | | |
3041 | 925 | *node = (pm_index_or_write_node_t) { |
3042 | 925 | .base = { .type = PM_INDEX_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3043 | 925 | .receiver = receiver, |
3044 | 925 | .call_operator_loc = call_operator_loc, |
3045 | 925 | .opening_loc = opening_loc, |
3046 | 925 | .arguments = arguments, |
3047 | 925 | .closing_loc = closing_loc, |
3048 | 925 | .block = block, |
3049 | 925 | .operator_loc = operator_loc, |
3050 | 925 | .value = value |
3051 | 925 | }; |
3052 | | |
3053 | 925 | return node; |
3054 | 925 | } |
3055 | | |
3056 | | /** |
3057 | | * Allocate and initialize a new IndexTargetNode node. |
3058 | | */ |
3059 | | pm_index_target_node_t * |
3060 | 2.04k | pm_index_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block) { |
3061 | 2.04k | pm_index_target_node_t *node = (pm_index_target_node_t *) pm_arena_alloc(arena, sizeof(pm_index_target_node_t), PRISM_ALIGNOF(pm_index_target_node_t)); |
3062 | | |
3063 | 2.04k | *node = (pm_index_target_node_t) { |
3064 | 2.04k | .base = { .type = PM_INDEX_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3065 | 2.04k | .receiver = receiver, |
3066 | 2.04k | .opening_loc = opening_loc, |
3067 | 2.04k | .arguments = arguments, |
3068 | 2.04k | .closing_loc = closing_loc, |
3069 | 2.04k | .block = block |
3070 | 2.04k | }; |
3071 | | |
3072 | 2.04k | return node; |
3073 | 2.04k | } |
3074 | | |
3075 | | /** |
3076 | | * Allocate and initialize a new InstanceVariableAndWriteNode node. |
3077 | | */ |
3078 | | pm_instance_variable_and_write_node_t * |
3079 | 114 | pm_instance_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) { |
3080 | 114 | pm_instance_variable_and_write_node_t *node = (pm_instance_variable_and_write_node_t *) pm_arena_alloc(arena, sizeof(pm_instance_variable_and_write_node_t), PRISM_ALIGNOF(pm_instance_variable_and_write_node_t)); |
3081 | | |
3082 | 114 | *node = (pm_instance_variable_and_write_node_t) { |
3083 | 114 | .base = { .type = PM_INSTANCE_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3084 | 114 | .name = name, |
3085 | 114 | .name_loc = name_loc, |
3086 | 114 | .operator_loc = operator_loc, |
3087 | 114 | .value = value |
3088 | 114 | }; |
3089 | | |
3090 | 114 | return node; |
3091 | 114 | } |
3092 | | |
3093 | | /** |
3094 | | * Allocate and initialize a new InstanceVariableOperatorWriteNode node. |
3095 | | */ |
3096 | | pm_instance_variable_operator_write_node_t * |
3097 | 77 | pm_instance_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) { |
3098 | 77 | pm_instance_variable_operator_write_node_t *node = (pm_instance_variable_operator_write_node_t *) pm_arena_alloc(arena, sizeof(pm_instance_variable_operator_write_node_t), PRISM_ALIGNOF(pm_instance_variable_operator_write_node_t)); |
3099 | | |
3100 | 77 | *node = (pm_instance_variable_operator_write_node_t) { |
3101 | 77 | .base = { .type = PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3102 | 77 | .name = name, |
3103 | 77 | .name_loc = name_loc, |
3104 | 77 | .binary_operator_loc = binary_operator_loc, |
3105 | 77 | .value = value, |
3106 | 77 | .binary_operator = binary_operator |
3107 | 77 | }; |
3108 | | |
3109 | 77 | return node; |
3110 | 77 | } |
3111 | | |
3112 | | /** |
3113 | | * Allocate and initialize a new InstanceVariableOrWriteNode node. |
3114 | | */ |
3115 | | pm_instance_variable_or_write_node_t * |
3116 | 684 | pm_instance_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) { |
3117 | 684 | pm_instance_variable_or_write_node_t *node = (pm_instance_variable_or_write_node_t *) pm_arena_alloc(arena, sizeof(pm_instance_variable_or_write_node_t), PRISM_ALIGNOF(pm_instance_variable_or_write_node_t)); |
3118 | | |
3119 | 684 | *node = (pm_instance_variable_or_write_node_t) { |
3120 | 684 | .base = { .type = PM_INSTANCE_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3121 | 684 | .name = name, |
3122 | 684 | .name_loc = name_loc, |
3123 | 684 | .operator_loc = operator_loc, |
3124 | 684 | .value = value |
3125 | 684 | }; |
3126 | | |
3127 | 684 | return node; |
3128 | 684 | } |
3129 | | |
3130 | | /** |
3131 | | * Allocate and initialize a new InstanceVariableReadNode node. |
3132 | | */ |
3133 | | pm_instance_variable_read_node_t * |
3134 | 6.24k | pm_instance_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
3135 | 6.24k | pm_instance_variable_read_node_t *node = (pm_instance_variable_read_node_t *) pm_arena_alloc(arena, sizeof(pm_instance_variable_read_node_t), PRISM_ALIGNOF(pm_instance_variable_read_node_t)); |
3136 | | |
3137 | 6.24k | *node = (pm_instance_variable_read_node_t) { |
3138 | 6.24k | .base = { .type = PM_INSTANCE_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3139 | 6.24k | .name = name |
3140 | 6.24k | }; |
3141 | | |
3142 | 6.24k | return node; |
3143 | 6.24k | } |
3144 | | |
3145 | | /** |
3146 | | * Allocate and initialize a new InstanceVariableTargetNode node. |
3147 | | */ |
3148 | | pm_instance_variable_target_node_t * |
3149 | | pm_instance_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
3150 | | pm_instance_variable_target_node_t *node = (pm_instance_variable_target_node_t *) pm_arena_alloc(arena, sizeof(pm_instance_variable_target_node_t), PRISM_ALIGNOF(pm_instance_variable_target_node_t)); |
3151 | | |
3152 | | *node = (pm_instance_variable_target_node_t) { |
3153 | | .base = { .type = PM_INSTANCE_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3154 | | .name = name |
3155 | | }; |
3156 | | |
3157 | | return node; |
3158 | | } |
3159 | | |
3160 | | /** |
3161 | | * Allocate and initialize a new InstanceVariableWriteNode node. |
3162 | | */ |
3163 | | pm_instance_variable_write_node_t * |
3164 | 628 | pm_instance_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) { |
3165 | 628 | pm_instance_variable_write_node_t *node = (pm_instance_variable_write_node_t *) pm_arena_alloc(arena, sizeof(pm_instance_variable_write_node_t), PRISM_ALIGNOF(pm_instance_variable_write_node_t)); |
3166 | | |
3167 | 628 | *node = (pm_instance_variable_write_node_t) { |
3168 | 628 | .base = { .type = PM_INSTANCE_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3169 | 628 | .name = name, |
3170 | 628 | .name_loc = name_loc, |
3171 | 628 | .value = value, |
3172 | 628 | .operator_loc = operator_loc |
3173 | 628 | }; |
3174 | | |
3175 | 628 | return node; |
3176 | 628 | } |
3177 | | |
3178 | | /** |
3179 | | * Allocate and initialize a new IntegerNode node. |
3180 | | */ |
3181 | | pm_integer_node_t * |
3182 | 66.3k | pm_integer_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_integer_t value) { |
3183 | 66.3k | pm_integer_node_t *node = (pm_integer_node_t *) pm_arena_alloc(arena, sizeof(pm_integer_node_t), PRISM_ALIGNOF(pm_integer_node_t)); |
3184 | | |
3185 | 66.3k | *node = (pm_integer_node_t) { |
3186 | 66.3k | .base = { .type = PM_INTEGER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3187 | 66.3k | .value = value |
3188 | 66.3k | }; |
3189 | | |
3190 | 66.3k | return node; |
3191 | 66.3k | } |
3192 | | |
3193 | | /** |
3194 | | * Allocate and initialize a new InterpolatedMatchLastLineNode node. |
3195 | | */ |
3196 | | pm_interpolated_match_last_line_node_t * |
3197 | | pm_interpolated_match_last_line_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) { |
3198 | | pm_interpolated_match_last_line_node_t *node = (pm_interpolated_match_last_line_node_t *) pm_arena_alloc(arena, sizeof(pm_interpolated_match_last_line_node_t), PRISM_ALIGNOF(pm_interpolated_match_last_line_node_t)); |
3199 | | |
3200 | | *node = (pm_interpolated_match_last_line_node_t) { |
3201 | | .base = { .type = PM_INTERPOLATED_MATCH_LAST_LINE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3202 | | .opening_loc = opening_loc, |
3203 | | .parts = parts, |
3204 | | .closing_loc = closing_loc |
3205 | | }; |
3206 | | |
3207 | | return node; |
3208 | | } |
3209 | | |
3210 | | /** |
3211 | | * Allocate and initialize a new InterpolatedRegularExpressionNode node. |
3212 | | */ |
3213 | | pm_interpolated_regular_expression_node_t * |
3214 | 1.78k | pm_interpolated_regular_expression_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) { |
3215 | 1.78k | pm_interpolated_regular_expression_node_t *node = (pm_interpolated_regular_expression_node_t *) pm_arena_alloc(arena, sizeof(pm_interpolated_regular_expression_node_t), PRISM_ALIGNOF(pm_interpolated_regular_expression_node_t)); |
3216 | | |
3217 | 1.78k | *node = (pm_interpolated_regular_expression_node_t) { |
3218 | 1.78k | .base = { .type = PM_INTERPOLATED_REGULAR_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3219 | 1.78k | .opening_loc = opening_loc, |
3220 | 1.78k | .parts = parts, |
3221 | 1.78k | .closing_loc = closing_loc |
3222 | 1.78k | }; |
3223 | | |
3224 | 1.78k | return node; |
3225 | 1.78k | } |
3226 | | |
3227 | | /** |
3228 | | * Allocate and initialize a new InterpolatedStringNode node. |
3229 | | */ |
3230 | | pm_interpolated_string_node_t * |
3231 | 8.32k | pm_interpolated_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) { |
3232 | 8.32k | pm_interpolated_string_node_t *node = (pm_interpolated_string_node_t *) pm_arena_alloc(arena, sizeof(pm_interpolated_string_node_t), PRISM_ALIGNOF(pm_interpolated_string_node_t)); |
3233 | | |
3234 | 8.32k | *node = (pm_interpolated_string_node_t) { |
3235 | 8.32k | .base = { .type = PM_INTERPOLATED_STRING_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3236 | 8.32k | .opening_loc = opening_loc, |
3237 | 8.32k | .parts = parts, |
3238 | 8.32k | .closing_loc = closing_loc |
3239 | 8.32k | }; |
3240 | | |
3241 | 8.32k | return node; |
3242 | 8.32k | } |
3243 | | |
3244 | | /** |
3245 | | * Allocate and initialize a new InterpolatedSymbolNode node. |
3246 | | */ |
3247 | | pm_interpolated_symbol_node_t * |
3248 | 1.29k | pm_interpolated_symbol_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) { |
3249 | 1.29k | pm_interpolated_symbol_node_t *node = (pm_interpolated_symbol_node_t *) pm_arena_alloc(arena, sizeof(pm_interpolated_symbol_node_t), PRISM_ALIGNOF(pm_interpolated_symbol_node_t)); |
3250 | | |
3251 | 1.29k | *node = (pm_interpolated_symbol_node_t) { |
3252 | 1.29k | .base = { .type = PM_INTERPOLATED_SYMBOL_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3253 | 1.29k | .opening_loc = opening_loc, |
3254 | 1.29k | .parts = parts, |
3255 | 1.29k | .closing_loc = closing_loc |
3256 | 1.29k | }; |
3257 | | |
3258 | 1.29k | return node; |
3259 | 1.29k | } |
3260 | | |
3261 | | /** |
3262 | | * Allocate and initialize a new InterpolatedXStringNode node. |
3263 | | */ |
3264 | | pm_interpolated_x_string_node_t * |
3265 | 458 | pm_interpolated_x_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) { |
3266 | 458 | pm_interpolated_x_string_node_t *node = (pm_interpolated_x_string_node_t *) pm_arena_alloc(arena, sizeof(pm_interpolated_x_string_node_t), PRISM_ALIGNOF(pm_interpolated_x_string_node_t)); |
3267 | | |
3268 | 458 | *node = (pm_interpolated_x_string_node_t) { |
3269 | 458 | .base = { .type = PM_INTERPOLATED_X_STRING_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3270 | 458 | .opening_loc = opening_loc, |
3271 | 458 | .parts = parts, |
3272 | 458 | .closing_loc = closing_loc |
3273 | 458 | }; |
3274 | | |
3275 | 458 | return node; |
3276 | 458 | } |
3277 | | |
3278 | | /** |
3279 | | * Allocate and initialize a new ItLocalVariableReadNode node. |
3280 | | */ |
3281 | | pm_it_local_variable_read_node_t * |
3282 | 339 | pm_it_local_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
3283 | 339 | pm_it_local_variable_read_node_t *node = (pm_it_local_variable_read_node_t *) pm_arena_alloc(arena, sizeof(pm_it_local_variable_read_node_t), PRISM_ALIGNOF(pm_it_local_variable_read_node_t)); |
3284 | | |
3285 | 339 | *node = (pm_it_local_variable_read_node_t) { |
3286 | 339 | .base = { .type = PM_IT_LOCAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location } |
3287 | 339 | }; |
3288 | | |
3289 | 339 | return node; |
3290 | 339 | } |
3291 | | |
3292 | | /** |
3293 | | * Allocate and initialize a new ItParametersNode node. |
3294 | | */ |
3295 | | pm_it_parameters_node_t * |
3296 | 211 | pm_it_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
3297 | 211 | pm_it_parameters_node_t *node = (pm_it_parameters_node_t *) pm_arena_alloc(arena, sizeof(pm_it_parameters_node_t), PRISM_ALIGNOF(pm_it_parameters_node_t)); |
3298 | | |
3299 | 211 | *node = (pm_it_parameters_node_t) { |
3300 | 211 | .base = { .type = PM_IT_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location } |
3301 | 211 | }; |
3302 | | |
3303 | 211 | return node; |
3304 | 211 | } |
3305 | | |
3306 | | /** |
3307 | | * Allocate and initialize a new KeywordHashNode node. |
3308 | | */ |
3309 | | pm_keyword_hash_node_t * |
3310 | 4.18k | pm_keyword_hash_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t elements) { |
3311 | 4.18k | pm_keyword_hash_node_t *node = (pm_keyword_hash_node_t *) pm_arena_alloc(arena, sizeof(pm_keyword_hash_node_t), PRISM_ALIGNOF(pm_keyword_hash_node_t)); |
3312 | | |
3313 | 4.18k | *node = (pm_keyword_hash_node_t) { |
3314 | 4.18k | .base = { .type = PM_KEYWORD_HASH_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3315 | 4.18k | .elements = elements |
3316 | 4.18k | }; |
3317 | | |
3318 | 4.18k | return node; |
3319 | 4.18k | } |
3320 | | |
3321 | | /** |
3322 | | * Allocate and initialize a new KeywordRestParameterNode node. |
3323 | | */ |
3324 | | pm_keyword_rest_parameter_node_t * |
3325 | 571 | pm_keyword_rest_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc) { |
3326 | 571 | pm_keyword_rest_parameter_node_t *node = (pm_keyword_rest_parameter_node_t *) pm_arena_alloc(arena, sizeof(pm_keyword_rest_parameter_node_t), PRISM_ALIGNOF(pm_keyword_rest_parameter_node_t)); |
3327 | | |
3328 | 571 | *node = (pm_keyword_rest_parameter_node_t) { |
3329 | 571 | .base = { .type = PM_KEYWORD_REST_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3330 | 571 | .name = name, |
3331 | 571 | .name_loc = name_loc, |
3332 | 571 | .operator_loc = operator_loc |
3333 | 571 | }; |
3334 | | |
3335 | 571 | return node; |
3336 | 571 | } |
3337 | | |
3338 | | /** |
3339 | | * Allocate and initialize a new LambdaNode node. |
3340 | | */ |
3341 | | pm_lambda_node_t * |
3342 | 2.55k | pm_lambda_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t operator_loc, pm_location_t opening_loc, pm_location_t closing_loc, struct pm_node *parameters, struct pm_node *body) { |
3343 | 2.55k | pm_lambda_node_t *node = (pm_lambda_node_t *) pm_arena_alloc(arena, sizeof(pm_lambda_node_t), PRISM_ALIGNOF(pm_lambda_node_t)); |
3344 | | |
3345 | 2.55k | *node = (pm_lambda_node_t) { |
3346 | 2.55k | .base = { .type = PM_LAMBDA_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3347 | 2.55k | .locals = locals, |
3348 | 2.55k | .operator_loc = operator_loc, |
3349 | 2.55k | .opening_loc = opening_loc, |
3350 | 2.55k | .closing_loc = closing_loc, |
3351 | 2.55k | .parameters = parameters, |
3352 | 2.55k | .body = body |
3353 | 2.55k | }; |
3354 | | |
3355 | 2.55k | return node; |
3356 | 2.55k | } |
3357 | | |
3358 | | /** |
3359 | | * Allocate and initialize a new LocalVariableAndWriteNode node. |
3360 | | */ |
3361 | | pm_local_variable_and_write_node_t * |
3362 | 174 | pm_local_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value, pm_constant_id_t name, uint32_t depth) { |
3363 | 174 | pm_local_variable_and_write_node_t *node = (pm_local_variable_and_write_node_t *) pm_arena_alloc(arena, sizeof(pm_local_variable_and_write_node_t), PRISM_ALIGNOF(pm_local_variable_and_write_node_t)); |
3364 | | |
3365 | 174 | *node = (pm_local_variable_and_write_node_t) { |
3366 | 174 | .base = { .type = PM_LOCAL_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3367 | 174 | .name_loc = name_loc, |
3368 | 174 | .operator_loc = operator_loc, |
3369 | 174 | .value = value, |
3370 | 174 | .name = name, |
3371 | 174 | .depth = depth |
3372 | 174 | }; |
3373 | | |
3374 | 174 | return node; |
3375 | 174 | } |
3376 | | |
3377 | | /** |
3378 | | * Allocate and initialize a new LocalVariableOperatorWriteNode node. |
3379 | | */ |
3380 | | pm_local_variable_operator_write_node_t * |
3381 | 1.35k | pm_local_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t name, pm_constant_id_t binary_operator, uint32_t depth) { |
3382 | 1.35k | pm_local_variable_operator_write_node_t *node = (pm_local_variable_operator_write_node_t *) pm_arena_alloc(arena, sizeof(pm_local_variable_operator_write_node_t), PRISM_ALIGNOF(pm_local_variable_operator_write_node_t)); |
3383 | | |
3384 | 1.35k | *node = (pm_local_variable_operator_write_node_t) { |
3385 | 1.35k | .base = { .type = PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3386 | 1.35k | .name_loc = name_loc, |
3387 | 1.35k | .binary_operator_loc = binary_operator_loc, |
3388 | 1.35k | .value = value, |
3389 | 1.35k | .name = name, |
3390 | 1.35k | .binary_operator = binary_operator, |
3391 | 1.35k | .depth = depth |
3392 | 1.35k | }; |
3393 | | |
3394 | 1.35k | return node; |
3395 | 1.35k | } |
3396 | | |
3397 | | /** |
3398 | | * Allocate and initialize a new LocalVariableOrWriteNode node. |
3399 | | */ |
3400 | | pm_local_variable_or_write_node_t * |
3401 | 484 | pm_local_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value, pm_constant_id_t name, uint32_t depth) { |
3402 | 484 | pm_local_variable_or_write_node_t *node = (pm_local_variable_or_write_node_t *) pm_arena_alloc(arena, sizeof(pm_local_variable_or_write_node_t), PRISM_ALIGNOF(pm_local_variable_or_write_node_t)); |
3403 | | |
3404 | 484 | *node = (pm_local_variable_or_write_node_t) { |
3405 | 484 | .base = { .type = PM_LOCAL_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3406 | 484 | .name_loc = name_loc, |
3407 | 484 | .operator_loc = operator_loc, |
3408 | 484 | .value = value, |
3409 | 484 | .name = name, |
3410 | 484 | .depth = depth |
3411 | 484 | }; |
3412 | | |
3413 | 484 | return node; |
3414 | 484 | } |
3415 | | |
3416 | | /** |
3417 | | * Allocate and initialize a new LocalVariableReadNode node. |
3418 | | */ |
3419 | | pm_local_variable_read_node_t * |
3420 | 44.7k | pm_local_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, uint32_t depth) { |
3421 | 44.7k | pm_local_variable_read_node_t *node = (pm_local_variable_read_node_t *) pm_arena_alloc(arena, sizeof(pm_local_variable_read_node_t), PRISM_ALIGNOF(pm_local_variable_read_node_t)); |
3422 | | |
3423 | 44.7k | *node = (pm_local_variable_read_node_t) { |
3424 | 44.7k | .base = { .type = PM_LOCAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3425 | 44.7k | .name = name, |
3426 | 44.7k | .depth = depth |
3427 | 44.7k | }; |
3428 | | |
3429 | 44.7k | return node; |
3430 | 44.7k | } |
3431 | | |
3432 | | /** |
3433 | | * Allocate and initialize a new LocalVariableTargetNode node. |
3434 | | */ |
3435 | | pm_local_variable_target_node_t * |
3436 | 21.0k | pm_local_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, uint32_t depth) { |
3437 | 21.0k | pm_local_variable_target_node_t *node = (pm_local_variable_target_node_t *) pm_arena_alloc(arena, sizeof(pm_local_variable_target_node_t), PRISM_ALIGNOF(pm_local_variable_target_node_t)); |
3438 | | |
3439 | 21.0k | *node = (pm_local_variable_target_node_t) { |
3440 | 21.0k | .base = { .type = PM_LOCAL_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3441 | 21.0k | .name = name, |
3442 | 21.0k | .depth = depth |
3443 | 21.0k | }; |
3444 | | |
3445 | 21.0k | return node; |
3446 | 21.0k | } |
3447 | | |
3448 | | /** |
3449 | | * Allocate and initialize a new LocalVariableWriteNode node. |
3450 | | */ |
3451 | | pm_local_variable_write_node_t * |
3452 | 19.5k | pm_local_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, uint32_t depth, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) { |
3453 | 19.5k | pm_local_variable_write_node_t *node = (pm_local_variable_write_node_t *) pm_arena_alloc(arena, sizeof(pm_local_variable_write_node_t), PRISM_ALIGNOF(pm_local_variable_write_node_t)); |
3454 | | |
3455 | 19.5k | *node = (pm_local_variable_write_node_t) { |
3456 | 19.5k | .base = { .type = PM_LOCAL_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3457 | 19.5k | .name = name, |
3458 | 19.5k | .depth = depth, |
3459 | 19.5k | .name_loc = name_loc, |
3460 | 19.5k | .value = value, |
3461 | 19.5k | .operator_loc = operator_loc |
3462 | 19.5k | }; |
3463 | | |
3464 | 19.5k | return node; |
3465 | 19.5k | } |
3466 | | |
3467 | | /** |
3468 | | * Allocate and initialize a new MatchLastLineNode node. |
3469 | | */ |
3470 | | pm_match_last_line_node_t * |
3471 | | pm_match_last_line_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) { |
3472 | | pm_match_last_line_node_t *node = (pm_match_last_line_node_t *) pm_arena_alloc(arena, sizeof(pm_match_last_line_node_t), PRISM_ALIGNOF(pm_match_last_line_node_t)); |
3473 | | |
3474 | | *node = (pm_match_last_line_node_t) { |
3475 | | .base = { .type = PM_MATCH_LAST_LINE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3476 | | .opening_loc = opening_loc, |
3477 | | .content_loc = content_loc, |
3478 | | .closing_loc = closing_loc, |
3479 | | .unescaped = unescaped |
3480 | | }; |
3481 | | |
3482 | | return node; |
3483 | | } |
3484 | | |
3485 | | /** |
3486 | | * Allocate and initialize a new MatchPredicateNode node. |
3487 | | */ |
3488 | | pm_match_predicate_node_t * |
3489 | 646 | pm_match_predicate_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, struct pm_node *pattern, pm_location_t keyword_loc) { |
3490 | 646 | pm_match_predicate_node_t *node = (pm_match_predicate_node_t *) pm_arena_alloc(arena, sizeof(pm_match_predicate_node_t), PRISM_ALIGNOF(pm_match_predicate_node_t)); |
3491 | | |
3492 | 646 | *node = (pm_match_predicate_node_t) { |
3493 | 646 | .base = { .type = PM_MATCH_PREDICATE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3494 | 646 | .value = value, |
3495 | 646 | .pattern = pattern, |
3496 | 646 | .keyword_loc = keyword_loc |
3497 | 646 | }; |
3498 | | |
3499 | 646 | return node; |
3500 | 646 | } |
3501 | | |
3502 | | /** |
3503 | | * Allocate and initialize a new MatchRequiredNode node. |
3504 | | */ |
3505 | | pm_match_required_node_t * |
3506 | 20.2k | pm_match_required_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, struct pm_node *pattern, pm_location_t operator_loc) { |
3507 | 20.2k | pm_match_required_node_t *node = (pm_match_required_node_t *) pm_arena_alloc(arena, sizeof(pm_match_required_node_t), PRISM_ALIGNOF(pm_match_required_node_t)); |
3508 | | |
3509 | 20.2k | *node = (pm_match_required_node_t) { |
3510 | 20.2k | .base = { .type = PM_MATCH_REQUIRED_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3511 | 20.2k | .value = value, |
3512 | 20.2k | .pattern = pattern, |
3513 | 20.2k | .operator_loc = operator_loc |
3514 | 20.2k | }; |
3515 | | |
3516 | 20.2k | return node; |
3517 | 20.2k | } |
3518 | | |
3519 | | /** |
3520 | | * Allocate and initialize a new MatchWriteNode node. |
3521 | | */ |
3522 | | pm_match_write_node_t * |
3523 | 1.22k | pm_match_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_call_node *call, pm_node_list_t targets) { |
3524 | 1.22k | pm_match_write_node_t *node = (pm_match_write_node_t *) pm_arena_alloc(arena, sizeof(pm_match_write_node_t), PRISM_ALIGNOF(pm_match_write_node_t)); |
3525 | | |
3526 | 1.22k | *node = (pm_match_write_node_t) { |
3527 | 1.22k | .base = { .type = PM_MATCH_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3528 | 1.22k | .call = call, |
3529 | 1.22k | .targets = targets |
3530 | 1.22k | }; |
3531 | | |
3532 | 1.22k | return node; |
3533 | 1.22k | } |
3534 | | |
3535 | | /** |
3536 | | * Allocate and initialize a new ModuleNode node. |
3537 | | */ |
3538 | | pm_module_node_t * |
3539 | 850 | pm_module_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t module_keyword_loc, struct pm_node *constant_path, struct pm_node *body, pm_location_t end_keyword_loc, pm_constant_id_t name) { |
3540 | 850 | pm_module_node_t *node = (pm_module_node_t *) pm_arena_alloc(arena, sizeof(pm_module_node_t), PRISM_ALIGNOF(pm_module_node_t)); |
3541 | | |
3542 | 850 | *node = (pm_module_node_t) { |
3543 | 850 | .base = { .type = PM_MODULE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3544 | 850 | .locals = locals, |
3545 | 850 | .module_keyword_loc = module_keyword_loc, |
3546 | 850 | .constant_path = constant_path, |
3547 | 850 | .body = body, |
3548 | 850 | .end_keyword_loc = end_keyword_loc, |
3549 | 850 | .name = name |
3550 | 850 | }; |
3551 | | |
3552 | 850 | return node; |
3553 | 850 | } |
3554 | | |
3555 | | /** |
3556 | | * Allocate and initialize a new MultiTargetNode node. |
3557 | | */ |
3558 | | pm_multi_target_node_t * |
3559 | 14.2k | pm_multi_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t lefts, struct pm_node *rest, pm_node_list_t rights, pm_location_t lparen_loc, pm_location_t rparen_loc) { |
3560 | 14.2k | pm_multi_target_node_t *node = (pm_multi_target_node_t *) pm_arena_alloc(arena, sizeof(pm_multi_target_node_t), PRISM_ALIGNOF(pm_multi_target_node_t)); |
3561 | | |
3562 | 14.2k | *node = (pm_multi_target_node_t) { |
3563 | 14.2k | .base = { .type = PM_MULTI_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3564 | 14.2k | .lefts = lefts, |
3565 | 14.2k | .rest = rest, |
3566 | 14.2k | .rights = rights, |
3567 | 14.2k | .lparen_loc = lparen_loc, |
3568 | 14.2k | .rparen_loc = rparen_loc |
3569 | 14.2k | }; |
3570 | | |
3571 | 14.2k | return node; |
3572 | 14.2k | } |
3573 | | |
3574 | | /** |
3575 | | * Allocate and initialize a new MultiWriteNode node. |
3576 | | */ |
3577 | | pm_multi_write_node_t * |
3578 | 7.75k | pm_multi_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t lefts, struct pm_node *rest, pm_node_list_t rights, pm_location_t lparen_loc, pm_location_t rparen_loc, pm_location_t operator_loc, struct pm_node *value) { |
3579 | 7.75k | pm_multi_write_node_t *node = (pm_multi_write_node_t *) pm_arena_alloc(arena, sizeof(pm_multi_write_node_t), PRISM_ALIGNOF(pm_multi_write_node_t)); |
3580 | | |
3581 | 7.75k | *node = (pm_multi_write_node_t) { |
3582 | 7.75k | .base = { .type = PM_MULTI_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3583 | 7.75k | .lefts = lefts, |
3584 | 7.75k | .rest = rest, |
3585 | 7.75k | .rights = rights, |
3586 | 7.75k | .lparen_loc = lparen_loc, |
3587 | 7.75k | .rparen_loc = rparen_loc, |
3588 | 7.75k | .operator_loc = operator_loc, |
3589 | 7.75k | .value = value |
3590 | 7.75k | }; |
3591 | | |
3592 | 7.75k | return node; |
3593 | 7.75k | } |
3594 | | |
3595 | | /** |
3596 | | * Allocate and initialize a new NextNode node. |
3597 | | */ |
3598 | | pm_next_node_t * |
3599 | 466 | pm_next_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_arguments_node *arguments, pm_location_t keyword_loc) { |
3600 | 466 | pm_next_node_t *node = (pm_next_node_t *) pm_arena_alloc(arena, sizeof(pm_next_node_t), PRISM_ALIGNOF(pm_next_node_t)); |
3601 | | |
3602 | 466 | *node = (pm_next_node_t) { |
3603 | 466 | .base = { .type = PM_NEXT_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3604 | 466 | .arguments = arguments, |
3605 | 466 | .keyword_loc = keyword_loc |
3606 | 466 | }; |
3607 | | |
3608 | 466 | return node; |
3609 | 466 | } |
3610 | | |
3611 | | /** |
3612 | | * Allocate and initialize a new NilNode node. |
3613 | | */ |
3614 | | pm_nil_node_t * |
3615 | 1.87k | pm_nil_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
3616 | 1.87k | pm_nil_node_t *node = (pm_nil_node_t *) pm_arena_alloc(arena, sizeof(pm_nil_node_t), PRISM_ALIGNOF(pm_nil_node_t)); |
3617 | | |
3618 | 1.87k | *node = (pm_nil_node_t) { |
3619 | 1.87k | .base = { .type = PM_NIL_NODE, .flags = flags, .node_id = node_id, .location = location } |
3620 | 1.87k | }; |
3621 | | |
3622 | 1.87k | return node; |
3623 | 1.87k | } |
3624 | | |
3625 | | /** |
3626 | | * Allocate and initialize a new NoBlockParameterNode node. |
3627 | | */ |
3628 | | pm_no_block_parameter_node_t * |
3629 | 1 | pm_no_block_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, pm_location_t keyword_loc) { |
3630 | 1 | pm_no_block_parameter_node_t *node = (pm_no_block_parameter_node_t *) pm_arena_alloc(arena, sizeof(pm_no_block_parameter_node_t), PRISM_ALIGNOF(pm_no_block_parameter_node_t)); |
3631 | | |
3632 | 1 | *node = (pm_no_block_parameter_node_t) { |
3633 | 1 | .base = { .type = PM_NO_BLOCK_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3634 | 1 | .operator_loc = operator_loc, |
3635 | 1 | .keyword_loc = keyword_loc |
3636 | 1 | }; |
3637 | | |
3638 | 1 | return node; |
3639 | 1 | } |
3640 | | |
3641 | | /** |
3642 | | * Allocate and initialize a new NoKeywordsParameterNode node. |
3643 | | */ |
3644 | | pm_no_keywords_parameter_node_t * |
3645 | 148 | pm_no_keywords_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, pm_location_t keyword_loc) { |
3646 | 148 | pm_no_keywords_parameter_node_t *node = (pm_no_keywords_parameter_node_t *) pm_arena_alloc(arena, sizeof(pm_no_keywords_parameter_node_t), PRISM_ALIGNOF(pm_no_keywords_parameter_node_t)); |
3647 | | |
3648 | 148 | *node = (pm_no_keywords_parameter_node_t) { |
3649 | 148 | .base = { .type = PM_NO_KEYWORDS_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3650 | 148 | .operator_loc = operator_loc, |
3651 | 148 | .keyword_loc = keyword_loc |
3652 | 148 | }; |
3653 | | |
3654 | 148 | return node; |
3655 | 148 | } |
3656 | | |
3657 | | /** |
3658 | | * Allocate and initialize a new NumberedParametersNode node. |
3659 | | */ |
3660 | | pm_numbered_parameters_node_t * |
3661 | 67 | pm_numbered_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, uint8_t maximum) { |
3662 | 67 | pm_numbered_parameters_node_t *node = (pm_numbered_parameters_node_t *) pm_arena_alloc(arena, sizeof(pm_numbered_parameters_node_t), PRISM_ALIGNOF(pm_numbered_parameters_node_t)); |
3663 | | |
3664 | 67 | *node = (pm_numbered_parameters_node_t) { |
3665 | 67 | .base = { .type = PM_NUMBERED_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3666 | 67 | .maximum = maximum |
3667 | 67 | }; |
3668 | | |
3669 | 67 | return node; |
3670 | 67 | } |
3671 | | |
3672 | | /** |
3673 | | * Allocate and initialize a new NumberedReferenceReadNode node. |
3674 | | */ |
3675 | | pm_numbered_reference_read_node_t * |
3676 | 145 | pm_numbered_reference_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, uint32_t number) { |
3677 | 145 | pm_numbered_reference_read_node_t *node = (pm_numbered_reference_read_node_t *) pm_arena_alloc(arena, sizeof(pm_numbered_reference_read_node_t), PRISM_ALIGNOF(pm_numbered_reference_read_node_t)); |
3678 | | |
3679 | 145 | *node = (pm_numbered_reference_read_node_t) { |
3680 | 145 | .base = { .type = PM_NUMBERED_REFERENCE_READ_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3681 | 145 | .number = number |
3682 | 145 | }; |
3683 | | |
3684 | 145 | return node; |
3685 | 145 | } |
3686 | | |
3687 | | /** |
3688 | | * Allocate and initialize a new OptionalKeywordParameterNode node. |
3689 | | */ |
3690 | | pm_optional_keyword_parameter_node_t * |
3691 | 650 | pm_optional_keyword_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value) { |
3692 | 650 | pm_optional_keyword_parameter_node_t *node = (pm_optional_keyword_parameter_node_t *) pm_arena_alloc(arena, sizeof(pm_optional_keyword_parameter_node_t), PRISM_ALIGNOF(pm_optional_keyword_parameter_node_t)); |
3693 | | |
3694 | 650 | *node = (pm_optional_keyword_parameter_node_t) { |
3695 | 650 | .base = { .type = PM_OPTIONAL_KEYWORD_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3696 | 650 | .name = name, |
3697 | 650 | .name_loc = name_loc, |
3698 | 650 | .value = value |
3699 | 650 | }; |
3700 | | |
3701 | 650 | return node; |
3702 | 650 | } |
3703 | | |
3704 | | /** |
3705 | | * Allocate and initialize a new OptionalParameterNode node. |
3706 | | */ |
3707 | | pm_optional_parameter_node_t * |
3708 | 1.74k | pm_optional_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) { |
3709 | 1.74k | pm_optional_parameter_node_t *node = (pm_optional_parameter_node_t *) pm_arena_alloc(arena, sizeof(pm_optional_parameter_node_t), PRISM_ALIGNOF(pm_optional_parameter_node_t)); |
3710 | | |
3711 | 1.74k | *node = (pm_optional_parameter_node_t) { |
3712 | 1.74k | .base = { .type = PM_OPTIONAL_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3713 | 1.74k | .name = name, |
3714 | 1.74k | .name_loc = name_loc, |
3715 | 1.74k | .operator_loc = operator_loc, |
3716 | 1.74k | .value = value |
3717 | 1.74k | }; |
3718 | | |
3719 | 1.74k | return node; |
3720 | 1.74k | } |
3721 | | |
3722 | | /** |
3723 | | * Allocate and initialize a new OrNode node. |
3724 | | */ |
3725 | | pm_or_node_t * |
3726 | 338 | pm_or_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) { |
3727 | 338 | pm_or_node_t *node = (pm_or_node_t *) pm_arena_alloc(arena, sizeof(pm_or_node_t), PRISM_ALIGNOF(pm_or_node_t)); |
3728 | | |
3729 | 338 | *node = (pm_or_node_t) { |
3730 | 338 | .base = { .type = PM_OR_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3731 | 338 | .left = left, |
3732 | 338 | .right = right, |
3733 | 338 | .operator_loc = operator_loc |
3734 | 338 | }; |
3735 | | |
3736 | 338 | return node; |
3737 | 338 | } |
3738 | | |
3739 | | /** |
3740 | | * Allocate and initialize a new ParametersNode node. |
3741 | | */ |
3742 | | pm_parameters_node_t * |
3743 | 8.54k | pm_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t requireds, pm_node_list_t optionals, struct pm_node *rest, pm_node_list_t posts, pm_node_list_t keywords, struct pm_node *keyword_rest, struct pm_node *block) { |
3744 | 8.54k | pm_parameters_node_t *node = (pm_parameters_node_t *) pm_arena_alloc(arena, sizeof(pm_parameters_node_t), PRISM_ALIGNOF(pm_parameters_node_t)); |
3745 | | |
3746 | 8.54k | *node = (pm_parameters_node_t) { |
3747 | 8.54k | .base = { .type = PM_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3748 | 8.54k | .requireds = requireds, |
3749 | 8.54k | .optionals = optionals, |
3750 | 8.54k | .rest = rest, |
3751 | 8.54k | .posts = posts, |
3752 | 8.54k | .keywords = keywords, |
3753 | 8.54k | .keyword_rest = keyword_rest, |
3754 | 8.54k | .block = block |
3755 | 8.54k | }; |
3756 | | |
3757 | 8.54k | return node; |
3758 | 8.54k | } |
3759 | | |
3760 | | /** |
3761 | | * Allocate and initialize a new ParenthesesNode node. |
3762 | | */ |
3763 | | pm_parentheses_node_t * |
3764 | 24.3k | pm_parentheses_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *body, pm_location_t opening_loc, pm_location_t closing_loc) { |
3765 | 24.3k | pm_parentheses_node_t *node = (pm_parentheses_node_t *) pm_arena_alloc(arena, sizeof(pm_parentheses_node_t), PRISM_ALIGNOF(pm_parentheses_node_t)); |
3766 | | |
3767 | 24.3k | *node = (pm_parentheses_node_t) { |
3768 | 24.3k | .base = { .type = PM_PARENTHESES_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3769 | 24.3k | .body = body, |
3770 | 24.3k | .opening_loc = opening_loc, |
3771 | 24.3k | .closing_loc = closing_loc |
3772 | 24.3k | }; |
3773 | | |
3774 | 24.3k | return node; |
3775 | 24.3k | } |
3776 | | |
3777 | | /** |
3778 | | * Allocate and initialize a new PinnedExpressionNode node. |
3779 | | */ |
3780 | | pm_pinned_expression_node_t * |
3781 | 184 | pm_pinned_expression_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *expression, pm_location_t operator_loc, pm_location_t lparen_loc, pm_location_t rparen_loc) { |
3782 | 184 | pm_pinned_expression_node_t *node = (pm_pinned_expression_node_t *) pm_arena_alloc(arena, sizeof(pm_pinned_expression_node_t), PRISM_ALIGNOF(pm_pinned_expression_node_t)); |
3783 | | |
3784 | 184 | *node = (pm_pinned_expression_node_t) { |
3785 | 184 | .base = { .type = PM_PINNED_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3786 | 184 | .expression = expression, |
3787 | 184 | .operator_loc = operator_loc, |
3788 | 184 | .lparen_loc = lparen_loc, |
3789 | 184 | .rparen_loc = rparen_loc |
3790 | 184 | }; |
3791 | | |
3792 | 184 | return node; |
3793 | 184 | } |
3794 | | |
3795 | | /** |
3796 | | * Allocate and initialize a new PinnedVariableNode node. |
3797 | | */ |
3798 | | pm_pinned_variable_node_t * |
3799 | 946 | pm_pinned_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *variable, pm_location_t operator_loc) { |
3800 | 946 | pm_pinned_variable_node_t *node = (pm_pinned_variable_node_t *) pm_arena_alloc(arena, sizeof(pm_pinned_variable_node_t), PRISM_ALIGNOF(pm_pinned_variable_node_t)); |
3801 | | |
3802 | 946 | *node = (pm_pinned_variable_node_t) { |
3803 | 946 | .base = { .type = PM_PINNED_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3804 | 946 | .variable = variable, |
3805 | 946 | .operator_loc = operator_loc |
3806 | 946 | }; |
3807 | | |
3808 | 946 | return node; |
3809 | 946 | } |
3810 | | |
3811 | | /** |
3812 | | * Allocate and initialize a new PostExecutionNode node. |
3813 | | */ |
3814 | | pm_post_execution_node_t * |
3815 | 361 | pm_post_execution_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_statements_node *statements, pm_location_t keyword_loc, pm_location_t opening_loc, pm_location_t closing_loc) { |
3816 | 361 | pm_post_execution_node_t *node = (pm_post_execution_node_t *) pm_arena_alloc(arena, sizeof(pm_post_execution_node_t), PRISM_ALIGNOF(pm_post_execution_node_t)); |
3817 | | |
3818 | 361 | *node = (pm_post_execution_node_t) { |
3819 | 361 | .base = { .type = PM_POST_EXECUTION_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3820 | 361 | .statements = statements, |
3821 | 361 | .keyword_loc = keyword_loc, |
3822 | 361 | .opening_loc = opening_loc, |
3823 | 361 | .closing_loc = closing_loc |
3824 | 361 | }; |
3825 | | |
3826 | 361 | return node; |
3827 | 361 | } |
3828 | | |
3829 | | /** |
3830 | | * Allocate and initialize a new PreExecutionNode node. |
3831 | | */ |
3832 | | pm_pre_execution_node_t * |
3833 | 156 | pm_pre_execution_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_statements_node *statements, pm_location_t keyword_loc, pm_location_t opening_loc, pm_location_t closing_loc) { |
3834 | 156 | pm_pre_execution_node_t *node = (pm_pre_execution_node_t *) pm_arena_alloc(arena, sizeof(pm_pre_execution_node_t), PRISM_ALIGNOF(pm_pre_execution_node_t)); |
3835 | | |
3836 | 156 | *node = (pm_pre_execution_node_t) { |
3837 | 156 | .base = { .type = PM_PRE_EXECUTION_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3838 | 156 | .statements = statements, |
3839 | 156 | .keyword_loc = keyword_loc, |
3840 | 156 | .opening_loc = opening_loc, |
3841 | 156 | .closing_loc = closing_loc |
3842 | 156 | }; |
3843 | | |
3844 | 156 | return node; |
3845 | 156 | } |
3846 | | |
3847 | | /** |
3848 | | * Allocate and initialize a new ProgramNode node. |
3849 | | */ |
3850 | | pm_program_node_t * |
3851 | 14.3k | pm_program_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, struct pm_statements_node *statements) { |
3852 | 14.3k | pm_program_node_t *node = (pm_program_node_t *) pm_arena_alloc(arena, sizeof(pm_program_node_t), PRISM_ALIGNOF(pm_program_node_t)); |
3853 | | |
3854 | 14.3k | *node = (pm_program_node_t) { |
3855 | 14.3k | .base = { .type = PM_PROGRAM_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3856 | 14.3k | .locals = locals, |
3857 | 14.3k | .statements = statements |
3858 | 14.3k | }; |
3859 | | |
3860 | 14.3k | return node; |
3861 | 14.3k | } |
3862 | | |
3863 | | /** |
3864 | | * Allocate and initialize a new RangeNode node. |
3865 | | */ |
3866 | | pm_range_node_t * |
3867 | 10.7k | pm_range_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) { |
3868 | 10.7k | pm_range_node_t *node = (pm_range_node_t *) pm_arena_alloc(arena, sizeof(pm_range_node_t), PRISM_ALIGNOF(pm_range_node_t)); |
3869 | | |
3870 | 10.7k | *node = (pm_range_node_t) { |
3871 | 10.7k | .base = { .type = PM_RANGE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3872 | 10.7k | .left = left, |
3873 | 10.7k | .right = right, |
3874 | 10.7k | .operator_loc = operator_loc |
3875 | 10.7k | }; |
3876 | | |
3877 | 10.7k | return node; |
3878 | 10.7k | } |
3879 | | |
3880 | | /** |
3881 | | * Allocate and initialize a new RationalNode node. |
3882 | | */ |
3883 | | pm_rational_node_t * |
3884 | 3.15k | pm_rational_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_integer_t numerator, pm_integer_t denominator) { |
3885 | 3.15k | pm_rational_node_t *node = (pm_rational_node_t *) pm_arena_alloc(arena, sizeof(pm_rational_node_t), PRISM_ALIGNOF(pm_rational_node_t)); |
3886 | | |
3887 | 3.15k | *node = (pm_rational_node_t) { |
3888 | 3.15k | .base = { .type = PM_RATIONAL_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3889 | 3.15k | .numerator = numerator, |
3890 | 3.15k | .denominator = denominator |
3891 | 3.15k | }; |
3892 | | |
3893 | 3.15k | return node; |
3894 | 3.15k | } |
3895 | | |
3896 | | /** |
3897 | | * Allocate and initialize a new RedoNode node. |
3898 | | */ |
3899 | | pm_redo_node_t * |
3900 | 55 | pm_redo_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
3901 | 55 | pm_redo_node_t *node = (pm_redo_node_t *) pm_arena_alloc(arena, sizeof(pm_redo_node_t), PRISM_ALIGNOF(pm_redo_node_t)); |
3902 | | |
3903 | 55 | *node = (pm_redo_node_t) { |
3904 | 55 | .base = { .type = PM_REDO_NODE, .flags = flags, .node_id = node_id, .location = location } |
3905 | 55 | }; |
3906 | | |
3907 | 55 | return node; |
3908 | 55 | } |
3909 | | |
3910 | | /** |
3911 | | * Allocate and initialize a new RegularExpressionNode node. |
3912 | | */ |
3913 | | pm_regular_expression_node_t * |
3914 | 8.58k | pm_regular_expression_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) { |
3915 | 8.58k | pm_regular_expression_node_t *node = (pm_regular_expression_node_t *) pm_arena_alloc(arena, sizeof(pm_regular_expression_node_t), PRISM_ALIGNOF(pm_regular_expression_node_t)); |
3916 | | |
3917 | 8.58k | *node = (pm_regular_expression_node_t) { |
3918 | 8.58k | .base = { .type = PM_REGULAR_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3919 | 8.58k | .opening_loc = opening_loc, |
3920 | 8.58k | .content_loc = content_loc, |
3921 | 8.58k | .closing_loc = closing_loc, |
3922 | 8.58k | .unescaped = unescaped |
3923 | 8.58k | }; |
3924 | | |
3925 | 8.58k | return node; |
3926 | 8.58k | } |
3927 | | |
3928 | | /** |
3929 | | * Allocate and initialize a new RequiredKeywordParameterNode node. |
3930 | | */ |
3931 | | pm_required_keyword_parameter_node_t * |
3932 | 1.65k | pm_required_keyword_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc) { |
3933 | 1.65k | pm_required_keyword_parameter_node_t *node = (pm_required_keyword_parameter_node_t *) pm_arena_alloc(arena, sizeof(pm_required_keyword_parameter_node_t), PRISM_ALIGNOF(pm_required_keyword_parameter_node_t)); |
3934 | | |
3935 | 1.65k | *node = (pm_required_keyword_parameter_node_t) { |
3936 | 1.65k | .base = { .type = PM_REQUIRED_KEYWORD_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3937 | 1.65k | .name = name, |
3938 | 1.65k | .name_loc = name_loc |
3939 | 1.65k | }; |
3940 | | |
3941 | 1.65k | return node; |
3942 | 1.65k | } |
3943 | | |
3944 | | /** |
3945 | | * Allocate and initialize a new RequiredParameterNode node. |
3946 | | */ |
3947 | | pm_required_parameter_node_t * |
3948 | 11.3k | pm_required_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) { |
3949 | 11.3k | pm_required_parameter_node_t *node = (pm_required_parameter_node_t *) pm_arena_alloc(arena, sizeof(pm_required_parameter_node_t), PRISM_ALIGNOF(pm_required_parameter_node_t)); |
3950 | | |
3951 | 11.3k | *node = (pm_required_parameter_node_t) { |
3952 | 11.3k | .base = { .type = PM_REQUIRED_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3953 | 11.3k | .name = name |
3954 | 11.3k | }; |
3955 | | |
3956 | 11.3k | return node; |
3957 | 11.3k | } |
3958 | | |
3959 | | /** |
3960 | | * Allocate and initialize a new RescueModifierNode node. |
3961 | | */ |
3962 | | pm_rescue_modifier_node_t * |
3963 | 2.50k | pm_rescue_modifier_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *expression, pm_location_t keyword_loc, struct pm_node *rescue_expression) { |
3964 | 2.50k | pm_rescue_modifier_node_t *node = (pm_rescue_modifier_node_t *) pm_arena_alloc(arena, sizeof(pm_rescue_modifier_node_t), PRISM_ALIGNOF(pm_rescue_modifier_node_t)); |
3965 | | |
3966 | 2.50k | *node = (pm_rescue_modifier_node_t) { |
3967 | 2.50k | .base = { .type = PM_RESCUE_MODIFIER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3968 | 2.50k | .expression = expression, |
3969 | 2.50k | .keyword_loc = keyword_loc, |
3970 | 2.50k | .rescue_expression = rescue_expression |
3971 | 2.50k | }; |
3972 | | |
3973 | 2.50k | return node; |
3974 | 2.50k | } |
3975 | | |
3976 | | /** |
3977 | | * Allocate and initialize a new RescueNode node. |
3978 | | */ |
3979 | | pm_rescue_node_t * |
3980 | 2.69k | pm_rescue_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, pm_node_list_t exceptions, pm_location_t operator_loc, struct pm_node *reference, pm_location_t then_keyword_loc, struct pm_statements_node *statements, struct pm_rescue_node *subsequent) { |
3981 | 2.69k | pm_rescue_node_t *node = (pm_rescue_node_t *) pm_arena_alloc(arena, sizeof(pm_rescue_node_t), PRISM_ALIGNOF(pm_rescue_node_t)); |
3982 | | |
3983 | 2.69k | *node = (pm_rescue_node_t) { |
3984 | 2.69k | .base = { .type = PM_RESCUE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
3985 | 2.69k | .keyword_loc = keyword_loc, |
3986 | 2.69k | .exceptions = exceptions, |
3987 | 2.69k | .operator_loc = operator_loc, |
3988 | 2.69k | .reference = reference, |
3989 | 2.69k | .then_keyword_loc = then_keyword_loc, |
3990 | 2.69k | .statements = statements, |
3991 | 2.69k | .subsequent = subsequent |
3992 | 2.69k | }; |
3993 | | |
3994 | 2.69k | return node; |
3995 | 2.69k | } |
3996 | | |
3997 | | /** |
3998 | | * Allocate and initialize a new RestParameterNode node. |
3999 | | */ |
4000 | | pm_rest_parameter_node_t * |
4001 | 1.61k | pm_rest_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc) { |
4002 | 1.61k | pm_rest_parameter_node_t *node = (pm_rest_parameter_node_t *) pm_arena_alloc(arena, sizeof(pm_rest_parameter_node_t), PRISM_ALIGNOF(pm_rest_parameter_node_t)); |
4003 | | |
4004 | 1.61k | *node = (pm_rest_parameter_node_t) { |
4005 | 1.61k | .base = { .type = PM_REST_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4006 | 1.61k | .name = name, |
4007 | 1.61k | .name_loc = name_loc, |
4008 | 1.61k | .operator_loc = operator_loc |
4009 | 1.61k | }; |
4010 | | |
4011 | 1.61k | return node; |
4012 | 1.61k | } |
4013 | | |
4014 | | /** |
4015 | | * Allocate and initialize a new RetryNode node. |
4016 | | */ |
4017 | | pm_retry_node_t * |
4018 | 298 | pm_retry_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
4019 | 298 | pm_retry_node_t *node = (pm_retry_node_t *) pm_arena_alloc(arena, sizeof(pm_retry_node_t), PRISM_ALIGNOF(pm_retry_node_t)); |
4020 | | |
4021 | 298 | *node = (pm_retry_node_t) { |
4022 | 298 | .base = { .type = PM_RETRY_NODE, .flags = flags, .node_id = node_id, .location = location } |
4023 | 298 | }; |
4024 | | |
4025 | 298 | return node; |
4026 | 298 | } |
4027 | | |
4028 | | /** |
4029 | | * Allocate and initialize a new ReturnNode node. |
4030 | | */ |
4031 | | pm_return_node_t * |
4032 | 15.0k | pm_return_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, struct pm_arguments_node *arguments) { |
4033 | 15.0k | pm_return_node_t *node = (pm_return_node_t *) pm_arena_alloc(arena, sizeof(pm_return_node_t), PRISM_ALIGNOF(pm_return_node_t)); |
4034 | | |
4035 | 15.0k | *node = (pm_return_node_t) { |
4036 | 15.0k | .base = { .type = PM_RETURN_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4037 | 15.0k | .keyword_loc = keyword_loc, |
4038 | 15.0k | .arguments = arguments |
4039 | 15.0k | }; |
4040 | | |
4041 | 15.0k | return node; |
4042 | 15.0k | } |
4043 | | |
4044 | | /** |
4045 | | * Allocate and initialize a new SelfNode node. |
4046 | | */ |
4047 | | pm_self_node_t * |
4048 | 2.53k | pm_self_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
4049 | 2.53k | pm_self_node_t *node = (pm_self_node_t *) pm_arena_alloc(arena, sizeof(pm_self_node_t), PRISM_ALIGNOF(pm_self_node_t)); |
4050 | | |
4051 | 2.53k | *node = (pm_self_node_t) { |
4052 | 2.53k | .base = { .type = PM_SELF_NODE, .flags = flags, .node_id = node_id, .location = location } |
4053 | 2.53k | }; |
4054 | | |
4055 | 2.53k | return node; |
4056 | 2.53k | } |
4057 | | |
4058 | | /** |
4059 | | * Allocate and initialize a new ShareableConstantNode node. |
4060 | | */ |
4061 | | pm_shareable_constant_node_t * |
4062 | 0 | pm_shareable_constant_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *write) { |
4063 | 0 | pm_shareable_constant_node_t *node = (pm_shareable_constant_node_t *) pm_arena_alloc(arena, sizeof(pm_shareable_constant_node_t), PRISM_ALIGNOF(pm_shareable_constant_node_t)); |
4064 | |
|
4065 | 0 | *node = (pm_shareable_constant_node_t) { |
4066 | 0 | .base = { .type = PM_SHAREABLE_CONSTANT_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4067 | 0 | .write = write |
4068 | 0 | }; |
4069 | |
|
4070 | 0 | return node; |
4071 | 0 | } |
4072 | | |
4073 | | /** |
4074 | | * Allocate and initialize a new SingletonClassNode node. |
4075 | | */ |
4076 | | pm_singleton_class_node_t * |
4077 | 844 | pm_singleton_class_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t class_keyword_loc, pm_location_t operator_loc, struct pm_node *expression, struct pm_node *body, pm_location_t end_keyword_loc) { |
4078 | 844 | pm_singleton_class_node_t *node = (pm_singleton_class_node_t *) pm_arena_alloc(arena, sizeof(pm_singleton_class_node_t), PRISM_ALIGNOF(pm_singleton_class_node_t)); |
4079 | | |
4080 | 844 | *node = (pm_singleton_class_node_t) { |
4081 | 844 | .base = { .type = PM_SINGLETON_CLASS_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4082 | 844 | .locals = locals, |
4083 | 844 | .class_keyword_loc = class_keyword_loc, |
4084 | 844 | .operator_loc = operator_loc, |
4085 | 844 | .expression = expression, |
4086 | 844 | .body = body, |
4087 | 844 | .end_keyword_loc = end_keyword_loc |
4088 | 844 | }; |
4089 | | |
4090 | 844 | return node; |
4091 | 844 | } |
4092 | | |
4093 | | /** |
4094 | | * Allocate and initialize a new SourceEncodingNode node. |
4095 | | */ |
4096 | | pm_source_encoding_node_t * |
4097 | 957 | pm_source_encoding_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
4098 | 957 | pm_source_encoding_node_t *node = (pm_source_encoding_node_t *) pm_arena_alloc(arena, sizeof(pm_source_encoding_node_t), PRISM_ALIGNOF(pm_source_encoding_node_t)); |
4099 | | |
4100 | 957 | *node = (pm_source_encoding_node_t) { |
4101 | 957 | .base = { .type = PM_SOURCE_ENCODING_NODE, .flags = flags, .node_id = node_id, .location = location } |
4102 | 957 | }; |
4103 | | |
4104 | 957 | return node; |
4105 | 957 | } |
4106 | | |
4107 | | /** |
4108 | | * Allocate and initialize a new SourceFileNode node. |
4109 | | */ |
4110 | | pm_source_file_node_t * |
4111 | 1.03k | pm_source_file_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_string_t filepath) { |
4112 | 1.03k | pm_source_file_node_t *node = (pm_source_file_node_t *) pm_arena_alloc(arena, sizeof(pm_source_file_node_t), PRISM_ALIGNOF(pm_source_file_node_t)); |
4113 | | |
4114 | 1.03k | *node = (pm_source_file_node_t) { |
4115 | 1.03k | .base = { .type = PM_SOURCE_FILE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4116 | 1.03k | .filepath = filepath |
4117 | 1.03k | }; |
4118 | | |
4119 | 1.03k | return node; |
4120 | 1.03k | } |
4121 | | |
4122 | | /** |
4123 | | * Allocate and initialize a new SourceLineNode node. |
4124 | | */ |
4125 | | pm_source_line_node_t * |
4126 | 1.35k | pm_source_line_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
4127 | 1.35k | pm_source_line_node_t *node = (pm_source_line_node_t *) pm_arena_alloc(arena, sizeof(pm_source_line_node_t), PRISM_ALIGNOF(pm_source_line_node_t)); |
4128 | | |
4129 | 1.35k | *node = (pm_source_line_node_t) { |
4130 | 1.35k | .base = { .type = PM_SOURCE_LINE_NODE, .flags = flags, .node_id = node_id, .location = location } |
4131 | 1.35k | }; |
4132 | | |
4133 | 1.35k | return node; |
4134 | 1.35k | } |
4135 | | |
4136 | | /** |
4137 | | * Allocate and initialize a new SplatNode node. |
4138 | | */ |
4139 | | pm_splat_node_t * |
4140 | 7.98k | pm_splat_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, struct pm_node *expression) { |
4141 | 7.98k | pm_splat_node_t *node = (pm_splat_node_t *) pm_arena_alloc(arena, sizeof(pm_splat_node_t), PRISM_ALIGNOF(pm_splat_node_t)); |
4142 | | |
4143 | 7.98k | *node = (pm_splat_node_t) { |
4144 | 7.98k | .base = { .type = PM_SPLAT_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4145 | 7.98k | .operator_loc = operator_loc, |
4146 | 7.98k | .expression = expression |
4147 | 7.98k | }; |
4148 | | |
4149 | 7.98k | return node; |
4150 | 7.98k | } |
4151 | | |
4152 | | /** |
4153 | | * Allocate and initialize a new StatementsNode node. |
4154 | | */ |
4155 | | pm_statements_node_t * |
4156 | 87.1k | pm_statements_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t body) { |
4157 | 87.1k | pm_statements_node_t *node = (pm_statements_node_t *) pm_arena_alloc(arena, sizeof(pm_statements_node_t), PRISM_ALIGNOF(pm_statements_node_t)); |
4158 | | |
4159 | 87.1k | *node = (pm_statements_node_t) { |
4160 | 87.1k | .base = { .type = PM_STATEMENTS_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4161 | 87.1k | .body = body |
4162 | 87.1k | }; |
4163 | | |
4164 | 87.1k | return node; |
4165 | 87.1k | } |
4166 | | |
4167 | | /** |
4168 | | * Allocate and initialize a new StringNode node. |
4169 | | */ |
4170 | | pm_string_node_t * |
4171 | 72.8k | pm_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) { |
4172 | 72.8k | pm_string_node_t *node = (pm_string_node_t *) pm_arena_alloc(arena, sizeof(pm_string_node_t), PRISM_ALIGNOF(pm_string_node_t)); |
4173 | | |
4174 | 72.8k | *node = (pm_string_node_t) { |
4175 | 72.8k | .base = { .type = PM_STRING_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4176 | 72.8k | .opening_loc = opening_loc, |
4177 | 72.8k | .content_loc = content_loc, |
4178 | 72.8k | .closing_loc = closing_loc, |
4179 | 72.8k | .unescaped = unescaped |
4180 | 72.8k | }; |
4181 | | |
4182 | 72.8k | return node; |
4183 | 72.8k | } |
4184 | | |
4185 | | /** |
4186 | | * Allocate and initialize a new SuperNode node. |
4187 | | */ |
4188 | | pm_super_node_t * |
4189 | 291 | pm_super_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, pm_location_t lparen_loc, struct pm_arguments_node *arguments, pm_location_t rparen_loc, struct pm_node *block) { |
4190 | 291 | pm_super_node_t *node = (pm_super_node_t *) pm_arena_alloc(arena, sizeof(pm_super_node_t), PRISM_ALIGNOF(pm_super_node_t)); |
4191 | | |
4192 | 291 | *node = (pm_super_node_t) { |
4193 | 291 | .base = { .type = PM_SUPER_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4194 | 291 | .keyword_loc = keyword_loc, |
4195 | 291 | .lparen_loc = lparen_loc, |
4196 | 291 | .arguments = arguments, |
4197 | 291 | .rparen_loc = rparen_loc, |
4198 | 291 | .block = block |
4199 | 291 | }; |
4200 | | |
4201 | 291 | return node; |
4202 | 291 | } |
4203 | | |
4204 | | /** |
4205 | | * Allocate and initialize a new SymbolNode node. |
4206 | | */ |
4207 | | pm_symbol_node_t * |
4208 | 35.3k | pm_symbol_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) { |
4209 | 35.3k | pm_symbol_node_t *node = (pm_symbol_node_t *) pm_arena_alloc(arena, sizeof(pm_symbol_node_t), PRISM_ALIGNOF(pm_symbol_node_t)); |
4210 | | |
4211 | 35.3k | *node = (pm_symbol_node_t) { |
4212 | 35.3k | .base = { .type = PM_SYMBOL_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4213 | 35.3k | .opening_loc = opening_loc, |
4214 | 35.3k | .content_loc = content_loc, |
4215 | 35.3k | .closing_loc = closing_loc, |
4216 | 35.3k | .unescaped = unescaped |
4217 | 35.3k | }; |
4218 | | |
4219 | 35.3k | return node; |
4220 | 35.3k | } |
4221 | | |
4222 | | /** |
4223 | | * Allocate and initialize a new TrueNode node. |
4224 | | */ |
4225 | | pm_true_node_t * |
4226 | 5.21k | pm_true_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) { |
4227 | 5.21k | pm_true_node_t *node = (pm_true_node_t *) pm_arena_alloc(arena, sizeof(pm_true_node_t), PRISM_ALIGNOF(pm_true_node_t)); |
4228 | | |
4229 | 5.21k | *node = (pm_true_node_t) { |
4230 | 5.21k | .base = { .type = PM_TRUE_NODE, .flags = flags, .node_id = node_id, .location = location } |
4231 | 5.21k | }; |
4232 | | |
4233 | 5.21k | return node; |
4234 | 5.21k | } |
4235 | | |
4236 | | /** |
4237 | | * Allocate and initialize a new UndefNode node. |
4238 | | */ |
4239 | | pm_undef_node_t * |
4240 | 645 | pm_undef_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t names, pm_location_t keyword_loc) { |
4241 | 645 | pm_undef_node_t *node = (pm_undef_node_t *) pm_arena_alloc(arena, sizeof(pm_undef_node_t), PRISM_ALIGNOF(pm_undef_node_t)); |
4242 | | |
4243 | 645 | *node = (pm_undef_node_t) { |
4244 | 645 | .base = { .type = PM_UNDEF_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4245 | 645 | .names = names, |
4246 | 645 | .keyword_loc = keyword_loc |
4247 | 645 | }; |
4248 | | |
4249 | 645 | return node; |
4250 | 645 | } |
4251 | | |
4252 | | /** |
4253 | | * Allocate and initialize a new UnlessNode node. |
4254 | | */ |
4255 | | pm_unless_node_t * |
4256 | 96 | pm_unless_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t unless_keyword_loc, struct pm_node *predicate, pm_location_t then_keyword_loc, struct pm_statements_node *statements, struct pm_else_node *else_clause, pm_location_t end_keyword_loc) { |
4257 | 96 | pm_unless_node_t *node = (pm_unless_node_t *) pm_arena_alloc(arena, sizeof(pm_unless_node_t), PRISM_ALIGNOF(pm_unless_node_t)); |
4258 | | |
4259 | 96 | *node = (pm_unless_node_t) { |
4260 | 96 | .base = { .type = PM_UNLESS_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4261 | 96 | .unless_keyword_loc = unless_keyword_loc, |
4262 | 96 | .predicate = predicate, |
4263 | 96 | .then_keyword_loc = then_keyword_loc, |
4264 | 96 | .statements = statements, |
4265 | 96 | .else_clause = else_clause, |
4266 | 96 | .end_keyword_loc = end_keyword_loc |
4267 | 96 | }; |
4268 | | |
4269 | 96 | return node; |
4270 | 96 | } |
4271 | | |
4272 | | /** |
4273 | | * Allocate and initialize a new UntilNode node. |
4274 | | */ |
4275 | | pm_until_node_t * |
4276 | 210 | pm_until_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t until_keyword_loc, pm_location_t do_keyword_loc, pm_location_t end_keyword_loc, struct pm_node *predicate, struct pm_statements_node *statements) { |
4277 | 210 | pm_until_node_t *node = (pm_until_node_t *) pm_arena_alloc(arena, sizeof(pm_until_node_t), PRISM_ALIGNOF(pm_until_node_t)); |
4278 | | |
4279 | 210 | *node = (pm_until_node_t) { |
4280 | 210 | .base = { .type = PM_UNTIL_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4281 | 210 | .until_keyword_loc = until_keyword_loc, |
4282 | 210 | .do_keyword_loc = do_keyword_loc, |
4283 | 210 | .end_keyword_loc = end_keyword_loc, |
4284 | 210 | .predicate = predicate, |
4285 | 210 | .statements = statements |
4286 | 210 | }; |
4287 | | |
4288 | 210 | return node; |
4289 | 210 | } |
4290 | | |
4291 | | /** |
4292 | | * Allocate and initialize a new WhenNode node. |
4293 | | */ |
4294 | | pm_when_node_t * |
4295 | 1.92k | pm_when_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t when_keyword_loc, pm_node_list_t conditions, pm_location_t then_keyword_loc, struct pm_statements_node *statements) { |
4296 | 1.92k | pm_when_node_t *node = (pm_when_node_t *) pm_arena_alloc(arena, sizeof(pm_when_node_t), PRISM_ALIGNOF(pm_when_node_t)); |
4297 | | |
4298 | 1.92k | *node = (pm_when_node_t) { |
4299 | 1.92k | .base = { .type = PM_WHEN_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4300 | 1.92k | .when_keyword_loc = when_keyword_loc, |
4301 | 1.92k | .conditions = conditions, |
4302 | 1.92k | .then_keyword_loc = then_keyword_loc, |
4303 | 1.92k | .statements = statements |
4304 | 1.92k | }; |
4305 | | |
4306 | 1.92k | return node; |
4307 | 1.92k | } |
4308 | | |
4309 | | /** |
4310 | | * Allocate and initialize a new WhileNode node. |
4311 | | */ |
4312 | | pm_while_node_t * |
4313 | 4.29k | pm_while_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t while_keyword_loc, pm_location_t do_keyword_loc, pm_location_t end_keyword_loc, struct pm_node *predicate, struct pm_statements_node *statements) { |
4314 | 4.29k | pm_while_node_t *node = (pm_while_node_t *) pm_arena_alloc(arena, sizeof(pm_while_node_t), PRISM_ALIGNOF(pm_while_node_t)); |
4315 | | |
4316 | 4.29k | *node = (pm_while_node_t) { |
4317 | 4.29k | .base = { .type = PM_WHILE_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4318 | 4.29k | .while_keyword_loc = while_keyword_loc, |
4319 | 4.29k | .do_keyword_loc = do_keyword_loc, |
4320 | 4.29k | .end_keyword_loc = end_keyword_loc, |
4321 | 4.29k | .predicate = predicate, |
4322 | 4.29k | .statements = statements |
4323 | 4.29k | }; |
4324 | | |
4325 | 4.29k | return node; |
4326 | 4.29k | } |
4327 | | |
4328 | | /** |
4329 | | * Allocate and initialize a new XStringNode node. |
4330 | | */ |
4331 | | pm_x_string_node_t * |
4332 | 3.08k | pm_x_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) { |
4333 | 3.08k | pm_x_string_node_t *node = (pm_x_string_node_t *) pm_arena_alloc(arena, sizeof(pm_x_string_node_t), PRISM_ALIGNOF(pm_x_string_node_t)); |
4334 | | |
4335 | 3.08k | *node = (pm_x_string_node_t) { |
4336 | 3.08k | .base = { .type = PM_X_STRING_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4337 | 3.08k | .opening_loc = opening_loc, |
4338 | 3.08k | .content_loc = content_loc, |
4339 | 3.08k | .closing_loc = closing_loc, |
4340 | 3.08k | .unescaped = unescaped |
4341 | 3.08k | }; |
4342 | | |
4343 | 3.08k | return node; |
4344 | 3.08k | } |
4345 | | |
4346 | | /** |
4347 | | * Allocate and initialize a new YieldNode node. |
4348 | | */ |
4349 | | pm_yield_node_t * |
4350 | 230 | pm_yield_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, pm_location_t lparen_loc, struct pm_arguments_node *arguments, pm_location_t rparen_loc) { |
4351 | 230 | pm_yield_node_t *node = (pm_yield_node_t *) pm_arena_alloc(arena, sizeof(pm_yield_node_t), PRISM_ALIGNOF(pm_yield_node_t)); |
4352 | | |
4353 | 230 | *node = (pm_yield_node_t) { |
4354 | 230 | .base = { .type = PM_YIELD_NODE, .flags = flags, .node_id = node_id, .location = location }, |
4355 | 230 | .keyword_loc = keyword_loc, |
4356 | 230 | .lparen_loc = lparen_loc, |
4357 | 230 | .arguments = arguments, |
4358 | 230 | .rparen_loc = rparen_loc |
4359 | 230 | }; |
4360 | | |
4361 | 230 | return node; |
4362 | 230 | } |