1 /* valaccodecontrolflowmodule.c generated by valac, the Vala compiler
2 * generated from valaccodecontrolflowmodule.vala, do not modify */
3
4 /* valaccodecontrolflowmodule.vala
5 *
6 * Copyright (C) 2006-2011 Jürg Billeter
7 * Copyright (C) 2006-2008 Raffaele Sandrini
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 * Author:
24 * Jürg Billeter <j@bitron.ch>
25 * Raffaele Sandrini <raffaele@sandrini.ch>
26 */
27
28 #include "valacodegen.h"
29 #include <vala.h>
30 #include <glib.h>
31 #include <valaccode.h>
32 #include <valagee.h>
33 #include <glib-object.h>
34 #include <stdlib.h>
35 #include <string.h>
36
37 #define _vala_ccode_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_node_unref (var), NULL)))
38 #define _vala_target_value_unref0(var) ((var == NULL) ? NULL : (var = (vala_target_value_unref (var), NULL)))
39 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
40 #define _g_free0(var) (var = (g_free (var), NULL))
41 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
42
43 static gpointer vala_ccode_control_flow_module_parent_class = NULL;
44
45 static void vala_ccode_control_flow_module_real_visit_if_statement (ValaCodeVisitor* base,
46 ValaIfStatement* stmt);
47 static void vala_ccode_control_flow_module_visit_string_switch_statement (ValaCCodeControlFlowModule* self,
48 ValaSwitchStatement* stmt);
49 static void vala_ccode_control_flow_module_real_visit_switch_statement (ValaCodeVisitor* base,
50 ValaSwitchStatement* stmt);
51 static void vala_ccode_control_flow_module_real_visit_switch_label (ValaCodeVisitor* base,
52 ValaSwitchLabel* label);
53 static void vala_ccode_control_flow_module_real_visit_loop (ValaCodeVisitor* base,
54 ValaLoop* stmt);
55 static void vala_ccode_control_flow_module_real_visit_foreach_statement (ValaCodeVisitor* base,
56 ValaForeachStatement* stmt);
57 static void vala_ccode_control_flow_module_real_visit_break_statement (ValaCodeVisitor* base,
58 ValaBreakStatement* stmt);
59 static void vala_ccode_control_flow_module_real_visit_continue_statement (ValaCodeVisitor* base,
60 ValaContinueStatement* stmt);
61 static GType vala_ccode_control_flow_module_get_type_once (void);
62
63 static void
vala_ccode_control_flow_module_real_visit_if_statement(ValaCodeVisitor * base,ValaIfStatement * stmt)64 vala_ccode_control_flow_module_real_visit_if_statement (ValaCodeVisitor* base,
65 ValaIfStatement* stmt)
66 {
67 ValaCCodeControlFlowModule * self;
68 ValaCCodeFunction* _tmp0_;
69 ValaCCodeFunction* _tmp1_;
70 ValaExpression* _tmp2_;
71 ValaExpression* _tmp3_;
72 ValaCCodeExpression* _tmp4_;
73 ValaBlock* _tmp5_;
74 ValaBlock* _tmp6_;
75 ValaBlock* _tmp7_;
76 ValaBlock* _tmp8_;
77 ValaCCodeFunction* _tmp13_;
78 ValaCCodeFunction* _tmp14_;
79 self = (ValaCCodeControlFlowModule*) base;
80 g_return_if_fail (stmt != NULL);
81 _tmp0_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
82 _tmp1_ = _tmp0_;
83 _tmp2_ = vala_if_statement_get_condition (stmt);
84 _tmp3_ = _tmp2_;
85 _tmp4_ = vala_get_cvalue (_tmp3_);
86 vala_ccode_function_open_if (_tmp1_, _tmp4_);
87 _tmp5_ = vala_if_statement_get_true_statement (stmt);
88 _tmp6_ = _tmp5_;
89 vala_code_node_emit ((ValaCodeNode*) _tmp6_, (ValaCodeGenerator*) self);
90 _tmp7_ = vala_if_statement_get_false_statement (stmt);
91 _tmp8_ = _tmp7_;
92 if (_tmp8_ != NULL) {
93 ValaCCodeFunction* _tmp9_;
94 ValaCCodeFunction* _tmp10_;
95 ValaBlock* _tmp11_;
96 ValaBlock* _tmp12_;
97 _tmp9_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
98 _tmp10_ = _tmp9_;
99 vala_ccode_function_add_else (_tmp10_);
100 _tmp11_ = vala_if_statement_get_false_statement (stmt);
101 _tmp12_ = _tmp11_;
102 vala_code_node_emit ((ValaCodeNode*) _tmp12_, (ValaCodeGenerator*) self);
103 }
104 _tmp13_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
105 _tmp14_ = _tmp13_;
106 vala_ccode_function_close (_tmp14_);
107 }
108
109 static gpointer
_vala_ccode_node_ref0(gpointer self)110 _vala_ccode_node_ref0 (gpointer self)
111 {
112 return self ? vala_ccode_node_ref (self) : NULL;
113 }
114
115 static gpointer
_vala_iterable_ref0(gpointer self)116 _vala_iterable_ref0 (gpointer self)
117 {
118 return self ? vala_iterable_ref (self) : NULL;
119 }
120
121 static gpointer
_vala_code_node_ref0(gpointer self)122 _vala_code_node_ref0 (gpointer self)
123 {
124 return self ? vala_code_node_ref (self) : NULL;
125 }
126
127 static void
vala_ccode_control_flow_module_visit_string_switch_statement(ValaCCodeControlFlowModule * self,ValaSwitchStatement * stmt)128 vala_ccode_control_flow_module_visit_string_switch_statement (ValaCCodeControlFlowModule* self,
129 ValaSwitchStatement* stmt)
130 {
131 ValaTargetValue* temp_value = NULL;
132 ValaExpression* _tmp0_;
133 ValaExpression* _tmp1_;
134 ValaDataType* _tmp2_;
135 ValaDataType* _tmp3_;
136 ValaTargetValue* _tmp4_;
137 ValaCCodeExpression* ctemp = NULL;
138 ValaTargetValue* _tmp5_;
139 ValaCCodeExpression* _tmp6_;
140 ValaCCodeExpression* _tmp7_;
141 ValaCCodeAssignment* cinit = NULL;
142 ValaCCodeExpression* _tmp8_;
143 ValaExpression* _tmp9_;
144 ValaExpression* _tmp10_;
145 ValaCCodeExpression* _tmp11_;
146 ValaCCodeAssignment* _tmp12_;
147 ValaCCodeConstant* czero = NULL;
148 ValaCCodeConstant* _tmp13_;
149 ValaCCodeFunctionCall* free_call = NULL;
150 ValaCCodeIdentifier* _tmp14_;
151 ValaCCodeIdentifier* _tmp15_;
152 ValaCCodeFunctionCall* _tmp16_;
153 ValaCCodeFunctionCall* _tmp17_;
154 ValaCCodeFunctionCall* _tmp18_;
155 ValaCCodeExpression* _tmp19_;
156 ValaCCodeBinaryExpression* cisnull = NULL;
157 ValaCCodeConstant* _tmp20_;
158 ValaCCodeConstant* _tmp21_;
159 ValaCCodeExpression* _tmp22_;
160 ValaCCodeBinaryExpression* _tmp23_;
161 ValaCCodeBinaryExpression* _tmp24_;
162 ValaCCodeFunctionCall* cquark = NULL;
163 ValaCCodeIdentifier* _tmp25_;
164 ValaCCodeIdentifier* _tmp26_;
165 ValaCCodeFunctionCall* _tmp27_;
166 ValaCCodeFunctionCall* _tmp28_;
167 ValaCCodeFunctionCall* _tmp29_;
168 ValaCCodeExpression* _tmp30_;
169 ValaCCodeConditionalExpression* ccond = NULL;
170 ValaCCodeBinaryExpression* _tmp31_;
171 ValaCCodeConstant* _tmp32_;
172 ValaCCodeConstant* _tmp33_;
173 ValaCCodeFunctionCall* _tmp34_;
174 ValaCCodeConditionalExpression* _tmp35_;
175 ValaCCodeConditionalExpression* _tmp36_;
176 gint label_temp_id = 0;
177 gint _tmp37_;
178 gint _tmp38_;
179 ValaDataType* _tmp39_;
180 ValaTargetValue* _tmp40_;
181 gint label_count = 0;
182 ValaCCodeFunction* _tmp82_;
183 ValaCCodeFunction* _tmp83_;
184 ValaCCodeAssignment* _tmp84_;
185 ValaTargetValue* _tmp85_;
186 ValaCCodeExpression* _tmp86_;
187 ValaCCodeExpression* _tmp87_;
188 ValaCCodeExpression* _tmp88_;
189 ValaCCodeConditionalExpression* _tmp89_;
190 ValaCCodeAssignment* _tmp90_;
191 ValaCCodeFunction* _tmp91_;
192 ValaCCodeFunction* _tmp92_;
193 ValaCCodeAssignment* _tmp93_;
194 ValaExpression* _tmp94_;
195 ValaExpression* _tmp95_;
196 ValaDataType* _tmp96_;
197 ValaDataType* _tmp97_;
198 gboolean _tmp98_;
199 gboolean _tmp99_;
200 ValaSwitchSection* default_section = NULL;
201 gint n = 0;
202 ValaSwitchSection* _tmp189_;
203 g_return_if_fail (self != NULL);
204 g_return_if_fail (stmt != NULL);
205 _tmp0_ = vala_switch_statement_get_expression (stmt);
206 _tmp1_ = _tmp0_;
207 _tmp2_ = vala_expression_get_value_type (_tmp1_);
208 _tmp3_ = _tmp2_;
209 _tmp4_ = vala_ccode_base_module_create_temp_value ((ValaCCodeBaseModule*) self, _tmp3_, FALSE, (ValaCodeNode*) stmt, NULL);
210 temp_value = _tmp4_;
211 _tmp5_ = temp_value;
212 _tmp6_ = vala_get_cvalue_ (_tmp5_);
213 _tmp7_ = _vala_ccode_node_ref0 (_tmp6_);
214 ctemp = _tmp7_;
215 _tmp8_ = ctemp;
216 _tmp9_ = vala_switch_statement_get_expression (stmt);
217 _tmp10_ = _tmp9_;
218 _tmp11_ = vala_get_cvalue (_tmp10_);
219 _tmp12_ = vala_ccode_assignment_new (_tmp8_, _tmp11_, VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE);
220 cinit = _tmp12_;
221 _tmp13_ = vala_ccode_constant_new ("0");
222 czero = _tmp13_;
223 _tmp14_ = vala_ccode_identifier_new ("g_free");
224 _tmp15_ = _tmp14_;
225 _tmp16_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp15_);
226 _tmp17_ = _tmp16_;
227 _vala_ccode_node_unref0 (_tmp15_);
228 free_call = _tmp17_;
229 _tmp18_ = free_call;
230 _tmp19_ = ctemp;
231 vala_ccode_function_call_add_argument (_tmp18_, _tmp19_);
232 _tmp20_ = vala_ccode_constant_new ("NULL");
233 _tmp21_ = _tmp20_;
234 _tmp22_ = ctemp;
235 _tmp23_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_EQUALITY, (ValaCCodeExpression*) _tmp21_, _tmp22_);
236 _tmp24_ = _tmp23_;
237 _vala_ccode_node_unref0 (_tmp21_);
238 cisnull = _tmp24_;
239 _tmp25_ = vala_ccode_identifier_new ("g_quark_from_string");
240 _tmp26_ = _tmp25_;
241 _tmp27_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp26_);
242 _tmp28_ = _tmp27_;
243 _vala_ccode_node_unref0 (_tmp26_);
244 cquark = _tmp28_;
245 _tmp29_ = cquark;
246 _tmp30_ = ctemp;
247 vala_ccode_function_call_add_argument (_tmp29_, _tmp30_);
248 _tmp31_ = cisnull;
249 _tmp32_ = vala_ccode_constant_new ("0");
250 _tmp33_ = _tmp32_;
251 _tmp34_ = cquark;
252 _tmp35_ = vala_ccode_conditional_expression_new ((ValaCCodeExpression*) _tmp31_, (ValaCCodeExpression*) _tmp33_, (ValaCCodeExpression*) _tmp34_);
253 _tmp36_ = _tmp35_;
254 _vala_ccode_node_unref0 (_tmp33_);
255 ccond = _tmp36_;
256 _tmp37_ = vala_ccode_base_module_get_next_temp_var_id ((ValaCCodeBaseModule*) self);
257 _tmp38_ = _tmp37_;
258 vala_ccode_base_module_set_next_temp_var_id ((ValaCCodeBaseModule*) self, _tmp38_ + 1);
259 label_temp_id = _tmp38_;
260 _tmp39_ = ((ValaCCodeBaseModule*) self)->gquark_type;
261 _tmp40_ = vala_ccode_base_module_create_temp_value ((ValaCCodeBaseModule*) self, _tmp39_, TRUE, (ValaCodeNode*) stmt, NULL);
262 _vala_target_value_unref0 (temp_value);
263 temp_value = _tmp40_;
264 label_count = 0;
265 {
266 ValaList* _section_list = NULL;
267 ValaList* _tmp41_;
268 ValaList* _tmp42_;
269 gint _section_size = 0;
270 ValaList* _tmp43_;
271 gint _tmp44_;
272 gint _tmp45_;
273 gint _section_index = 0;
274 _tmp41_ = vala_switch_statement_get_sections (stmt);
275 _tmp42_ = _vala_iterable_ref0 (_tmp41_);
276 _section_list = _tmp42_;
277 _tmp43_ = _section_list;
278 _tmp44_ = vala_collection_get_size ((ValaCollection*) _tmp43_);
279 _tmp45_ = _tmp44_;
280 _section_size = _tmp45_;
281 _section_index = -1;
282 while (TRUE) {
283 gint _tmp46_;
284 gint _tmp47_;
285 ValaSwitchSection* section = NULL;
286 ValaList* _tmp48_;
287 gpointer _tmp49_;
288 ValaSwitchSection* _tmp50_;
289 _section_index = _section_index + 1;
290 _tmp46_ = _section_index;
291 _tmp47_ = _section_size;
292 if (!(_tmp46_ < _tmp47_)) {
293 break;
294 }
295 _tmp48_ = _section_list;
296 _tmp49_ = vala_list_get (_tmp48_, _section_index);
297 section = (ValaSwitchSection*) _tmp49_;
298 _tmp50_ = section;
299 if (vala_switch_section_has_default_label (_tmp50_)) {
300 _vala_code_node_unref0 (section);
301 continue;
302 }
303 {
304 ValaList* _label_list = NULL;
305 ValaSwitchSection* _tmp51_;
306 ValaList* _tmp52_;
307 ValaList* _tmp53_;
308 gint _label_size = 0;
309 ValaList* _tmp54_;
310 gint _tmp55_;
311 gint _tmp56_;
312 gint _label_index = 0;
313 _tmp51_ = section;
314 _tmp52_ = vala_switch_section_get_labels (_tmp51_);
315 _tmp53_ = _vala_iterable_ref0 (_tmp52_);
316 _label_list = _tmp53_;
317 _tmp54_ = _label_list;
318 _tmp55_ = vala_collection_get_size ((ValaCollection*) _tmp54_);
319 _tmp56_ = _tmp55_;
320 _label_size = _tmp56_;
321 _label_index = -1;
322 while (TRUE) {
323 gint _tmp57_;
324 gint _tmp58_;
325 ValaSwitchLabel* label = NULL;
326 ValaList* _tmp59_;
327 gpointer _tmp60_;
328 ValaSwitchLabel* _tmp61_;
329 ValaExpression* _tmp62_;
330 ValaExpression* _tmp63_;
331 ValaCCodeExpression* cexpr = NULL;
332 ValaSwitchLabel* _tmp64_;
333 ValaExpression* _tmp65_;
334 ValaExpression* _tmp66_;
335 ValaCCodeExpression* _tmp67_;
336 ValaCCodeExpression* _tmp68_;
337 ValaCCodeExpression* _tmp69_;
338 _label_index = _label_index + 1;
339 _tmp57_ = _label_index;
340 _tmp58_ = _label_size;
341 if (!(_tmp57_ < _tmp58_)) {
342 break;
343 }
344 _tmp59_ = _label_list;
345 _tmp60_ = vala_list_get (_tmp59_, _label_index);
346 label = (ValaSwitchLabel*) _tmp60_;
347 _tmp61_ = label;
348 _tmp62_ = vala_switch_label_get_expression (_tmp61_);
349 _tmp63_ = _tmp62_;
350 vala_code_node_emit ((ValaCodeNode*) _tmp63_, (ValaCodeGenerator*) self);
351 _tmp64_ = label;
352 _tmp65_ = vala_switch_label_get_expression (_tmp64_);
353 _tmp66_ = _tmp65_;
354 _tmp67_ = vala_get_cvalue (_tmp66_);
355 _tmp68_ = _vala_ccode_node_ref0 (_tmp67_);
356 cexpr = _tmp68_;
357 _tmp69_ = cexpr;
358 if (vala_ccode_base_module_is_constant_ccode_expression (_tmp69_)) {
359 gchar* cname = NULL;
360 gint _tmp70_;
361 gint _tmp71_;
362 gchar* _tmp72_;
363 ValaCCodeFunction* _tmp73_;
364 ValaCCodeFunction* _tmp74_;
365 ValaDataType* _tmp75_;
366 gchar* _tmp76_;
367 gchar* _tmp77_;
368 const gchar* _tmp78_;
369 ValaCCodeConstant* _tmp79_;
370 ValaCCodeVariableDeclarator* _tmp80_;
371 ValaCCodeVariableDeclarator* _tmp81_;
372 _tmp70_ = label_temp_id;
373 _tmp71_ = label_count;
374 label_count = _tmp71_ + 1;
375 _tmp72_ = g_strdup_printf ("_tmp%d_label%d", _tmp70_, _tmp71_);
376 cname = _tmp72_;
377 _tmp73_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
378 _tmp74_ = _tmp73_;
379 _tmp75_ = ((ValaCCodeBaseModule*) self)->gquark_type;
380 _tmp76_ = vala_get_ccode_name ((ValaCodeNode*) _tmp75_);
381 _tmp77_ = _tmp76_;
382 _tmp78_ = cname;
383 _tmp79_ = czero;
384 _tmp80_ = vala_ccode_variable_declarator_new (_tmp78_, (ValaCCodeExpression*) _tmp79_, NULL);
385 _tmp81_ = _tmp80_;
386 vala_ccode_function_add_declaration (_tmp74_, _tmp77_, (ValaCCodeDeclarator*) _tmp81_, VALA_CCODE_MODIFIERS_STATIC);
387 _vala_ccode_node_unref0 (_tmp81_);
388 _g_free0 (_tmp77_);
389 _g_free0 (cname);
390 }
391 _vala_ccode_node_unref0 (cexpr);
392 _vala_code_node_unref0 (label);
393 }
394 _vala_iterable_unref0 (_label_list);
395 }
396 _vala_code_node_unref0 (section);
397 }
398 _vala_iterable_unref0 (_section_list);
399 }
400 _tmp82_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
401 _tmp83_ = _tmp82_;
402 _tmp84_ = cinit;
403 vala_ccode_function_add_expression (_tmp83_, (ValaCCodeExpression*) _tmp84_);
404 _tmp85_ = temp_value;
405 _tmp86_ = vala_get_cvalue_ (_tmp85_);
406 _tmp87_ = _vala_ccode_node_ref0 (_tmp86_);
407 _vala_ccode_node_unref0 (ctemp);
408 ctemp = _tmp87_;
409 _tmp88_ = ctemp;
410 _tmp89_ = ccond;
411 _tmp90_ = vala_ccode_assignment_new (_tmp88_, (ValaCCodeExpression*) _tmp89_, VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE);
412 _vala_ccode_node_unref0 (cinit);
413 cinit = _tmp90_;
414 _tmp91_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
415 _tmp92_ = _tmp91_;
416 _tmp93_ = cinit;
417 vala_ccode_function_add_expression (_tmp92_, (ValaCCodeExpression*) _tmp93_);
418 _tmp94_ = vala_switch_statement_get_expression (stmt);
419 _tmp95_ = _tmp94_;
420 _tmp96_ = vala_expression_get_value_type (_tmp95_);
421 _tmp97_ = _tmp96_;
422 _tmp98_ = vala_data_type_get_value_owned (_tmp97_);
423 _tmp99_ = _tmp98_;
424 if (_tmp99_) {
425 ValaCCodeFunction* _tmp100_;
426 ValaCCodeFunction* _tmp101_;
427 ValaCCodeFunctionCall* _tmp102_;
428 _tmp100_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
429 _tmp101_ = _tmp100_;
430 _tmp102_ = free_call;
431 vala_ccode_function_add_expression (_tmp101_, (ValaCCodeExpression*) _tmp102_);
432 }
433 default_section = NULL;
434 label_count = 0;
435 n = 0;
436 {
437 ValaList* _section_list = NULL;
438 ValaList* _tmp103_;
439 ValaList* _tmp104_;
440 gint _section_size = 0;
441 ValaList* _tmp105_;
442 gint _tmp106_;
443 gint _tmp107_;
444 gint _section_index = 0;
445 _tmp103_ = vala_switch_statement_get_sections (stmt);
446 _tmp104_ = _vala_iterable_ref0 (_tmp103_);
447 _section_list = _tmp104_;
448 _tmp105_ = _section_list;
449 _tmp106_ = vala_collection_get_size ((ValaCollection*) _tmp105_);
450 _tmp107_ = _tmp106_;
451 _section_size = _tmp107_;
452 _section_index = -1;
453 while (TRUE) {
454 gint _tmp108_;
455 gint _tmp109_;
456 ValaSwitchSection* section = NULL;
457 ValaList* _tmp110_;
458 gpointer _tmp111_;
459 ValaSwitchSection* _tmp112_;
460 ValaCCodeBinaryExpression* cor = NULL;
461 ValaCCodeFunction* _tmp179_;
462 ValaCCodeFunction* _tmp180_;
463 ValaCCodeConstant* _tmp181_;
464 ValaCCodeConstant* _tmp182_;
465 ValaCCodeFunction* _tmp183_;
466 ValaCCodeFunction* _tmp184_;
467 ValaSwitchSection* _tmp185_;
468 ValaCCodeFunction* _tmp186_;
469 ValaCCodeFunction* _tmp187_;
470 gint _tmp188_;
471 _section_index = _section_index + 1;
472 _tmp108_ = _section_index;
473 _tmp109_ = _section_size;
474 if (!(_tmp108_ < _tmp109_)) {
475 break;
476 }
477 _tmp110_ = _section_list;
478 _tmp111_ = vala_list_get (_tmp110_, _section_index);
479 section = (ValaSwitchSection*) _tmp111_;
480 _tmp112_ = section;
481 if (vala_switch_section_has_default_label (_tmp112_)) {
482 ValaSwitchSection* _tmp113_;
483 ValaSwitchSection* _tmp114_;
484 _tmp113_ = section;
485 _tmp114_ = _vala_code_node_ref0 (_tmp113_);
486 _vala_code_node_unref0 (default_section);
487 default_section = _tmp114_;
488 _vala_code_node_unref0 (section);
489 continue;
490 }
491 cor = NULL;
492 {
493 ValaList* _label_list = NULL;
494 ValaSwitchSection* _tmp115_;
495 ValaList* _tmp116_;
496 ValaList* _tmp117_;
497 gint _label_size = 0;
498 ValaList* _tmp118_;
499 gint _tmp119_;
500 gint _tmp120_;
501 gint _label_index = 0;
502 _tmp115_ = section;
503 _tmp116_ = vala_switch_section_get_labels (_tmp115_);
504 _tmp117_ = _vala_iterable_ref0 (_tmp116_);
505 _label_list = _tmp117_;
506 _tmp118_ = _label_list;
507 _tmp119_ = vala_collection_get_size ((ValaCollection*) _tmp118_);
508 _tmp120_ = _tmp119_;
509 _label_size = _tmp120_;
510 _label_index = -1;
511 while (TRUE) {
512 gint _tmp121_;
513 gint _tmp122_;
514 ValaSwitchLabel* label = NULL;
515 ValaList* _tmp123_;
516 gpointer _tmp124_;
517 ValaSwitchLabel* _tmp125_;
518 ValaExpression* _tmp126_;
519 ValaExpression* _tmp127_;
520 ValaCCodeExpression* cexpr = NULL;
521 ValaSwitchLabel* _tmp128_;
522 ValaExpression* _tmp129_;
523 ValaExpression* _tmp130_;
524 ValaCCodeExpression* _tmp131_;
525 ValaCCodeExpression* _tmp132_;
526 ValaCCodeExpression* _tmp133_;
527 ValaCCodeBinaryExpression* ccmp = NULL;
528 ValaCCodeExpression* _tmp164_;
529 ValaCCodeExpression* _tmp165_;
530 ValaCCodeBinaryExpression* _tmp166_;
531 ValaCCodeBinaryExpression* _tmp167_;
532 _label_index = _label_index + 1;
533 _tmp121_ = _label_index;
534 _tmp122_ = _label_size;
535 if (!(_tmp121_ < _tmp122_)) {
536 break;
537 }
538 _tmp123_ = _label_list;
539 _tmp124_ = vala_list_get (_tmp123_, _label_index);
540 label = (ValaSwitchLabel*) _tmp124_;
541 _tmp125_ = label;
542 _tmp126_ = vala_switch_label_get_expression (_tmp125_);
543 _tmp127_ = _tmp126_;
544 vala_code_node_emit ((ValaCodeNode*) _tmp127_, (ValaCodeGenerator*) self);
545 _tmp128_ = label;
546 _tmp129_ = vala_switch_label_get_expression (_tmp128_);
547 _tmp130_ = _tmp129_;
548 _tmp131_ = vala_get_cvalue (_tmp130_);
549 _tmp132_ = _vala_ccode_node_ref0 (_tmp131_);
550 cexpr = _tmp132_;
551 _tmp133_ = cexpr;
552 if (vala_ccode_base_module_is_constant_ccode_expression (_tmp133_)) {
553 ValaCCodeIdentifier* cname = NULL;
554 gint _tmp134_;
555 gint _tmp135_;
556 gchar* _tmp136_;
557 gchar* _tmp137_;
558 ValaCCodeIdentifier* _tmp138_;
559 ValaCCodeIdentifier* _tmp139_;
560 ValaCCodeBinaryExpression* ccondition = NULL;
561 ValaCCodeConstant* _tmp140_;
562 ValaCCodeIdentifier* _tmp141_;
563 ValaCCodeBinaryExpression* _tmp142_;
564 ValaCCodeFunctionCall* ccall = NULL;
565 ValaCCodeIdentifier* _tmp143_;
566 ValaCCodeIdentifier* _tmp144_;
567 ValaCCodeFunctionCall* _tmp145_;
568 ValaCCodeFunctionCall* _tmp146_;
569 ValaCCodeIdentifier* _tmp147_;
570 ValaCCodeFunctionCall* _tmp148_;
571 ValaCCodeAssignment* _tmp149_;
572 ValaCCodeFunctionCall* _tmp150_;
573 ValaCCodeExpression* _tmp151_;
574 ValaCCodeBinaryExpression* _tmp152_;
575 ValaCCodeIdentifier* _tmp153_;
576 ValaCCodeAssignment* _tmp154_;
577 ValaCCodeConditionalExpression* _tmp155_;
578 _tmp134_ = label_temp_id;
579 _tmp135_ = label_count;
580 label_count = _tmp135_ + 1;
581 _tmp136_ = g_strdup_printf ("_tmp%d_label%d", _tmp134_, _tmp135_);
582 _tmp137_ = _tmp136_;
583 _tmp138_ = vala_ccode_identifier_new (_tmp137_);
584 _tmp139_ = _tmp138_;
585 _g_free0 (_tmp137_);
586 cname = _tmp139_;
587 _tmp140_ = czero;
588 _tmp141_ = cname;
589 _tmp142_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_INEQUALITY, (ValaCCodeExpression*) _tmp140_, (ValaCCodeExpression*) _tmp141_);
590 ccondition = _tmp142_;
591 _tmp143_ = vala_ccode_identifier_new ("g_quark_from_static_string");
592 _tmp144_ = _tmp143_;
593 _tmp145_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp144_);
594 _tmp146_ = _tmp145_;
595 _vala_ccode_node_unref0 (_tmp144_);
596 ccall = _tmp146_;
597 _tmp147_ = cname;
598 _tmp148_ = ccall;
599 _tmp149_ = vala_ccode_assignment_new ((ValaCCodeExpression*) _tmp147_, (ValaCCodeExpression*) _tmp148_, VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE);
600 _vala_ccode_node_unref0 (cinit);
601 cinit = _tmp149_;
602 _tmp150_ = ccall;
603 _tmp151_ = cexpr;
604 vala_ccode_function_call_add_argument (_tmp150_, _tmp151_);
605 _tmp152_ = ccondition;
606 _tmp153_ = cname;
607 _tmp154_ = cinit;
608 _tmp155_ = vala_ccode_conditional_expression_new ((ValaCCodeExpression*) _tmp152_, (ValaCCodeExpression*) _tmp153_, (ValaCCodeExpression*) _tmp154_);
609 _vala_ccode_node_unref0 (cexpr);
610 cexpr = (ValaCCodeExpression*) _tmp155_;
611 _vala_ccode_node_unref0 (ccall);
612 _vala_ccode_node_unref0 (ccondition);
613 _vala_ccode_node_unref0 (cname);
614 } else {
615 ValaCCodeFunctionCall* ccall = NULL;
616 ValaCCodeIdentifier* _tmp156_;
617 ValaCCodeIdentifier* _tmp157_;
618 ValaCCodeFunctionCall* _tmp158_;
619 ValaCCodeFunctionCall* _tmp159_;
620 ValaCCodeFunctionCall* _tmp160_;
621 ValaCCodeExpression* _tmp161_;
622 ValaCCodeFunctionCall* _tmp162_;
623 ValaCCodeExpression* _tmp163_;
624 _tmp156_ = vala_ccode_identifier_new ("g_quark_from_string");
625 _tmp157_ = _tmp156_;
626 _tmp158_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp157_);
627 _tmp159_ = _tmp158_;
628 _vala_ccode_node_unref0 (_tmp157_);
629 ccall = _tmp159_;
630 _tmp160_ = ccall;
631 _tmp161_ = cexpr;
632 vala_ccode_function_call_add_argument (_tmp160_, _tmp161_);
633 _tmp162_ = ccall;
634 _tmp163_ = _vala_ccode_node_ref0 ((ValaCCodeExpression*) _tmp162_);
635 _vala_ccode_node_unref0 (cexpr);
636 cexpr = _tmp163_;
637 _vala_ccode_node_unref0 (ccall);
638 }
639 _tmp164_ = ctemp;
640 _tmp165_ = cexpr;
641 _tmp166_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_EQUALITY, _tmp164_, _tmp165_);
642 ccmp = _tmp166_;
643 _tmp167_ = cor;
644 if (_tmp167_ == NULL) {
645 ValaCCodeBinaryExpression* _tmp168_;
646 ValaCCodeBinaryExpression* _tmp169_;
647 _tmp168_ = ccmp;
648 _tmp169_ = _vala_ccode_node_ref0 (_tmp168_);
649 _vala_ccode_node_unref0 (cor);
650 cor = _tmp169_;
651 } else {
652 ValaCCodeBinaryExpression* _tmp170_;
653 ValaCCodeBinaryExpression* _tmp171_;
654 ValaCCodeBinaryExpression* _tmp172_;
655 _tmp170_ = cor;
656 _tmp171_ = ccmp;
657 _tmp172_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_OR, (ValaCCodeExpression*) _tmp170_, (ValaCCodeExpression*) _tmp171_);
658 _vala_ccode_node_unref0 (cor);
659 cor = _tmp172_;
660 }
661 _vala_ccode_node_unref0 (ccmp);
662 _vala_ccode_node_unref0 (cexpr);
663 _vala_code_node_unref0 (label);
664 }
665 _vala_iterable_unref0 (_label_list);
666 }
667 if (n > 0) {
668 ValaCCodeFunction* _tmp173_;
669 ValaCCodeFunction* _tmp174_;
670 ValaCCodeBinaryExpression* _tmp175_;
671 _tmp173_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
672 _tmp174_ = _tmp173_;
673 _tmp175_ = cor;
674 vala_ccode_function_else_if (_tmp174_, (ValaCCodeExpression*) _tmp175_);
675 } else {
676 ValaCCodeFunction* _tmp176_;
677 ValaCCodeFunction* _tmp177_;
678 ValaCCodeBinaryExpression* _tmp178_;
679 _tmp176_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
680 _tmp177_ = _tmp176_;
681 _tmp178_ = cor;
682 vala_ccode_function_open_if (_tmp177_, (ValaCCodeExpression*) _tmp178_);
683 }
684 _tmp179_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
685 _tmp180_ = _tmp179_;
686 _tmp181_ = vala_ccode_constant_new ("0");
687 _tmp182_ = _tmp181_;
688 vala_ccode_function_open_switch (_tmp180_, (ValaCCodeExpression*) _tmp182_);
689 _vala_ccode_node_unref0 (_tmp182_);
690 _tmp183_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
691 _tmp184_ = _tmp183_;
692 vala_ccode_function_add_default (_tmp184_);
693 _tmp185_ = section;
694 vala_code_node_emit ((ValaCodeNode*) _tmp185_, (ValaCodeGenerator*) self);
695 _tmp186_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
696 _tmp187_ = _tmp186_;
697 vala_ccode_function_close (_tmp187_);
698 _tmp188_ = n;
699 n = _tmp188_ + 1;
700 _vala_ccode_node_unref0 (cor);
701 _vala_code_node_unref0 (section);
702 }
703 _vala_iterable_unref0 (_section_list);
704 }
705 _tmp189_ = default_section;
706 if (_tmp189_ != NULL) {
707 ValaCCodeFunction* _tmp192_;
708 ValaCCodeFunction* _tmp193_;
709 ValaCCodeConstant* _tmp194_;
710 ValaCCodeConstant* _tmp195_;
711 ValaCCodeFunction* _tmp196_;
712 ValaCCodeFunction* _tmp197_;
713 ValaSwitchSection* _tmp198_;
714 ValaCCodeFunction* _tmp199_;
715 ValaCCodeFunction* _tmp200_;
716 if (n > 0) {
717 ValaCCodeFunction* _tmp190_;
718 ValaCCodeFunction* _tmp191_;
719 _tmp190_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
720 _tmp191_ = _tmp190_;
721 vala_ccode_function_add_else (_tmp191_);
722 }
723 _tmp192_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
724 _tmp193_ = _tmp192_;
725 _tmp194_ = vala_ccode_constant_new ("0");
726 _tmp195_ = _tmp194_;
727 vala_ccode_function_open_switch (_tmp193_, (ValaCCodeExpression*) _tmp195_);
728 _vala_ccode_node_unref0 (_tmp195_);
729 _tmp196_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
730 _tmp197_ = _tmp196_;
731 vala_ccode_function_add_default (_tmp197_);
732 _tmp198_ = default_section;
733 vala_code_node_emit ((ValaCodeNode*) _tmp198_, (ValaCodeGenerator*) self);
734 _tmp199_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
735 _tmp200_ = _tmp199_;
736 vala_ccode_function_close (_tmp200_);
737 }
738 if (n > 0) {
739 ValaCCodeFunction* _tmp201_;
740 ValaCCodeFunction* _tmp202_;
741 _tmp201_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
742 _tmp202_ = _tmp201_;
743 vala_ccode_function_close (_tmp202_);
744 }
745 _vala_code_node_unref0 (default_section);
746 _vala_ccode_node_unref0 (ccond);
747 _vala_ccode_node_unref0 (cquark);
748 _vala_ccode_node_unref0 (cisnull);
749 _vala_ccode_node_unref0 (free_call);
750 _vala_ccode_node_unref0 (czero);
751 _vala_ccode_node_unref0 (cinit);
752 _vala_ccode_node_unref0 (ctemp);
753 _vala_target_value_unref0 (temp_value);
754 }
755
756 static void
vala_ccode_control_flow_module_real_visit_switch_statement(ValaCodeVisitor * base,ValaSwitchStatement * stmt)757 vala_ccode_control_flow_module_real_visit_switch_statement (ValaCodeVisitor* base,
758 ValaSwitchStatement* stmt)
759 {
760 ValaCCodeControlFlowModule * self;
761 ValaExpression* _tmp0_;
762 ValaExpression* _tmp1_;
763 ValaDataType* _tmp2_;
764 ValaDataType* _tmp3_;
765 ValaDataType* _tmp4_;
766 ValaCCodeFunction* _tmp5_;
767 ValaCCodeFunction* _tmp6_;
768 ValaExpression* _tmp7_;
769 ValaExpression* _tmp8_;
770 ValaCCodeExpression* _tmp9_;
771 gboolean has_default = FALSE;
772 ValaCCodeFunction* _tmp27_;
773 ValaCCodeFunction* _tmp28_;
774 self = (ValaCCodeControlFlowModule*) base;
775 g_return_if_fail (stmt != NULL);
776 _tmp0_ = vala_switch_statement_get_expression (stmt);
777 _tmp1_ = _tmp0_;
778 _tmp2_ = vala_expression_get_value_type (_tmp1_);
779 _tmp3_ = _tmp2_;
780 _tmp4_ = ((ValaCCodeBaseModule*) self)->string_type;
781 if (vala_data_type_compatible (_tmp3_, _tmp4_)) {
782 vala_ccode_control_flow_module_visit_string_switch_statement (self, stmt);
783 return;
784 }
785 _tmp5_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
786 _tmp6_ = _tmp5_;
787 _tmp7_ = vala_switch_statement_get_expression (stmt);
788 _tmp8_ = _tmp7_;
789 _tmp9_ = vala_get_cvalue (_tmp8_);
790 vala_ccode_function_open_switch (_tmp6_, _tmp9_);
791 has_default = FALSE;
792 {
793 ValaList* _section_list = NULL;
794 ValaList* _tmp10_;
795 ValaList* _tmp11_;
796 gint _section_size = 0;
797 ValaList* _tmp12_;
798 gint _tmp13_;
799 gint _tmp14_;
800 gint _section_index = 0;
801 _tmp10_ = vala_switch_statement_get_sections (stmt);
802 _tmp11_ = _vala_iterable_ref0 (_tmp10_);
803 _section_list = _tmp11_;
804 _tmp12_ = _section_list;
805 _tmp13_ = vala_collection_get_size ((ValaCollection*) _tmp12_);
806 _tmp14_ = _tmp13_;
807 _section_size = _tmp14_;
808 _section_index = -1;
809 while (TRUE) {
810 gint _tmp15_;
811 gint _tmp16_;
812 ValaSwitchSection* section = NULL;
813 ValaList* _tmp17_;
814 gpointer _tmp18_;
815 ValaSwitchSection* _tmp19_;
816 ValaSwitchSection* _tmp22_;
817 _section_index = _section_index + 1;
818 _tmp15_ = _section_index;
819 _tmp16_ = _section_size;
820 if (!(_tmp15_ < _tmp16_)) {
821 break;
822 }
823 _tmp17_ = _section_list;
824 _tmp18_ = vala_list_get (_tmp17_, _section_index);
825 section = (ValaSwitchSection*) _tmp18_;
826 _tmp19_ = section;
827 if (vala_switch_section_has_default_label (_tmp19_)) {
828 ValaCCodeFunction* _tmp20_;
829 ValaCCodeFunction* _tmp21_;
830 _tmp20_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
831 _tmp21_ = _tmp20_;
832 vala_ccode_function_add_default (_tmp21_);
833 has_default = TRUE;
834 }
835 _tmp22_ = section;
836 vala_code_node_emit ((ValaCodeNode*) _tmp22_, (ValaCodeGenerator*) self);
837 _vala_code_node_unref0 (section);
838 }
839 _vala_iterable_unref0 (_section_list);
840 }
841 if (!has_default) {
842 ValaCCodeFunction* _tmp23_;
843 ValaCCodeFunction* _tmp24_;
844 ValaCCodeFunction* _tmp25_;
845 ValaCCodeFunction* _tmp26_;
846 _tmp23_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
847 _tmp24_ = _tmp23_;
848 vala_ccode_function_add_default (_tmp24_);
849 _tmp25_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
850 _tmp26_ = _tmp25_;
851 vala_ccode_function_add_break (_tmp26_);
852 }
853 _tmp27_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
854 _tmp28_ = _tmp27_;
855 vala_ccode_function_close (_tmp28_);
856 }
857
858 static void
vala_ccode_control_flow_module_real_visit_switch_label(ValaCodeVisitor * base,ValaSwitchLabel * label)859 vala_ccode_control_flow_module_real_visit_switch_label (ValaCodeVisitor* base,
860 ValaSwitchLabel* label)
861 {
862 ValaCCodeControlFlowModule * self;
863 ValaSwitchSection* _tmp0_;
864 ValaSwitchSection* _tmp1_;
865 ValaCodeNode* _tmp2_;
866 ValaCodeNode* _tmp3_;
867 ValaExpression* _tmp4_;
868 ValaExpression* _tmp5_;
869 ValaDataType* _tmp6_;
870 ValaDataType* _tmp7_;
871 ValaDataType* _tmp8_;
872 ValaExpression* _tmp9_;
873 ValaExpression* _tmp10_;
874 self = (ValaCCodeControlFlowModule*) base;
875 g_return_if_fail (label != NULL);
876 _tmp0_ = vala_switch_label_get_section (label);
877 _tmp1_ = _tmp0_;
878 _tmp2_ = vala_code_node_get_parent_node ((ValaCodeNode*) _tmp1_);
879 _tmp3_ = _tmp2_;
880 _tmp4_ = vala_switch_statement_get_expression (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, VALA_TYPE_SWITCH_STATEMENT, ValaSwitchStatement));
881 _tmp5_ = _tmp4_;
882 _tmp6_ = vala_expression_get_value_type (_tmp5_);
883 _tmp7_ = _tmp6_;
884 _tmp8_ = ((ValaCCodeBaseModule*) self)->string_type;
885 if (vala_data_type_compatible (_tmp7_, _tmp8_)) {
886 return;
887 }
888 _tmp9_ = vala_switch_label_get_expression (label);
889 _tmp10_ = _tmp9_;
890 if (_tmp10_ != NULL) {
891 ValaExpression* _tmp11_;
892 ValaExpression* _tmp12_;
893 ValaExpression* _tmp13_;
894 ValaExpression* _tmp14_;
895 ValaCCodeFunction* _tmp15_;
896 ValaCCodeFunction* _tmp16_;
897 ValaExpression* _tmp17_;
898 ValaExpression* _tmp18_;
899 ValaCCodeExpression* _tmp19_;
900 _tmp11_ = vala_switch_label_get_expression (label);
901 _tmp12_ = _tmp11_;
902 vala_code_node_emit ((ValaCodeNode*) _tmp12_, (ValaCodeGenerator*) self);
903 _tmp13_ = vala_switch_label_get_expression (label);
904 _tmp14_ = _tmp13_;
905 vala_code_visitor_visit_end_full_expression ((ValaCodeVisitor*) self, _tmp14_);
906 _tmp15_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
907 _tmp16_ = _tmp15_;
908 _tmp17_ = vala_switch_label_get_expression (label);
909 _tmp18_ = _tmp17_;
910 _tmp19_ = vala_get_cvalue (_tmp18_);
911 vala_ccode_function_add_case (_tmp16_, _tmp19_);
912 }
913 }
914
915 static void
vala_ccode_control_flow_module_real_visit_loop(ValaCodeVisitor * base,ValaLoop * stmt)916 vala_ccode_control_flow_module_real_visit_loop (ValaCodeVisitor* base,
917 ValaLoop* stmt)
918 {
919 ValaCCodeControlFlowModule * self;
920 ValaCodeContext* _tmp0_;
921 ValaCodeContext* _tmp1_;
922 ValaProfile _tmp2_;
923 ValaProfile _tmp3_;
924 ValaBlock* _tmp13_;
925 ValaBlock* _tmp14_;
926 ValaCCodeFunction* _tmp15_;
927 ValaCCodeFunction* _tmp16_;
928 self = (ValaCCodeControlFlowModule*) base;
929 g_return_if_fail (stmt != NULL);
930 _tmp0_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
931 _tmp1_ = _tmp0_;
932 _tmp2_ = vala_code_context_get_profile (_tmp1_);
933 _tmp3_ = _tmp2_;
934 if (_tmp3_ == VALA_PROFILE_GOBJECT) {
935 ValaCCodeFunction* _tmp4_;
936 ValaCCodeFunction* _tmp5_;
937 ValaCCodeConstant* _tmp6_;
938 ValaCCodeConstant* _tmp7_;
939 _tmp4_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
940 _tmp5_ = _tmp4_;
941 _tmp6_ = vala_ccode_constant_new ("TRUE");
942 _tmp7_ = _tmp6_;
943 vala_ccode_function_open_while (_tmp5_, (ValaCCodeExpression*) _tmp7_);
944 _vala_ccode_node_unref0 (_tmp7_);
945 } else {
946 ValaCCodeFile* _tmp8_;
947 ValaCCodeFunction* _tmp9_;
948 ValaCCodeFunction* _tmp10_;
949 ValaCCodeConstant* _tmp11_;
950 ValaCCodeConstant* _tmp12_;
951 _tmp8_ = ((ValaCCodeBaseModule*) self)->cfile;
952 vala_ccode_file_add_include (_tmp8_, "stdbool.h", FALSE);
953 _tmp9_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
954 _tmp10_ = _tmp9_;
955 _tmp11_ = vala_ccode_constant_new ("true");
956 _tmp12_ = _tmp11_;
957 vala_ccode_function_open_while (_tmp10_, (ValaCCodeExpression*) _tmp12_);
958 _vala_ccode_node_unref0 (_tmp12_);
959 }
960 _tmp13_ = vala_loop_get_body (stmt);
961 _tmp14_ = _tmp13_;
962 vala_code_node_emit ((ValaCodeNode*) _tmp14_, (ValaCodeGenerator*) self);
963 _tmp15_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
964 _tmp16_ = _tmp15_;
965 vala_ccode_function_close (_tmp16_);
966 }
967
968 static void
vala_ccode_control_flow_module_real_visit_foreach_statement(ValaCodeVisitor * base,ValaForeachStatement * stmt)969 vala_ccode_control_flow_module_real_visit_foreach_statement (ValaCodeVisitor* base,
970 ValaForeachStatement* stmt)
971 {
972 ValaCCodeControlFlowModule * self;
973 ValaCCodeFunction* _tmp0_;
974 ValaCCodeFunction* _tmp1_;
975 ValaLocalVariable* collection_backup = NULL;
976 ValaLocalVariable* _tmp2_;
977 ValaLocalVariable* _tmp3_;
978 ValaLocalVariable* _tmp4_;
979 ValaDataType* collection_type = NULL;
980 ValaLocalVariable* _tmp5_;
981 ValaDataType* _tmp6_;
982 ValaDataType* _tmp7_;
983 ValaDataType* _tmp8_;
984 ValaArrayType* array_type = NULL;
985 ValaDataType* _tmp9_;
986 ValaArrayType* _tmp10_;
987 ValaArrayType* _tmp11_;
988 ValaLocalVariable* _tmp14_;
989 ValaCCodeFunction* _tmp15_;
990 ValaCCodeFunction* _tmp16_;
991 ValaLocalVariable* _tmp17_;
992 gchar* _tmp18_;
993 gchar* _tmp19_;
994 ValaCCodeExpression* _tmp20_;
995 ValaCCodeExpression* _tmp21_;
996 ValaExpression* _tmp22_;
997 ValaExpression* _tmp23_;
998 ValaCCodeExpression* _tmp24_;
999 gboolean _tmp25_ = FALSE;
1000 gboolean _tmp26_;
1001 gboolean _tmp27_;
1002 ValaExpression* _tmp34_;
1003 ValaExpression* _tmp35_;
1004 ValaDataType* _tmp36_;
1005 ValaDataType* _tmp37_;
1006 ValaCCodeFunction* _tmp388_;
1007 ValaCCodeFunction* _tmp389_;
1008 self = (ValaCCodeControlFlowModule*) base;
1009 g_return_if_fail (stmt != NULL);
1010 _tmp0_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1011 _tmp1_ = _tmp0_;
1012 vala_ccode_function_open_block (_tmp1_);
1013 _tmp2_ = vala_foreach_statement_get_collection_variable (stmt);
1014 _tmp3_ = _tmp2_;
1015 _tmp4_ = _vala_code_node_ref0 (_tmp3_);
1016 collection_backup = _tmp4_;
1017 _tmp5_ = collection_backup;
1018 _tmp6_ = vala_variable_get_variable_type ((ValaVariable*) _tmp5_);
1019 _tmp7_ = _tmp6_;
1020 _tmp8_ = _vala_code_node_ref0 (_tmp7_);
1021 collection_type = _tmp8_;
1022 _tmp9_ = collection_type;
1023 _tmp10_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, VALA_TYPE_ARRAY_TYPE) ? ((ValaArrayType*) _tmp9_) : NULL);
1024 array_type = _tmp10_;
1025 _tmp11_ = array_type;
1026 if (_tmp11_ != NULL) {
1027 ValaArrayType* _tmp12_;
1028 ValaArrayType* _tmp13_;
1029 _tmp12_ = array_type;
1030 vala_array_type_set_inline_allocated (_tmp12_, FALSE);
1031 _tmp13_ = array_type;
1032 vala_array_type_set_fixed_length (_tmp13_, FALSE);
1033 }
1034 _tmp14_ = collection_backup;
1035 vala_code_visitor_visit_local_variable ((ValaCodeVisitor*) self, _tmp14_);
1036 _tmp15_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1037 _tmp16_ = _tmp15_;
1038 _tmp17_ = collection_backup;
1039 _tmp18_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp17_);
1040 _tmp19_ = _tmp18_;
1041 _tmp20_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp19_);
1042 _tmp21_ = _tmp20_;
1043 _tmp22_ = vala_foreach_statement_get_collection (stmt);
1044 _tmp23_ = _tmp22_;
1045 _tmp24_ = vala_get_cvalue (_tmp23_);
1046 vala_ccode_function_add_assignment (_tmp16_, _tmp21_, _tmp24_);
1047 _vala_ccode_node_unref0 (_tmp21_);
1048 _g_free0 (_tmp19_);
1049 _tmp26_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) stmt);
1050 _tmp27_ = _tmp26_;
1051 if (_tmp27_) {
1052 ValaExpression* _tmp28_;
1053 ValaExpression* _tmp29_;
1054 gboolean _tmp30_;
1055 gboolean _tmp31_;
1056 _tmp28_ = vala_foreach_statement_get_collection (stmt);
1057 _tmp29_ = _tmp28_;
1058 _tmp30_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp29_);
1059 _tmp31_ = _tmp30_;
1060 _tmp25_ = _tmp31_;
1061 } else {
1062 _tmp25_ = FALSE;
1063 }
1064 if (_tmp25_) {
1065 ValaExpression* _tmp32_;
1066 ValaExpression* _tmp33_;
1067 _tmp32_ = vala_foreach_statement_get_collection (stmt);
1068 _tmp33_ = _tmp32_;
1069 vala_ccode_base_module_add_simple_check ((ValaCCodeBaseModule*) self, (ValaCodeNode*) _tmp33_, FALSE);
1070 }
1071 _tmp34_ = vala_foreach_statement_get_collection (stmt);
1072 _tmp35_ = _tmp34_;
1073 _tmp36_ = vala_expression_get_value_type (_tmp35_);
1074 _tmp37_ = _tmp36_;
1075 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp37_, VALA_TYPE_ARRAY_TYPE)) {
1076 ValaExpression* _tmp38_;
1077 ValaExpression* _tmp39_;
1078 ValaDataType* _tmp40_;
1079 ValaDataType* _tmp41_;
1080 ValaArrayType* _tmp42_;
1081 ValaCCodeExpression* array_len = NULL;
1082 ValaLocalVariable* _tmp43_;
1083 gchar* _tmp44_;
1084 gchar* _tmp45_;
1085 gchar* _tmp46_;
1086 gchar* _tmp47_;
1087 ValaCCodeExpression* _tmp48_;
1088 ValaCCodeExpression* _tmp49_;
1089 ValaCCodeFunction* _tmp50_;
1090 ValaCCodeFunction* _tmp51_;
1091 ValaCCodeExpression* _tmp52_;
1092 ValaExpression* _tmp53_;
1093 ValaExpression* _tmp54_;
1094 ValaCCodeExpression* _tmp55_;
1095 ValaCCodeExpression* _tmp56_;
1096 ValaLocalVariable* iterator_variable = NULL;
1097 ValaArrayType* _tmp57_;
1098 ValaDataType* _tmp58_;
1099 ValaDataType* _tmp59_;
1100 ValaDataType* _tmp60_;
1101 ValaDataType* _tmp61_;
1102 const gchar* _tmp62_;
1103 const gchar* _tmp63_;
1104 gchar* _tmp64_;
1105 gchar* _tmp65_;
1106 ValaLocalVariable* _tmp66_;
1107 ValaLocalVariable* _tmp67_;
1108 ValaLocalVariable* _tmp68_;
1109 gchar* it_name = NULL;
1110 ValaLocalVariable* _tmp69_;
1111 gchar* _tmp70_;
1112 ValaCCodeBinaryExpression* ccond = NULL;
1113 const gchar* _tmp71_;
1114 ValaCCodeExpression* _tmp72_;
1115 ValaCCodeExpression* _tmp73_;
1116 ValaCCodeExpression* _tmp74_;
1117 ValaCCodeBinaryExpression* _tmp75_;
1118 ValaCCodeBinaryExpression* _tmp76_;
1119 ValaCCodeFunction* _tmp77_;
1120 ValaCCodeFunction* _tmp78_;
1121 const gchar* _tmp79_;
1122 ValaCCodeExpression* _tmp80_;
1123 ValaCCodeExpression* _tmp81_;
1124 ValaCCodeConstant* _tmp82_;
1125 ValaCCodeConstant* _tmp83_;
1126 ValaCCodeAssignment* _tmp84_;
1127 ValaCCodeAssignment* _tmp85_;
1128 ValaCCodeBinaryExpression* _tmp86_;
1129 const gchar* _tmp87_;
1130 ValaCCodeExpression* _tmp88_;
1131 ValaCCodeExpression* _tmp89_;
1132 const gchar* _tmp90_;
1133 ValaCCodeExpression* _tmp91_;
1134 ValaCCodeExpression* _tmp92_;
1135 ValaCCodeConstant* _tmp93_;
1136 ValaCCodeConstant* _tmp94_;
1137 ValaCCodeBinaryExpression* _tmp95_;
1138 ValaCCodeBinaryExpression* _tmp96_;
1139 ValaCCodeAssignment* _tmp97_;
1140 ValaCCodeAssignment* _tmp98_;
1141 ValaCCodeExpression* element_expr = NULL;
1142 ValaLocalVariable* _tmp99_;
1143 gchar* _tmp100_;
1144 gchar* _tmp101_;
1145 ValaCCodeExpression* _tmp102_;
1146 ValaCCodeExpression* _tmp103_;
1147 const gchar* _tmp104_;
1148 ValaCCodeExpression* _tmp105_;
1149 ValaCCodeExpression* _tmp106_;
1150 ValaCCodeElementAccess* _tmp107_;
1151 ValaCCodeExpression* _tmp108_;
1152 ValaDataType* element_type = NULL;
1153 ValaArrayType* _tmp109_;
1154 ValaDataType* _tmp110_;
1155 ValaDataType* _tmp111_;
1156 ValaDataType* _tmp112_;
1157 ValaDataType* _tmp113_;
1158 ValaDataType* _tmp114_;
1159 ValaCCodeExpression* _tmp115_;
1160 ValaGLibValue* _tmp116_;
1161 ValaGLibValue* _tmp117_;
1162 ValaDataType* _tmp118_;
1163 ValaDataType* _tmp119_;
1164 ValaTargetValue* _tmp120_;
1165 ValaTargetValue* _tmp121_;
1166 ValaCCodeExpression* _tmp122_;
1167 ValaCCodeExpression* _tmp123_;
1168 ValaLocalVariable* _tmp124_;
1169 ValaLocalVariable* _tmp125_;
1170 ValaCCodeFunction* _tmp126_;
1171 ValaCCodeFunction* _tmp127_;
1172 ValaLocalVariable* _tmp128_;
1173 ValaLocalVariable* _tmp129_;
1174 gchar* _tmp130_;
1175 gchar* _tmp131_;
1176 ValaCCodeExpression* _tmp132_;
1177 ValaCCodeExpression* _tmp133_;
1178 ValaCCodeExpression* _tmp134_;
1179 ValaDataType* _tmp135_;
1180 ValaDataType* _tmp136_;
1181 ValaBlock* _tmp157_;
1182 ValaBlock* _tmp158_;
1183 ValaCCodeFunction* _tmp159_;
1184 ValaCCodeFunction* _tmp160_;
1185 _tmp38_ = vala_foreach_statement_get_collection (stmt);
1186 _tmp39_ = _tmp38_;
1187 _tmp40_ = vala_expression_get_value_type (_tmp39_);
1188 _tmp41_ = _tmp40_;
1189 _tmp42_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp41_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
1190 _vala_code_node_unref0 (array_type);
1191 array_type = _tmp42_;
1192 _tmp43_ = collection_backup;
1193 _tmp44_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp43_);
1194 _tmp45_ = _tmp44_;
1195 _tmp46_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, _tmp45_, 1);
1196 _tmp47_ = _tmp46_;
1197 _tmp48_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp47_);
1198 _tmp49_ = _tmp48_;
1199 _g_free0 (_tmp47_);
1200 _g_free0 (_tmp45_);
1201 array_len = _tmp49_;
1202 _tmp50_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1203 _tmp51_ = _tmp50_;
1204 _tmp52_ = array_len;
1205 _tmp53_ = vala_foreach_statement_get_collection (stmt);
1206 _tmp54_ = _tmp53_;
1207 _tmp55_ = vala_ccode_base_module_get_array_length_cexpression ((ValaCCodeBaseModule*) self, _tmp54_, -1);
1208 _tmp56_ = _tmp55_;
1209 vala_ccode_function_add_assignment (_tmp51_, _tmp52_, _tmp56_);
1210 _vala_ccode_node_unref0 (_tmp56_);
1211 _tmp57_ = array_type;
1212 _tmp58_ = vala_array_type_get_length_type (_tmp57_);
1213 _tmp59_ = _tmp58_;
1214 _tmp60_ = vala_data_type_copy (_tmp59_);
1215 _tmp61_ = _tmp60_;
1216 _tmp62_ = vala_foreach_statement_get_variable_name (stmt);
1217 _tmp63_ = _tmp62_;
1218 _tmp64_ = g_strconcat (_tmp63_, "_it", NULL);
1219 _tmp65_ = _tmp64_;
1220 _tmp66_ = vala_local_variable_new (_tmp61_, _tmp65_, NULL, NULL);
1221 _tmp67_ = _tmp66_;
1222 _g_free0 (_tmp65_);
1223 _vala_code_node_unref0 (_tmp61_);
1224 iterator_variable = _tmp67_;
1225 _tmp68_ = iterator_variable;
1226 vala_code_visitor_visit_local_variable ((ValaCodeVisitor*) self, _tmp68_);
1227 _tmp69_ = iterator_variable;
1228 _tmp70_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp69_);
1229 it_name = _tmp70_;
1230 _tmp71_ = it_name;
1231 _tmp72_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp71_);
1232 _tmp73_ = _tmp72_;
1233 _tmp74_ = array_len;
1234 _tmp75_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_LESS_THAN, _tmp73_, _tmp74_);
1235 _tmp76_ = _tmp75_;
1236 _vala_ccode_node_unref0 (_tmp73_);
1237 ccond = _tmp76_;
1238 _tmp77_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1239 _tmp78_ = _tmp77_;
1240 _tmp79_ = it_name;
1241 _tmp80_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp79_);
1242 _tmp81_ = _tmp80_;
1243 _tmp82_ = vala_ccode_constant_new ("0");
1244 _tmp83_ = _tmp82_;
1245 _tmp84_ = vala_ccode_assignment_new (_tmp81_, (ValaCCodeExpression*) _tmp83_, VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE);
1246 _tmp85_ = _tmp84_;
1247 _tmp86_ = ccond;
1248 _tmp87_ = it_name;
1249 _tmp88_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp87_);
1250 _tmp89_ = _tmp88_;
1251 _tmp90_ = it_name;
1252 _tmp91_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp90_);
1253 _tmp92_ = _tmp91_;
1254 _tmp93_ = vala_ccode_constant_new ("1");
1255 _tmp94_ = _tmp93_;
1256 _tmp95_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_PLUS, _tmp92_, (ValaCCodeExpression*) _tmp94_);
1257 _tmp96_ = _tmp95_;
1258 _tmp97_ = vala_ccode_assignment_new (_tmp89_, (ValaCCodeExpression*) _tmp96_, VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE);
1259 _tmp98_ = _tmp97_;
1260 vala_ccode_function_open_for (_tmp78_, (ValaCCodeExpression*) _tmp85_, (ValaCCodeExpression*) _tmp86_, (ValaCCodeExpression*) _tmp98_);
1261 _vala_ccode_node_unref0 (_tmp98_);
1262 _vala_ccode_node_unref0 (_tmp96_);
1263 _vala_ccode_node_unref0 (_tmp94_);
1264 _vala_ccode_node_unref0 (_tmp92_);
1265 _vala_ccode_node_unref0 (_tmp89_);
1266 _vala_ccode_node_unref0 (_tmp85_);
1267 _vala_ccode_node_unref0 (_tmp83_);
1268 _vala_ccode_node_unref0 (_tmp81_);
1269 _tmp99_ = collection_backup;
1270 _tmp100_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp99_);
1271 _tmp101_ = _tmp100_;
1272 _tmp102_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp101_);
1273 _tmp103_ = _tmp102_;
1274 _tmp104_ = it_name;
1275 _tmp105_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp104_);
1276 _tmp106_ = _tmp105_;
1277 _tmp107_ = vala_ccode_element_access_new (_tmp103_, _tmp106_);
1278 _tmp108_ = (ValaCCodeExpression*) _tmp107_;
1279 _vala_ccode_node_unref0 (_tmp106_);
1280 _vala_ccode_node_unref0 (_tmp103_);
1281 _g_free0 (_tmp101_);
1282 element_expr = _tmp108_;
1283 _tmp109_ = array_type;
1284 _tmp110_ = vala_array_type_get_element_type (_tmp109_);
1285 _tmp111_ = _tmp110_;
1286 _tmp112_ = vala_data_type_copy (_tmp111_);
1287 element_type = _tmp112_;
1288 _tmp113_ = element_type;
1289 vala_data_type_set_value_owned (_tmp113_, FALSE);
1290 _tmp114_ = element_type;
1291 _tmp115_ = element_expr;
1292 _tmp116_ = vala_glib_value_new (_tmp114_, _tmp115_, TRUE);
1293 _tmp117_ = _tmp116_;
1294 _tmp118_ = vala_foreach_statement_get_type_reference (stmt);
1295 _tmp119_ = _tmp118_;
1296 _tmp120_ = vala_ccode_base_module_transform_value ((ValaCCodeBaseModule*) self, (ValaTargetValue*) _tmp117_, _tmp119_, (ValaCodeNode*) stmt);
1297 _tmp121_ = _tmp120_;
1298 _tmp122_ = vala_get_cvalue_ (_tmp121_);
1299 _tmp123_ = _vala_ccode_node_ref0 (_tmp122_);
1300 _vala_ccode_node_unref0 (element_expr);
1301 element_expr = _tmp123_;
1302 _vala_target_value_unref0 (_tmp121_);
1303 _vala_target_value_unref0 (_tmp117_);
1304 _tmp124_ = vala_foreach_statement_get_element_variable (stmt);
1305 _tmp125_ = _tmp124_;
1306 vala_code_visitor_visit_local_variable ((ValaCodeVisitor*) self, _tmp125_);
1307 _tmp126_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1308 _tmp127_ = _tmp126_;
1309 _tmp128_ = vala_foreach_statement_get_element_variable (stmt);
1310 _tmp129_ = _tmp128_;
1311 _tmp130_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp129_);
1312 _tmp131_ = _tmp130_;
1313 _tmp132_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp131_);
1314 _tmp133_ = _tmp132_;
1315 _tmp134_ = element_expr;
1316 vala_ccode_function_add_assignment (_tmp127_, _tmp133_, _tmp134_);
1317 _vala_ccode_node_unref0 (_tmp133_);
1318 _g_free0 (_tmp131_);
1319 _tmp135_ = vala_foreach_statement_get_type_reference (stmt);
1320 _tmp136_ = _tmp135_;
1321 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp136_, VALA_TYPE_ARRAY_TYPE)) {
1322 ValaArrayType* inner_array_type = NULL;
1323 ValaDataType* _tmp137_;
1324 ValaDataType* _tmp138_;
1325 ValaArrayType* _tmp139_;
1326 _tmp137_ = vala_foreach_statement_get_type_reference (stmt);
1327 _tmp138_ = _tmp137_;
1328 _tmp139_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp138_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
1329 inner_array_type = _tmp139_;
1330 {
1331 gint dim = 0;
1332 dim = 1;
1333 {
1334 gboolean _tmp140_ = FALSE;
1335 _tmp140_ = TRUE;
1336 while (TRUE) {
1337 ValaArrayType* _tmp142_;
1338 gint _tmp143_;
1339 gint _tmp144_;
1340 ValaCCodeFunction* _tmp145_;
1341 ValaCCodeFunction* _tmp146_;
1342 ValaLocalVariable* _tmp147_;
1343 ValaLocalVariable* _tmp148_;
1344 gchar* _tmp149_;
1345 gchar* _tmp150_;
1346 gchar* _tmp151_;
1347 gchar* _tmp152_;
1348 ValaCCodeExpression* _tmp153_;
1349 ValaCCodeExpression* _tmp154_;
1350 ValaCCodeConstant* _tmp155_;
1351 ValaCCodeConstant* _tmp156_;
1352 if (!_tmp140_) {
1353 gint _tmp141_;
1354 _tmp141_ = dim;
1355 dim = _tmp141_ + 1;
1356 }
1357 _tmp140_ = FALSE;
1358 _tmp142_ = inner_array_type;
1359 _tmp143_ = vala_array_type_get_rank (_tmp142_);
1360 _tmp144_ = _tmp143_;
1361 if (!(dim <= _tmp144_)) {
1362 break;
1363 }
1364 _tmp145_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1365 _tmp146_ = _tmp145_;
1366 _tmp147_ = vala_foreach_statement_get_element_variable (stmt);
1367 _tmp148_ = _tmp147_;
1368 _tmp149_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp148_);
1369 _tmp150_ = _tmp149_;
1370 _tmp151_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, _tmp150_, dim);
1371 _tmp152_ = _tmp151_;
1372 _tmp153_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp152_);
1373 _tmp154_ = _tmp153_;
1374 _tmp155_ = vala_ccode_constant_new ("-1");
1375 _tmp156_ = _tmp155_;
1376 vala_ccode_function_add_assignment (_tmp146_, _tmp154_, (ValaCCodeExpression*) _tmp156_);
1377 _vala_ccode_node_unref0 (_tmp156_);
1378 _vala_ccode_node_unref0 (_tmp154_);
1379 _g_free0 (_tmp152_);
1380 _g_free0 (_tmp150_);
1381 }
1382 }
1383 }
1384 _vala_code_node_unref0 (inner_array_type);
1385 }
1386 _tmp157_ = vala_foreach_statement_get_body (stmt);
1387 _tmp158_ = _tmp157_;
1388 vala_code_node_emit ((ValaCodeNode*) _tmp158_, (ValaCodeGenerator*) self);
1389 _tmp159_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1390 _tmp160_ = _tmp159_;
1391 vala_ccode_function_close (_tmp160_);
1392 _vala_code_node_unref0 (element_type);
1393 _vala_ccode_node_unref0 (element_expr);
1394 _vala_ccode_node_unref0 (ccond);
1395 _g_free0 (it_name);
1396 _vala_code_node_unref0 (iterator_variable);
1397 _vala_ccode_node_unref0 (array_len);
1398 } else {
1399 gboolean _tmp161_ = FALSE;
1400 ValaExpression* _tmp162_;
1401 ValaExpression* _tmp163_;
1402 ValaDataType* _tmp164_;
1403 ValaDataType* _tmp165_;
1404 ValaClass* _tmp166_;
1405 ValaObjectType* _tmp167_;
1406 ValaObjectType* _tmp168_;
1407 gboolean _tmp169_;
1408 _tmp162_ = vala_foreach_statement_get_collection (stmt);
1409 _tmp163_ = _tmp162_;
1410 _tmp164_ = vala_expression_get_value_type (_tmp163_);
1411 _tmp165_ = _tmp164_;
1412 _tmp166_ = ((ValaCCodeBaseModule*) self)->glist_type;
1413 _tmp167_ = vala_object_type_new ((ValaObjectTypeSymbol*) _tmp166_);
1414 _tmp168_ = _tmp167_;
1415 _tmp169_ = vala_data_type_compatible (_tmp165_, (ValaDataType*) _tmp168_);
1416 _vala_code_node_unref0 (_tmp168_);
1417 if (_tmp169_) {
1418 _tmp161_ = TRUE;
1419 } else {
1420 ValaExpression* _tmp170_;
1421 ValaExpression* _tmp171_;
1422 ValaDataType* _tmp172_;
1423 ValaDataType* _tmp173_;
1424 ValaClass* _tmp174_;
1425 ValaObjectType* _tmp175_;
1426 ValaObjectType* _tmp176_;
1427 _tmp170_ = vala_foreach_statement_get_collection (stmt);
1428 _tmp171_ = _tmp170_;
1429 _tmp172_ = vala_expression_get_value_type (_tmp171_);
1430 _tmp173_ = _tmp172_;
1431 _tmp174_ = ((ValaCCodeBaseModule*) self)->gslist_type;
1432 _tmp175_ = vala_object_type_new ((ValaObjectTypeSymbol*) _tmp174_);
1433 _tmp176_ = _tmp175_;
1434 _tmp161_ = vala_data_type_compatible (_tmp173_, (ValaDataType*) _tmp176_);
1435 _vala_code_node_unref0 (_tmp176_);
1436 }
1437 if (_tmp161_) {
1438 ValaLocalVariable* iterator_variable = NULL;
1439 ValaDataType* _tmp177_;
1440 ValaDataType* _tmp178_;
1441 ValaDataType* _tmp179_;
1442 const gchar* _tmp180_;
1443 const gchar* _tmp181_;
1444 gchar* _tmp182_;
1445 gchar* _tmp183_;
1446 ValaLocalVariable* _tmp184_;
1447 ValaLocalVariable* _tmp185_;
1448 ValaLocalVariable* _tmp186_;
1449 gchar* it_name = NULL;
1450 ValaLocalVariable* _tmp187_;
1451 gchar* _tmp188_;
1452 ValaCCodeBinaryExpression* ccond = NULL;
1453 const gchar* _tmp189_;
1454 ValaCCodeExpression* _tmp190_;
1455 ValaCCodeExpression* _tmp191_;
1456 ValaCCodeConstant* _tmp192_;
1457 ValaCCodeConstant* _tmp193_;
1458 ValaCCodeBinaryExpression* _tmp194_;
1459 ValaCCodeBinaryExpression* _tmp195_;
1460 ValaCCodeFunction* _tmp196_;
1461 ValaCCodeFunction* _tmp197_;
1462 const gchar* _tmp198_;
1463 ValaCCodeExpression* _tmp199_;
1464 ValaCCodeExpression* _tmp200_;
1465 ValaLocalVariable* _tmp201_;
1466 gchar* _tmp202_;
1467 gchar* _tmp203_;
1468 ValaCCodeExpression* _tmp204_;
1469 ValaCCodeExpression* _tmp205_;
1470 ValaCCodeAssignment* _tmp206_;
1471 ValaCCodeAssignment* _tmp207_;
1472 ValaCCodeBinaryExpression* _tmp208_;
1473 const gchar* _tmp209_;
1474 ValaCCodeExpression* _tmp210_;
1475 ValaCCodeExpression* _tmp211_;
1476 const gchar* _tmp212_;
1477 ValaCCodeExpression* _tmp213_;
1478 ValaCCodeExpression* _tmp214_;
1479 ValaCCodeMemberAccess* _tmp215_;
1480 ValaCCodeMemberAccess* _tmp216_;
1481 ValaCCodeAssignment* _tmp217_;
1482 ValaCCodeAssignment* _tmp218_;
1483 ValaCCodeExpression* element_expr = NULL;
1484 const gchar* _tmp219_;
1485 ValaCCodeExpression* _tmp220_;
1486 ValaCCodeExpression* _tmp221_;
1487 ValaCCodeMemberAccess* _tmp222_;
1488 ValaCCodeExpression* _tmp223_;
1489 ValaDataType* _tmp224_;
1490 ValaList* _tmp225_;
1491 gint _tmp226_;
1492 gint _tmp227_;
1493 ValaDataType* element_data_type = NULL;
1494 ValaDataType* _tmp230_;
1495 ValaList* _tmp231_;
1496 gpointer _tmp232_;
1497 ValaDataType* _tmp233_;
1498 ValaDataType* _tmp234_;
1499 ValaDataType* _tmp235_;
1500 ValaDataType* _tmp236_;
1501 ValaCCodeExpression* _tmp237_;
1502 ValaDataType* _tmp238_;
1503 ValaCCodeExpression* _tmp239_;
1504 ValaDataType* _tmp240_;
1505 ValaCCodeExpression* _tmp241_;
1506 ValaGLibValue* _tmp242_;
1507 ValaGLibValue* _tmp243_;
1508 ValaDataType* _tmp244_;
1509 ValaDataType* _tmp245_;
1510 ValaTargetValue* _tmp246_;
1511 ValaTargetValue* _tmp247_;
1512 ValaCCodeExpression* _tmp248_;
1513 ValaCCodeExpression* _tmp249_;
1514 ValaLocalVariable* _tmp250_;
1515 ValaLocalVariable* _tmp251_;
1516 ValaCCodeFunction* _tmp252_;
1517 ValaCCodeFunction* _tmp253_;
1518 ValaLocalVariable* _tmp254_;
1519 ValaLocalVariable* _tmp255_;
1520 gchar* _tmp256_;
1521 gchar* _tmp257_;
1522 ValaCCodeExpression* _tmp258_;
1523 ValaCCodeExpression* _tmp259_;
1524 ValaCCodeExpression* _tmp260_;
1525 ValaBlock* _tmp261_;
1526 ValaBlock* _tmp262_;
1527 ValaCCodeFunction* _tmp263_;
1528 ValaCCodeFunction* _tmp264_;
1529 _tmp177_ = collection_type;
1530 _tmp178_ = vala_data_type_copy (_tmp177_);
1531 _tmp179_ = _tmp178_;
1532 _tmp180_ = vala_foreach_statement_get_variable_name (stmt);
1533 _tmp181_ = _tmp180_;
1534 _tmp182_ = g_strconcat (_tmp181_, "_it", NULL);
1535 _tmp183_ = _tmp182_;
1536 _tmp184_ = vala_local_variable_new (_tmp179_, _tmp183_, NULL, NULL);
1537 _tmp185_ = _tmp184_;
1538 _g_free0 (_tmp183_);
1539 _vala_code_node_unref0 (_tmp179_);
1540 iterator_variable = _tmp185_;
1541 _tmp186_ = iterator_variable;
1542 vala_code_visitor_visit_local_variable ((ValaCodeVisitor*) self, _tmp186_);
1543 _tmp187_ = iterator_variable;
1544 _tmp188_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp187_);
1545 it_name = _tmp188_;
1546 _tmp189_ = it_name;
1547 _tmp190_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp189_);
1548 _tmp191_ = _tmp190_;
1549 _tmp192_ = vala_ccode_constant_new ("NULL");
1550 _tmp193_ = _tmp192_;
1551 _tmp194_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_INEQUALITY, _tmp191_, (ValaCCodeExpression*) _tmp193_);
1552 _tmp195_ = _tmp194_;
1553 _vala_ccode_node_unref0 (_tmp193_);
1554 _vala_ccode_node_unref0 (_tmp191_);
1555 ccond = _tmp195_;
1556 _tmp196_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1557 _tmp197_ = _tmp196_;
1558 _tmp198_ = it_name;
1559 _tmp199_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp198_);
1560 _tmp200_ = _tmp199_;
1561 _tmp201_ = collection_backup;
1562 _tmp202_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp201_);
1563 _tmp203_ = _tmp202_;
1564 _tmp204_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp203_);
1565 _tmp205_ = _tmp204_;
1566 _tmp206_ = vala_ccode_assignment_new (_tmp200_, _tmp205_, VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE);
1567 _tmp207_ = _tmp206_;
1568 _tmp208_ = ccond;
1569 _tmp209_ = it_name;
1570 _tmp210_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp209_);
1571 _tmp211_ = _tmp210_;
1572 _tmp212_ = it_name;
1573 _tmp213_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp212_);
1574 _tmp214_ = _tmp213_;
1575 _tmp215_ = vala_ccode_member_access_new_pointer (_tmp214_, "next");
1576 _tmp216_ = _tmp215_;
1577 _tmp217_ = vala_ccode_assignment_new (_tmp211_, (ValaCCodeExpression*) _tmp216_, VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE);
1578 _tmp218_ = _tmp217_;
1579 vala_ccode_function_open_for (_tmp197_, (ValaCCodeExpression*) _tmp207_, (ValaCCodeExpression*) _tmp208_, (ValaCCodeExpression*) _tmp218_);
1580 _vala_ccode_node_unref0 (_tmp218_);
1581 _vala_ccode_node_unref0 (_tmp216_);
1582 _vala_ccode_node_unref0 (_tmp214_);
1583 _vala_ccode_node_unref0 (_tmp211_);
1584 _vala_ccode_node_unref0 (_tmp207_);
1585 _vala_ccode_node_unref0 (_tmp205_);
1586 _g_free0 (_tmp203_);
1587 _vala_ccode_node_unref0 (_tmp200_);
1588 _tmp219_ = it_name;
1589 _tmp220_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp219_);
1590 _tmp221_ = _tmp220_;
1591 _tmp222_ = vala_ccode_member_access_new_pointer (_tmp221_, "data");
1592 _tmp223_ = (ValaCCodeExpression*) _tmp222_;
1593 _vala_ccode_node_unref0 (_tmp221_);
1594 element_expr = _tmp223_;
1595 _tmp224_ = collection_type;
1596 _tmp225_ = vala_data_type_get_type_arguments (_tmp224_);
1597 _tmp226_ = vala_collection_get_size ((ValaCollection*) _tmp225_);
1598 _tmp227_ = _tmp226_;
1599 if (_tmp227_ != 1) {
1600 ValaSourceReference* _tmp228_;
1601 ValaSourceReference* _tmp229_;
1602 _tmp228_ = vala_code_node_get_source_reference ((ValaCodeNode*) stmt);
1603 _tmp229_ = _tmp228_;
1604 vala_report_error (_tmp229_, "internal error: missing generic type argument");
1605 vala_code_node_set_error ((ValaCodeNode*) stmt, TRUE);
1606 _vala_ccode_node_unref0 (element_expr);
1607 _vala_ccode_node_unref0 (ccond);
1608 _g_free0 (it_name);
1609 _vala_code_node_unref0 (iterator_variable);
1610 _vala_code_node_unref0 (array_type);
1611 _vala_code_node_unref0 (collection_type);
1612 _vala_code_node_unref0 (collection_backup);
1613 return;
1614 }
1615 _tmp230_ = collection_type;
1616 _tmp231_ = vala_data_type_get_type_arguments (_tmp230_);
1617 _tmp232_ = vala_list_get (_tmp231_, 0);
1618 _tmp233_ = (ValaDataType*) _tmp232_;
1619 _tmp234_ = vala_data_type_copy (_tmp233_);
1620 _tmp235_ = _tmp234_;
1621 _vala_code_node_unref0 (_tmp233_);
1622 element_data_type = _tmp235_;
1623 _tmp236_ = element_data_type;
1624 vala_data_type_set_value_owned (_tmp236_, FALSE);
1625 _tmp237_ = element_expr;
1626 _tmp238_ = element_data_type;
1627 _tmp239_ = vala_ccode_base_module_convert_from_generic_pointer ((ValaCCodeBaseModule*) self, _tmp237_, _tmp238_);
1628 _vala_ccode_node_unref0 (element_expr);
1629 element_expr = _tmp239_;
1630 _tmp240_ = element_data_type;
1631 _tmp241_ = element_expr;
1632 _tmp242_ = vala_glib_value_new (_tmp240_, _tmp241_, FALSE);
1633 _tmp243_ = _tmp242_;
1634 _tmp244_ = vala_foreach_statement_get_type_reference (stmt);
1635 _tmp245_ = _tmp244_;
1636 _tmp246_ = vala_ccode_base_module_transform_value ((ValaCCodeBaseModule*) self, (ValaTargetValue*) _tmp243_, _tmp245_, (ValaCodeNode*) stmt);
1637 _tmp247_ = _tmp246_;
1638 _tmp248_ = vala_get_cvalue_ (_tmp247_);
1639 _tmp249_ = _vala_ccode_node_ref0 (_tmp248_);
1640 _vala_ccode_node_unref0 (element_expr);
1641 element_expr = _tmp249_;
1642 _vala_target_value_unref0 (_tmp247_);
1643 _vala_target_value_unref0 (_tmp243_);
1644 _tmp250_ = vala_foreach_statement_get_element_variable (stmt);
1645 _tmp251_ = _tmp250_;
1646 vala_code_visitor_visit_local_variable ((ValaCodeVisitor*) self, _tmp251_);
1647 _tmp252_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1648 _tmp253_ = _tmp252_;
1649 _tmp254_ = vala_foreach_statement_get_element_variable (stmt);
1650 _tmp255_ = _tmp254_;
1651 _tmp256_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp255_);
1652 _tmp257_ = _tmp256_;
1653 _tmp258_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp257_);
1654 _tmp259_ = _tmp258_;
1655 _tmp260_ = element_expr;
1656 vala_ccode_function_add_assignment (_tmp253_, _tmp259_, _tmp260_);
1657 _vala_ccode_node_unref0 (_tmp259_);
1658 _g_free0 (_tmp257_);
1659 _tmp261_ = vala_foreach_statement_get_body (stmt);
1660 _tmp262_ = _tmp261_;
1661 vala_code_node_emit ((ValaCodeNode*) _tmp262_, (ValaCodeGenerator*) self);
1662 _tmp263_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1663 _tmp264_ = _tmp263_;
1664 vala_ccode_function_close (_tmp264_);
1665 _vala_code_node_unref0 (element_data_type);
1666 _vala_ccode_node_unref0 (element_expr);
1667 _vala_ccode_node_unref0 (ccond);
1668 _g_free0 (it_name);
1669 _vala_code_node_unref0 (iterator_variable);
1670 } else {
1671 ValaExpression* _tmp265_;
1672 ValaExpression* _tmp266_;
1673 ValaDataType* _tmp267_;
1674 ValaDataType* _tmp268_;
1675 ValaClass* _tmp269_;
1676 ValaObjectType* _tmp270_;
1677 ValaObjectType* _tmp271_;
1678 gboolean _tmp272_;
1679 _tmp265_ = vala_foreach_statement_get_collection (stmt);
1680 _tmp266_ = _tmp265_;
1681 _tmp267_ = vala_expression_get_value_type (_tmp266_);
1682 _tmp268_ = _tmp267_;
1683 _tmp269_ = ((ValaCCodeBaseModule*) self)->gvaluearray_type;
1684 _tmp270_ = vala_object_type_new ((ValaObjectTypeSymbol*) _tmp269_);
1685 _tmp271_ = _tmp270_;
1686 _tmp272_ = vala_data_type_compatible (_tmp268_, (ValaDataType*) _tmp271_);
1687 _vala_code_node_unref0 (_tmp271_);
1688 if (_tmp272_) {
1689 ValaLocalVariable* iterator_variable = NULL;
1690 ValaDataType* _tmp273_;
1691 ValaDataType* _tmp274_;
1692 ValaDataType* _tmp275_;
1693 const gchar* _tmp276_;
1694 const gchar* _tmp277_;
1695 gchar* _tmp278_;
1696 gchar* _tmp279_;
1697 ValaLocalVariable* _tmp280_;
1698 ValaLocalVariable* _tmp281_;
1699 ValaLocalVariable* _tmp282_;
1700 gchar* arr_index = NULL;
1701 ValaLocalVariable* _tmp283_;
1702 gchar* _tmp284_;
1703 gchar* _tmp285_;
1704 gchar* _tmp286_;
1705 gchar* _tmp287_;
1706 ValaCCodeBinaryExpression* ccond = NULL;
1707 const gchar* _tmp288_;
1708 ValaCCodeExpression* _tmp289_;
1709 ValaCCodeExpression* _tmp290_;
1710 ValaLocalVariable* _tmp291_;
1711 gchar* _tmp292_;
1712 gchar* _tmp293_;
1713 ValaCCodeExpression* _tmp294_;
1714 ValaCCodeExpression* _tmp295_;
1715 ValaCCodeMemberAccess* _tmp296_;
1716 ValaCCodeMemberAccess* _tmp297_;
1717 ValaCCodeBinaryExpression* _tmp298_;
1718 ValaCCodeBinaryExpression* _tmp299_;
1719 ValaCCodeFunction* _tmp300_;
1720 ValaCCodeFunction* _tmp301_;
1721 const gchar* _tmp302_;
1722 ValaCCodeExpression* _tmp303_;
1723 ValaCCodeExpression* _tmp304_;
1724 ValaCCodeConstant* _tmp305_;
1725 ValaCCodeConstant* _tmp306_;
1726 ValaCCodeAssignment* _tmp307_;
1727 ValaCCodeAssignment* _tmp308_;
1728 ValaCCodeBinaryExpression* _tmp309_;
1729 const gchar* _tmp310_;
1730 ValaCCodeExpression* _tmp311_;
1731 ValaCCodeExpression* _tmp312_;
1732 const gchar* _tmp313_;
1733 ValaCCodeExpression* _tmp314_;
1734 ValaCCodeExpression* _tmp315_;
1735 ValaCCodeConstant* _tmp316_;
1736 ValaCCodeConstant* _tmp317_;
1737 ValaCCodeBinaryExpression* _tmp318_;
1738 ValaCCodeBinaryExpression* _tmp319_;
1739 ValaCCodeAssignment* _tmp320_;
1740 ValaCCodeAssignment* _tmp321_;
1741 ValaCCodeFunctionCall* get_item = NULL;
1742 ValaCCodeIdentifier* _tmp322_;
1743 ValaCCodeIdentifier* _tmp323_;
1744 ValaCCodeFunctionCall* _tmp324_;
1745 ValaCCodeFunctionCall* _tmp325_;
1746 ValaCCodeFunctionCall* _tmp326_;
1747 ValaLocalVariable* _tmp327_;
1748 gchar* _tmp328_;
1749 gchar* _tmp329_;
1750 ValaCCodeExpression* _tmp330_;
1751 ValaCCodeExpression* _tmp331_;
1752 ValaCCodeFunctionCall* _tmp332_;
1753 const gchar* _tmp333_;
1754 ValaCCodeExpression* _tmp334_;
1755 ValaCCodeExpression* _tmp335_;
1756 ValaCCodeExpression* element_expr = NULL;
1757 ValaCCodeFunctionCall* _tmp336_;
1758 ValaCCodeUnaryExpression* _tmp337_;
1759 ValaDataType* _tmp338_;
1760 ValaDataType* _tmp339_;
1761 gboolean _tmp340_;
1762 gboolean _tmp341_;
1763 ValaLocalVariable* _tmp354_;
1764 ValaLocalVariable* _tmp355_;
1765 ValaCCodeFunction* _tmp356_;
1766 ValaCCodeFunction* _tmp357_;
1767 ValaLocalVariable* _tmp358_;
1768 ValaLocalVariable* _tmp359_;
1769 gchar* _tmp360_;
1770 gchar* _tmp361_;
1771 ValaCCodeExpression* _tmp362_;
1772 ValaCCodeExpression* _tmp363_;
1773 ValaCCodeExpression* _tmp364_;
1774 ValaBlock* _tmp365_;
1775 ValaBlock* _tmp366_;
1776 ValaCCodeFunction* _tmp367_;
1777 ValaCCodeFunction* _tmp368_;
1778 _tmp273_ = ((ValaCCodeBaseModule*) self)->uint_type;
1779 _tmp274_ = vala_data_type_copy (_tmp273_);
1780 _tmp275_ = _tmp274_;
1781 _tmp276_ = vala_foreach_statement_get_variable_name (stmt);
1782 _tmp277_ = _tmp276_;
1783 _tmp278_ = g_strdup_printf ("%s_index", _tmp277_);
1784 _tmp279_ = _tmp278_;
1785 _tmp280_ = vala_local_variable_new (_tmp275_, _tmp279_, NULL, NULL);
1786 _tmp281_ = _tmp280_;
1787 _g_free0 (_tmp279_);
1788 _vala_code_node_unref0 (_tmp275_);
1789 iterator_variable = _tmp281_;
1790 _tmp282_ = iterator_variable;
1791 vala_code_visitor_visit_local_variable ((ValaCodeVisitor*) self, _tmp282_);
1792 _tmp283_ = iterator_variable;
1793 _tmp284_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp283_);
1794 _tmp285_ = _tmp284_;
1795 _tmp286_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, _tmp285_);
1796 _tmp287_ = _tmp286_;
1797 _g_free0 (_tmp285_);
1798 arr_index = _tmp287_;
1799 _tmp288_ = arr_index;
1800 _tmp289_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp288_);
1801 _tmp290_ = _tmp289_;
1802 _tmp291_ = collection_backup;
1803 _tmp292_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp291_);
1804 _tmp293_ = _tmp292_;
1805 _tmp294_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp293_);
1806 _tmp295_ = _tmp294_;
1807 _tmp296_ = vala_ccode_member_access_new_pointer (_tmp295_, "n_values");
1808 _tmp297_ = _tmp296_;
1809 _tmp298_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_LESS_THAN, _tmp290_, (ValaCCodeExpression*) _tmp297_);
1810 _tmp299_ = _tmp298_;
1811 _vala_ccode_node_unref0 (_tmp297_);
1812 _vala_ccode_node_unref0 (_tmp295_);
1813 _g_free0 (_tmp293_);
1814 _vala_ccode_node_unref0 (_tmp290_);
1815 ccond = _tmp299_;
1816 _tmp300_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1817 _tmp301_ = _tmp300_;
1818 _tmp302_ = arr_index;
1819 _tmp303_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp302_);
1820 _tmp304_ = _tmp303_;
1821 _tmp305_ = vala_ccode_constant_new ("0");
1822 _tmp306_ = _tmp305_;
1823 _tmp307_ = vala_ccode_assignment_new (_tmp304_, (ValaCCodeExpression*) _tmp306_, VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE);
1824 _tmp308_ = _tmp307_;
1825 _tmp309_ = ccond;
1826 _tmp310_ = arr_index;
1827 _tmp311_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp310_);
1828 _tmp312_ = _tmp311_;
1829 _tmp313_ = arr_index;
1830 _tmp314_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp313_);
1831 _tmp315_ = _tmp314_;
1832 _tmp316_ = vala_ccode_constant_new ("1");
1833 _tmp317_ = _tmp316_;
1834 _tmp318_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_PLUS, _tmp315_, (ValaCCodeExpression*) _tmp317_);
1835 _tmp319_ = _tmp318_;
1836 _tmp320_ = vala_ccode_assignment_new (_tmp312_, (ValaCCodeExpression*) _tmp319_, VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE);
1837 _tmp321_ = _tmp320_;
1838 vala_ccode_function_open_for (_tmp301_, (ValaCCodeExpression*) _tmp308_, (ValaCCodeExpression*) _tmp309_, (ValaCCodeExpression*) _tmp321_);
1839 _vala_ccode_node_unref0 (_tmp321_);
1840 _vala_ccode_node_unref0 (_tmp319_);
1841 _vala_ccode_node_unref0 (_tmp317_);
1842 _vala_ccode_node_unref0 (_tmp315_);
1843 _vala_ccode_node_unref0 (_tmp312_);
1844 _vala_ccode_node_unref0 (_tmp308_);
1845 _vala_ccode_node_unref0 (_tmp306_);
1846 _vala_ccode_node_unref0 (_tmp304_);
1847 _tmp322_ = vala_ccode_identifier_new ("g_value_array_get_nth");
1848 _tmp323_ = _tmp322_;
1849 _tmp324_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp323_);
1850 _tmp325_ = _tmp324_;
1851 _vala_ccode_node_unref0 (_tmp323_);
1852 get_item = _tmp325_;
1853 _tmp326_ = get_item;
1854 _tmp327_ = collection_backup;
1855 _tmp328_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp327_);
1856 _tmp329_ = _tmp328_;
1857 _tmp330_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp329_);
1858 _tmp331_ = _tmp330_;
1859 vala_ccode_function_call_add_argument (_tmp326_, _tmp331_);
1860 _vala_ccode_node_unref0 (_tmp331_);
1861 _g_free0 (_tmp329_);
1862 _tmp332_ = get_item;
1863 _tmp333_ = arr_index;
1864 _tmp334_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp333_);
1865 _tmp335_ = _tmp334_;
1866 vala_ccode_function_call_add_argument (_tmp332_, _tmp335_);
1867 _vala_ccode_node_unref0 (_tmp335_);
1868 _tmp336_ = get_item;
1869 _tmp337_ = vala_ccode_unary_expression_new (VALA_CCODE_UNARY_OPERATOR_POINTER_INDIRECTION, (ValaCCodeExpression*) _tmp336_);
1870 element_expr = (ValaCCodeExpression*) _tmp337_;
1871 _tmp338_ = vala_foreach_statement_get_type_reference (stmt);
1872 _tmp339_ = _tmp338_;
1873 _tmp340_ = vala_data_type_get_value_owned (_tmp339_);
1874 _tmp341_ = _tmp340_;
1875 if (_tmp341_) {
1876 ValaDataType* _tmp342_;
1877 ValaDataType* _tmp343_;
1878 ValaCCodeExpression* _tmp344_;
1879 ValaGLibValue* _tmp345_;
1880 ValaGLibValue* _tmp346_;
1881 ValaStruct* _tmp347_;
1882 ValaStructValueType* _tmp348_;
1883 ValaStructValueType* _tmp349_;
1884 ValaTargetValue* _tmp350_;
1885 ValaTargetValue* _tmp351_;
1886 ValaCCodeExpression* _tmp352_;
1887 ValaCCodeExpression* _tmp353_;
1888 _tmp342_ = vala_foreach_statement_get_type_reference (stmt);
1889 _tmp343_ = _tmp342_;
1890 _tmp344_ = element_expr;
1891 _tmp345_ = vala_glib_value_new (_tmp343_, _tmp344_, FALSE);
1892 _tmp346_ = _tmp345_;
1893 _tmp347_ = ((ValaCCodeBaseModule*) self)->gvalue_type;
1894 _tmp348_ = vala_struct_value_type_new (_tmp347_);
1895 _tmp349_ = _tmp348_;
1896 _tmp350_ = vala_ccode_base_module_copy_value ((ValaCCodeBaseModule*) self, (ValaTargetValue*) _tmp346_, (ValaCodeNode*) _tmp349_);
1897 _tmp351_ = _tmp350_;
1898 _tmp352_ = vala_get_cvalue_ (_tmp351_);
1899 _tmp353_ = _vala_ccode_node_ref0 (_tmp352_);
1900 _vala_ccode_node_unref0 (element_expr);
1901 element_expr = _tmp353_;
1902 _vala_target_value_unref0 (_tmp351_);
1903 _vala_code_node_unref0 (_tmp349_);
1904 _vala_target_value_unref0 (_tmp346_);
1905 }
1906 _tmp354_ = vala_foreach_statement_get_element_variable (stmt);
1907 _tmp355_ = _tmp354_;
1908 vala_code_visitor_visit_local_variable ((ValaCodeVisitor*) self, _tmp355_);
1909 _tmp356_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1910 _tmp357_ = _tmp356_;
1911 _tmp358_ = vala_foreach_statement_get_element_variable (stmt);
1912 _tmp359_ = _tmp358_;
1913 _tmp360_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp359_);
1914 _tmp361_ = _tmp360_;
1915 _tmp362_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp361_);
1916 _tmp363_ = _tmp362_;
1917 _tmp364_ = element_expr;
1918 vala_ccode_function_add_assignment (_tmp357_, _tmp363_, _tmp364_);
1919 _vala_ccode_node_unref0 (_tmp363_);
1920 _g_free0 (_tmp361_);
1921 _tmp365_ = vala_foreach_statement_get_body (stmt);
1922 _tmp366_ = _tmp365_;
1923 vala_code_node_emit ((ValaCodeNode*) _tmp366_, (ValaCodeGenerator*) self);
1924 _tmp367_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1925 _tmp368_ = _tmp367_;
1926 vala_ccode_function_close (_tmp368_);
1927 _vala_ccode_node_unref0 (element_expr);
1928 _vala_ccode_node_unref0 (get_item);
1929 _vala_ccode_node_unref0 (ccond);
1930 _g_free0 (arr_index);
1931 _vala_code_node_unref0 (iterator_variable);
1932 } else {
1933 ValaSourceReference* _tmp369_;
1934 ValaSourceReference* _tmp370_;
1935 _tmp369_ = vala_code_node_get_source_reference ((ValaCodeNode*) stmt);
1936 _tmp370_ = _tmp369_;
1937 vala_report_error (_tmp370_, "internal error: unsupported collection type");
1938 vala_code_node_set_error ((ValaCodeNode*) stmt, TRUE);
1939 _vala_code_node_unref0 (array_type);
1940 _vala_code_node_unref0 (collection_type);
1941 _vala_code_node_unref0 (collection_backup);
1942 return;
1943 }
1944 }
1945 }
1946 {
1947 ValaList* _local_list = NULL;
1948 ValaList* _tmp371_;
1949 ValaList* _tmp372_;
1950 gint _local_size = 0;
1951 ValaList* _tmp373_;
1952 gint _tmp374_;
1953 gint _tmp375_;
1954 gint _local_index = 0;
1955 _tmp371_ = vala_block_get_local_variables ((ValaBlock*) stmt);
1956 _tmp372_ = _vala_iterable_ref0 (_tmp371_);
1957 _local_list = _tmp372_;
1958 _tmp373_ = _local_list;
1959 _tmp374_ = vala_collection_get_size ((ValaCollection*) _tmp373_);
1960 _tmp375_ = _tmp374_;
1961 _local_size = _tmp375_;
1962 _local_index = -1;
1963 while (TRUE) {
1964 gint _tmp376_;
1965 gint _tmp377_;
1966 ValaLocalVariable* local = NULL;
1967 ValaList* _tmp378_;
1968 gpointer _tmp379_;
1969 ValaLocalVariable* _tmp380_;
1970 ValaDataType* _tmp381_;
1971 ValaDataType* _tmp382_;
1972 _local_index = _local_index + 1;
1973 _tmp376_ = _local_index;
1974 _tmp377_ = _local_size;
1975 if (!(_tmp376_ < _tmp377_)) {
1976 break;
1977 }
1978 _tmp378_ = _local_list;
1979 _tmp379_ = vala_list_get (_tmp378_, _local_index);
1980 local = (ValaLocalVariable*) _tmp379_;
1981 _tmp380_ = local;
1982 _tmp381_ = vala_variable_get_variable_type ((ValaVariable*) _tmp380_);
1983 _tmp382_ = _tmp381_;
1984 if (vala_ccode_base_module_requires_destroy (_tmp382_)) {
1985 ValaCCodeFunction* _tmp383_;
1986 ValaCCodeFunction* _tmp384_;
1987 ValaLocalVariable* _tmp385_;
1988 ValaCCodeExpression* _tmp386_;
1989 ValaCCodeExpression* _tmp387_;
1990 _tmp383_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1991 _tmp384_ = _tmp383_;
1992 _tmp385_ = local;
1993 _tmp386_ = vala_ccode_base_module_destroy_local ((ValaCCodeBaseModule*) self, _tmp385_);
1994 _tmp387_ = _tmp386_;
1995 vala_ccode_function_add_expression (_tmp384_, _tmp387_);
1996 _vala_ccode_node_unref0 (_tmp387_);
1997 }
1998 _vala_code_node_unref0 (local);
1999 }
2000 _vala_iterable_unref0 (_local_list);
2001 }
2002 _tmp388_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
2003 _tmp389_ = _tmp388_;
2004 vala_ccode_function_close (_tmp389_);
2005 _vala_code_node_unref0 (array_type);
2006 _vala_code_node_unref0 (collection_type);
2007 _vala_code_node_unref0 (collection_backup);
2008 }
2009
2010 static void
vala_ccode_control_flow_module_real_visit_break_statement(ValaCodeVisitor * base,ValaBreakStatement * stmt)2011 vala_ccode_control_flow_module_real_visit_break_statement (ValaCodeVisitor* base,
2012 ValaBreakStatement* stmt)
2013 {
2014 ValaCCodeControlFlowModule * self;
2015 ValaSymbol* _tmp0_;
2016 ValaSymbol* _tmp1_;
2017 ValaCCodeFunction* _tmp2_;
2018 ValaCCodeFunction* _tmp3_;
2019 self = (ValaCCodeControlFlowModule*) base;
2020 g_return_if_fail (stmt != NULL);
2021 _tmp0_ = vala_ccode_base_module_get_current_symbol ((ValaCCodeBaseModule*) self);
2022 _tmp1_ = _tmp0_;
2023 vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, _tmp1_, (ValaStatement*) stmt, NULL);
2024 _tmp2_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
2025 _tmp3_ = _tmp2_;
2026 vala_ccode_function_add_break (_tmp3_);
2027 }
2028
2029 static void
vala_ccode_control_flow_module_real_visit_continue_statement(ValaCodeVisitor * base,ValaContinueStatement * stmt)2030 vala_ccode_control_flow_module_real_visit_continue_statement (ValaCodeVisitor* base,
2031 ValaContinueStatement* stmt)
2032 {
2033 ValaCCodeControlFlowModule * self;
2034 ValaSymbol* _tmp0_;
2035 ValaSymbol* _tmp1_;
2036 ValaCCodeFunction* _tmp2_;
2037 ValaCCodeFunction* _tmp3_;
2038 self = (ValaCCodeControlFlowModule*) base;
2039 g_return_if_fail (stmt != NULL);
2040 _tmp0_ = vala_ccode_base_module_get_current_symbol ((ValaCCodeBaseModule*) self);
2041 _tmp1_ = _tmp0_;
2042 vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, _tmp1_, (ValaStatement*) stmt, NULL);
2043 _tmp2_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
2044 _tmp3_ = _tmp2_;
2045 vala_ccode_function_add_continue (_tmp3_);
2046 }
2047
2048 ValaCCodeControlFlowModule*
vala_ccode_control_flow_module_construct(GType object_type)2049 vala_ccode_control_flow_module_construct (GType object_type)
2050 {
2051 ValaCCodeControlFlowModule* self = NULL;
2052 self = (ValaCCodeControlFlowModule*) vala_ccode_method_module_construct (object_type);
2053 return self;
2054 }
2055
2056 static void
vala_ccode_control_flow_module_class_init(ValaCCodeControlFlowModuleClass * klass,gpointer klass_data)2057 vala_ccode_control_flow_module_class_init (ValaCCodeControlFlowModuleClass * klass,
2058 gpointer klass_data)
2059 {
2060 vala_ccode_control_flow_module_parent_class = g_type_class_peek_parent (klass);
2061 ((ValaCodeVisitorClass *) klass)->visit_if_statement = (void (*) (ValaCodeVisitor*, ValaIfStatement*)) vala_ccode_control_flow_module_real_visit_if_statement;
2062 ((ValaCodeVisitorClass *) klass)->visit_switch_statement = (void (*) (ValaCodeVisitor*, ValaSwitchStatement*)) vala_ccode_control_flow_module_real_visit_switch_statement;
2063 ((ValaCodeVisitorClass *) klass)->visit_switch_label = (void (*) (ValaCodeVisitor*, ValaSwitchLabel*)) vala_ccode_control_flow_module_real_visit_switch_label;
2064 ((ValaCodeVisitorClass *) klass)->visit_loop = (void (*) (ValaCodeVisitor*, ValaLoop*)) vala_ccode_control_flow_module_real_visit_loop;
2065 ((ValaCodeVisitorClass *) klass)->visit_foreach_statement = (void (*) (ValaCodeVisitor*, ValaForeachStatement*)) vala_ccode_control_flow_module_real_visit_foreach_statement;
2066 ((ValaCodeVisitorClass *) klass)->visit_break_statement = (void (*) (ValaCodeVisitor*, ValaBreakStatement*)) vala_ccode_control_flow_module_real_visit_break_statement;
2067 ((ValaCodeVisitorClass *) klass)->visit_continue_statement = (void (*) (ValaCodeVisitor*, ValaContinueStatement*)) vala_ccode_control_flow_module_real_visit_continue_statement;
2068 }
2069
2070 static void
vala_ccode_control_flow_module_instance_init(ValaCCodeControlFlowModule * self,gpointer klass)2071 vala_ccode_control_flow_module_instance_init (ValaCCodeControlFlowModule * self,
2072 gpointer klass)
2073 {
2074 }
2075
2076 static GType
vala_ccode_control_flow_module_get_type_once(void)2077 vala_ccode_control_flow_module_get_type_once (void)
2078 {
2079 static const GTypeInfo g_define_type_info = { sizeof (ValaCCodeControlFlowModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_ccode_control_flow_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCCodeControlFlowModule), 0, (GInstanceInitFunc) vala_ccode_control_flow_module_instance_init, NULL };
2080 GType vala_ccode_control_flow_module_type_id;
2081 vala_ccode_control_flow_module_type_id = g_type_register_static (VALA_TYPE_CCODE_METHOD_MODULE, "ValaCCodeControlFlowModule", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
2082 return vala_ccode_control_flow_module_type_id;
2083 }
2084
2085 GType
vala_ccode_control_flow_module_get_type(void)2086 vala_ccode_control_flow_module_get_type (void)
2087 {
2088 static volatile gsize vala_ccode_control_flow_module_type_id__volatile = 0;
2089 if (g_once_init_enter (&vala_ccode_control_flow_module_type_id__volatile)) {
2090 GType vala_ccode_control_flow_module_type_id;
2091 vala_ccode_control_flow_module_type_id = vala_ccode_control_flow_module_get_type_once ();
2092 g_once_init_leave (&vala_ccode_control_flow_module_type_id__volatile, vala_ccode_control_flow_module_type_id);
2093 }
2094 return vala_ccode_control_flow_module_type_id__volatile;
2095 }
2096
2097