1 /* valatrystatement.c generated by valac, the Vala compiler
2 * generated from valatrystatement.vala, do not modify */
3
4 /* valatrystatement.vala
5 *
6 * Copyright (C) 2007-2010 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 #include <valagee.h>
29 #include <glib-object.h>
30
31 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
32 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
33
34 struct _ValaTryStatementPrivate {
35 gboolean _after_try_block_reachable;
36 ValaBlock* _body;
37 ValaBlock* _finally_body;
38 ValaList* catch_clauses;
39 };
40
41 static gint ValaTryStatement_private_offset;
42 static gpointer vala_try_statement_parent_class = NULL;
43 static ValaStatementIface * vala_try_statement_vala_statement_parent_iface = NULL;
44
45 static void vala_try_statement_real_accept (ValaCodeNode* base,
46 ValaCodeVisitor* visitor);
47 static void vala_try_statement_real_accept_children (ValaCodeNode* base,
48 ValaCodeVisitor* visitor);
49 static void vala_try_statement_real_get_error_types (ValaCodeNode* base,
50 ValaCollection* collection,
51 ValaSourceReference* source_reference);
52 static gboolean vala_try_statement_real_check (ValaCodeNode* base,
53 ValaCodeContext* context);
54 static void vala_try_statement_real_emit (ValaCodeNode* base,
55 ValaCodeGenerator* codegen);
56 static void vala_try_statement_finalize (ValaCodeNode * obj);
57 static GType vala_try_statement_get_type_once (void);
58
59 static inline gpointer
vala_try_statement_get_instance_private(ValaTryStatement * self)60 vala_try_statement_get_instance_private (ValaTryStatement* self)
61 {
62 return G_STRUCT_MEMBER_P (self, ValaTryStatement_private_offset);
63 }
64
65 ValaBlock*
vala_try_statement_get_body(ValaTryStatement * self)66 vala_try_statement_get_body (ValaTryStatement* self)
67 {
68 ValaBlock* result;
69 ValaBlock* _tmp0_;
70 g_return_val_if_fail (self != NULL, NULL);
71 _tmp0_ = self->priv->_body;
72 result = _tmp0_;
73 return result;
74 }
75
76 static gpointer
_vala_code_node_ref0(gpointer self)77 _vala_code_node_ref0 (gpointer self)
78 {
79 return self ? vala_code_node_ref (self) : NULL;
80 }
81
82 void
vala_try_statement_set_body(ValaTryStatement * self,ValaBlock * value)83 vala_try_statement_set_body (ValaTryStatement* self,
84 ValaBlock* value)
85 {
86 ValaBlock* _tmp0_;
87 ValaBlock* _tmp1_;
88 g_return_if_fail (self != NULL);
89 _tmp0_ = _vala_code_node_ref0 (value);
90 _vala_code_node_unref0 (self->priv->_body);
91 self->priv->_body = _tmp0_;
92 _tmp1_ = self->priv->_body;
93 vala_code_node_set_parent_node ((ValaCodeNode*) _tmp1_, (ValaCodeNode*) self);
94 }
95
96 ValaBlock*
vala_try_statement_get_finally_body(ValaTryStatement * self)97 vala_try_statement_get_finally_body (ValaTryStatement* self)
98 {
99 ValaBlock* result;
100 ValaBlock* _tmp0_;
101 g_return_val_if_fail (self != NULL, NULL);
102 _tmp0_ = self->priv->_finally_body;
103 result = _tmp0_;
104 return result;
105 }
106
107 void
vala_try_statement_set_finally_body(ValaTryStatement * self,ValaBlock * value)108 vala_try_statement_set_finally_body (ValaTryStatement* self,
109 ValaBlock* value)
110 {
111 ValaBlock* _tmp0_;
112 ValaBlock* _tmp1_;
113 g_return_if_fail (self != NULL);
114 _tmp0_ = _vala_code_node_ref0 (value);
115 _vala_code_node_unref0 (self->priv->_finally_body);
116 self->priv->_finally_body = _tmp0_;
117 _tmp1_ = self->priv->_finally_body;
118 if (_tmp1_ != NULL) {
119 ValaBlock* _tmp2_;
120 _tmp2_ = self->priv->_finally_body;
121 vala_code_node_set_parent_node ((ValaCodeNode*) _tmp2_, (ValaCodeNode*) self);
122 }
123 }
124
125 gboolean
vala_try_statement_get_after_try_block_reachable(ValaTryStatement * self)126 vala_try_statement_get_after_try_block_reachable (ValaTryStatement* self)
127 {
128 gboolean result;
129 g_return_val_if_fail (self != NULL, FALSE);
130 result = self->priv->_after_try_block_reachable;
131 return result;
132 }
133
134 void
vala_try_statement_set_after_try_block_reachable(ValaTryStatement * self,gboolean value)135 vala_try_statement_set_after_try_block_reachable (ValaTryStatement* self,
136 gboolean value)
137 {
138 g_return_if_fail (self != NULL);
139 self->priv->_after_try_block_reachable = value;
140 }
141
142 /**
143 * Creates a new try statement.
144 *
145 * @param body body of the try statement
146 * @param finally_body body of the optional finally clause
147 * @param source_reference reference to source code
148 * @return newly created try statement
149 */
150 ValaTryStatement*
vala_try_statement_construct(GType object_type,ValaBlock * body,ValaBlock * finally_body,ValaSourceReference * source_reference)151 vala_try_statement_construct (GType object_type,
152 ValaBlock* body,
153 ValaBlock* finally_body,
154 ValaSourceReference* source_reference)
155 {
156 ValaTryStatement* self = NULL;
157 g_return_val_if_fail (body != NULL, NULL);
158 self = (ValaTryStatement*) vala_code_node_construct (object_type);
159 vala_try_statement_set_body (self, body);
160 vala_try_statement_set_finally_body (self, finally_body);
161 vala_code_node_set_source_reference ((ValaCodeNode*) self, source_reference);
162 return self;
163 }
164
165 ValaTryStatement*
vala_try_statement_new(ValaBlock * body,ValaBlock * finally_body,ValaSourceReference * source_reference)166 vala_try_statement_new (ValaBlock* body,
167 ValaBlock* finally_body,
168 ValaSourceReference* source_reference)
169 {
170 return vala_try_statement_construct (VALA_TYPE_TRY_STATEMENT, body, finally_body, source_reference);
171 }
172
173 /**
174 * Appends the specified clause to the list of catch clauses.
175 *
176 * @param clause a catch clause
177 */
178 void
vala_try_statement_add_catch_clause(ValaTryStatement * self,ValaCatchClause * clause)179 vala_try_statement_add_catch_clause (ValaTryStatement* self,
180 ValaCatchClause* clause)
181 {
182 ValaList* _tmp0_;
183 g_return_if_fail (self != NULL);
184 g_return_if_fail (clause != NULL);
185 vala_code_node_set_parent_node ((ValaCodeNode*) clause, (ValaCodeNode*) self);
186 _tmp0_ = self->priv->catch_clauses;
187 vala_collection_add ((ValaCollection*) _tmp0_, clause);
188 }
189
190 /**
191 * Returns the list of catch clauses.
192 *
193 * @return list of catch clauses
194 */
195 ValaList*
vala_try_statement_get_catch_clauses(ValaTryStatement * self)196 vala_try_statement_get_catch_clauses (ValaTryStatement* self)
197 {
198 ValaList* _tmp0_;
199 ValaList* result = NULL;
200 g_return_val_if_fail (self != NULL, NULL);
201 _tmp0_ = self->priv->catch_clauses;
202 result = _tmp0_;
203 return result;
204 }
205
206 static void
vala_try_statement_real_accept(ValaCodeNode * base,ValaCodeVisitor * visitor)207 vala_try_statement_real_accept (ValaCodeNode* base,
208 ValaCodeVisitor* visitor)
209 {
210 ValaTryStatement * self;
211 self = (ValaTryStatement*) base;
212 g_return_if_fail (visitor != NULL);
213 vala_code_visitor_visit_try_statement (visitor, self);
214 }
215
216 static gpointer
_vala_iterable_ref0(gpointer self)217 _vala_iterable_ref0 (gpointer self)
218 {
219 return self ? vala_iterable_ref (self) : NULL;
220 }
221
222 static void
vala_try_statement_real_accept_children(ValaCodeNode * base,ValaCodeVisitor * visitor)223 vala_try_statement_real_accept_children (ValaCodeNode* base,
224 ValaCodeVisitor* visitor)
225 {
226 ValaTryStatement * self;
227 ValaBlock* _tmp0_;
228 ValaBlock* _tmp1_;
229 ValaBlock* _tmp12_;
230 ValaBlock* _tmp13_;
231 self = (ValaTryStatement*) base;
232 g_return_if_fail (visitor != NULL);
233 _tmp0_ = vala_try_statement_get_body (self);
234 _tmp1_ = _tmp0_;
235 vala_code_node_accept ((ValaCodeNode*) _tmp1_, visitor);
236 {
237 ValaList* _clause_list = NULL;
238 ValaList* _tmp2_;
239 ValaList* _tmp3_;
240 gint _clause_size = 0;
241 ValaList* _tmp4_;
242 gint _tmp5_;
243 gint _tmp6_;
244 gint _clause_index = 0;
245 _tmp2_ = self->priv->catch_clauses;
246 _tmp3_ = _vala_iterable_ref0 (_tmp2_);
247 _clause_list = _tmp3_;
248 _tmp4_ = _clause_list;
249 _tmp5_ = vala_collection_get_size ((ValaCollection*) _tmp4_);
250 _tmp6_ = _tmp5_;
251 _clause_size = _tmp6_;
252 _clause_index = -1;
253 while (TRUE) {
254 gint _tmp7_;
255 gint _tmp8_;
256 ValaCatchClause* clause = NULL;
257 ValaList* _tmp9_;
258 gpointer _tmp10_;
259 ValaCatchClause* _tmp11_;
260 _clause_index = _clause_index + 1;
261 _tmp7_ = _clause_index;
262 _tmp8_ = _clause_size;
263 if (!(_tmp7_ < _tmp8_)) {
264 break;
265 }
266 _tmp9_ = _clause_list;
267 _tmp10_ = vala_list_get (_tmp9_, _clause_index);
268 clause = (ValaCatchClause*) _tmp10_;
269 _tmp11_ = clause;
270 vala_code_node_accept ((ValaCodeNode*) _tmp11_, visitor);
271 _vala_code_node_unref0 (clause);
272 }
273 _vala_iterable_unref0 (_clause_list);
274 }
275 _tmp12_ = vala_try_statement_get_finally_body (self);
276 _tmp13_ = _tmp12_;
277 if (_tmp13_ != NULL) {
278 ValaBlock* _tmp14_;
279 ValaBlock* _tmp15_;
280 _tmp14_ = vala_try_statement_get_finally_body (self);
281 _tmp15_ = _tmp14_;
282 vala_code_node_accept ((ValaCodeNode*) _tmp15_, visitor);
283 }
284 }
285
286 static void
vala_try_statement_real_get_error_types(ValaCodeNode * base,ValaCollection * collection,ValaSourceReference * source_reference)287 vala_try_statement_real_get_error_types (ValaCodeNode* base,
288 ValaCollection* collection,
289 ValaSourceReference* source_reference)
290 {
291 ValaTryStatement * self;
292 ValaArrayList* error_types = NULL;
293 GEqualFunc _tmp0_;
294 ValaArrayList* _tmp1_;
295 ValaBlock* _tmp2_;
296 ValaBlock* _tmp3_;
297 ValaArrayList* _tmp4_;
298 ValaBlock* _tmp36_;
299 ValaBlock* _tmp37_;
300 self = (ValaTryStatement*) base;
301 g_return_if_fail (collection != NULL);
302 _tmp0_ = g_direct_equal;
303 _tmp1_ = vala_array_list_new (VALA_TYPE_DATA_TYPE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp0_);
304 error_types = _tmp1_;
305 _tmp2_ = vala_try_statement_get_body (self);
306 _tmp3_ = _tmp2_;
307 _tmp4_ = error_types;
308 vala_code_node_get_error_types ((ValaCodeNode*) _tmp3_, (ValaCollection*) _tmp4_, source_reference);
309 {
310 ValaList* _clause_list = NULL;
311 ValaList* _tmp5_;
312 ValaList* _tmp6_;
313 gint _clause_size = 0;
314 ValaList* _tmp7_;
315 gint _tmp8_;
316 gint _tmp9_;
317 gint _clause_index = 0;
318 _tmp5_ = self->priv->catch_clauses;
319 _tmp6_ = _vala_iterable_ref0 (_tmp5_);
320 _clause_list = _tmp6_;
321 _tmp7_ = _clause_list;
322 _tmp8_ = vala_collection_get_size ((ValaCollection*) _tmp7_);
323 _tmp9_ = _tmp8_;
324 _clause_size = _tmp9_;
325 _clause_index = -1;
326 while (TRUE) {
327 gint _tmp10_;
328 gint _tmp11_;
329 ValaCatchClause* clause = NULL;
330 ValaList* _tmp12_;
331 gpointer _tmp13_;
332 ValaCatchClause* _tmp33_;
333 ValaBlock* _tmp34_;
334 ValaBlock* _tmp35_;
335 _clause_index = _clause_index + 1;
336 _tmp10_ = _clause_index;
337 _tmp11_ = _clause_size;
338 if (!(_tmp10_ < _tmp11_)) {
339 break;
340 }
341 _tmp12_ = _clause_list;
342 _tmp13_ = vala_list_get (_tmp12_, _clause_index);
343 clause = (ValaCatchClause*) _tmp13_;
344 {
345 gint i = 0;
346 i = 0;
347 {
348 gboolean _tmp14_ = FALSE;
349 _tmp14_ = TRUE;
350 while (TRUE) {
351 ValaArrayList* _tmp16_;
352 gint _tmp17_;
353 gint _tmp18_;
354 ValaDataType* error_type = NULL;
355 ValaArrayList* _tmp19_;
356 gpointer _tmp20_;
357 gboolean _tmp21_ = FALSE;
358 ValaCatchClause* _tmp22_;
359 ValaDataType* _tmp23_;
360 ValaDataType* _tmp24_;
361 if (!_tmp14_) {
362 gint _tmp15_;
363 _tmp15_ = i;
364 i = _tmp15_ + 1;
365 }
366 _tmp14_ = FALSE;
367 _tmp16_ = error_types;
368 _tmp17_ = vala_collection_get_size ((ValaCollection*) _tmp16_);
369 _tmp18_ = _tmp17_;
370 if (!(i < _tmp18_)) {
371 break;
372 }
373 _tmp19_ = error_types;
374 _tmp20_ = vala_list_get ((ValaList*) _tmp19_, i);
375 error_type = (ValaDataType*) _tmp20_;
376 _tmp22_ = clause;
377 _tmp23_ = vala_catch_clause_get_error_type (_tmp22_);
378 _tmp24_ = _tmp23_;
379 if (_tmp24_ == NULL) {
380 _tmp21_ = TRUE;
381 } else {
382 ValaDataType* _tmp25_;
383 ValaCatchClause* _tmp26_;
384 ValaDataType* _tmp27_;
385 ValaDataType* _tmp28_;
386 _tmp25_ = error_type;
387 _tmp26_ = clause;
388 _tmp27_ = vala_catch_clause_get_error_type (_tmp26_);
389 _tmp28_ = _tmp27_;
390 _tmp21_ = vala_data_type_compatible (_tmp25_, _tmp28_);
391 }
392 if (_tmp21_) {
393 ValaArrayList* _tmp29_;
394 gpointer _tmp30_;
395 ValaDataType* _tmp31_;
396 gint _tmp32_;
397 _tmp29_ = error_types;
398 _tmp30_ = vala_list_remove_at ((ValaList*) _tmp29_, i);
399 _tmp31_ = (ValaDataType*) _tmp30_;
400 _vala_code_node_unref0 (_tmp31_);
401 _tmp32_ = i;
402 i = _tmp32_ - 1;
403 }
404 _vala_code_node_unref0 (error_type);
405 }
406 }
407 }
408 _tmp33_ = clause;
409 _tmp34_ = vala_catch_clause_get_body (_tmp33_);
410 _tmp35_ = _tmp34_;
411 vala_code_node_get_error_types ((ValaCodeNode*) _tmp35_, collection, source_reference);
412 _vala_code_node_unref0 (clause);
413 }
414 _vala_iterable_unref0 (_clause_list);
415 }
416 _tmp36_ = vala_try_statement_get_finally_body (self);
417 _tmp37_ = _tmp36_;
418 if (_tmp37_ != NULL) {
419 ValaBlock* _tmp38_;
420 ValaBlock* _tmp39_;
421 _tmp38_ = vala_try_statement_get_finally_body (self);
422 _tmp39_ = _tmp38_;
423 vala_code_node_get_error_types ((ValaCodeNode*) _tmp39_, collection, source_reference);
424 }
425 {
426 ValaArrayList* _error_type_list = NULL;
427 ValaArrayList* _tmp40_;
428 ValaArrayList* _tmp41_;
429 gint _error_type_size = 0;
430 ValaArrayList* _tmp42_;
431 gint _tmp43_;
432 gint _tmp44_;
433 gint _error_type_index = 0;
434 _tmp40_ = error_types;
435 _tmp41_ = _vala_iterable_ref0 (_tmp40_);
436 _error_type_list = _tmp41_;
437 _tmp42_ = _error_type_list;
438 _tmp43_ = vala_collection_get_size ((ValaCollection*) _tmp42_);
439 _tmp44_ = _tmp43_;
440 _error_type_size = _tmp44_;
441 _error_type_index = -1;
442 while (TRUE) {
443 gint _tmp45_;
444 gint _tmp46_;
445 ValaDataType* error_type = NULL;
446 ValaArrayList* _tmp47_;
447 gpointer _tmp48_;
448 ValaDataType* _tmp49_;
449 _error_type_index = _error_type_index + 1;
450 _tmp45_ = _error_type_index;
451 _tmp46_ = _error_type_size;
452 if (!(_tmp45_ < _tmp46_)) {
453 break;
454 }
455 _tmp47_ = _error_type_list;
456 _tmp48_ = vala_list_get ((ValaList*) _tmp47_, _error_type_index);
457 error_type = (ValaDataType*) _tmp48_;
458 _tmp49_ = error_type;
459 vala_collection_add (collection, _tmp49_);
460 _vala_code_node_unref0 (error_type);
461 }
462 _vala_iterable_unref0 (_error_type_list);
463 }
464 _vala_iterable_unref0 (error_types);
465 }
466
467 static gboolean
vala_try_statement_real_check(ValaCodeNode * base,ValaCodeContext * context)468 vala_try_statement_real_check (ValaCodeNode* base,
469 ValaCodeContext* context)
470 {
471 ValaTryStatement * self;
472 gboolean _tmp0_;
473 gboolean _tmp1_;
474 ValaProfile _tmp4_;
475 ValaProfile _tmp5_;
476 ValaBlock* _tmp8_;
477 ValaBlock* _tmp9_;
478 ValaBlock* _tmp20_;
479 ValaBlock* _tmp21_;
480 gboolean _tmp24_;
481 gboolean _tmp25_;
482 gboolean result = FALSE;
483 self = (ValaTryStatement*) base;
484 g_return_val_if_fail (context != NULL, FALSE);
485 _tmp0_ = vala_code_node_get_checked ((ValaCodeNode*) self);
486 _tmp1_ = _tmp0_;
487 if (_tmp1_) {
488 gboolean _tmp2_;
489 gboolean _tmp3_;
490 _tmp2_ = vala_code_node_get_error ((ValaCodeNode*) self);
491 _tmp3_ = _tmp2_;
492 result = !_tmp3_;
493 return result;
494 }
495 vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
496 _tmp4_ = vala_code_context_get_profile (context);
497 _tmp5_ = _tmp4_;
498 if (_tmp5_ == VALA_PROFILE_POSIX) {
499 ValaSourceReference* _tmp6_;
500 ValaSourceReference* _tmp7_;
501 _tmp6_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
502 _tmp7_ = _tmp6_;
503 vala_report_error (_tmp7_, "`try' is not supported in POSIX profile");
504 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
505 result = FALSE;
506 return result;
507 }
508 _tmp8_ = vala_try_statement_get_body (self);
509 _tmp9_ = _tmp8_;
510 vala_code_node_check ((ValaCodeNode*) _tmp9_, context);
511 {
512 ValaList* _clause_list = NULL;
513 ValaList* _tmp10_;
514 ValaList* _tmp11_;
515 gint _clause_size = 0;
516 ValaList* _tmp12_;
517 gint _tmp13_;
518 gint _tmp14_;
519 gint _clause_index = 0;
520 _tmp10_ = self->priv->catch_clauses;
521 _tmp11_ = _vala_iterable_ref0 (_tmp10_);
522 _clause_list = _tmp11_;
523 _tmp12_ = _clause_list;
524 _tmp13_ = vala_collection_get_size ((ValaCollection*) _tmp12_);
525 _tmp14_ = _tmp13_;
526 _clause_size = _tmp14_;
527 _clause_index = -1;
528 while (TRUE) {
529 gint _tmp15_;
530 gint _tmp16_;
531 ValaCatchClause* clause = NULL;
532 ValaList* _tmp17_;
533 gpointer _tmp18_;
534 ValaCatchClause* _tmp19_;
535 _clause_index = _clause_index + 1;
536 _tmp15_ = _clause_index;
537 _tmp16_ = _clause_size;
538 if (!(_tmp15_ < _tmp16_)) {
539 break;
540 }
541 _tmp17_ = _clause_list;
542 _tmp18_ = vala_list_get (_tmp17_, _clause_index);
543 clause = (ValaCatchClause*) _tmp18_;
544 _tmp19_ = clause;
545 vala_code_node_check ((ValaCodeNode*) _tmp19_, context);
546 _vala_code_node_unref0 (clause);
547 }
548 _vala_iterable_unref0 (_clause_list);
549 }
550 _tmp20_ = vala_try_statement_get_finally_body (self);
551 _tmp21_ = _tmp20_;
552 if (_tmp21_ != NULL) {
553 ValaBlock* _tmp22_;
554 ValaBlock* _tmp23_;
555 _tmp22_ = vala_try_statement_get_finally_body (self);
556 _tmp23_ = _tmp22_;
557 vala_code_node_check ((ValaCodeNode*) _tmp23_, context);
558 }
559 _tmp24_ = vala_code_node_get_error ((ValaCodeNode*) self);
560 _tmp25_ = _tmp24_;
561 result = !_tmp25_;
562 return result;
563 }
564
565 static void
vala_try_statement_real_emit(ValaCodeNode * base,ValaCodeGenerator * codegen)566 vala_try_statement_real_emit (ValaCodeNode* base,
567 ValaCodeGenerator* codegen)
568 {
569 ValaTryStatement * self;
570 self = (ValaTryStatement*) base;
571 g_return_if_fail (codegen != NULL);
572 vala_code_visitor_visit_try_statement ((ValaCodeVisitor*) codegen, self);
573 }
574
575 static void
vala_try_statement_class_init(ValaTryStatementClass * klass,gpointer klass_data)576 vala_try_statement_class_init (ValaTryStatementClass * klass,
577 gpointer klass_data)
578 {
579 vala_try_statement_parent_class = g_type_class_peek_parent (klass);
580 ((ValaCodeNodeClass *) klass)->finalize = vala_try_statement_finalize;
581 g_type_class_adjust_private_offset (klass, &ValaTryStatement_private_offset);
582 ((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_try_statement_real_accept;
583 ((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_try_statement_real_accept_children;
584 ((ValaCodeNodeClass *) klass)->get_error_types = (void (*) (ValaCodeNode*, ValaCollection*, ValaSourceReference*)) vala_try_statement_real_get_error_types;
585 ((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_try_statement_real_check;
586 ((ValaCodeNodeClass *) klass)->emit = (void (*) (ValaCodeNode*, ValaCodeGenerator*)) vala_try_statement_real_emit;
587 }
588
589 static void
vala_try_statement_vala_statement_interface_init(ValaStatementIface * iface,gpointer iface_data)590 vala_try_statement_vala_statement_interface_init (ValaStatementIface * iface,
591 gpointer iface_data)
592 {
593 vala_try_statement_vala_statement_parent_iface = g_type_interface_peek_parent (iface);
594 }
595
596 static void
vala_try_statement_instance_init(ValaTryStatement * self,gpointer klass)597 vala_try_statement_instance_init (ValaTryStatement * self,
598 gpointer klass)
599 {
600 GEqualFunc _tmp0_;
601 ValaArrayList* _tmp1_;
602 self->priv = vala_try_statement_get_instance_private (self);
603 self->priv->_after_try_block_reachable = TRUE;
604 _tmp0_ = g_direct_equal;
605 _tmp1_ = vala_array_list_new (VALA_TYPE_CATCH_CLAUSE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp0_);
606 self->priv->catch_clauses = (ValaList*) _tmp1_;
607 }
608
609 static void
vala_try_statement_finalize(ValaCodeNode * obj)610 vala_try_statement_finalize (ValaCodeNode * obj)
611 {
612 ValaTryStatement * self;
613 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_TRY_STATEMENT, ValaTryStatement);
614 _vala_code_node_unref0 (self->priv->_body);
615 _vala_code_node_unref0 (self->priv->_finally_body);
616 _vala_iterable_unref0 (self->priv->catch_clauses);
617 VALA_CODE_NODE_CLASS (vala_try_statement_parent_class)->finalize (obj);
618 }
619
620 /**
621 * Represents a try statement in the source code.
622 */
623 static GType
vala_try_statement_get_type_once(void)624 vala_try_statement_get_type_once (void)
625 {
626 static const GTypeInfo g_define_type_info = { sizeof (ValaTryStatementClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_try_statement_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaTryStatement), 0, (GInstanceInitFunc) vala_try_statement_instance_init, NULL };
627 static const GInterfaceInfo vala_statement_info = { (GInterfaceInitFunc) vala_try_statement_vala_statement_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
628 GType vala_try_statement_type_id;
629 vala_try_statement_type_id = g_type_register_static (VALA_TYPE_CODE_NODE, "ValaTryStatement", &g_define_type_info, 0);
630 g_type_add_interface_static (vala_try_statement_type_id, VALA_TYPE_STATEMENT, &vala_statement_info);
631 ValaTryStatement_private_offset = g_type_add_instance_private (vala_try_statement_type_id, sizeof (ValaTryStatementPrivate));
632 return vala_try_statement_type_id;
633 }
634
635 GType
vala_try_statement_get_type(void)636 vala_try_statement_get_type (void)
637 {
638 static volatile gsize vala_try_statement_type_id__volatile = 0;
639 if (g_once_init_enter (&vala_try_statement_type_id__volatile)) {
640 GType vala_try_statement_type_id;
641 vala_try_statement_type_id = vala_try_statement_get_type_once ();
642 g_once_init_leave (&vala_try_statement_type_id__volatile, vala_try_statement_type_id);
643 }
644 return vala_try_statement_type_id__volatile;
645 }
646
647