1 /* valadostatement.c generated by valac, the Vala compiler
2  * generated from valadostatement.vala, do not modify */
3 
4 /* valadostatement.vala
5  *
6  * Copyright (C) 2006-2009  Jürg Billeter
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12 
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17 
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
21  *
22  * Author:
23  * 	Jürg Billeter <j@bitron.ch>
24  */
25 
26 #include "vala.h"
27 #include <glib.h>
28 
29 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
30 #define _g_free0(var) (var = (g_free (var), NULL))
31 
32 struct _ValaDoStatementPrivate {
33 	ValaExpression* _condition;
34 	ValaBlock* _body;
35 };
36 
37 static gint ValaDoStatement_private_offset;
38 static gpointer vala_do_statement_parent_class = NULL;
39 static ValaStatementIface * vala_do_statement_vala_statement_parent_iface = NULL;
40 
41 static void vala_do_statement_real_accept (ValaCodeNode* base,
42                                     ValaCodeVisitor* visitor);
43 static void vala_do_statement_real_accept_children (ValaCodeNode* base,
44                                              ValaCodeVisitor* visitor);
45 static gboolean vala_do_statement_always_true (ValaDoStatement* self,
46                                         ValaExpression* condition);
47 static void vala_do_statement_real_replace_expression (ValaCodeNode* base,
48                                                 ValaExpression* old_node,
49                                                 ValaExpression* new_node);
50 static gboolean vala_do_statement_real_check (ValaCodeNode* base,
51                                        ValaCodeContext* context);
52 static void vala_do_statement_finalize (ValaCodeNode * obj);
53 static GType vala_do_statement_get_type_once (void);
54 
55 static inline gpointer
vala_do_statement_get_instance_private(ValaDoStatement * self)56 vala_do_statement_get_instance_private (ValaDoStatement* self)
57 {
58 	return G_STRUCT_MEMBER_P (self, ValaDoStatement_private_offset);
59 }
60 
61 ValaBlock*
vala_do_statement_get_body(ValaDoStatement * self)62 vala_do_statement_get_body (ValaDoStatement* self)
63 {
64 	ValaBlock* result;
65 	ValaBlock* _tmp0_;
66 	g_return_val_if_fail (self != NULL, NULL);
67 	_tmp0_ = self->priv->_body;
68 	result = _tmp0_;
69 	return result;
70 }
71 
72 static gpointer
_vala_code_node_ref0(gpointer self)73 _vala_code_node_ref0 (gpointer self)
74 {
75 	return self ? vala_code_node_ref (self) : NULL;
76 }
77 
78 void
vala_do_statement_set_body(ValaDoStatement * self,ValaBlock * value)79 vala_do_statement_set_body (ValaDoStatement* self,
80                             ValaBlock* value)
81 {
82 	ValaBlock* _tmp0_;
83 	ValaBlock* _tmp1_;
84 	g_return_if_fail (self != NULL);
85 	_tmp0_ = _vala_code_node_ref0 (value);
86 	_vala_code_node_unref0 (self->priv->_body);
87 	self->priv->_body = _tmp0_;
88 	_tmp1_ = self->priv->_body;
89 	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp1_, (ValaCodeNode*) self);
90 }
91 
92 ValaExpression*
vala_do_statement_get_condition(ValaDoStatement * self)93 vala_do_statement_get_condition (ValaDoStatement* self)
94 {
95 	ValaExpression* result;
96 	ValaExpression* _tmp0_;
97 	g_return_val_if_fail (self != NULL, NULL);
98 	_tmp0_ = self->priv->_condition;
99 	result = _tmp0_;
100 	return result;
101 }
102 
103 void
vala_do_statement_set_condition(ValaDoStatement * self,ValaExpression * value)104 vala_do_statement_set_condition (ValaDoStatement* self,
105                                  ValaExpression* value)
106 {
107 	ValaExpression* _tmp0_;
108 	ValaExpression* _tmp1_;
109 	g_return_if_fail (self != NULL);
110 	_tmp0_ = _vala_code_node_ref0 (value);
111 	_vala_code_node_unref0 (self->priv->_condition);
112 	self->priv->_condition = _tmp0_;
113 	_tmp1_ = self->priv->_condition;
114 	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp1_, (ValaCodeNode*) self);
115 }
116 
117 /**
118  * Creates a new do statement.
119  *
120  * @param body              loop body
121  * @param condition         loop condition
122  * @param source_reference  reference to source code
123  * @return                  newly created do statement
124  */
125 ValaDoStatement*
vala_do_statement_construct(GType object_type,ValaBlock * body,ValaExpression * condition,ValaSourceReference * source_reference)126 vala_do_statement_construct (GType object_type,
127                              ValaBlock* body,
128                              ValaExpression* condition,
129                              ValaSourceReference* source_reference)
130 {
131 	ValaDoStatement* self = NULL;
132 	g_return_val_if_fail (body != NULL, NULL);
133 	g_return_val_if_fail (condition != NULL, NULL);
134 	self = (ValaDoStatement*) vala_code_node_construct (object_type);
135 	vala_do_statement_set_condition (self, condition);
136 	vala_code_node_set_source_reference ((ValaCodeNode*) self, source_reference);
137 	vala_do_statement_set_body (self, body);
138 	return self;
139 }
140 
141 ValaDoStatement*
vala_do_statement_new(ValaBlock * body,ValaExpression * condition,ValaSourceReference * source_reference)142 vala_do_statement_new (ValaBlock* body,
143                        ValaExpression* condition,
144                        ValaSourceReference* source_reference)
145 {
146 	return vala_do_statement_construct (VALA_TYPE_DO_STATEMENT, body, condition, source_reference);
147 }
148 
149 static void
vala_do_statement_real_accept(ValaCodeNode * base,ValaCodeVisitor * visitor)150 vala_do_statement_real_accept (ValaCodeNode* base,
151                                ValaCodeVisitor* visitor)
152 {
153 	ValaDoStatement * self;
154 	self = (ValaDoStatement*) base;
155 	g_return_if_fail (visitor != NULL);
156 	vala_code_visitor_visit_do_statement (visitor, self);
157 }
158 
159 static void
vala_do_statement_real_accept_children(ValaCodeNode * base,ValaCodeVisitor * visitor)160 vala_do_statement_real_accept_children (ValaCodeNode* base,
161                                         ValaCodeVisitor* visitor)
162 {
163 	ValaDoStatement * self;
164 	ValaBlock* _tmp0_;
165 	ValaBlock* _tmp1_;
166 	ValaExpression* _tmp2_;
167 	ValaExpression* _tmp3_;
168 	ValaExpression* _tmp4_;
169 	ValaExpression* _tmp5_;
170 	self = (ValaDoStatement*) base;
171 	g_return_if_fail (visitor != NULL);
172 	_tmp0_ = vala_do_statement_get_body (self);
173 	_tmp1_ = _tmp0_;
174 	vala_code_node_accept ((ValaCodeNode*) _tmp1_, visitor);
175 	_tmp2_ = vala_do_statement_get_condition (self);
176 	_tmp3_ = _tmp2_;
177 	vala_code_node_accept ((ValaCodeNode*) _tmp3_, visitor);
178 	_tmp4_ = vala_do_statement_get_condition (self);
179 	_tmp5_ = _tmp4_;
180 	vala_code_visitor_visit_end_full_expression (visitor, _tmp5_);
181 }
182 
183 static gboolean
vala_do_statement_always_true(ValaDoStatement * self,ValaExpression * condition)184 vala_do_statement_always_true (ValaDoStatement* self,
185                                ValaExpression* condition)
186 {
187 	ValaBooleanLiteral* literal = NULL;
188 	gboolean _tmp0_ = FALSE;
189 	ValaBooleanLiteral* _tmp1_;
190 	gboolean result = FALSE;
191 	g_return_val_if_fail (self != NULL, FALSE);
192 	g_return_val_if_fail (condition != NULL, FALSE);
193 	literal = VALA_IS_BOOLEAN_LITERAL (condition) ? ((ValaBooleanLiteral*) condition) : NULL;
194 	_tmp1_ = literal;
195 	if (_tmp1_ != NULL) {
196 		ValaBooleanLiteral* _tmp2_;
197 		gboolean _tmp3_;
198 		gboolean _tmp4_;
199 		_tmp2_ = literal;
200 		_tmp3_ = vala_boolean_literal_get_value (_tmp2_);
201 		_tmp4_ = _tmp3_;
202 		_tmp0_ = _tmp4_;
203 	} else {
204 		_tmp0_ = FALSE;
205 	}
206 	result = _tmp0_;
207 	return result;
208 }
209 
210 static void
vala_do_statement_real_replace_expression(ValaCodeNode * base,ValaExpression * old_node,ValaExpression * new_node)211 vala_do_statement_real_replace_expression (ValaCodeNode* base,
212                                            ValaExpression* old_node,
213                                            ValaExpression* new_node)
214 {
215 	ValaDoStatement * self;
216 	ValaExpression* _tmp0_;
217 	ValaExpression* _tmp1_;
218 	self = (ValaDoStatement*) base;
219 	g_return_if_fail (old_node != NULL);
220 	g_return_if_fail (new_node != NULL);
221 	_tmp0_ = vala_do_statement_get_condition (self);
222 	_tmp1_ = _tmp0_;
223 	if (_tmp1_ == old_node) {
224 		vala_do_statement_set_condition (self, new_node);
225 	}
226 }
227 
228 static gboolean
vala_do_statement_real_check(ValaCodeNode * base,ValaCodeContext * context)229 vala_do_statement_real_check (ValaCodeNode* base,
230                               ValaCodeContext* context)
231 {
232 	ValaDoStatement * self;
233 	gboolean _tmp0_;
234 	gboolean _tmp1_;
235 	ValaExpression* _tmp4_;
236 	ValaExpression* _tmp5_;
237 	ValaBlock* block = NULL;
238 	ValaSourceReference* _tmp18_;
239 	ValaSourceReference* _tmp19_;
240 	ValaBlock* _tmp20_;
241 	ValaLocalVariable* first_local = NULL;
242 	ValaSemanticAnalyzer* _tmp21_;
243 	ValaSemanticAnalyzer* _tmp22_;
244 	ValaDataType* _tmp23_;
245 	ValaDataType* _tmp24_;
246 	ValaDataType* _tmp25_;
247 	gchar* _tmp26_;
248 	gchar* _tmp27_;
249 	ValaSourceReference* _tmp28_;
250 	ValaSourceReference* _tmp29_;
251 	ValaBooleanLiteral* _tmp30_;
252 	ValaBooleanLiteral* _tmp31_;
253 	ValaSourceReference* _tmp32_;
254 	ValaSourceReference* _tmp33_;
255 	ValaLocalVariable* _tmp34_;
256 	ValaLocalVariable* _tmp35_;
257 	ValaBlock* _tmp36_;
258 	ValaLocalVariable* _tmp37_;
259 	ValaSourceReference* _tmp38_;
260 	ValaSourceReference* _tmp39_;
261 	ValaDeclarationStatement* _tmp40_;
262 	ValaDeclarationStatement* _tmp41_;
263 	ValaUnaryExpression* if_condition = NULL;
264 	ValaExpression* _tmp42_;
265 	ValaExpression* _tmp43_;
266 	ValaExpression* _tmp44_;
267 	ValaExpression* _tmp45_;
268 	ValaSourceReference* _tmp46_;
269 	ValaSourceReference* _tmp47_;
270 	ValaUnaryExpression* _tmp48_;
271 	ValaBlock* true_block = NULL;
272 	ValaExpression* _tmp49_;
273 	ValaExpression* _tmp50_;
274 	ValaSourceReference* _tmp51_;
275 	ValaSourceReference* _tmp52_;
276 	ValaBlock* _tmp53_;
277 	ValaBlock* _tmp54_;
278 	ValaExpression* _tmp55_;
279 	ValaExpression* _tmp56_;
280 	ValaSourceReference* _tmp57_;
281 	ValaSourceReference* _tmp58_;
282 	ValaBreakStatement* _tmp59_;
283 	ValaBreakStatement* _tmp60_;
284 	ValaIfStatement* if_stmt = NULL;
285 	ValaUnaryExpression* _tmp61_;
286 	ValaBlock* _tmp62_;
287 	ValaExpression* _tmp63_;
288 	ValaExpression* _tmp64_;
289 	ValaSourceReference* _tmp65_;
290 	ValaSourceReference* _tmp66_;
291 	ValaIfStatement* _tmp67_;
292 	ValaBlock* condition_block = NULL;
293 	ValaExpression* _tmp68_;
294 	ValaExpression* _tmp69_;
295 	ValaSourceReference* _tmp70_;
296 	ValaSourceReference* _tmp71_;
297 	ValaBlock* _tmp72_;
298 	ValaBlock* _tmp73_;
299 	ValaIfStatement* _tmp74_;
300 	ValaIfStatement* first_if = NULL;
301 	ValaLocalVariable* _tmp75_;
302 	const gchar* _tmp76_;
303 	const gchar* _tmp77_;
304 	ValaSourceReference* _tmp78_;
305 	ValaSourceReference* _tmp79_;
306 	ValaMemberAccess* _tmp80_;
307 	ValaMemberAccess* _tmp81_;
308 	ValaSourceReference* _tmp82_;
309 	ValaSourceReference* _tmp83_;
310 	ValaUnaryExpression* _tmp84_;
311 	ValaUnaryExpression* _tmp85_;
312 	ValaBlock* _tmp86_;
313 	ValaSourceReference* _tmp87_;
314 	ValaSourceReference* _tmp88_;
315 	ValaIfStatement* _tmp89_;
316 	ValaIfStatement* _tmp90_;
317 	ValaBlock* _tmp91_;
318 	ValaBlock* _tmp92_;
319 	ValaIfStatement* _tmp93_;
320 	ValaBlock* _tmp94_;
321 	ValaBlock* _tmp95_;
322 	ValaLocalVariable* _tmp96_;
323 	const gchar* _tmp97_;
324 	const gchar* _tmp98_;
325 	ValaSourceReference* _tmp99_;
326 	ValaSourceReference* _tmp100_;
327 	ValaMemberAccess* _tmp101_;
328 	ValaMemberAccess* _tmp102_;
329 	ValaSourceReference* _tmp103_;
330 	ValaSourceReference* _tmp104_;
331 	ValaBooleanLiteral* _tmp105_;
332 	ValaBooleanLiteral* _tmp106_;
333 	ValaSourceReference* _tmp107_;
334 	ValaSourceReference* _tmp108_;
335 	ValaAssignment* _tmp109_;
336 	ValaAssignment* _tmp110_;
337 	ValaSourceReference* _tmp111_;
338 	ValaSourceReference* _tmp112_;
339 	ValaExpressionStatement* _tmp113_;
340 	ValaExpressionStatement* _tmp114_;
341 	ValaBlock* _tmp115_;
342 	ValaBlock* _tmp116_;
343 	ValaBlock* _tmp117_;
344 	ValaSourceReference* _tmp118_;
345 	ValaSourceReference* _tmp119_;
346 	ValaLoop* _tmp120_;
347 	ValaLoop* _tmp121_;
348 	ValaBlock* parent_block = NULL;
349 	ValaCodeNode* _tmp122_;
350 	ValaCodeNode* _tmp123_;
351 	ValaBlock* _tmp124_;
352 	ValaBlock* _tmp125_;
353 	ValaBlock* _tmp126_;
354 	gboolean _tmp127_;
355 	gboolean _tmp128_;
356 	gboolean result = FALSE;
357 	self = (ValaDoStatement*) base;
358 	g_return_val_if_fail (context != NULL, FALSE);
359 	_tmp0_ = vala_code_node_get_checked ((ValaCodeNode*) self);
360 	_tmp1_ = _tmp0_;
361 	if (_tmp1_) {
362 		gboolean _tmp2_;
363 		gboolean _tmp3_;
364 		_tmp2_ = vala_code_node_get_error ((ValaCodeNode*) self);
365 		_tmp3_ = _tmp2_;
366 		result = !_tmp3_;
367 		return result;
368 	}
369 	vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
370 	_tmp4_ = vala_do_statement_get_condition (self);
371 	_tmp5_ = _tmp4_;
372 	if (vala_do_statement_always_true (self, _tmp5_)) {
373 		ValaLoop* loop = NULL;
374 		ValaBlock* _tmp6_;
375 		ValaBlock* _tmp7_;
376 		ValaSourceReference* _tmp8_;
377 		ValaSourceReference* _tmp9_;
378 		ValaLoop* _tmp10_;
379 		ValaBlock* parent_block = NULL;
380 		ValaCodeNode* _tmp11_;
381 		ValaCodeNode* _tmp12_;
382 		ValaBlock* _tmp13_;
383 		ValaLoop* _tmp14_;
384 		ValaLoop* _tmp15_;
385 		gboolean _tmp16_;
386 		gboolean _tmp17_;
387 		_tmp6_ = vala_do_statement_get_body (self);
388 		_tmp7_ = _tmp6_;
389 		_tmp8_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
390 		_tmp9_ = _tmp8_;
391 		_tmp10_ = vala_loop_new (_tmp7_, _tmp9_);
392 		loop = _tmp10_;
393 		_tmp11_ = vala_code_node_get_parent_node ((ValaCodeNode*) self);
394 		_tmp12_ = _tmp11_;
395 		parent_block = G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, VALA_TYPE_BLOCK, ValaBlock);
396 		_tmp13_ = parent_block;
397 		_tmp14_ = loop;
398 		vala_block_replace_statement (_tmp13_, (ValaStatement*) self, (ValaStatement*) _tmp14_);
399 		_tmp15_ = loop;
400 		if (!vala_code_node_check ((ValaCodeNode*) _tmp15_, context)) {
401 			vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
402 		}
403 		_tmp16_ = vala_code_node_get_error ((ValaCodeNode*) self);
404 		_tmp17_ = _tmp16_;
405 		result = !_tmp17_;
406 		_vala_code_node_unref0 (loop);
407 		return result;
408 	}
409 	_tmp18_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
410 	_tmp19_ = _tmp18_;
411 	_tmp20_ = vala_block_new (_tmp19_);
412 	block = _tmp20_;
413 	_tmp21_ = vala_code_context_get_analyzer (context);
414 	_tmp22_ = _tmp21_;
415 	_tmp23_ = _tmp22_->bool_type;
416 	_tmp24_ = vala_data_type_copy (_tmp23_);
417 	_tmp25_ = _tmp24_;
418 	_tmp26_ = vala_code_node_get_temp_name ();
419 	_tmp27_ = _tmp26_;
420 	_tmp28_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
421 	_tmp29_ = _tmp28_;
422 	_tmp30_ = vala_boolean_literal_new (TRUE, _tmp29_);
423 	_tmp31_ = _tmp30_;
424 	_tmp32_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
425 	_tmp33_ = _tmp32_;
426 	_tmp34_ = vala_local_variable_new (_tmp25_, _tmp27_, (ValaExpression*) _tmp31_, _tmp33_);
427 	_tmp35_ = _tmp34_;
428 	_vala_code_node_unref0 (_tmp31_);
429 	_g_free0 (_tmp27_);
430 	_vala_code_node_unref0 (_tmp25_);
431 	first_local = _tmp35_;
432 	_tmp36_ = block;
433 	_tmp37_ = first_local;
434 	_tmp38_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
435 	_tmp39_ = _tmp38_;
436 	_tmp40_ = vala_declaration_statement_new ((ValaSymbol*) _tmp37_, _tmp39_);
437 	_tmp41_ = _tmp40_;
438 	vala_block_add_statement (_tmp36_, (ValaStatement*) _tmp41_);
439 	_vala_code_node_unref0 (_tmp41_);
440 	_tmp42_ = vala_do_statement_get_condition (self);
441 	_tmp43_ = _tmp42_;
442 	_tmp44_ = vala_do_statement_get_condition (self);
443 	_tmp45_ = _tmp44_;
444 	_tmp46_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp45_);
445 	_tmp47_ = _tmp46_;
446 	_tmp48_ = vala_unary_expression_new (VALA_UNARY_OPERATOR_LOGICAL_NEGATION, _tmp43_, _tmp47_);
447 	if_condition = _tmp48_;
448 	_tmp49_ = vala_do_statement_get_condition (self);
449 	_tmp50_ = _tmp49_;
450 	_tmp51_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp50_);
451 	_tmp52_ = _tmp51_;
452 	_tmp53_ = vala_block_new (_tmp52_);
453 	true_block = _tmp53_;
454 	_tmp54_ = true_block;
455 	_tmp55_ = vala_do_statement_get_condition (self);
456 	_tmp56_ = _tmp55_;
457 	_tmp57_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp56_);
458 	_tmp58_ = _tmp57_;
459 	_tmp59_ = vala_break_statement_new (_tmp58_);
460 	_tmp60_ = _tmp59_;
461 	vala_block_add_statement (_tmp54_, (ValaStatement*) _tmp60_);
462 	_vala_code_node_unref0 (_tmp60_);
463 	_tmp61_ = if_condition;
464 	_tmp62_ = true_block;
465 	_tmp63_ = vala_do_statement_get_condition (self);
466 	_tmp64_ = _tmp63_;
467 	_tmp65_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp64_);
468 	_tmp66_ = _tmp65_;
469 	_tmp67_ = vala_if_statement_new ((ValaExpression*) _tmp61_, _tmp62_, NULL, _tmp66_);
470 	if_stmt = _tmp67_;
471 	_tmp68_ = vala_do_statement_get_condition (self);
472 	_tmp69_ = _tmp68_;
473 	_tmp70_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp69_);
474 	_tmp71_ = _tmp70_;
475 	_tmp72_ = vala_block_new (_tmp71_);
476 	condition_block = _tmp72_;
477 	_tmp73_ = condition_block;
478 	_tmp74_ = if_stmt;
479 	vala_block_add_statement (_tmp73_, (ValaStatement*) _tmp74_);
480 	_tmp75_ = first_local;
481 	_tmp76_ = vala_symbol_get_name ((ValaSymbol*) _tmp75_);
482 	_tmp77_ = _tmp76_;
483 	_tmp78_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
484 	_tmp79_ = _tmp78_;
485 	_tmp80_ = vala_member_access_new_simple (_tmp77_, _tmp79_);
486 	_tmp81_ = _tmp80_;
487 	_tmp82_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
488 	_tmp83_ = _tmp82_;
489 	_tmp84_ = vala_unary_expression_new (VALA_UNARY_OPERATOR_LOGICAL_NEGATION, (ValaExpression*) _tmp81_, _tmp83_);
490 	_tmp85_ = _tmp84_;
491 	_tmp86_ = condition_block;
492 	_tmp87_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
493 	_tmp88_ = _tmp87_;
494 	_tmp89_ = vala_if_statement_new ((ValaExpression*) _tmp85_, _tmp86_, NULL, _tmp88_);
495 	_tmp90_ = _tmp89_;
496 	_vala_code_node_unref0 (_tmp85_);
497 	_vala_code_node_unref0 (_tmp81_);
498 	first_if = _tmp90_;
499 	_tmp91_ = vala_do_statement_get_body (self);
500 	_tmp92_ = _tmp91_;
501 	_tmp93_ = first_if;
502 	vala_block_insert_statement (_tmp92_, 0, (ValaStatement*) _tmp93_);
503 	_tmp94_ = vala_do_statement_get_body (self);
504 	_tmp95_ = _tmp94_;
505 	_tmp96_ = first_local;
506 	_tmp97_ = vala_symbol_get_name ((ValaSymbol*) _tmp96_);
507 	_tmp98_ = _tmp97_;
508 	_tmp99_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
509 	_tmp100_ = _tmp99_;
510 	_tmp101_ = vala_member_access_new_simple (_tmp98_, _tmp100_);
511 	_tmp102_ = _tmp101_;
512 	_tmp103_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
513 	_tmp104_ = _tmp103_;
514 	_tmp105_ = vala_boolean_literal_new (FALSE, _tmp104_);
515 	_tmp106_ = _tmp105_;
516 	_tmp107_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
517 	_tmp108_ = _tmp107_;
518 	_tmp109_ = vala_assignment_new ((ValaExpression*) _tmp102_, (ValaExpression*) _tmp106_, VALA_ASSIGNMENT_OPERATOR_SIMPLE, _tmp108_);
519 	_tmp110_ = _tmp109_;
520 	_tmp111_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
521 	_tmp112_ = _tmp111_;
522 	_tmp113_ = vala_expression_statement_new ((ValaExpression*) _tmp110_, _tmp112_);
523 	_tmp114_ = _tmp113_;
524 	vala_block_insert_statement (_tmp95_, 1, (ValaStatement*) _tmp114_);
525 	_vala_code_node_unref0 (_tmp114_);
526 	_vala_code_node_unref0 (_tmp110_);
527 	_vala_code_node_unref0 (_tmp106_);
528 	_vala_code_node_unref0 (_tmp102_);
529 	_tmp115_ = block;
530 	_tmp116_ = vala_do_statement_get_body (self);
531 	_tmp117_ = _tmp116_;
532 	_tmp118_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
533 	_tmp119_ = _tmp118_;
534 	_tmp120_ = vala_loop_new (_tmp117_, _tmp119_);
535 	_tmp121_ = _tmp120_;
536 	vala_block_add_statement (_tmp115_, (ValaStatement*) _tmp121_);
537 	_vala_code_node_unref0 (_tmp121_);
538 	_tmp122_ = vala_code_node_get_parent_node ((ValaCodeNode*) self);
539 	_tmp123_ = _tmp122_;
540 	parent_block = G_TYPE_CHECK_INSTANCE_CAST (_tmp123_, VALA_TYPE_BLOCK, ValaBlock);
541 	_tmp124_ = parent_block;
542 	_tmp125_ = block;
543 	vala_block_replace_statement (_tmp124_, (ValaStatement*) self, (ValaStatement*) _tmp125_);
544 	_tmp126_ = block;
545 	if (!vala_code_node_check ((ValaCodeNode*) _tmp126_, context)) {
546 		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
547 	}
548 	_tmp127_ = vala_code_node_get_error ((ValaCodeNode*) self);
549 	_tmp128_ = _tmp127_;
550 	result = !_tmp128_;
551 	_vala_code_node_unref0 (first_if);
552 	_vala_code_node_unref0 (condition_block);
553 	_vala_code_node_unref0 (if_stmt);
554 	_vala_code_node_unref0 (true_block);
555 	_vala_code_node_unref0 (if_condition);
556 	_vala_code_node_unref0 (first_local);
557 	_vala_code_node_unref0 (block);
558 	return result;
559 }
560 
561 static void
vala_do_statement_class_init(ValaDoStatementClass * klass,gpointer klass_data)562 vala_do_statement_class_init (ValaDoStatementClass * klass,
563                               gpointer klass_data)
564 {
565 	vala_do_statement_parent_class = g_type_class_peek_parent (klass);
566 	((ValaCodeNodeClass *) klass)->finalize = vala_do_statement_finalize;
567 	g_type_class_adjust_private_offset (klass, &ValaDoStatement_private_offset);
568 	((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_do_statement_real_accept;
569 	((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_do_statement_real_accept_children;
570 	((ValaCodeNodeClass *) klass)->replace_expression = (void (*) (ValaCodeNode*, ValaExpression*, ValaExpression*)) vala_do_statement_real_replace_expression;
571 	((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_do_statement_real_check;
572 }
573 
574 static void
vala_do_statement_vala_statement_interface_init(ValaStatementIface * iface,gpointer iface_data)575 vala_do_statement_vala_statement_interface_init (ValaStatementIface * iface,
576                                                  gpointer iface_data)
577 {
578 	vala_do_statement_vala_statement_parent_iface = g_type_interface_peek_parent (iface);
579 }
580 
581 static void
vala_do_statement_instance_init(ValaDoStatement * self,gpointer klass)582 vala_do_statement_instance_init (ValaDoStatement * self,
583                                  gpointer klass)
584 {
585 	self->priv = vala_do_statement_get_instance_private (self);
586 }
587 
588 static void
vala_do_statement_finalize(ValaCodeNode * obj)589 vala_do_statement_finalize (ValaCodeNode * obj)
590 {
591 	ValaDoStatement * self;
592 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_DO_STATEMENT, ValaDoStatement);
593 	_vala_code_node_unref0 (self->priv->_condition);
594 	_vala_code_node_unref0 (self->priv->_body);
595 	VALA_CODE_NODE_CLASS (vala_do_statement_parent_class)->finalize (obj);
596 }
597 
598 /**
599  * Represents a do iteration statement in the source code.
600  */
601 static GType
vala_do_statement_get_type_once(void)602 vala_do_statement_get_type_once (void)
603 {
604 	static const GTypeInfo g_define_type_info = { sizeof (ValaDoStatementClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_do_statement_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaDoStatement), 0, (GInstanceInitFunc) vala_do_statement_instance_init, NULL };
605 	static const GInterfaceInfo vala_statement_info = { (GInterfaceInitFunc) vala_do_statement_vala_statement_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
606 	GType vala_do_statement_type_id;
607 	vala_do_statement_type_id = g_type_register_static (VALA_TYPE_CODE_NODE, "ValaDoStatement", &g_define_type_info, 0);
608 	g_type_add_interface_static (vala_do_statement_type_id, VALA_TYPE_STATEMENT, &vala_statement_info);
609 	ValaDoStatement_private_offset = g_type_add_instance_private (vala_do_statement_type_id, sizeof (ValaDoStatementPrivate));
610 	return vala_do_statement_type_id;
611 }
612 
613 GType
vala_do_statement_get_type(void)614 vala_do_statement_get_type (void)
615 {
616 	static volatile gsize vala_do_statement_type_id__volatile = 0;
617 	if (g_once_init_enter (&vala_do_statement_type_id__volatile)) {
618 		GType vala_do_statement_type_id;
619 		vala_do_statement_type_id = vala_do_statement_get_type_once ();
620 		g_once_init_leave (&vala_do_statement_type_id__volatile, vala_do_statement_type_id);
621 	}
622 	return vala_do_statement_type_id__volatile;
623 }
624 
625