1 /* valagerrormodule.c generated by valac, the Vala compiler
2  * generated from valagerrormodule.vala, do not modify */
3 
4 /* valagerrormodule.vala
5  *
6  * Copyright (C) 2008-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  *	Thijs Vermeir <thijsvermeir@gmail.com>
25  */
26 
27 #include "valacodegen.h"
28 #include <glib.h>
29 #include <vala.h>
30 #include <valaccode.h>
31 #include <valagee.h>
32 #include <glib-object.h>
33 #include <stdlib.h>
34 #include <string.h>
35 
36 #define _g_free0(var) (var = (g_free (var), NULL))
37 #define _vala_ccode_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_node_unref (var), NULL)))
38 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
39 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
40 #define _vala_target_value_unref0(var) ((var == NULL) ? NULL : (var = (vala_target_value_unref (var), NULL)))
41 
42 struct _ValaGErrorModulePrivate {
43 	gboolean is_in_catch;
44 };
45 
46 static gint ValaGErrorModule_private_offset;
47 static gpointer vala_gerror_module_parent_class = NULL;
48 
49 static void vala_gerror_module_real_generate_error_domain_declaration (ValaCCodeBaseModule* base,
50                                                                 ValaErrorDomain* edomain,
51                                                                 ValaCCodeFile* decl_space);
52 static void vala_gerror_module_real_visit_error_domain (ValaCodeVisitor* base,
53                                                  ValaErrorDomain* edomain);
54 static void vala_gerror_module_real_visit_throw_statement (ValaCodeVisitor* base,
55                                                     ValaThrowStatement* stmt);
56 static void vala_gerror_module_real_return_with_exception (ValaGErrorModule* self,
57                                                     ValaCCodeExpression* error_expr);
58 static void vala_gerror_module_uncaught_error_statement (ValaGErrorModule* self,
59                                                   ValaCCodeExpression* inner_error,
60                                                   gboolean unexpected,
61                                                   ValaCodeNode* start_at);
62 static gboolean vala_gerror_module_in_finally_block (ValaGErrorModule* self,
63                                               ValaCodeNode* node);
64 static void vala_gerror_module_real_add_simple_check (ValaCCodeBaseModule* base,
65                                                ValaCodeNode* node,
66                                                gboolean always_fails);
67 static void vala_gerror_module_real_visit_try_statement (ValaCodeVisitor* base,
68                                                   ValaTryStatement* stmt);
69 static void vala_gerror_module_real_visit_catch_clause (ValaCodeVisitor* base,
70                                                  ValaCatchClause* clause);
71 static void vala_gerror_module_real_append_scope_free (ValaCCodeBaseModule* base,
72                                                 ValaSymbol* sym,
73                                                 ValaCodeNode* stop_at);
74 static void vala_gerror_module_finalize (ValaCodeVisitor * obj);
75 static GType vala_gerror_module_get_type_once (void);
76 
77 static inline gpointer
vala_gerror_module_get_instance_private(ValaGErrorModule * self)78 vala_gerror_module_get_instance_private (ValaGErrorModule* self)
79 {
80 	return G_STRUCT_MEMBER_P (self, ValaGErrorModule_private_offset);
81 }
82 
83 static gpointer
_vala_iterable_ref0(gpointer self)84 _vala_iterable_ref0 (gpointer self)
85 {
86 	return self ? vala_iterable_ref (self) : NULL;
87 }
88 
89 static void
vala_gerror_module_real_generate_error_domain_declaration(ValaCCodeBaseModule * base,ValaErrorDomain * edomain,ValaCCodeFile * decl_space)90 vala_gerror_module_real_generate_error_domain_declaration (ValaCCodeBaseModule* base,
91                                                            ValaErrorDomain* edomain,
92                                                            ValaCCodeFile* decl_space)
93 {
94 	ValaGErrorModule * self;
95 	gchar* _tmp0_;
96 	gchar* _tmp1_;
97 	gboolean _tmp2_;
98 	ValaDataType* _tmp3_;
99 	ValaCCodeEnum* cenum = NULL;
100 	gchar* _tmp4_;
101 	gchar* _tmp5_;
102 	ValaCCodeEnum* _tmp6_;
103 	ValaCCodeEnum* _tmp7_;
104 	ValaCCodeEnum* _tmp39_;
105 	gchar* quark_fun_name = NULL;
106 	gchar* _tmp40_;
107 	gchar* _tmp41_;
108 	gchar* _tmp42_;
109 	gchar* _tmp43_;
110 	ValaCCodeMacroReplacement* error_domain_define = NULL;
111 	gchar* _tmp44_;
112 	gchar* _tmp45_;
113 	const gchar* _tmp46_;
114 	gchar* _tmp47_;
115 	gchar* _tmp48_;
116 	ValaCCodeMacroReplacement* _tmp49_;
117 	ValaCCodeMacroReplacement* _tmp50_;
118 	ValaCCodeMacroReplacement* _tmp51_;
119 	ValaCCodeFunction* cquark_fun = NULL;
120 	const gchar* _tmp52_;
121 	ValaDataType* _tmp53_;
122 	ValaTypeSymbol* _tmp54_;
123 	ValaTypeSymbol* _tmp55_;
124 	gchar* _tmp56_;
125 	gchar* _tmp57_;
126 	ValaCCodeFunction* _tmp58_;
127 	ValaCCodeFunction* _tmp59_;
128 	ValaCCodeFunction* _tmp60_;
129 	self = (ValaGErrorModule*) base;
130 	g_return_if_fail (edomain != NULL);
131 	g_return_if_fail (decl_space != NULL);
132 	_tmp0_ = vala_get_ccode_name ((ValaCodeNode*) edomain);
133 	_tmp1_ = _tmp0_;
134 	_tmp2_ = vala_ccode_base_module_add_symbol_declaration ((ValaCCodeBaseModule*) self, decl_space, (ValaSymbol*) edomain, _tmp1_);
135 	_g_free0 (_tmp1_);
136 	if (_tmp2_) {
137 		return;
138 	}
139 	_tmp3_ = ((ValaCCodeBaseModule*) self)->gquark_type;
140 	vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp3_, decl_space);
141 	_tmp4_ = vala_get_ccode_name ((ValaCodeNode*) edomain);
142 	_tmp5_ = _tmp4_;
143 	_tmp6_ = vala_ccode_enum_new (_tmp5_);
144 	_tmp7_ = _tmp6_;
145 	_g_free0 (_tmp5_);
146 	cenum = _tmp7_;
147 	{
148 		ValaList* _ecode_list = NULL;
149 		ValaList* _tmp8_;
150 		ValaList* _tmp9_;
151 		gint _ecode_size = 0;
152 		ValaList* _tmp10_;
153 		gint _tmp11_;
154 		gint _tmp12_;
155 		gint _ecode_index = 0;
156 		_tmp8_ = vala_error_domain_get_codes (edomain);
157 		_tmp9_ = _vala_iterable_ref0 (_tmp8_);
158 		_ecode_list = _tmp9_;
159 		_tmp10_ = _ecode_list;
160 		_tmp11_ = vala_collection_get_size ((ValaCollection*) _tmp10_);
161 		_tmp12_ = _tmp11_;
162 		_ecode_size = _tmp12_;
163 		_ecode_index = -1;
164 		while (TRUE) {
165 			gint _tmp13_;
166 			gint _tmp14_;
167 			ValaErrorCode* ecode = NULL;
168 			ValaList* _tmp15_;
169 			gpointer _tmp16_;
170 			ValaErrorCode* _tmp17_;
171 			ValaExpression* _tmp18_;
172 			ValaExpression* _tmp19_;
173 			_ecode_index = _ecode_index + 1;
174 			_tmp13_ = _ecode_index;
175 			_tmp14_ = _ecode_size;
176 			if (!(_tmp13_ < _tmp14_)) {
177 				break;
178 			}
179 			_tmp15_ = _ecode_list;
180 			_tmp16_ = vala_list_get (_tmp15_, _ecode_index);
181 			ecode = (ValaErrorCode*) _tmp16_;
182 			_tmp17_ = ecode;
183 			_tmp18_ = vala_error_code_get_value (_tmp17_);
184 			_tmp19_ = _tmp18_;
185 			if (_tmp19_ == NULL) {
186 				ValaCCodeEnum* _tmp20_;
187 				ValaErrorCode* _tmp21_;
188 				gchar* _tmp22_;
189 				gchar* _tmp23_;
190 				ValaCCodeEnumValue* _tmp24_;
191 				ValaCCodeEnumValue* _tmp25_;
192 				_tmp20_ = cenum;
193 				_tmp21_ = ecode;
194 				_tmp22_ = vala_get_ccode_name ((ValaCodeNode*) _tmp21_);
195 				_tmp23_ = _tmp22_;
196 				_tmp24_ = vala_ccode_enum_value_new (_tmp23_, NULL);
197 				_tmp25_ = _tmp24_;
198 				vala_ccode_enum_add_value (_tmp20_, _tmp25_);
199 				_vala_ccode_node_unref0 (_tmp25_);
200 				_g_free0 (_tmp23_);
201 			} else {
202 				ValaErrorCode* _tmp26_;
203 				ValaExpression* _tmp27_;
204 				ValaExpression* _tmp28_;
205 				ValaCCodeEnum* _tmp29_;
206 				ValaErrorCode* _tmp30_;
207 				gchar* _tmp31_;
208 				gchar* _tmp32_;
209 				ValaErrorCode* _tmp33_;
210 				ValaExpression* _tmp34_;
211 				ValaExpression* _tmp35_;
212 				ValaCCodeExpression* _tmp36_;
213 				ValaCCodeEnumValue* _tmp37_;
214 				ValaCCodeEnumValue* _tmp38_;
215 				_tmp26_ = ecode;
216 				_tmp27_ = vala_error_code_get_value (_tmp26_);
217 				_tmp28_ = _tmp27_;
218 				vala_code_node_emit ((ValaCodeNode*) _tmp28_, (ValaCodeGenerator*) self);
219 				_tmp29_ = cenum;
220 				_tmp30_ = ecode;
221 				_tmp31_ = vala_get_ccode_name ((ValaCodeNode*) _tmp30_);
222 				_tmp32_ = _tmp31_;
223 				_tmp33_ = ecode;
224 				_tmp34_ = vala_error_code_get_value (_tmp33_);
225 				_tmp35_ = _tmp34_;
226 				_tmp36_ = vala_get_cvalue (_tmp35_);
227 				_tmp37_ = vala_ccode_enum_value_new (_tmp32_, _tmp36_);
228 				_tmp38_ = _tmp37_;
229 				vala_ccode_enum_add_value (_tmp29_, _tmp38_);
230 				_vala_ccode_node_unref0 (_tmp38_);
231 				_g_free0 (_tmp32_);
232 			}
233 			_vala_code_node_unref0 (ecode);
234 		}
235 		_vala_iterable_unref0 (_ecode_list);
236 	}
237 	_tmp39_ = cenum;
238 	vala_ccode_file_add_type_definition (decl_space, (ValaCCodeNode*) _tmp39_);
239 	_tmp40_ = vala_get_ccode_lower_case_prefix ((ValaSymbol*) edomain);
240 	_tmp41_ = _tmp40_;
241 	_tmp42_ = g_strconcat (_tmp41_, "quark", NULL);
242 	_tmp43_ = _tmp42_;
243 	_g_free0 (_tmp41_);
244 	quark_fun_name = _tmp43_;
245 	_tmp44_ = vala_get_ccode_upper_case_name ((ValaSymbol*) edomain, NULL);
246 	_tmp45_ = _tmp44_;
247 	_tmp46_ = quark_fun_name;
248 	_tmp47_ = g_strconcat (_tmp46_, " ()", NULL);
249 	_tmp48_ = _tmp47_;
250 	_tmp49_ = vala_ccode_macro_replacement_new (_tmp45_, _tmp48_);
251 	_tmp50_ = _tmp49_;
252 	_g_free0 (_tmp48_);
253 	_g_free0 (_tmp45_);
254 	error_domain_define = _tmp50_;
255 	_tmp51_ = error_domain_define;
256 	vala_ccode_file_add_type_definition (decl_space, (ValaCCodeNode*) _tmp51_);
257 	_tmp52_ = quark_fun_name;
258 	_tmp53_ = ((ValaCCodeBaseModule*) self)->gquark_type;
259 	_tmp54_ = vala_data_type_get_type_symbol (_tmp53_);
260 	_tmp55_ = _tmp54_;
261 	_tmp56_ = vala_get_ccode_name ((ValaCodeNode*) _tmp55_);
262 	_tmp57_ = _tmp56_;
263 	_tmp58_ = vala_ccode_function_new (_tmp52_, _tmp57_);
264 	_tmp59_ = _tmp58_;
265 	_g_free0 (_tmp57_);
266 	cquark_fun = _tmp59_;
267 	_tmp60_ = cquark_fun;
268 	vala_ccode_file_add_function_declaration (decl_space, _tmp60_);
269 	_vala_ccode_node_unref0 (cquark_fun);
270 	_vala_ccode_node_unref0 (error_domain_define);
271 	_g_free0 (quark_fun_name);
272 	_vala_ccode_node_unref0 (cenum);
273 }
274 
275 static void
vala_gerror_module_real_visit_error_domain(ValaCodeVisitor * base,ValaErrorDomain * edomain)276 vala_gerror_module_real_visit_error_domain (ValaCodeVisitor* base,
277                                             ValaErrorDomain* edomain)
278 {
279 	ValaGErrorModule * self;
280 	ValaComment* _tmp0_;
281 	ValaComment* _tmp1_;
282 	ValaCCodeFile* _tmp9_;
283 	gchar* quark_fun_name = NULL;
284 	gchar* _tmp12_;
285 	gchar* _tmp13_;
286 	gchar* _tmp14_;
287 	gchar* _tmp15_;
288 	ValaCCodeFunction* cquark_fun = NULL;
289 	ValaDataType* _tmp16_;
290 	ValaTypeSymbol* _tmp17_;
291 	ValaTypeSymbol* _tmp18_;
292 	gchar* _tmp19_;
293 	gchar* _tmp20_;
294 	ValaCCodeFunction* _tmp21_;
295 	ValaCCodeFunction* _tmp22_;
296 	ValaCCodeFunctionCall* cquark_call = NULL;
297 	ValaCCodeIdentifier* _tmp23_;
298 	ValaCCodeIdentifier* _tmp24_;
299 	ValaCCodeFunctionCall* _tmp25_;
300 	ValaCCodeFunctionCall* _tmp26_;
301 	gchar* _tmp27_;
302 	gchar* _tmp28_;
303 	gchar* _tmp29_;
304 	gchar* _tmp30_;
305 	gchar* _tmp31_;
306 	gchar* _tmp32_;
307 	ValaCCodeConstant* _tmp33_;
308 	ValaCCodeConstant* _tmp34_;
309 	ValaCCodeFunction* _tmp35_;
310 	ValaCCodeFunction* _tmp36_;
311 	ValaCCodeFile* _tmp37_;
312 	self = (ValaGErrorModule*) base;
313 	g_return_if_fail (edomain != NULL);
314 	_tmp0_ = vala_symbol_get_comment ((ValaSymbol*) edomain);
315 	_tmp1_ = _tmp0_;
316 	if (_tmp1_ != NULL) {
317 		ValaCCodeFile* _tmp2_;
318 		ValaComment* _tmp3_;
319 		ValaComment* _tmp4_;
320 		const gchar* _tmp5_;
321 		const gchar* _tmp6_;
322 		ValaCCodeComment* _tmp7_;
323 		ValaCCodeComment* _tmp8_;
324 		_tmp2_ = ((ValaCCodeBaseModule*) self)->cfile;
325 		_tmp3_ = vala_symbol_get_comment ((ValaSymbol*) edomain);
326 		_tmp4_ = _tmp3_;
327 		_tmp5_ = vala_comment_get_content (_tmp4_);
328 		_tmp6_ = _tmp5_;
329 		_tmp7_ = vala_ccode_comment_new (_tmp6_);
330 		_tmp8_ = _tmp7_;
331 		vala_ccode_file_add_type_definition (_tmp2_, (ValaCCodeNode*) _tmp8_);
332 		_vala_ccode_node_unref0 (_tmp8_);
333 	}
334 	_tmp9_ = ((ValaCCodeBaseModule*) self)->cfile;
335 	vala_ccode_base_module_generate_error_domain_declaration ((ValaCCodeBaseModule*) self, edomain, _tmp9_);
336 	if (!vala_symbol_is_internal_symbol ((ValaSymbol*) edomain)) {
337 		ValaCCodeFile* _tmp10_;
338 		_tmp10_ = ((ValaCCodeBaseModule*) self)->header_file;
339 		vala_ccode_base_module_generate_error_domain_declaration ((ValaCCodeBaseModule*) self, edomain, _tmp10_);
340 	}
341 	if (!vala_symbol_is_private_symbol ((ValaSymbol*) edomain)) {
342 		ValaCCodeFile* _tmp11_;
343 		_tmp11_ = ((ValaCCodeBaseModule*) self)->internal_header_file;
344 		vala_ccode_base_module_generate_error_domain_declaration ((ValaCCodeBaseModule*) self, edomain, _tmp11_);
345 	}
346 	vala_code_node_accept_children ((ValaCodeNode*) edomain, (ValaCodeVisitor*) self);
347 	_tmp12_ = vala_get_ccode_lower_case_prefix ((ValaSymbol*) edomain);
348 	_tmp13_ = _tmp12_;
349 	_tmp14_ = g_strconcat (_tmp13_, "quark", NULL);
350 	_tmp15_ = _tmp14_;
351 	_g_free0 (_tmp13_);
352 	quark_fun_name = _tmp15_;
353 	_tmp16_ = ((ValaCCodeBaseModule*) self)->gquark_type;
354 	_tmp17_ = vala_data_type_get_type_symbol (_tmp16_);
355 	_tmp18_ = _tmp17_;
356 	_tmp19_ = vala_get_ccode_name ((ValaCodeNode*) _tmp18_);
357 	_tmp20_ = _tmp19_;
358 	_tmp21_ = vala_ccode_function_new (quark_fun_name, _tmp20_);
359 	_tmp22_ = _tmp21_;
360 	_g_free0 (_tmp20_);
361 	cquark_fun = _tmp22_;
362 	vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, cquark_fun);
363 	_tmp23_ = vala_ccode_identifier_new ("g_quark_from_static_string");
364 	_tmp24_ = _tmp23_;
365 	_tmp25_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp24_);
366 	_tmp26_ = _tmp25_;
367 	_vala_ccode_node_unref0 (_tmp24_);
368 	cquark_call = _tmp26_;
369 	_tmp27_ = vala_get_ccode_quark_name (edomain);
370 	_tmp28_ = _tmp27_;
371 	_tmp29_ = g_strconcat ("\"", _tmp28_, NULL);
372 	_tmp30_ = _tmp29_;
373 	_tmp31_ = g_strconcat (_tmp30_, "\"", NULL);
374 	_tmp32_ = _tmp31_;
375 	_tmp33_ = vala_ccode_constant_new (_tmp32_);
376 	_tmp34_ = _tmp33_;
377 	vala_ccode_function_call_add_argument (cquark_call, (ValaCCodeExpression*) _tmp34_);
378 	_vala_ccode_node_unref0 (_tmp34_);
379 	_g_free0 (_tmp32_);
380 	_g_free0 (_tmp30_);
381 	_g_free0 (_tmp28_);
382 	_tmp35_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
383 	_tmp36_ = _tmp35_;
384 	vala_ccode_function_add_return (_tmp36_, (ValaCCodeExpression*) cquark_call);
385 	vala_ccode_base_module_pop_function ((ValaCCodeBaseModule*) self);
386 	_tmp37_ = ((ValaCCodeBaseModule*) self)->cfile;
387 	vala_ccode_file_add_function (_tmp37_, cquark_fun);
388 	_vala_ccode_node_unref0 (cquark_call);
389 	_vala_ccode_node_unref0 (cquark_fun);
390 	_g_free0 (quark_fun_name);
391 }
392 
393 static void
vala_gerror_module_real_visit_throw_statement(ValaCodeVisitor * base,ValaThrowStatement * stmt)394 vala_gerror_module_real_visit_throw_statement (ValaCodeVisitor* base,
395                                                ValaThrowStatement* stmt)
396 {
397 	ValaGErrorModule * self;
398 	ValaCCodeFunction* _tmp0_;
399 	ValaCCodeFunction* _tmp1_;
400 	ValaCCodeExpression* _tmp2_;
401 	ValaCCodeExpression* _tmp3_;
402 	ValaExpression* _tmp4_;
403 	ValaExpression* _tmp5_;
404 	ValaCCodeExpression* _tmp6_;
405 	self = (ValaGErrorModule*) base;
406 	g_return_if_fail (stmt != NULL);
407 	vala_ccode_base_module_set_current_method_inner_error ((ValaCCodeBaseModule*) self, TRUE);
408 	_tmp0_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
409 	_tmp1_ = _tmp0_;
410 	_tmp2_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
411 	_tmp3_ = _tmp2_;
412 	_tmp4_ = vala_throw_statement_get_error_expression (stmt);
413 	_tmp5_ = _tmp4_;
414 	_tmp6_ = vala_get_cvalue (_tmp5_);
415 	vala_ccode_function_add_assignment (_tmp1_, _tmp3_, _tmp6_);
416 	_vala_ccode_node_unref0 (_tmp3_);
417 	vala_ccode_base_module_add_simple_check ((ValaCCodeBaseModule*) self, (ValaCodeNode*) stmt, TRUE);
418 }
419 
420 static gpointer
_vala_code_node_ref0(gpointer self)421 _vala_code_node_ref0 (gpointer self)
422 {
423 	return self ? vala_code_node_ref (self) : NULL;
424 }
425 
426 static void
vala_gerror_module_real_return_with_exception(ValaGErrorModule * self,ValaCCodeExpression * error_expr)427 vala_gerror_module_real_return_with_exception (ValaGErrorModule* self,
428                                                ValaCCodeExpression* error_expr)
429 {
430 	ValaCCodeFunctionCall* cpropagate = NULL;
431 	ValaCCodeIdentifier* _tmp0_;
432 	ValaCCodeIdentifier* _tmp1_;
433 	ValaCCodeFunctionCall* _tmp2_;
434 	ValaCCodeFunctionCall* _tmp3_;
435 	ValaCCodeFunctionCall* _tmp4_;
436 	ValaCCodeIdentifier* _tmp5_;
437 	ValaCCodeIdentifier* _tmp6_;
438 	ValaCCodeFunctionCall* _tmp7_;
439 	ValaCCodeFunction* _tmp8_;
440 	ValaCCodeFunction* _tmp9_;
441 	ValaCCodeFunctionCall* _tmp10_;
442 	ValaSymbol* _tmp11_;
443 	ValaSymbol* _tmp12_;
444 	ValaMethod* _tmp13_;
445 	ValaMethod* _tmp14_;
446 	gboolean _tmp15_ = FALSE;
447 	ValaMethod* _tmp16_;
448 	ValaMethod* _tmp17_;
449 	g_return_if_fail (error_expr != NULL);
450 	_tmp0_ = vala_ccode_identifier_new ("g_propagate_error");
451 	_tmp1_ = _tmp0_;
452 	_tmp2_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp1_);
453 	_tmp3_ = _tmp2_;
454 	_vala_ccode_node_unref0 (_tmp1_);
455 	cpropagate = _tmp3_;
456 	_tmp4_ = cpropagate;
457 	_tmp5_ = vala_ccode_identifier_new ("error");
458 	_tmp6_ = _tmp5_;
459 	vala_ccode_function_call_add_argument (_tmp4_, (ValaCCodeExpression*) _tmp6_);
460 	_vala_ccode_node_unref0 (_tmp6_);
461 	_tmp7_ = cpropagate;
462 	vala_ccode_function_call_add_argument (_tmp7_, error_expr);
463 	_tmp8_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
464 	_tmp9_ = _tmp8_;
465 	_tmp10_ = cpropagate;
466 	vala_ccode_function_add_expression (_tmp9_, (ValaCCodeExpression*) _tmp10_);
467 	_tmp11_ = vala_ccode_base_module_get_current_symbol ((ValaCCodeBaseModule*) self);
468 	_tmp12_ = _tmp11_;
469 	vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, _tmp12_, NULL, NULL);
470 	_tmp13_ = vala_ccode_base_module_get_current_method ((ValaCCodeBaseModule*) self);
471 	_tmp14_ = _tmp13_;
472 	vala_ccode_base_module_append_out_param_free ((ValaCCodeBaseModule*) self, _tmp14_);
473 	_tmp16_ = vala_ccode_base_module_get_current_method ((ValaCCodeBaseModule*) self);
474 	_tmp17_ = _tmp16_;
475 	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp17_, VALA_TYPE_CREATION_METHOD)) {
476 		ValaMethod* _tmp18_;
477 		ValaMethod* _tmp19_;
478 		ValaSymbol* _tmp20_;
479 		ValaSymbol* _tmp21_;
480 		_tmp18_ = vala_ccode_base_module_get_current_method ((ValaCCodeBaseModule*) self);
481 		_tmp19_ = _tmp18_;
482 		_tmp20_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp19_);
483 		_tmp21_ = _tmp20_;
484 		_tmp15_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp21_, VALA_TYPE_CLASS);
485 	} else {
486 		_tmp15_ = FALSE;
487 	}
488 	if (_tmp15_) {
489 		ValaClass* cl = NULL;
490 		ValaMethod* _tmp22_;
491 		ValaMethod* _tmp23_;
492 		ValaSymbol* _tmp24_;
493 		ValaSymbol* _tmp25_;
494 		ValaClass* _tmp26_;
495 		ValaCCodeFunction* _tmp27_;
496 		ValaCCodeFunction* _tmp28_;
497 		ValaClass* _tmp29_;
498 		ValaObjectType* _tmp30_;
499 		ValaObjectType* _tmp31_;
500 		ValaCCodeIdentifier* _tmp32_;
501 		ValaCCodeIdentifier* _tmp33_;
502 		ValaGLibValue* _tmp34_;
503 		ValaGLibValue* _tmp35_;
504 		ValaCCodeExpression* _tmp36_;
505 		ValaCCodeExpression* _tmp37_;
506 		ValaCCodeFunction* _tmp38_;
507 		ValaCCodeFunction* _tmp39_;
508 		ValaCCodeConstant* _tmp40_;
509 		ValaCCodeConstant* _tmp41_;
510 		_tmp22_ = vala_ccode_base_module_get_current_method ((ValaCCodeBaseModule*) self);
511 		_tmp23_ = _tmp22_;
512 		_tmp24_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp23_);
513 		_tmp25_ = _tmp24_;
514 		_tmp26_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, VALA_TYPE_CLASS, ValaClass));
515 		cl = _tmp26_;
516 		_tmp27_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
517 		_tmp28_ = _tmp27_;
518 		_tmp29_ = cl;
519 		_tmp30_ = vala_object_type_new ((ValaObjectTypeSymbol*) _tmp29_);
520 		_tmp31_ = _tmp30_;
521 		_tmp32_ = vala_ccode_identifier_new ("self");
522 		_tmp33_ = _tmp32_;
523 		_tmp34_ = vala_glib_value_new ((ValaDataType*) _tmp31_, (ValaCCodeExpression*) _tmp33_, TRUE);
524 		_tmp35_ = _tmp34_;
525 		_tmp36_ = vala_ccode_base_module_destroy_value ((ValaCCodeBaseModule*) self, (ValaTargetValue*) _tmp35_, FALSE);
526 		_tmp37_ = _tmp36_;
527 		vala_ccode_function_add_expression (_tmp28_, _tmp37_);
528 		_vala_ccode_node_unref0 (_tmp37_);
529 		_vala_target_value_unref0 (_tmp35_);
530 		_vala_ccode_node_unref0 (_tmp33_);
531 		_vala_code_node_unref0 (_tmp31_);
532 		_tmp38_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
533 		_tmp39_ = _tmp38_;
534 		_tmp40_ = vala_ccode_constant_new ("NULL");
535 		_tmp41_ = _tmp40_;
536 		vala_ccode_function_add_return (_tmp39_, (ValaCCodeExpression*) _tmp41_);
537 		_vala_ccode_node_unref0 (_tmp41_);
538 		_vala_code_node_unref0 (cl);
539 	} else {
540 		if (vala_ccode_base_module_is_in_coroutine ((ValaCCodeBaseModule*) self)) {
541 			ValaCCodeFunction* _tmp42_;
542 			ValaCCodeFunction* _tmp43_;
543 			ValaCCodeConstant* _tmp44_;
544 			ValaCCodeConstant* _tmp45_;
545 			_tmp42_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
546 			_tmp43_ = _tmp42_;
547 			_tmp44_ = vala_ccode_constant_new ("FALSE");
548 			_tmp45_ = _tmp44_;
549 			vala_ccode_function_add_return (_tmp43_, (ValaCCodeExpression*) _tmp45_);
550 			_vala_ccode_node_unref0 (_tmp45_);
551 		} else {
552 			ValaDataType* _tmp46_;
553 			ValaDataType* _tmp47_;
554 			_tmp46_ = vala_ccode_base_module_get_current_return_type ((ValaCCodeBaseModule*) self);
555 			_tmp47_ = _tmp46_;
556 			vala_ccode_base_module_return_default_value ((ValaCCodeBaseModule*) self, _tmp47_, TRUE);
557 		}
558 	}
559 	_vala_ccode_node_unref0 (cpropagate);
560 }
561 
562 void
vala_gerror_module_return_with_exception(ValaGErrorModule * self,ValaCCodeExpression * error_expr)563 vala_gerror_module_return_with_exception (ValaGErrorModule* self,
564                                           ValaCCodeExpression* error_expr)
565 {
566 	g_return_if_fail (self != NULL);
567 	VALA_GERROR_MODULE_GET_CLASS (self)->return_with_exception (self, error_expr);
568 }
569 
570 static void
vala_gerror_module_uncaught_error_statement(ValaGErrorModule * self,ValaCCodeExpression * inner_error,gboolean unexpected,ValaCodeNode * start_at)571 vala_gerror_module_uncaught_error_statement (ValaGErrorModule* self,
572                                              ValaCCodeExpression* inner_error,
573                                              gboolean unexpected,
574                                              ValaCodeNode* start_at)
575 {
576 	ValaMethod* _tmp4_;
577 	ValaMethod* _tmp5_;
578 	ValaCCodeFile* _tmp6_;
579 	ValaCCodeFunctionCall* ccritical = NULL;
580 	ValaCCodeIdentifier* _tmp7_;
581 	ValaCCodeIdentifier* _tmp8_;
582 	ValaCCodeFunctionCall* _tmp9_;
583 	ValaCCodeFunctionCall* _tmp10_;
584 	const gchar* _tmp11_ = NULL;
585 	ValaCCodeFunctionCall* _tmp12_;
586 	ValaCCodeConstant* _tmp13_;
587 	ValaCCodeConstant* _tmp14_;
588 	ValaCCodeFunctionCall* _tmp15_;
589 	ValaCCodeConstant* _tmp16_;
590 	ValaCCodeConstant* _tmp17_;
591 	ValaCCodeFunctionCall* _tmp18_;
592 	ValaCCodeConstant* _tmp19_;
593 	ValaCCodeConstant* _tmp20_;
594 	ValaCCodeFunctionCall* _tmp21_;
595 	ValaCCodeMemberAccess* _tmp22_;
596 	ValaCCodeMemberAccess* _tmp23_;
597 	ValaCCodeFunctionCall* domain_name = NULL;
598 	ValaCCodeIdentifier* _tmp24_;
599 	ValaCCodeIdentifier* _tmp25_;
600 	ValaCCodeFunctionCall* _tmp26_;
601 	ValaCCodeFunctionCall* _tmp27_;
602 	ValaCCodeFunctionCall* _tmp28_;
603 	ValaCCodeMemberAccess* _tmp29_;
604 	ValaCCodeMemberAccess* _tmp30_;
605 	ValaCCodeFunctionCall* _tmp31_;
606 	ValaCCodeFunctionCall* _tmp32_;
607 	ValaCCodeFunctionCall* _tmp33_;
608 	ValaCCodeMemberAccess* _tmp34_;
609 	ValaCCodeMemberAccess* _tmp35_;
610 	ValaCCodeFunctionCall* cclear = NULL;
611 	ValaCCodeIdentifier* _tmp36_;
612 	ValaCCodeIdentifier* _tmp37_;
613 	ValaCCodeFunctionCall* _tmp38_;
614 	ValaCCodeFunctionCall* _tmp39_;
615 	ValaCCodeFunctionCall* _tmp40_;
616 	ValaCCodeUnaryExpression* _tmp41_;
617 	ValaCCodeUnaryExpression* _tmp42_;
618 	ValaCCodeFunction* _tmp43_;
619 	ValaCCodeFunction* _tmp44_;
620 	ValaCCodeFunctionCall* _tmp45_;
621 	ValaCCodeFunction* _tmp46_;
622 	ValaCCodeFunction* _tmp47_;
623 	ValaCCodeFunctionCall* _tmp48_;
624 	gboolean _tmp49_ = FALSE;
625 	g_return_if_fail (self != NULL);
626 	g_return_if_fail (inner_error != NULL);
627 	if (G_TYPE_CHECK_INSTANCE_TYPE (start_at, VALA_TYPE_TRY_STATEMENT)) {
628 		ValaCodeNode* _tmp0_;
629 		ValaCodeNode* _tmp1_;
630 		_tmp0_ = vala_code_node_get_parent_node (start_at);
631 		_tmp1_ = _tmp0_;
632 		vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, (ValaSymbol*) (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, VALA_TYPE_BLOCK) ? ((ValaBlock*) _tmp1_) : NULL), NULL, NULL);
633 	} else {
634 		ValaSymbol* _tmp2_;
635 		ValaSymbol* _tmp3_;
636 		_tmp2_ = vala_ccode_base_module_get_current_symbol ((ValaCCodeBaseModule*) self);
637 		_tmp3_ = _tmp2_;
638 		vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, _tmp3_, NULL, NULL);
639 	}
640 	_tmp4_ = vala_ccode_base_module_get_current_method ((ValaCCodeBaseModule*) self);
641 	_tmp5_ = _tmp4_;
642 	vala_ccode_base_module_append_out_param_free ((ValaCCodeBaseModule*) self, _tmp5_);
643 	_tmp6_ = ((ValaCCodeBaseModule*) self)->cfile;
644 	vala_ccode_file_add_include (_tmp6_, "glib.h", FALSE);
645 	_tmp7_ = vala_ccode_identifier_new ("g_critical");
646 	_tmp8_ = _tmp7_;
647 	_tmp9_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp8_);
648 	_tmp10_ = _tmp9_;
649 	_vala_ccode_node_unref0 (_tmp8_);
650 	ccritical = _tmp10_;
651 	if (unexpected) {
652 		_tmp11_ = "\"file %s: line %d: unexpected error: %s (%s, %d)\"";
653 	} else {
654 		_tmp11_ = "\"file %s: line %d: uncaught error: %s (%s, %d)\"";
655 	}
656 	_tmp12_ = ccritical;
657 	_tmp13_ = vala_ccode_constant_new (_tmp11_);
658 	_tmp14_ = _tmp13_;
659 	vala_ccode_function_call_add_argument (_tmp12_, (ValaCCodeExpression*) _tmp14_);
660 	_vala_ccode_node_unref0 (_tmp14_);
661 	_tmp15_ = ccritical;
662 	_tmp16_ = vala_ccode_constant_new ("__FILE__");
663 	_tmp17_ = _tmp16_;
664 	vala_ccode_function_call_add_argument (_tmp15_, (ValaCCodeExpression*) _tmp17_);
665 	_vala_ccode_node_unref0 (_tmp17_);
666 	_tmp18_ = ccritical;
667 	_tmp19_ = vala_ccode_constant_new ("__LINE__");
668 	_tmp20_ = _tmp19_;
669 	vala_ccode_function_call_add_argument (_tmp18_, (ValaCCodeExpression*) _tmp20_);
670 	_vala_ccode_node_unref0 (_tmp20_);
671 	_tmp21_ = ccritical;
672 	_tmp22_ = vala_ccode_member_access_new_pointer (inner_error, "message");
673 	_tmp23_ = _tmp22_;
674 	vala_ccode_function_call_add_argument (_tmp21_, (ValaCCodeExpression*) _tmp23_);
675 	_vala_ccode_node_unref0 (_tmp23_);
676 	_tmp24_ = vala_ccode_identifier_new ("g_quark_to_string");
677 	_tmp25_ = _tmp24_;
678 	_tmp26_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp25_);
679 	_tmp27_ = _tmp26_;
680 	_vala_ccode_node_unref0 (_tmp25_);
681 	domain_name = _tmp27_;
682 	_tmp28_ = domain_name;
683 	_tmp29_ = vala_ccode_member_access_new_pointer (inner_error, "domain");
684 	_tmp30_ = _tmp29_;
685 	vala_ccode_function_call_add_argument (_tmp28_, (ValaCCodeExpression*) _tmp30_);
686 	_vala_ccode_node_unref0 (_tmp30_);
687 	_tmp31_ = ccritical;
688 	_tmp32_ = domain_name;
689 	vala_ccode_function_call_add_argument (_tmp31_, (ValaCCodeExpression*) _tmp32_);
690 	_tmp33_ = ccritical;
691 	_tmp34_ = vala_ccode_member_access_new_pointer (inner_error, "code");
692 	_tmp35_ = _tmp34_;
693 	vala_ccode_function_call_add_argument (_tmp33_, (ValaCCodeExpression*) _tmp35_);
694 	_vala_ccode_node_unref0 (_tmp35_);
695 	_tmp36_ = vala_ccode_identifier_new ("g_clear_error");
696 	_tmp37_ = _tmp36_;
697 	_tmp38_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp37_);
698 	_tmp39_ = _tmp38_;
699 	_vala_ccode_node_unref0 (_tmp37_);
700 	cclear = _tmp39_;
701 	_tmp40_ = cclear;
702 	_tmp41_ = vala_ccode_unary_expression_new (VALA_CCODE_UNARY_OPERATOR_ADDRESS_OF, inner_error);
703 	_tmp42_ = _tmp41_;
704 	vala_ccode_function_call_add_argument (_tmp40_, (ValaCCodeExpression*) _tmp42_);
705 	_vala_ccode_node_unref0 (_tmp42_);
706 	_tmp43_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
707 	_tmp44_ = _tmp43_;
708 	_tmp45_ = ccritical;
709 	vala_ccode_function_add_expression (_tmp44_, (ValaCCodeExpression*) _tmp45_);
710 	_tmp46_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
711 	_tmp47_ = _tmp46_;
712 	_tmp48_ = cclear;
713 	vala_ccode_function_add_expression (_tmp47_, (ValaCCodeExpression*) _tmp48_);
714 	if (vala_ccode_base_module_is_in_constructor ((ValaCCodeBaseModule*) self)) {
715 		_tmp49_ = TRUE;
716 	} else {
717 		_tmp49_ = vala_ccode_base_module_is_in_destructor ((ValaCCodeBaseModule*) self);
718 	}
719 	if (_tmp49_) {
720 	} else {
721 		ValaMethod* _tmp50_;
722 		ValaMethod* _tmp51_;
723 		_tmp50_ = vala_ccode_base_module_get_current_method ((ValaCCodeBaseModule*) self);
724 		_tmp51_ = _tmp50_;
725 		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp51_, VALA_TYPE_CREATION_METHOD)) {
726 			ValaMethod* _tmp52_;
727 			ValaMethod* _tmp53_;
728 			ValaSymbol* _tmp54_;
729 			ValaSymbol* _tmp55_;
730 			_tmp52_ = vala_ccode_base_module_get_current_method ((ValaCCodeBaseModule*) self);
731 			_tmp53_ = _tmp52_;
732 			_tmp54_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp53_);
733 			_tmp55_ = _tmp54_;
734 			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp55_, VALA_TYPE_STRUCT)) {
735 				ValaCCodeFunction* _tmp56_;
736 				ValaCCodeFunction* _tmp57_;
737 				_tmp56_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
738 				_tmp57_ = _tmp56_;
739 				vala_ccode_function_add_return (_tmp57_, NULL);
740 			} else {
741 				ValaCCodeFunction* _tmp58_;
742 				ValaCCodeFunction* _tmp59_;
743 				ValaCCodeConstant* _tmp60_;
744 				ValaCCodeConstant* _tmp61_;
745 				_tmp58_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
746 				_tmp59_ = _tmp58_;
747 				_tmp60_ = vala_ccode_constant_new ("NULL");
748 				_tmp61_ = _tmp60_;
749 				vala_ccode_function_add_return (_tmp59_, (ValaCCodeExpression*) _tmp61_);
750 				_vala_ccode_node_unref0 (_tmp61_);
751 			}
752 		} else {
753 			if (vala_ccode_base_module_is_in_coroutine ((ValaCCodeBaseModule*) self)) {
754 				ValaCCodeMemberAccess* async_result_expr = NULL;
755 				ValaCCodeIdentifier* _tmp62_;
756 				ValaCCodeIdentifier* _tmp63_;
757 				ValaCCodeMemberAccess* _tmp64_;
758 				ValaCCodeMemberAccess* _tmp65_;
759 				ValaCCodeFunctionCall* unref = NULL;
760 				ValaCCodeIdentifier* _tmp66_;
761 				ValaCCodeIdentifier* _tmp67_;
762 				ValaCCodeFunctionCall* _tmp68_;
763 				ValaCCodeFunctionCall* _tmp69_;
764 				ValaCCodeFunctionCall* _tmp70_;
765 				ValaCCodeMemberAccess* _tmp71_;
766 				ValaCCodeFunction* _tmp72_;
767 				ValaCCodeFunction* _tmp73_;
768 				ValaCCodeFunctionCall* _tmp74_;
769 				ValaCCodeFunction* _tmp75_;
770 				ValaCCodeFunction* _tmp76_;
771 				ValaCCodeConstant* _tmp77_;
772 				ValaCCodeConstant* _tmp78_;
773 				_tmp62_ = vala_ccode_identifier_new ("_data_");
774 				_tmp63_ = _tmp62_;
775 				_tmp64_ = vala_ccode_member_access_new_pointer ((ValaCCodeExpression*) _tmp63_, "_async_result");
776 				_tmp65_ = _tmp64_;
777 				_vala_ccode_node_unref0 (_tmp63_);
778 				async_result_expr = _tmp65_;
779 				_tmp66_ = vala_ccode_identifier_new ("g_object_unref");
780 				_tmp67_ = _tmp66_;
781 				_tmp68_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp67_);
782 				_tmp69_ = _tmp68_;
783 				_vala_ccode_node_unref0 (_tmp67_);
784 				unref = _tmp69_;
785 				_tmp70_ = unref;
786 				_tmp71_ = async_result_expr;
787 				vala_ccode_function_call_add_argument (_tmp70_, (ValaCCodeExpression*) _tmp71_);
788 				_tmp72_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
789 				_tmp73_ = _tmp72_;
790 				_tmp74_ = unref;
791 				vala_ccode_function_add_expression (_tmp73_, (ValaCCodeExpression*) _tmp74_);
792 				_tmp75_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
793 				_tmp76_ = _tmp75_;
794 				_tmp77_ = vala_ccode_constant_new ("FALSE");
795 				_tmp78_ = _tmp77_;
796 				vala_ccode_function_add_return (_tmp76_, (ValaCCodeExpression*) _tmp78_);
797 				_vala_ccode_node_unref0 (_tmp78_);
798 				_vala_ccode_node_unref0 (unref);
799 				_vala_ccode_node_unref0 (async_result_expr);
800 			} else {
801 				ValaDataType* _tmp79_;
802 				ValaDataType* _tmp80_;
803 				_tmp79_ = vala_ccode_base_module_get_current_return_type ((ValaCCodeBaseModule*) self);
804 				_tmp80_ = _tmp79_;
805 				if (_tmp80_ != NULL) {
806 					ValaDataType* _tmp81_;
807 					ValaDataType* _tmp82_;
808 					_tmp81_ = vala_ccode_base_module_get_current_return_type ((ValaCCodeBaseModule*) self);
809 					_tmp82_ = _tmp81_;
810 					vala_ccode_base_module_return_default_value ((ValaCCodeBaseModule*) self, _tmp82_, TRUE);
811 				}
812 			}
813 		}
814 	}
815 	_vala_ccode_node_unref0 (cclear);
816 	_vala_ccode_node_unref0 (domain_name);
817 	_vala_ccode_node_unref0 (ccritical);
818 }
819 
820 static gboolean
vala_gerror_module_in_finally_block(ValaGErrorModule * self,ValaCodeNode * node)821 vala_gerror_module_in_finally_block (ValaGErrorModule* self,
822                                      ValaCodeNode* node)
823 {
824 	ValaCodeNode* current_node = NULL;
825 	ValaCodeNode* _tmp0_;
826 	gboolean result = FALSE;
827 	g_return_val_if_fail (self != NULL, FALSE);
828 	g_return_val_if_fail (node != NULL, FALSE);
829 	_tmp0_ = _vala_code_node_ref0 (node);
830 	current_node = _tmp0_;
831 	while (TRUE) {
832 		ValaCodeNode* _tmp1_;
833 		ValaTryStatement* try_stmt = NULL;
834 		ValaCodeNode* _tmp2_;
835 		ValaCodeNode* _tmp3_;
836 		ValaCodeNode* _tmp4_;
837 		ValaTryStatement* _tmp5_;
838 		gboolean _tmp6_ = FALSE;
839 		ValaTryStatement* _tmp7_;
840 		ValaCodeNode* _tmp12_;
841 		ValaCodeNode* _tmp13_;
842 		ValaCodeNode* _tmp14_;
843 		ValaCodeNode* _tmp15_;
844 		_tmp1_ = current_node;
845 		if (!(_tmp1_ != NULL)) {
846 			break;
847 		}
848 		_tmp2_ = current_node;
849 		_tmp3_ = vala_code_node_get_parent_node (_tmp2_);
850 		_tmp4_ = _tmp3_;
851 		_tmp5_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, VALA_TYPE_TRY_STATEMENT) ? ((ValaTryStatement*) _tmp4_) : NULL);
852 		try_stmt = _tmp5_;
853 		_tmp7_ = try_stmt;
854 		if (_tmp7_ != NULL) {
855 			ValaTryStatement* _tmp8_;
856 			ValaBlock* _tmp9_;
857 			ValaBlock* _tmp10_;
858 			ValaCodeNode* _tmp11_;
859 			_tmp8_ = try_stmt;
860 			_tmp9_ = vala_try_statement_get_finally_body (_tmp8_);
861 			_tmp10_ = _tmp9_;
862 			_tmp11_ = current_node;
863 			_tmp6_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, VALA_TYPE_CODE_NODE, ValaCodeNode) == _tmp11_;
864 		} else {
865 			_tmp6_ = FALSE;
866 		}
867 		if (_tmp6_) {
868 			result = TRUE;
869 			_vala_code_node_unref0 (try_stmt);
870 			_vala_code_node_unref0 (current_node);
871 			return result;
872 		}
873 		_tmp12_ = current_node;
874 		_tmp13_ = vala_code_node_get_parent_node (_tmp12_);
875 		_tmp14_ = _tmp13_;
876 		_tmp15_ = _vala_code_node_ref0 (_tmp14_);
877 		_vala_code_node_unref0 (current_node);
878 		current_node = _tmp15_;
879 		_vala_code_node_unref0 (try_stmt);
880 	}
881 	result = FALSE;
882 	_vala_code_node_unref0 (current_node);
883 	return result;
884 }
885 
886 static gpointer
_vala_ccode_node_ref0(gpointer self)887 _vala_ccode_node_ref0 (gpointer self)
888 {
889 	return self ? vala_ccode_node_ref (self) : NULL;
890 }
891 
892 static void
vala_gerror_module_real_add_simple_check(ValaCCodeBaseModule * base,ValaCodeNode * node,gboolean always_fails)893 vala_gerror_module_real_add_simple_check (ValaCCodeBaseModule* base,
894                                           ValaCodeNode* node,
895                                           gboolean always_fails)
896 {
897 	ValaGErrorModule * self;
898 	ValaTryStatement* _tmp15_;
899 	ValaTryStatement* _tmp16_;
900 	self = (ValaGErrorModule*) base;
901 	g_return_if_fail (node != NULL);
902 	vala_ccode_base_module_set_current_method_inner_error ((ValaCCodeBaseModule*) self, TRUE);
903 	if (always_fails) {
904 	} else {
905 		ValaCCodeBinaryExpression* ccond = NULL;
906 		ValaCCodeExpression* _tmp0_;
907 		ValaCCodeExpression* _tmp1_;
908 		ValaCCodeConstant* _tmp2_;
909 		ValaCCodeConstant* _tmp3_;
910 		ValaCCodeBinaryExpression* _tmp4_;
911 		ValaCCodeBinaryExpression* _tmp5_;
912 		ValaCCodeFunctionCall* unlikely = NULL;
913 		ValaCCodeIdentifier* _tmp6_;
914 		ValaCCodeIdentifier* _tmp7_;
915 		ValaCCodeFunctionCall* _tmp8_;
916 		ValaCCodeFunctionCall* _tmp9_;
917 		ValaCCodeFunctionCall* _tmp10_;
918 		ValaCCodeBinaryExpression* _tmp11_;
919 		ValaCCodeFunction* _tmp12_;
920 		ValaCCodeFunction* _tmp13_;
921 		ValaCCodeFunctionCall* _tmp14_;
922 		_tmp0_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
923 		_tmp1_ = _tmp0_;
924 		_tmp2_ = vala_ccode_constant_new ("NULL");
925 		_tmp3_ = _tmp2_;
926 		_tmp4_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_INEQUALITY, _tmp1_, (ValaCCodeExpression*) _tmp3_);
927 		_tmp5_ = _tmp4_;
928 		_vala_ccode_node_unref0 (_tmp3_);
929 		_vala_ccode_node_unref0 (_tmp1_);
930 		ccond = _tmp5_;
931 		_tmp6_ = vala_ccode_identifier_new ("G_UNLIKELY");
932 		_tmp7_ = _tmp6_;
933 		_tmp8_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp7_);
934 		_tmp9_ = _tmp8_;
935 		_vala_ccode_node_unref0 (_tmp7_);
936 		unlikely = _tmp9_;
937 		_tmp10_ = unlikely;
938 		_tmp11_ = ccond;
939 		vala_ccode_function_call_add_argument (_tmp10_, (ValaCCodeExpression*) _tmp11_);
940 		_tmp12_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
941 		_tmp13_ = _tmp12_;
942 		_tmp14_ = unlikely;
943 		vala_ccode_function_open_if (_tmp13_, (ValaCCodeExpression*) _tmp14_);
944 		_vala_ccode_node_unref0 (unlikely);
945 		_vala_ccode_node_unref0 (ccond);
946 	}
947 	_tmp15_ = vala_ccode_base_module_get_current_try ((ValaCCodeBaseModule*) self);
948 	_tmp16_ = _tmp15_;
949 	if (_tmp16_ != NULL) {
950 		ValaArrayList* error_types = NULL;
951 		GEqualFunc _tmp25_;
952 		ValaArrayList* _tmp26_;
953 		ValaArrayList* _tmp27_;
954 		gboolean has_general_catch_clause = FALSE;
955 		if (self->priv->is_in_catch) {
956 			ValaSymbol* _tmp17_;
957 			ValaSymbol* _tmp18_;
958 			ValaCatchClause* _tmp19_;
959 			ValaCatchClause* _tmp20_;
960 			_tmp17_ = vala_ccode_base_module_get_current_symbol ((ValaCCodeBaseModule*) self);
961 			_tmp18_ = _tmp17_;
962 			_tmp19_ = vala_ccode_base_module_get_current_catch ((ValaCCodeBaseModule*) self);
963 			_tmp20_ = _tmp19_;
964 			vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, _tmp18_, NULL, (ValaCodeNode*) _tmp20_);
965 		} else {
966 			ValaSymbol* _tmp21_;
967 			ValaSymbol* _tmp22_;
968 			ValaTryStatement* _tmp23_;
969 			ValaTryStatement* _tmp24_;
970 			_tmp21_ = vala_ccode_base_module_get_current_symbol ((ValaCCodeBaseModule*) self);
971 			_tmp22_ = _tmp21_;
972 			_tmp23_ = vala_ccode_base_module_get_current_try ((ValaCCodeBaseModule*) self);
973 			_tmp24_ = _tmp23_;
974 			vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, _tmp22_, NULL, (ValaCodeNode*) _tmp24_);
975 		}
976 		_tmp25_ = g_direct_equal;
977 		_tmp26_ = vala_array_list_new (VALA_TYPE_DATA_TYPE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp25_);
978 		error_types = _tmp26_;
979 		_tmp27_ = error_types;
980 		vala_code_node_get_error_types (node, (ValaCollection*) _tmp27_, NULL);
981 		has_general_catch_clause = FALSE;
982 		if (!self->priv->is_in_catch) {
983 			ValaArrayList* handled_error_types = NULL;
984 			GEqualFunc _tmp28_;
985 			ValaArrayList* _tmp29_;
986 			_tmp28_ = g_direct_equal;
987 			_tmp29_ = vala_array_list_new (VALA_TYPE_DATA_TYPE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp28_);
988 			handled_error_types = _tmp29_;
989 			{
990 				ValaList* _clause_list = NULL;
991 				ValaTryStatement* _tmp30_;
992 				ValaTryStatement* _tmp31_;
993 				ValaList* _tmp32_;
994 				ValaList* _tmp33_;
995 				gint _clause_size = 0;
996 				ValaList* _tmp34_;
997 				gint _tmp35_;
998 				gint _tmp36_;
999 				gint _clause_index = 0;
1000 				_tmp30_ = vala_ccode_base_module_get_current_try ((ValaCCodeBaseModule*) self);
1001 				_tmp31_ = _tmp30_;
1002 				_tmp32_ = vala_try_statement_get_catch_clauses (_tmp31_);
1003 				_tmp33_ = _vala_iterable_ref0 (_tmp32_);
1004 				_clause_list = _tmp33_;
1005 				_tmp34_ = _clause_list;
1006 				_tmp35_ = vala_collection_get_size ((ValaCollection*) _tmp34_);
1007 				_tmp36_ = _tmp35_;
1008 				_clause_size = _tmp36_;
1009 				_clause_index = -1;
1010 				while (TRUE) {
1011 					gint _tmp37_;
1012 					gint _tmp38_;
1013 					ValaCatchClause* clause = NULL;
1014 					ValaList* _tmp39_;
1015 					gpointer _tmp40_;
1016 					ValaArrayList* _tmp71_;
1017 					ValaCatchClause* _tmp72_;
1018 					ValaDataType* _tmp73_;
1019 					ValaDataType* _tmp74_;
1020 					ValaErrorType* _tmp75_;
1021 					_clause_index = _clause_index + 1;
1022 					_tmp37_ = _clause_index;
1023 					_tmp38_ = _clause_size;
1024 					if (!(_tmp37_ < _tmp38_)) {
1025 						break;
1026 					}
1027 					_tmp39_ = _clause_list;
1028 					_tmp40_ = vala_list_get (_tmp39_, _clause_index);
1029 					clause = (ValaCatchClause*) _tmp40_;
1030 					{
1031 						ValaArrayList* _node_error_type_list = NULL;
1032 						ValaArrayList* _tmp41_;
1033 						ValaArrayList* _tmp42_;
1034 						gint _node_error_type_size = 0;
1035 						ValaArrayList* _tmp43_;
1036 						gint _tmp44_;
1037 						gint _tmp45_;
1038 						gint _node_error_type_index = 0;
1039 						_tmp41_ = error_types;
1040 						_tmp42_ = _vala_iterable_ref0 (_tmp41_);
1041 						_node_error_type_list = _tmp42_;
1042 						_tmp43_ = _node_error_type_list;
1043 						_tmp44_ = vala_collection_get_size ((ValaCollection*) _tmp43_);
1044 						_tmp45_ = _tmp44_;
1045 						_node_error_type_size = _tmp45_;
1046 						_node_error_type_index = -1;
1047 						while (TRUE) {
1048 							gint _tmp46_;
1049 							gint _tmp47_;
1050 							ValaDataType* node_error_type = NULL;
1051 							ValaArrayList* _tmp48_;
1052 							gpointer _tmp49_;
1053 							gboolean _tmp50_ = FALSE;
1054 							ValaCatchClause* _tmp51_;
1055 							ValaDataType* _tmp52_;
1056 							ValaDataType* _tmp53_;
1057 							_node_error_type_index = _node_error_type_index + 1;
1058 							_tmp46_ = _node_error_type_index;
1059 							_tmp47_ = _node_error_type_size;
1060 							if (!(_tmp46_ < _tmp47_)) {
1061 								break;
1062 							}
1063 							_tmp48_ = _node_error_type_list;
1064 							_tmp49_ = vala_list_get ((ValaList*) _tmp48_, _node_error_type_index);
1065 							node_error_type = (ValaDataType*) _tmp49_;
1066 							_tmp51_ = clause;
1067 							_tmp52_ = vala_catch_clause_get_error_type (_tmp51_);
1068 							_tmp53_ = _tmp52_;
1069 							if (_tmp53_ == NULL) {
1070 								_tmp50_ = TRUE;
1071 							} else {
1072 								ValaDataType* _tmp54_;
1073 								ValaCatchClause* _tmp55_;
1074 								ValaDataType* _tmp56_;
1075 								ValaDataType* _tmp57_;
1076 								_tmp54_ = node_error_type;
1077 								_tmp55_ = clause;
1078 								_tmp56_ = vala_catch_clause_get_error_type (_tmp55_);
1079 								_tmp57_ = _tmp56_;
1080 								_tmp50_ = vala_data_type_compatible (_tmp54_, _tmp57_);
1081 							}
1082 							if (_tmp50_) {
1083 								ValaArrayList* _tmp58_;
1084 								ValaDataType* _tmp59_;
1085 								_tmp58_ = handled_error_types;
1086 								_tmp59_ = node_error_type;
1087 								vala_collection_add ((ValaCollection*) _tmp58_, _tmp59_);
1088 							}
1089 							_vala_code_node_unref0 (node_error_type);
1090 						}
1091 						_vala_iterable_unref0 (_node_error_type_list);
1092 					}
1093 					{
1094 						ValaArrayList* _handled_error_type_list = NULL;
1095 						ValaArrayList* _tmp60_;
1096 						ValaArrayList* _tmp61_;
1097 						gint _handled_error_type_size = 0;
1098 						ValaArrayList* _tmp62_;
1099 						gint _tmp63_;
1100 						gint _tmp64_;
1101 						gint _handled_error_type_index = 0;
1102 						_tmp60_ = handled_error_types;
1103 						_tmp61_ = _vala_iterable_ref0 (_tmp60_);
1104 						_handled_error_type_list = _tmp61_;
1105 						_tmp62_ = _handled_error_type_list;
1106 						_tmp63_ = vala_collection_get_size ((ValaCollection*) _tmp62_);
1107 						_tmp64_ = _tmp63_;
1108 						_handled_error_type_size = _tmp64_;
1109 						_handled_error_type_index = -1;
1110 						while (TRUE) {
1111 							gint _tmp65_;
1112 							gint _tmp66_;
1113 							ValaDataType* handled_error_type = NULL;
1114 							ValaArrayList* _tmp67_;
1115 							gpointer _tmp68_;
1116 							ValaArrayList* _tmp69_;
1117 							ValaDataType* _tmp70_;
1118 							_handled_error_type_index = _handled_error_type_index + 1;
1119 							_tmp65_ = _handled_error_type_index;
1120 							_tmp66_ = _handled_error_type_size;
1121 							if (!(_tmp65_ < _tmp66_)) {
1122 								break;
1123 							}
1124 							_tmp67_ = _handled_error_type_list;
1125 							_tmp68_ = vala_list_get ((ValaList*) _tmp67_, _handled_error_type_index);
1126 							handled_error_type = (ValaDataType*) _tmp68_;
1127 							_tmp69_ = error_types;
1128 							_tmp70_ = handled_error_type;
1129 							vala_collection_remove ((ValaCollection*) _tmp69_, _tmp70_);
1130 							_vala_code_node_unref0 (handled_error_type);
1131 						}
1132 						_vala_iterable_unref0 (_handled_error_type_list);
1133 					}
1134 					_tmp71_ = handled_error_types;
1135 					vala_collection_clear ((ValaCollection*) _tmp71_);
1136 					_tmp72_ = clause;
1137 					_tmp73_ = vala_catch_clause_get_error_type (_tmp72_);
1138 					_tmp74_ = _tmp73_;
1139 					_tmp75_ = ((ValaCCodeBaseModule*) self)->gerror_type;
1140 					if (vala_data_type_equals (_tmp74_, (ValaDataType*) _tmp75_)) {
1141 						ValaCCodeFunction* _tmp76_;
1142 						ValaCCodeFunction* _tmp77_;
1143 						ValaCatchClause* _tmp78_;
1144 						const gchar* _tmp79_;
1145 						const gchar* _tmp80_;
1146 						has_general_catch_clause = TRUE;
1147 						_tmp76_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1148 						_tmp77_ = _tmp76_;
1149 						_tmp78_ = clause;
1150 						_tmp79_ = vala_catch_clause_get_clabel_name (_tmp78_);
1151 						_tmp80_ = _tmp79_;
1152 						vala_ccode_function_add_goto (_tmp77_, _tmp80_);
1153 						_vala_code_node_unref0 (clause);
1154 						break;
1155 					} else {
1156 						ValaErrorType* catch_type = NULL;
1157 						ValaCatchClause* _tmp81_;
1158 						ValaDataType* _tmp82_;
1159 						ValaDataType* _tmp83_;
1160 						ValaErrorType* _tmp84_;
1161 						ValaErrorType* _tmp85_;
1162 						ValaErrorCode* _tmp86_;
1163 						ValaErrorCode* _tmp87_;
1164 						ValaCCodeFunction* _tmp132_;
1165 						ValaCCodeFunction* _tmp133_;
1166 						ValaCatchClause* _tmp134_;
1167 						const gchar* _tmp135_;
1168 						const gchar* _tmp136_;
1169 						ValaCCodeFunction* _tmp137_;
1170 						ValaCCodeFunction* _tmp138_;
1171 						_tmp81_ = clause;
1172 						_tmp82_ = vala_catch_clause_get_error_type (_tmp81_);
1173 						_tmp83_ = _tmp82_;
1174 						_tmp84_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp83_, VALA_TYPE_ERROR_TYPE) ? ((ValaErrorType*) _tmp83_) : NULL);
1175 						catch_type = _tmp84_;
1176 						_tmp85_ = catch_type;
1177 						_tmp86_ = vala_error_type_get_error_code (_tmp85_);
1178 						_tmp87_ = _tmp86_;
1179 						if (_tmp87_ != NULL) {
1180 							ValaCCodeFunctionCall* error_match = NULL;
1181 							ValaCCodeIdentifier* _tmp88_;
1182 							ValaCCodeIdentifier* _tmp89_;
1183 							ValaCCodeFunctionCall* _tmp90_;
1184 							ValaCCodeFunctionCall* _tmp91_;
1185 							ValaCCodeFunctionCall* _tmp92_;
1186 							ValaCCodeExpression* _tmp93_;
1187 							ValaCCodeExpression* _tmp94_;
1188 							ValaCCodeFunctionCall* _tmp95_;
1189 							ValaErrorType* _tmp96_;
1190 							ValaTypeSymbol* _tmp97_;
1191 							ValaTypeSymbol* _tmp98_;
1192 							gchar* _tmp99_;
1193 							gchar* _tmp100_;
1194 							ValaCCodeIdentifier* _tmp101_;
1195 							ValaCCodeIdentifier* _tmp102_;
1196 							ValaCCodeFunctionCall* _tmp103_;
1197 							ValaErrorType* _tmp104_;
1198 							ValaErrorCode* _tmp105_;
1199 							ValaErrorCode* _tmp106_;
1200 							gchar* _tmp107_;
1201 							gchar* _tmp108_;
1202 							ValaCCodeIdentifier* _tmp109_;
1203 							ValaCCodeIdentifier* _tmp110_;
1204 							ValaCCodeFunction* _tmp111_;
1205 							ValaCCodeFunction* _tmp112_;
1206 							ValaCCodeFunctionCall* _tmp113_;
1207 							_tmp88_ = vala_ccode_identifier_new ("g_error_matches");
1208 							_tmp89_ = _tmp88_;
1209 							_tmp90_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp89_);
1210 							_tmp91_ = _tmp90_;
1211 							_vala_ccode_node_unref0 (_tmp89_);
1212 							error_match = _tmp91_;
1213 							_tmp92_ = error_match;
1214 							_tmp93_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1215 							_tmp94_ = _tmp93_;
1216 							vala_ccode_function_call_add_argument (_tmp92_, _tmp94_);
1217 							_vala_ccode_node_unref0 (_tmp94_);
1218 							_tmp95_ = error_match;
1219 							_tmp96_ = catch_type;
1220 							_tmp97_ = vala_data_type_get_type_symbol ((ValaDataType*) _tmp96_);
1221 							_tmp98_ = _tmp97_;
1222 							_tmp99_ = vala_get_ccode_upper_case_name ((ValaSymbol*) _tmp98_, NULL);
1223 							_tmp100_ = _tmp99_;
1224 							_tmp101_ = vala_ccode_identifier_new (_tmp100_);
1225 							_tmp102_ = _tmp101_;
1226 							vala_ccode_function_call_add_argument (_tmp95_, (ValaCCodeExpression*) _tmp102_);
1227 							_vala_ccode_node_unref0 (_tmp102_);
1228 							_g_free0 (_tmp100_);
1229 							_tmp103_ = error_match;
1230 							_tmp104_ = catch_type;
1231 							_tmp105_ = vala_error_type_get_error_code (_tmp104_);
1232 							_tmp106_ = _tmp105_;
1233 							_tmp107_ = vala_get_ccode_name ((ValaCodeNode*) _tmp106_);
1234 							_tmp108_ = _tmp107_;
1235 							_tmp109_ = vala_ccode_identifier_new (_tmp108_);
1236 							_tmp110_ = _tmp109_;
1237 							vala_ccode_function_call_add_argument (_tmp103_, (ValaCCodeExpression*) _tmp110_);
1238 							_vala_ccode_node_unref0 (_tmp110_);
1239 							_g_free0 (_tmp108_);
1240 							_tmp111_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1241 							_tmp112_ = _tmp111_;
1242 							_tmp113_ = error_match;
1243 							vala_ccode_function_open_if (_tmp112_, (ValaCCodeExpression*) _tmp113_);
1244 							_vala_ccode_node_unref0 (error_match);
1245 						} else {
1246 							ValaCCodeBinaryExpression* ccond = NULL;
1247 							ValaCCodeExpression* _tmp114_;
1248 							ValaCCodeExpression* _tmp115_;
1249 							ValaCCodeMemberAccess* _tmp116_;
1250 							ValaCCodeMemberAccess* _tmp117_;
1251 							ValaCatchClause* _tmp118_;
1252 							ValaDataType* _tmp119_;
1253 							ValaDataType* _tmp120_;
1254 							ValaTypeSymbol* _tmp121_;
1255 							ValaTypeSymbol* _tmp122_;
1256 							gchar* _tmp123_;
1257 							gchar* _tmp124_;
1258 							ValaCCodeIdentifier* _tmp125_;
1259 							ValaCCodeIdentifier* _tmp126_;
1260 							ValaCCodeBinaryExpression* _tmp127_;
1261 							ValaCCodeBinaryExpression* _tmp128_;
1262 							ValaCCodeFunction* _tmp129_;
1263 							ValaCCodeFunction* _tmp130_;
1264 							ValaCCodeBinaryExpression* _tmp131_;
1265 							_tmp114_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1266 							_tmp115_ = _tmp114_;
1267 							_tmp116_ = vala_ccode_member_access_new_pointer (_tmp115_, "domain");
1268 							_tmp117_ = _tmp116_;
1269 							_tmp118_ = clause;
1270 							_tmp119_ = vala_catch_clause_get_error_type (_tmp118_);
1271 							_tmp120_ = _tmp119_;
1272 							_tmp121_ = vala_data_type_get_type_symbol (_tmp120_);
1273 							_tmp122_ = _tmp121_;
1274 							_tmp123_ = vala_get_ccode_upper_case_name ((ValaSymbol*) _tmp122_, NULL);
1275 							_tmp124_ = _tmp123_;
1276 							_tmp125_ = vala_ccode_identifier_new (_tmp124_);
1277 							_tmp126_ = _tmp125_;
1278 							_tmp127_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_EQUALITY, (ValaCCodeExpression*) _tmp117_, (ValaCCodeExpression*) _tmp126_);
1279 							_tmp128_ = _tmp127_;
1280 							_vala_ccode_node_unref0 (_tmp126_);
1281 							_g_free0 (_tmp124_);
1282 							_vala_ccode_node_unref0 (_tmp117_);
1283 							_vala_ccode_node_unref0 (_tmp115_);
1284 							ccond = _tmp128_;
1285 							_tmp129_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1286 							_tmp130_ = _tmp129_;
1287 							_tmp131_ = ccond;
1288 							vala_ccode_function_open_if (_tmp130_, (ValaCCodeExpression*) _tmp131_);
1289 							_vala_ccode_node_unref0 (ccond);
1290 						}
1291 						_tmp132_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1292 						_tmp133_ = _tmp132_;
1293 						_tmp134_ = clause;
1294 						_tmp135_ = vala_catch_clause_get_clabel_name (_tmp134_);
1295 						_tmp136_ = _tmp135_;
1296 						vala_ccode_function_add_goto (_tmp133_, _tmp136_);
1297 						_tmp137_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1298 						_tmp138_ = _tmp137_;
1299 						vala_ccode_function_close (_tmp138_);
1300 						_vala_code_node_unref0 (catch_type);
1301 					}
1302 					_vala_code_node_unref0 (clause);
1303 				}
1304 				_vala_iterable_unref0 (_clause_list);
1305 			}
1306 			_vala_iterable_unref0 (handled_error_types);
1307 		}
1308 		if (has_general_catch_clause) {
1309 		} else {
1310 			ValaArrayList* _tmp139_;
1311 			gint _tmp140_;
1312 			gint _tmp141_;
1313 			_tmp139_ = error_types;
1314 			_tmp140_ = vala_collection_get_size ((ValaCollection*) _tmp139_);
1315 			_tmp141_ = _tmp140_;
1316 			if (_tmp141_ > 0) {
1317 				ValaCCodeFunction* _tmp142_;
1318 				ValaCCodeFunction* _tmp143_;
1319 				gint _tmp144_;
1320 				gint _tmp145_;
1321 				gchar* _tmp146_;
1322 				gchar* _tmp147_;
1323 				_tmp142_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1324 				_tmp143_ = _tmp142_;
1325 				_tmp144_ = vala_ccode_base_module_get_current_try_id ((ValaCCodeBaseModule*) self);
1326 				_tmp145_ = _tmp144_;
1327 				_tmp146_ = g_strdup_printf ("__finally%d", _tmp145_);
1328 				_tmp147_ = _tmp146_;
1329 				vala_ccode_function_add_goto (_tmp143_, _tmp147_);
1330 				_g_free0 (_tmp147_);
1331 			} else {
1332 				if (vala_gerror_module_in_finally_block (self, node)) {
1333 				} else {
1334 					ValaCCodeExpression* _tmp148_;
1335 					ValaCCodeExpression* _tmp149_;
1336 					ValaTryStatement* _tmp150_;
1337 					ValaTryStatement* _tmp151_;
1338 					_tmp148_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1339 					_tmp149_ = _tmp148_;
1340 					_tmp150_ = vala_ccode_base_module_get_current_try ((ValaCCodeBaseModule*) self);
1341 					_tmp151_ = _tmp150_;
1342 					vala_gerror_module_uncaught_error_statement (self, _tmp149_, TRUE, (ValaCodeNode*) _tmp151_);
1343 					_vala_ccode_node_unref0 (_tmp149_);
1344 				}
1345 			}
1346 		}
1347 		_vala_iterable_unref0 (error_types);
1348 	} else {
1349 		gboolean _tmp152_ = FALSE;
1350 		ValaMethod* _tmp153_;
1351 		ValaMethod* _tmp154_;
1352 		_tmp153_ = vala_ccode_base_module_get_current_method ((ValaCCodeBaseModule*) self);
1353 		_tmp154_ = _tmp153_;
1354 		if (_tmp154_ != NULL) {
1355 			ValaMethod* _tmp155_;
1356 			ValaMethod* _tmp156_;
1357 			gboolean _tmp157_;
1358 			gboolean _tmp158_;
1359 			_tmp155_ = vala_ccode_base_module_get_current_method ((ValaCCodeBaseModule*) self);
1360 			_tmp156_ = _tmp155_;
1361 			_tmp157_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp156_);
1362 			_tmp158_ = _tmp157_;
1363 			_tmp152_ = _tmp158_;
1364 		} else {
1365 			_tmp152_ = FALSE;
1366 		}
1367 		if (_tmp152_) {
1368 			ValaCCodeBinaryExpression* ccond = NULL;
1369 			ValaArrayList* error_types = NULL;
1370 			GEqualFunc _tmp159_;
1371 			ValaArrayList* _tmp160_;
1372 			ValaMethod* _tmp161_;
1373 			ValaMethod* _tmp162_;
1374 			ValaArrayList* _tmp163_;
1375 			ValaCCodeBinaryExpression* _tmp194_;
1376 			ccond = NULL;
1377 			_tmp159_ = g_direct_equal;
1378 			_tmp160_ = vala_array_list_new (VALA_TYPE_DATA_TYPE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp159_);
1379 			error_types = _tmp160_;
1380 			_tmp161_ = vala_ccode_base_module_get_current_method ((ValaCCodeBaseModule*) self);
1381 			_tmp162_ = _tmp161_;
1382 			_tmp163_ = error_types;
1383 			vala_code_node_get_error_types ((ValaCodeNode*) _tmp162_, (ValaCollection*) _tmp163_, NULL);
1384 			{
1385 				ValaArrayList* _error_type_list = NULL;
1386 				ValaArrayList* _tmp164_;
1387 				ValaArrayList* _tmp165_;
1388 				gint _error_type_size = 0;
1389 				ValaArrayList* _tmp166_;
1390 				gint _tmp167_;
1391 				gint _tmp168_;
1392 				gint _error_type_index = 0;
1393 				_tmp164_ = error_types;
1394 				_tmp165_ = _vala_iterable_ref0 (_tmp164_);
1395 				_error_type_list = _tmp165_;
1396 				_tmp166_ = _error_type_list;
1397 				_tmp167_ = vala_collection_get_size ((ValaCollection*) _tmp166_);
1398 				_tmp168_ = _tmp167_;
1399 				_error_type_size = _tmp168_;
1400 				_error_type_index = -1;
1401 				while (TRUE) {
1402 					gint _tmp169_;
1403 					gint _tmp170_;
1404 					ValaDataType* error_type = NULL;
1405 					ValaArrayList* _tmp171_;
1406 					gpointer _tmp172_;
1407 					ValaDataType* _tmp173_;
1408 					ValaErrorType* _tmp174_;
1409 					ValaCCodeBinaryExpression* domain_check = NULL;
1410 					ValaCCodeExpression* _tmp175_;
1411 					ValaCCodeExpression* _tmp176_;
1412 					ValaCCodeMemberAccess* _tmp177_;
1413 					ValaCCodeMemberAccess* _tmp178_;
1414 					ValaDataType* _tmp179_;
1415 					ValaTypeSymbol* _tmp180_;
1416 					ValaTypeSymbol* _tmp181_;
1417 					gchar* _tmp182_;
1418 					gchar* _tmp183_;
1419 					ValaCCodeIdentifier* _tmp184_;
1420 					ValaCCodeIdentifier* _tmp185_;
1421 					ValaCCodeBinaryExpression* _tmp186_;
1422 					ValaCCodeBinaryExpression* _tmp187_;
1423 					ValaCCodeBinaryExpression* _tmp188_;
1424 					_error_type_index = _error_type_index + 1;
1425 					_tmp169_ = _error_type_index;
1426 					_tmp170_ = _error_type_size;
1427 					if (!(_tmp169_ < _tmp170_)) {
1428 						break;
1429 					}
1430 					_tmp171_ = _error_type_list;
1431 					_tmp172_ = vala_list_get ((ValaList*) _tmp171_, _error_type_index);
1432 					error_type = (ValaDataType*) _tmp172_;
1433 					_tmp173_ = error_type;
1434 					_tmp174_ = ((ValaCCodeBaseModule*) self)->gerror_type;
1435 					if (vala_data_type_equals (_tmp173_, (ValaDataType*) _tmp174_)) {
1436 						_vala_ccode_node_unref0 (ccond);
1437 						ccond = NULL;
1438 						_vala_code_node_unref0 (error_type);
1439 						break;
1440 					}
1441 					_tmp175_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1442 					_tmp176_ = _tmp175_;
1443 					_tmp177_ = vala_ccode_member_access_new_pointer (_tmp176_, "domain");
1444 					_tmp178_ = _tmp177_;
1445 					_tmp179_ = error_type;
1446 					_tmp180_ = vala_data_type_get_type_symbol (_tmp179_);
1447 					_tmp181_ = _tmp180_;
1448 					_tmp182_ = vala_get_ccode_upper_case_name ((ValaSymbol*) _tmp181_, NULL);
1449 					_tmp183_ = _tmp182_;
1450 					_tmp184_ = vala_ccode_identifier_new (_tmp183_);
1451 					_tmp185_ = _tmp184_;
1452 					_tmp186_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_EQUALITY, (ValaCCodeExpression*) _tmp178_, (ValaCCodeExpression*) _tmp185_);
1453 					_tmp187_ = _tmp186_;
1454 					_vala_ccode_node_unref0 (_tmp185_);
1455 					_g_free0 (_tmp183_);
1456 					_vala_ccode_node_unref0 (_tmp178_);
1457 					_vala_ccode_node_unref0 (_tmp176_);
1458 					domain_check = _tmp187_;
1459 					_tmp188_ = ccond;
1460 					if (_tmp188_ == NULL) {
1461 						ValaCCodeBinaryExpression* _tmp189_;
1462 						ValaCCodeBinaryExpression* _tmp190_;
1463 						_tmp189_ = domain_check;
1464 						_tmp190_ = _vala_ccode_node_ref0 (_tmp189_);
1465 						_vala_ccode_node_unref0 (ccond);
1466 						ccond = _tmp190_;
1467 					} else {
1468 						ValaCCodeBinaryExpression* _tmp191_;
1469 						ValaCCodeBinaryExpression* _tmp192_;
1470 						ValaCCodeBinaryExpression* _tmp193_;
1471 						_tmp191_ = ccond;
1472 						_tmp192_ = domain_check;
1473 						_tmp193_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_OR, (ValaCCodeExpression*) _tmp191_, (ValaCCodeExpression*) _tmp192_);
1474 						_vala_ccode_node_unref0 (ccond);
1475 						ccond = _tmp193_;
1476 					}
1477 					_vala_ccode_node_unref0 (domain_check);
1478 					_vala_code_node_unref0 (error_type);
1479 				}
1480 				_vala_iterable_unref0 (_error_type_list);
1481 			}
1482 			_tmp194_ = ccond;
1483 			if (_tmp194_ != NULL) {
1484 				ValaCCodeFunction* _tmp195_;
1485 				ValaCCodeFunction* _tmp196_;
1486 				ValaCCodeBinaryExpression* _tmp197_;
1487 				ValaCCodeExpression* _tmp198_;
1488 				ValaCCodeExpression* _tmp199_;
1489 				ValaCCodeFunction* _tmp200_;
1490 				ValaCCodeFunction* _tmp201_;
1491 				ValaCCodeExpression* _tmp202_;
1492 				ValaCCodeExpression* _tmp203_;
1493 				ValaCCodeFunction* _tmp204_;
1494 				ValaCCodeFunction* _tmp205_;
1495 				_tmp195_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1496 				_tmp196_ = _tmp195_;
1497 				_tmp197_ = ccond;
1498 				vala_ccode_function_open_if (_tmp196_, (ValaCCodeExpression*) _tmp197_);
1499 				_tmp198_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1500 				_tmp199_ = _tmp198_;
1501 				vala_gerror_module_return_with_exception (self, _tmp199_);
1502 				_vala_ccode_node_unref0 (_tmp199_);
1503 				_tmp200_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1504 				_tmp201_ = _tmp200_;
1505 				vala_ccode_function_add_else (_tmp201_);
1506 				_tmp202_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1507 				_tmp203_ = _tmp202_;
1508 				vala_gerror_module_uncaught_error_statement (self, _tmp203_, FALSE, NULL);
1509 				_vala_ccode_node_unref0 (_tmp203_);
1510 				_tmp204_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1511 				_tmp205_ = _tmp204_;
1512 				vala_ccode_function_close (_tmp205_);
1513 			} else {
1514 				ValaCCodeExpression* _tmp206_;
1515 				ValaCCodeExpression* _tmp207_;
1516 				_tmp206_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1517 				_tmp207_ = _tmp206_;
1518 				vala_gerror_module_return_with_exception (self, _tmp207_);
1519 				_vala_ccode_node_unref0 (_tmp207_);
1520 			}
1521 			_vala_iterable_unref0 (error_types);
1522 			_vala_ccode_node_unref0 (ccond);
1523 		} else {
1524 			ValaCCodeExpression* _tmp208_;
1525 			ValaCCodeExpression* _tmp209_;
1526 			_tmp208_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1527 			_tmp209_ = _tmp208_;
1528 			vala_gerror_module_uncaught_error_statement (self, _tmp209_, FALSE, NULL);
1529 			_vala_ccode_node_unref0 (_tmp209_);
1530 		}
1531 	}
1532 	if (!always_fails) {
1533 		ValaCCodeFunction* _tmp210_;
1534 		ValaCCodeFunction* _tmp211_;
1535 		_tmp210_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1536 		_tmp211_ = _tmp210_;
1537 		vala_ccode_function_close (_tmp211_);
1538 	}
1539 }
1540 
1541 static void
vala_gerror_module_real_visit_try_statement(ValaCodeVisitor * base,ValaTryStatement * stmt)1542 vala_gerror_module_real_visit_try_statement (ValaCodeVisitor* base,
1543                                              ValaTryStatement* stmt)
1544 {
1545 	ValaGErrorModule * self;
1546 	gint this_try_id = 0;
1547 	gint _tmp0_;
1548 	gint _tmp1_;
1549 	ValaTryStatement* old_try = NULL;
1550 	ValaTryStatement* _tmp2_;
1551 	ValaTryStatement* _tmp3_;
1552 	ValaTryStatement* _tmp4_;
1553 	gint old_try_id = 0;
1554 	gint _tmp5_;
1555 	gint _tmp6_;
1556 	gboolean old_is_in_catch = FALSE;
1557 	ValaCatchClause* old_catch = NULL;
1558 	ValaCatchClause* _tmp7_;
1559 	ValaCatchClause* _tmp8_;
1560 	ValaCatchClause* _tmp9_;
1561 	ValaBlock* _tmp27_;
1562 	ValaBlock* _tmp28_;
1563 	ValaTryStatement* _tmp44_;
1564 	ValaCatchClause* _tmp45_;
1565 	ValaCCodeFunction* _tmp46_;
1566 	ValaCCodeFunction* _tmp47_;
1567 	gchar* _tmp48_;
1568 	gchar* _tmp49_;
1569 	ValaBlock* _tmp50_;
1570 	ValaBlock* _tmp51_;
1571 	gboolean _tmp58_;
1572 	gboolean _tmp59_;
1573 	self = (ValaGErrorModule*) base;
1574 	g_return_if_fail (stmt != NULL);
1575 	_tmp0_ = vala_ccode_base_module_get_next_try_id ((ValaCCodeBaseModule*) self);
1576 	_tmp1_ = _tmp0_;
1577 	vala_ccode_base_module_set_next_try_id ((ValaCCodeBaseModule*) self, _tmp1_ + 1);
1578 	this_try_id = _tmp1_;
1579 	_tmp2_ = vala_ccode_base_module_get_current_try ((ValaCCodeBaseModule*) self);
1580 	_tmp3_ = _tmp2_;
1581 	_tmp4_ = _vala_code_node_ref0 (_tmp3_);
1582 	old_try = _tmp4_;
1583 	_tmp5_ = vala_ccode_base_module_get_current_try_id ((ValaCCodeBaseModule*) self);
1584 	_tmp6_ = _tmp5_;
1585 	old_try_id = _tmp6_;
1586 	old_is_in_catch = self->priv->is_in_catch;
1587 	_tmp7_ = vala_ccode_base_module_get_current_catch ((ValaCCodeBaseModule*) self);
1588 	_tmp8_ = _tmp7_;
1589 	_tmp9_ = _vala_code_node_ref0 (_tmp8_);
1590 	old_catch = _tmp9_;
1591 	vala_ccode_base_module_set_current_try ((ValaCCodeBaseModule*) self, stmt);
1592 	vala_ccode_base_module_set_current_try_id ((ValaCCodeBaseModule*) self, this_try_id);
1593 	self->priv->is_in_catch = TRUE;
1594 	{
1595 		ValaList* _clause_list = NULL;
1596 		ValaList* _tmp10_;
1597 		ValaList* _tmp11_;
1598 		gint _clause_size = 0;
1599 		ValaList* _tmp12_;
1600 		gint _tmp13_;
1601 		gint _tmp14_;
1602 		gint _clause_index = 0;
1603 		_tmp10_ = vala_try_statement_get_catch_clauses (stmt);
1604 		_tmp11_ = _vala_iterable_ref0 (_tmp10_);
1605 		_clause_list = _tmp11_;
1606 		_tmp12_ = _clause_list;
1607 		_tmp13_ = vala_collection_get_size ((ValaCollection*) _tmp12_);
1608 		_tmp14_ = _tmp13_;
1609 		_clause_size = _tmp14_;
1610 		_clause_index = -1;
1611 		while (TRUE) {
1612 			gint _tmp15_;
1613 			gint _tmp16_;
1614 			ValaCatchClause* clause = NULL;
1615 			ValaList* _tmp17_;
1616 			gpointer _tmp18_;
1617 			ValaCatchClause* _tmp19_;
1618 			ValaCatchClause* _tmp20_;
1619 			ValaDataType* _tmp21_;
1620 			ValaDataType* _tmp22_;
1621 			gchar* _tmp23_;
1622 			gchar* _tmp24_;
1623 			gchar* _tmp25_;
1624 			gchar* _tmp26_;
1625 			_clause_index = _clause_index + 1;
1626 			_tmp15_ = _clause_index;
1627 			_tmp16_ = _clause_size;
1628 			if (!(_tmp15_ < _tmp16_)) {
1629 				break;
1630 			}
1631 			_tmp17_ = _clause_list;
1632 			_tmp18_ = vala_list_get (_tmp17_, _clause_index);
1633 			clause = (ValaCatchClause*) _tmp18_;
1634 			_tmp19_ = clause;
1635 			_tmp20_ = clause;
1636 			_tmp21_ = vala_catch_clause_get_error_type (_tmp20_);
1637 			_tmp22_ = _tmp21_;
1638 			_tmp23_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) _tmp22_, NULL);
1639 			_tmp24_ = _tmp23_;
1640 			_tmp25_ = g_strdup_printf ("__catch%d_%s", this_try_id, _tmp24_);
1641 			_tmp26_ = _tmp25_;
1642 			vala_catch_clause_set_clabel_name (_tmp19_, _tmp26_);
1643 			_g_free0 (_tmp26_);
1644 			_g_free0 (_tmp24_);
1645 			_vala_code_node_unref0 (clause);
1646 		}
1647 		_vala_iterable_unref0 (_clause_list);
1648 	}
1649 	self->priv->is_in_catch = FALSE;
1650 	_tmp27_ = vala_try_statement_get_body (stmt);
1651 	_tmp28_ = _tmp27_;
1652 	vala_code_node_emit ((ValaCodeNode*) _tmp28_, (ValaCodeGenerator*) self);
1653 	self->priv->is_in_catch = TRUE;
1654 	{
1655 		ValaList* _clause_list = NULL;
1656 		ValaList* _tmp29_;
1657 		ValaList* _tmp30_;
1658 		gint _clause_size = 0;
1659 		ValaList* _tmp31_;
1660 		gint _tmp32_;
1661 		gint _tmp33_;
1662 		gint _clause_index = 0;
1663 		_tmp29_ = vala_try_statement_get_catch_clauses (stmt);
1664 		_tmp30_ = _vala_iterable_ref0 (_tmp29_);
1665 		_clause_list = _tmp30_;
1666 		_tmp31_ = _clause_list;
1667 		_tmp32_ = vala_collection_get_size ((ValaCollection*) _tmp31_);
1668 		_tmp33_ = _tmp32_;
1669 		_clause_size = _tmp33_;
1670 		_clause_index = -1;
1671 		while (TRUE) {
1672 			gint _tmp34_;
1673 			gint _tmp35_;
1674 			ValaCatchClause* clause = NULL;
1675 			ValaList* _tmp36_;
1676 			gpointer _tmp37_;
1677 			ValaCatchClause* _tmp38_;
1678 			ValaCCodeFunction* _tmp39_;
1679 			ValaCCodeFunction* _tmp40_;
1680 			gchar* _tmp41_;
1681 			gchar* _tmp42_;
1682 			ValaCatchClause* _tmp43_;
1683 			_clause_index = _clause_index + 1;
1684 			_tmp34_ = _clause_index;
1685 			_tmp35_ = _clause_size;
1686 			if (!(_tmp34_ < _tmp35_)) {
1687 				break;
1688 			}
1689 			_tmp36_ = _clause_list;
1690 			_tmp37_ = vala_list_get (_tmp36_, _clause_index);
1691 			clause = (ValaCatchClause*) _tmp37_;
1692 			_tmp38_ = clause;
1693 			vala_ccode_base_module_set_current_catch ((ValaCCodeBaseModule*) self, _tmp38_);
1694 			_tmp39_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1695 			_tmp40_ = _tmp39_;
1696 			_tmp41_ = g_strdup_printf ("__finally%d", this_try_id);
1697 			_tmp42_ = _tmp41_;
1698 			vala_ccode_function_add_goto (_tmp40_, _tmp42_);
1699 			_g_free0 (_tmp42_);
1700 			_tmp43_ = clause;
1701 			vala_code_node_emit ((ValaCodeNode*) _tmp43_, (ValaCodeGenerator*) self);
1702 			_vala_code_node_unref0 (clause);
1703 		}
1704 		_vala_iterable_unref0 (_clause_list);
1705 	}
1706 	_tmp44_ = old_try;
1707 	vala_ccode_base_module_set_current_try ((ValaCCodeBaseModule*) self, _tmp44_);
1708 	vala_ccode_base_module_set_current_try_id ((ValaCCodeBaseModule*) self, old_try_id);
1709 	self->priv->is_in_catch = old_is_in_catch;
1710 	_tmp45_ = old_catch;
1711 	vala_ccode_base_module_set_current_catch ((ValaCCodeBaseModule*) self, _tmp45_);
1712 	_tmp46_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1713 	_tmp47_ = _tmp46_;
1714 	_tmp48_ = g_strdup_printf ("__finally%d", this_try_id);
1715 	_tmp49_ = _tmp48_;
1716 	vala_ccode_function_add_label (_tmp47_, _tmp49_);
1717 	_g_free0 (_tmp49_);
1718 	_tmp50_ = vala_try_statement_get_finally_body (stmt);
1719 	_tmp51_ = _tmp50_;
1720 	if (_tmp51_ != NULL) {
1721 		gint _tmp52_;
1722 		gint _tmp53_;
1723 		ValaBlock* _tmp54_;
1724 		ValaBlock* _tmp55_;
1725 		gint _tmp56_;
1726 		gint _tmp57_;
1727 		_tmp52_ = vala_ccode_base_module_get_current_inner_error_id ((ValaCCodeBaseModule*) self);
1728 		_tmp53_ = _tmp52_;
1729 		vala_ccode_base_module_set_current_inner_error_id ((ValaCCodeBaseModule*) self, _tmp53_ + 1);
1730 		_tmp54_ = vala_try_statement_get_finally_body (stmt);
1731 		_tmp55_ = _tmp54_;
1732 		vala_code_node_emit ((ValaCodeNode*) _tmp55_, (ValaCodeGenerator*) self);
1733 		_tmp56_ = vala_ccode_base_module_get_current_inner_error_id ((ValaCCodeBaseModule*) self);
1734 		_tmp57_ = _tmp56_;
1735 		vala_ccode_base_module_set_current_inner_error_id ((ValaCCodeBaseModule*) self, _tmp57_ - 1);
1736 	}
1737 	_tmp58_ = vala_try_statement_get_after_try_block_reachable (stmt);
1738 	_tmp59_ = _tmp58_;
1739 	vala_ccode_base_module_add_simple_check ((ValaCCodeBaseModule*) self, (ValaCodeNode*) stmt, !_tmp59_);
1740 	_vala_code_node_unref0 (old_catch);
1741 	_vala_code_node_unref0 (old_try);
1742 }
1743 
1744 static void
vala_gerror_module_real_visit_catch_clause(ValaCodeVisitor * base,ValaCatchClause * clause)1745 vala_gerror_module_real_visit_catch_clause (ValaCodeVisitor* base,
1746                                             ValaCatchClause* clause)
1747 {
1748 	ValaGErrorModule * self;
1749 	ValaErrorType* error_type = NULL;
1750 	ValaDataType* _tmp0_;
1751 	ValaDataType* _tmp1_;
1752 	ValaErrorType* _tmp2_;
1753 	ValaErrorType* _tmp3_;
1754 	ValaErrorDomain* _tmp4_;
1755 	ValaErrorDomain* _tmp5_;
1756 	ValaCCodeFunction* _tmp10_;
1757 	ValaCCodeFunction* _tmp11_;
1758 	const gchar* _tmp12_;
1759 	const gchar* _tmp13_;
1760 	ValaCCodeFunction* _tmp14_;
1761 	ValaCCodeFunction* _tmp15_;
1762 	gboolean _tmp16_ = FALSE;
1763 	ValaLocalVariable* _tmp17_;
1764 	ValaLocalVariable* _tmp18_;
1765 	ValaBlock* _tmp58_;
1766 	ValaBlock* _tmp59_;
1767 	ValaCCodeFunction* _tmp60_;
1768 	ValaCCodeFunction* _tmp61_;
1769 	self = (ValaGErrorModule*) base;
1770 	g_return_if_fail (clause != NULL);
1771 	vala_ccode_base_module_set_current_method_inner_error ((ValaCCodeBaseModule*) self, TRUE);
1772 	_tmp0_ = vala_catch_clause_get_error_type (clause);
1773 	_tmp1_ = _tmp0_;
1774 	_tmp2_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VALA_TYPE_ERROR_TYPE, ValaErrorType));
1775 	error_type = _tmp2_;
1776 	_tmp3_ = error_type;
1777 	_tmp4_ = vala_error_type_get_error_domain (_tmp3_);
1778 	_tmp5_ = _tmp4_;
1779 	if (_tmp5_ != NULL) {
1780 		ValaErrorType* _tmp6_;
1781 		ValaErrorDomain* _tmp7_;
1782 		ValaErrorDomain* _tmp8_;
1783 		ValaCCodeFile* _tmp9_;
1784 		_tmp6_ = error_type;
1785 		_tmp7_ = vala_error_type_get_error_domain (_tmp6_);
1786 		_tmp8_ = _tmp7_;
1787 		_tmp9_ = ((ValaCCodeBaseModule*) self)->cfile;
1788 		vala_ccode_base_module_generate_error_domain_declaration ((ValaCCodeBaseModule*) self, _tmp8_, _tmp9_);
1789 	}
1790 	_tmp10_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1791 	_tmp11_ = _tmp10_;
1792 	_tmp12_ = vala_catch_clause_get_clabel_name (clause);
1793 	_tmp13_ = _tmp12_;
1794 	vala_ccode_function_add_label (_tmp11_, _tmp13_);
1795 	_tmp14_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1796 	_tmp15_ = _tmp14_;
1797 	vala_ccode_function_open_block (_tmp15_);
1798 	_tmp17_ = vala_catch_clause_get_error_variable (clause);
1799 	_tmp18_ = _tmp17_;
1800 	if (_tmp18_ != NULL) {
1801 		ValaLocalVariable* _tmp19_;
1802 		ValaLocalVariable* _tmp20_;
1803 		gboolean _tmp21_;
1804 		gboolean _tmp22_;
1805 		_tmp19_ = vala_catch_clause_get_error_variable (clause);
1806 		_tmp20_ = _tmp19_;
1807 		_tmp21_ = vala_symbol_get_used ((ValaSymbol*) _tmp20_);
1808 		_tmp22_ = _tmp21_;
1809 		_tmp16_ = _tmp22_;
1810 	} else {
1811 		_tmp16_ = FALSE;
1812 	}
1813 	if (_tmp16_) {
1814 		ValaLocalVariable* _tmp23_;
1815 		ValaLocalVariable* _tmp24_;
1816 		ValaCCodeFunction* _tmp25_;
1817 		ValaCCodeFunction* _tmp26_;
1818 		ValaLocalVariable* _tmp27_;
1819 		ValaLocalVariable* _tmp28_;
1820 		gchar* _tmp29_;
1821 		gchar* _tmp30_;
1822 		ValaCCodeExpression* _tmp31_;
1823 		ValaCCodeExpression* _tmp32_;
1824 		ValaCCodeExpression* _tmp33_;
1825 		ValaCCodeExpression* _tmp34_;
1826 		ValaCCodeFunction* _tmp35_;
1827 		ValaCCodeFunction* _tmp36_;
1828 		ValaCCodeExpression* _tmp37_;
1829 		ValaCCodeExpression* _tmp38_;
1830 		ValaCCodeConstant* _tmp39_;
1831 		ValaCCodeConstant* _tmp40_;
1832 		_tmp23_ = vala_catch_clause_get_error_variable (clause);
1833 		_tmp24_ = _tmp23_;
1834 		vala_code_visitor_visit_local_variable ((ValaCodeVisitor*) self, _tmp24_);
1835 		_tmp25_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1836 		_tmp26_ = _tmp25_;
1837 		_tmp27_ = vala_catch_clause_get_error_variable (clause);
1838 		_tmp28_ = _tmp27_;
1839 		_tmp29_ = vala_ccode_base_module_get_local_cname ((ValaCCodeBaseModule*) self, _tmp28_);
1840 		_tmp30_ = _tmp29_;
1841 		_tmp31_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp30_);
1842 		_tmp32_ = _tmp31_;
1843 		_tmp33_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1844 		_tmp34_ = _tmp33_;
1845 		vala_ccode_function_add_assignment (_tmp26_, _tmp32_, _tmp34_);
1846 		_vala_ccode_node_unref0 (_tmp34_);
1847 		_vala_ccode_node_unref0 (_tmp32_);
1848 		_g_free0 (_tmp30_);
1849 		_tmp35_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1850 		_tmp36_ = _tmp35_;
1851 		_tmp37_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1852 		_tmp38_ = _tmp37_;
1853 		_tmp39_ = vala_ccode_constant_new ("NULL");
1854 		_tmp40_ = _tmp39_;
1855 		vala_ccode_function_add_assignment (_tmp36_, _tmp38_, (ValaCCodeExpression*) _tmp40_);
1856 		_vala_ccode_node_unref0 (_tmp40_);
1857 		_vala_ccode_node_unref0 (_tmp38_);
1858 	} else {
1859 		ValaLocalVariable* _tmp41_;
1860 		ValaLocalVariable* _tmp42_;
1861 		ValaCCodeFile* _tmp45_;
1862 		ValaCCodeFunctionCall* cclear = NULL;
1863 		ValaCCodeIdentifier* _tmp46_;
1864 		ValaCCodeIdentifier* _tmp47_;
1865 		ValaCCodeFunctionCall* _tmp48_;
1866 		ValaCCodeFunctionCall* _tmp49_;
1867 		ValaCCodeFunctionCall* _tmp50_;
1868 		ValaCCodeExpression* _tmp51_;
1869 		ValaCCodeExpression* _tmp52_;
1870 		ValaCCodeUnaryExpression* _tmp53_;
1871 		ValaCCodeUnaryExpression* _tmp54_;
1872 		ValaCCodeFunction* _tmp55_;
1873 		ValaCCodeFunction* _tmp56_;
1874 		ValaCCodeFunctionCall* _tmp57_;
1875 		_tmp41_ = vala_catch_clause_get_error_variable (clause);
1876 		_tmp42_ = _tmp41_;
1877 		if (_tmp42_ != NULL) {
1878 			ValaLocalVariable* _tmp43_;
1879 			ValaLocalVariable* _tmp44_;
1880 			_tmp43_ = vala_catch_clause_get_error_variable (clause);
1881 			_tmp44_ = _tmp43_;
1882 			vala_code_node_set_unreachable ((ValaCodeNode*) _tmp44_, TRUE);
1883 		}
1884 		_tmp45_ = ((ValaCCodeBaseModule*) self)->cfile;
1885 		vala_ccode_file_add_include (_tmp45_, "glib.h", FALSE);
1886 		_tmp46_ = vala_ccode_identifier_new ("g_clear_error");
1887 		_tmp47_ = _tmp46_;
1888 		_tmp48_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp47_);
1889 		_tmp49_ = _tmp48_;
1890 		_vala_ccode_node_unref0 (_tmp47_);
1891 		cclear = _tmp49_;
1892 		_tmp50_ = cclear;
1893 		_tmp51_ = vala_ccode_base_module_get_inner_error_cexpression ((ValaCCodeBaseModule*) self);
1894 		_tmp52_ = _tmp51_;
1895 		_tmp53_ = vala_ccode_unary_expression_new (VALA_CCODE_UNARY_OPERATOR_ADDRESS_OF, _tmp52_);
1896 		_tmp54_ = _tmp53_;
1897 		vala_ccode_function_call_add_argument (_tmp50_, (ValaCCodeExpression*) _tmp54_);
1898 		_vala_ccode_node_unref0 (_tmp54_);
1899 		_vala_ccode_node_unref0 (_tmp52_);
1900 		_tmp55_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1901 		_tmp56_ = _tmp55_;
1902 		_tmp57_ = cclear;
1903 		vala_ccode_function_add_expression (_tmp56_, (ValaCCodeExpression*) _tmp57_);
1904 		_vala_ccode_node_unref0 (cclear);
1905 	}
1906 	_tmp58_ = vala_catch_clause_get_body (clause);
1907 	_tmp59_ = _tmp58_;
1908 	vala_code_node_emit ((ValaCodeNode*) _tmp59_, (ValaCodeGenerator*) self);
1909 	_tmp60_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1910 	_tmp61_ = _tmp60_;
1911 	vala_ccode_function_close (_tmp61_);
1912 	_vala_code_node_unref0 (error_type);
1913 }
1914 
1915 static void
vala_gerror_module_real_append_scope_free(ValaCCodeBaseModule * base,ValaSymbol * sym,ValaCodeNode * stop_at)1916 vala_gerror_module_real_append_scope_free (ValaCCodeBaseModule* base,
1917                                            ValaSymbol* sym,
1918                                            ValaCodeNode* stop_at)
1919 {
1920 	ValaGErrorModule * self;
1921 	gboolean _tmp0_ = FALSE;
1922 	self = (ValaGErrorModule*) base;
1923 	g_return_if_fail (sym != NULL);
1924 	VALA_CCODE_BASE_MODULE_CLASS (vala_gerror_module_parent_class)->append_scope_free ((ValaCCodeBaseModule*) G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_CCODE_DELEGATE_MODULE, ValaCCodeDelegateModule), sym, stop_at);
1925 	if (G_TYPE_CHECK_INSTANCE_TYPE (stop_at, VALA_TYPE_TRY_STATEMENT)) {
1926 		_tmp0_ = TRUE;
1927 	} else {
1928 		_tmp0_ = G_TYPE_CHECK_INSTANCE_TYPE (stop_at, VALA_TYPE_CATCH_CLAUSE);
1929 	}
1930 	if (!_tmp0_) {
1931 		ValaBlock* finally_block = NULL;
1932 		ValaBlock* _tmp1_;
1933 		ValaCodeNode* _tmp2_;
1934 		ValaCodeNode* _tmp3_;
1935 		gboolean _tmp18_ = FALSE;
1936 		ValaBlock* _tmp19_;
1937 		_tmp1_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (NULL, VALA_TYPE_BLOCK, ValaBlock));
1938 		finally_block = _tmp1_;
1939 		_tmp2_ = vala_code_node_get_parent_node ((ValaCodeNode*) sym);
1940 		_tmp3_ = _tmp2_;
1941 		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, VALA_TYPE_TRY_STATEMENT)) {
1942 			ValaCodeNode* _tmp4_;
1943 			ValaCodeNode* _tmp5_;
1944 			ValaBlock* _tmp6_;
1945 			ValaBlock* _tmp7_;
1946 			ValaBlock* _tmp8_;
1947 			_tmp4_ = vala_code_node_get_parent_node ((ValaCodeNode*) sym);
1948 			_tmp5_ = _tmp4_;
1949 			_tmp6_ = vala_try_statement_get_finally_body (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, VALA_TYPE_TRY_STATEMENT, ValaTryStatement));
1950 			_tmp7_ = _tmp6_;
1951 			_tmp8_ = _vala_code_node_ref0 (_tmp7_);
1952 			_vala_code_node_unref0 (finally_block);
1953 			finally_block = _tmp8_;
1954 		} else {
1955 			ValaCodeNode* _tmp9_;
1956 			ValaCodeNode* _tmp10_;
1957 			_tmp9_ = vala_code_node_get_parent_node ((ValaCodeNode*) sym);
1958 			_tmp10_ = _tmp9_;
1959 			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, VALA_TYPE_CATCH_CLAUSE)) {
1960 				ValaCodeNode* _tmp11_;
1961 				ValaCodeNode* _tmp12_;
1962 				ValaCodeNode* _tmp13_;
1963 				ValaCodeNode* _tmp14_;
1964 				ValaBlock* _tmp15_;
1965 				ValaBlock* _tmp16_;
1966 				ValaBlock* _tmp17_;
1967 				_tmp11_ = vala_code_node_get_parent_node ((ValaCodeNode*) sym);
1968 				_tmp12_ = _tmp11_;
1969 				_tmp13_ = vala_code_node_get_parent_node (_tmp12_);
1970 				_tmp14_ = _tmp13_;
1971 				_tmp15_ = vala_try_statement_get_finally_body (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, VALA_TYPE_TRY_STATEMENT, ValaTryStatement));
1972 				_tmp16_ = _tmp15_;
1973 				_tmp17_ = _vala_code_node_ref0 (_tmp16_);
1974 				_vala_code_node_unref0 (finally_block);
1975 				finally_block = _tmp17_;
1976 			}
1977 		}
1978 		_tmp19_ = finally_block;
1979 		if (_tmp19_ != NULL) {
1980 			ValaBlock* _tmp20_;
1981 			_tmp20_ = finally_block;
1982 			_tmp18_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, VALA_TYPE_SYMBOL, ValaSymbol) != sym;
1983 		} else {
1984 			_tmp18_ = FALSE;
1985 		}
1986 		if (_tmp18_) {
1987 			ValaBlock* _tmp21_;
1988 			_tmp21_ = finally_block;
1989 			vala_code_node_emit ((ValaCodeNode*) _tmp21_, (ValaCodeGenerator*) self);
1990 		}
1991 		_vala_code_node_unref0 (finally_block);
1992 	}
1993 }
1994 
1995 ValaGErrorModule*
vala_gerror_module_construct(GType object_type)1996 vala_gerror_module_construct (GType object_type)
1997 {
1998 	ValaGErrorModule* self = NULL;
1999 	self = (ValaGErrorModule*) vala_ccode_delegate_module_construct (object_type);
2000 	return self;
2001 }
2002 
2003 ValaGErrorModule*
vala_gerror_module_new(void)2004 vala_gerror_module_new (void)
2005 {
2006 	return vala_gerror_module_construct (VALA_TYPE_GERROR_MODULE);
2007 }
2008 
2009 static void
vala_gerror_module_class_init(ValaGErrorModuleClass * klass,gpointer klass_data)2010 vala_gerror_module_class_init (ValaGErrorModuleClass * klass,
2011                                gpointer klass_data)
2012 {
2013 	vala_gerror_module_parent_class = g_type_class_peek_parent (klass);
2014 	((ValaCodeVisitorClass *) klass)->finalize = vala_gerror_module_finalize;
2015 	g_type_class_adjust_private_offset (klass, &ValaGErrorModule_private_offset);
2016 	((ValaCCodeBaseModuleClass *) klass)->generate_error_domain_declaration = (void (*) (ValaCCodeBaseModule*, ValaErrorDomain*, ValaCCodeFile*)) vala_gerror_module_real_generate_error_domain_declaration;
2017 	((ValaCodeVisitorClass *) klass)->visit_error_domain = (void (*) (ValaCodeVisitor*, ValaErrorDomain*)) vala_gerror_module_real_visit_error_domain;
2018 	((ValaCodeVisitorClass *) klass)->visit_throw_statement = (void (*) (ValaCodeVisitor*, ValaThrowStatement*)) vala_gerror_module_real_visit_throw_statement;
2019 	((ValaGErrorModuleClass *) klass)->return_with_exception = (void (*) (ValaGErrorModule*, ValaCCodeExpression*)) vala_gerror_module_real_return_with_exception;
2020 	((ValaCCodeBaseModuleClass *) klass)->add_simple_check = (void (*) (ValaCCodeBaseModule*, ValaCodeNode*, gboolean)) vala_gerror_module_real_add_simple_check;
2021 	((ValaCodeVisitorClass *) klass)->visit_try_statement = (void (*) (ValaCodeVisitor*, ValaTryStatement*)) vala_gerror_module_real_visit_try_statement;
2022 	((ValaCodeVisitorClass *) klass)->visit_catch_clause = (void (*) (ValaCodeVisitor*, ValaCatchClause*)) vala_gerror_module_real_visit_catch_clause;
2023 	((ValaCCodeBaseModuleClass *) klass)->append_scope_free = (void (*) (ValaCCodeBaseModule*, ValaSymbol*, ValaCodeNode*)) vala_gerror_module_real_append_scope_free;
2024 }
2025 
2026 static void
vala_gerror_module_instance_init(ValaGErrorModule * self,gpointer klass)2027 vala_gerror_module_instance_init (ValaGErrorModule * self,
2028                                   gpointer klass)
2029 {
2030 	self->priv = vala_gerror_module_get_instance_private (self);
2031 	self->priv->is_in_catch = FALSE;
2032 }
2033 
2034 static void
vala_gerror_module_finalize(ValaCodeVisitor * obj)2035 vala_gerror_module_finalize (ValaCodeVisitor * obj)
2036 {
2037 	ValaGErrorModule * self;
2038 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_GERROR_MODULE, ValaGErrorModule);
2039 	VALA_CODE_VISITOR_CLASS (vala_gerror_module_parent_class)->finalize (obj);
2040 }
2041 
2042 static GType
vala_gerror_module_get_type_once(void)2043 vala_gerror_module_get_type_once (void)
2044 {
2045 	static const GTypeInfo g_define_type_info = { sizeof (ValaGErrorModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_gerror_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaGErrorModule), 0, (GInstanceInitFunc) vala_gerror_module_instance_init, NULL };
2046 	GType vala_gerror_module_type_id;
2047 	vala_gerror_module_type_id = g_type_register_static (VALA_TYPE_CCODE_DELEGATE_MODULE, "ValaGErrorModule", &g_define_type_info, 0);
2048 	ValaGErrorModule_private_offset = g_type_add_instance_private (vala_gerror_module_type_id, sizeof (ValaGErrorModulePrivate));
2049 	return vala_gerror_module_type_id;
2050 }
2051 
2052 GType
vala_gerror_module_get_type(void)2053 vala_gerror_module_get_type (void)
2054 {
2055 	static volatile gsize vala_gerror_module_type_id__volatile = 0;
2056 	if (g_once_init_enter (&vala_gerror_module_type_id__volatile)) {
2057 		GType vala_gerror_module_type_id;
2058 		vala_gerror_module_type_id = vala_gerror_module_get_type_once ();
2059 		g_once_init_leave (&vala_gerror_module_type_id__volatile, vala_gerror_module_type_id);
2060 	}
2061 	return vala_gerror_module_type_id__volatile;
2062 }
2063 
2064