1 /* valaccodedelegatemodule.c generated by valac, the Vala compiler
2 * generated from valaccodedelegatemodule.vala, do not modify */
3
4 /* valaccodedelegatemodule.vala
5 *
6 * Copyright (C) 2006-2010 Jürg Billeter
7 * Copyright (C) 2006-2008 Raffaele Sandrini
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 * Author:
24 * Jürg Billeter <j@bitron.ch>
25 * Raffaele Sandrini <raffaele@sandrini.ch>
26 */
27
28 #include "valacodegen.h"
29 #include <vala.h>
30 #include <valaccode.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include <glib.h>
34 #include <valagee.h>
35 #include <glib-object.h>
36 #include <float.h>
37 #include <math.h>
38
39 #define _g_free0(var) (var = (g_free (var), NULL))
40 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
41 #define _vala_ccode_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_node_unref (var), NULL)))
42 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
43 #define _vala_iterator_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterator_unref (var), NULL)))
44 #define _vala_map_unref0(var) ((var == NULL) ? NULL : (var = (vala_map_unref (var), NULL)))
45
46 static gpointer vala_ccode_delegate_module_parent_class = NULL;
47
48 static void vala_ccode_delegate_module_real_generate_delegate_declaration (ValaCCodeBaseModule* base,
49 ValaDelegate* d,
50 ValaCCodeFile* decl_space);
51 static void vala_ccode_delegate_module_real_visit_delegate (ValaCodeVisitor* base,
52 ValaDelegate* d);
53 static gchar* vala_ccode_delegate_module_real_get_delegate_target_cname (ValaCCodeBaseModule* base,
54 const gchar* delegate_cname);
55 static ValaCCodeExpression* vala_ccode_delegate_module_real_get_delegate_target_cexpression (ValaCCodeBaseModule* base,
56 ValaExpression* delegate_expr,
57 ValaCCodeExpression* * delegate_target_destroy_notify);
58 static ValaCCodeExpression* vala_ccode_delegate_module_real_get_delegate_target_cvalue (ValaCCodeBaseModule* base,
59 ValaTargetValue* value);
60 static ValaCCodeExpression* vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cvalue (ValaCCodeBaseModule* base,
61 ValaTargetValue* value);
62 static gchar* vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cname (ValaCCodeBaseModule* base,
63 const gchar* delegate_cname);
64 static ValaCCodeExpression* vala_ccode_delegate_module_real_get_implicit_cast_expression (ValaCCodeBaseModule* base,
65 ValaCCodeExpression* source_cexpr,
66 ValaDataType* expression_type,
67 ValaDataType* target_type,
68 ValaCodeNode* node);
69 static ValaCCodeParameter* vala_ccode_delegate_module_real_generate_parameter (ValaCCodeMethodModule* base,
70 ValaParameter* param,
71 ValaCCodeFile* decl_space,
72 ValaMap* cparam_map,
73 ValaMap* carg_map);
74 static GType vala_ccode_delegate_module_get_type_once (void);
75
76 static gpointer
_vala_iterable_ref0(gpointer self)77 _vala_iterable_ref0 (gpointer self)
78 {
79 return self ? vala_iterable_ref (self) : NULL;
80 }
81
82 static gpointer
_vala_code_node_ref0(gpointer self)83 _vala_code_node_ref0 (gpointer self)
84 {
85 return self ? vala_code_node_ref (self) : NULL;
86 }
87
88 static void
vala_ccode_delegate_module_real_generate_delegate_declaration(ValaCCodeBaseModule * base,ValaDelegate * d,ValaCCodeFile * decl_space)89 vala_ccode_delegate_module_real_generate_delegate_declaration (ValaCCodeBaseModule* base,
90 ValaDelegate* d,
91 ValaCCodeFile* decl_space)
92 {
93 ValaCCodeDelegateModule * self;
94 gchar* _tmp0_;
95 gchar* _tmp1_;
96 gboolean _tmp2_;
97 ValaDataType* _tmp3_;
98 ValaDataType* _tmp4_;
99 ValaDataType* creturn_type = NULL;
100 ValaDataType* _tmp5_;
101 gboolean _tmp6_ = FALSE;
102 ValaDataType* _tmp7_;
103 ValaDataType* _tmp24_;
104 ValaHashMap* cparam_map = NULL;
105 GHashFunc _tmp25_;
106 GEqualFunc _tmp26_;
107 GEqualFunc _tmp27_;
108 ValaHashMap* _tmp28_;
109 ValaCCodeFunctionDeclarator* cfundecl = NULL;
110 gchar* _tmp29_;
111 gchar* _tmp30_;
112 ValaCCodeFunctionDeclarator* _tmp31_;
113 ValaCCodeFunctionDeclarator* _tmp32_;
114 ValaDataType* _tmp46_;
115 ValaDataType* _tmp47_;
116 gboolean _tmp115_;
117 gboolean _tmp116_;
118 gboolean _tmp125_;
119 gboolean _tmp126_;
120 gint last_pos = 0;
121 gint min_pos = 0;
122 ValaCCodeTypeDefinition* ctypedef = NULL;
123 ValaDataType* _tmp145_;
124 gchar* _tmp146_;
125 gchar* _tmp147_;
126 ValaCCodeFunctionDeclarator* _tmp148_;
127 ValaCCodeTypeDefinition* _tmp149_;
128 ValaCCodeTypeDefinition* _tmp150_;
129 ValaVersionAttribute* _tmp151_;
130 ValaVersionAttribute* _tmp152_;
131 gboolean _tmp153_;
132 gboolean _tmp154_;
133 ValaCCodeTypeDefinition* _tmp163_;
134 self = (ValaCCodeDelegateModule*) base;
135 g_return_if_fail (d != NULL);
136 g_return_if_fail (decl_space != NULL);
137 _tmp0_ = vala_get_ccode_name ((ValaCodeNode*) d);
138 _tmp1_ = _tmp0_;
139 _tmp2_ = vala_ccode_base_module_add_symbol_declaration ((ValaCCodeBaseModule*) self, decl_space, (ValaSymbol*) d, _tmp1_);
140 _g_free0 (_tmp1_);
141 if (_tmp2_) {
142 return;
143 }
144 _tmp3_ = vala_delegate_get_sender_type (d);
145 _tmp4_ = _tmp3_;
146 if (_tmp4_ != NULL) {
147 return;
148 }
149 _tmp5_ = vala_ccode_base_module_get_callable_creturn_type ((ValaCallable*) d);
150 creturn_type = _tmp5_;
151 _tmp7_ = creturn_type;
152 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_DELEGATE_TYPE)) {
153 ValaDataType* _tmp8_;
154 ValaDelegate* _tmp9_;
155 ValaDelegate* _tmp10_;
156 _tmp8_ = creturn_type;
157 _tmp9_ = vala_delegate_type_get_delegate_symbol (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
158 _tmp10_ = _tmp9_;
159 _tmp6_ = _tmp10_ == d;
160 } else {
161 _tmp6_ = FALSE;
162 }
163 if (_tmp6_) {
164 ValaCodeContext* _tmp11_;
165 ValaCodeContext* _tmp12_;
166 ValaNamespace* _tmp13_;
167 ValaNamespace* _tmp14_;
168 ValaScope* _tmp15_;
169 ValaScope* _tmp16_;
170 ValaSymbol* _tmp17_;
171 ValaSymbol* _tmp18_;
172 ValaScope* _tmp19_;
173 ValaScope* _tmp20_;
174 ValaSymbol* _tmp21_;
175 ValaDelegate* _tmp22_;
176 ValaDelegateType* _tmp23_;
177 _tmp11_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
178 _tmp12_ = _tmp11_;
179 _tmp13_ = vala_code_context_get_root (_tmp12_);
180 _tmp14_ = _tmp13_;
181 _tmp15_ = vala_symbol_get_scope ((ValaSymbol*) _tmp14_);
182 _tmp16_ = _tmp15_;
183 _tmp17_ = vala_scope_lookup (_tmp16_, "GLib");
184 _tmp18_ = _tmp17_;
185 _tmp19_ = vala_symbol_get_scope (_tmp18_);
186 _tmp20_ = _tmp19_;
187 _tmp21_ = vala_scope_lookup (_tmp20_, "Callback");
188 _tmp22_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, VALA_TYPE_DELEGATE, ValaDelegate);
189 _tmp23_ = vala_delegate_type_new (_tmp22_);
190 _vala_code_node_unref0 (creturn_type);
191 creturn_type = (ValaDataType*) _tmp23_;
192 _vala_code_node_unref0 (_tmp22_);
193 _vala_code_node_unref0 (_tmp18_);
194 }
195 _tmp24_ = creturn_type;
196 vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp24_, decl_space);
197 _tmp25_ = g_direct_hash;
198 _tmp26_ = g_direct_equal;
199 _tmp27_ = g_direct_equal;
200 _tmp28_ = vala_hash_map_new (G_TYPE_INT, NULL, NULL, VALA_TYPE_CCODE_PARAMETER, (GBoxedCopyFunc) vala_ccode_node_ref, (GDestroyNotify) vala_ccode_node_unref, _tmp25_, _tmp26_, _tmp27_);
201 cparam_map = _tmp28_;
202 _tmp29_ = vala_get_ccode_name ((ValaCodeNode*) d);
203 _tmp30_ = _tmp29_;
204 _tmp31_ = vala_ccode_function_declarator_new (_tmp30_);
205 _tmp32_ = _tmp31_;
206 _g_free0 (_tmp30_);
207 cfundecl = _tmp32_;
208 {
209 ValaList* _param_list = NULL;
210 ValaList* _tmp33_;
211 ValaList* _tmp34_;
212 gint _param_size = 0;
213 ValaList* _tmp35_;
214 gint _tmp36_;
215 gint _tmp37_;
216 gint _param_index = 0;
217 _tmp33_ = vala_callable_get_parameters ((ValaCallable*) d);
218 _tmp34_ = _vala_iterable_ref0 (_tmp33_);
219 _param_list = _tmp34_;
220 _tmp35_ = _param_list;
221 _tmp36_ = vala_collection_get_size ((ValaCollection*) _tmp35_);
222 _tmp37_ = _tmp36_;
223 _param_size = _tmp37_;
224 _param_index = -1;
225 while (TRUE) {
226 gint _tmp38_;
227 gint _tmp39_;
228 ValaParameter* param = NULL;
229 ValaList* _tmp40_;
230 gpointer _tmp41_;
231 ValaParameter* _tmp42_;
232 ValaHashMap* _tmp43_;
233 ValaCCodeParameter* _tmp44_;
234 ValaCCodeParameter* _tmp45_;
235 _param_index = _param_index + 1;
236 _tmp38_ = _param_index;
237 _tmp39_ = _param_size;
238 if (!(_tmp38_ < _tmp39_)) {
239 break;
240 }
241 _tmp40_ = _param_list;
242 _tmp41_ = vala_list_get (_tmp40_, _param_index);
243 param = (ValaParameter*) _tmp41_;
244 _tmp42_ = param;
245 _tmp43_ = cparam_map;
246 _tmp44_ = vala_ccode_method_module_generate_parameter ((ValaCCodeMethodModule*) self, _tmp42_, decl_space, (ValaMap*) _tmp43_, NULL);
247 _tmp45_ = _tmp44_;
248 _vala_ccode_node_unref0 (_tmp45_);
249 _vala_code_node_unref0 (param);
250 }
251 _vala_iterable_unref0 (_param_list);
252 }
253 _tmp46_ = vala_callable_get_return_type ((ValaCallable*) d);
254 _tmp47_ = _tmp46_;
255 if (vala_data_type_is_real_non_null_struct_type (_tmp47_)) {
256 ValaCCodeParameter* cparam = NULL;
257 ValaDataType* _tmp48_;
258 ValaDataType* _tmp49_;
259 gchar* _tmp50_;
260 gchar* _tmp51_;
261 gchar* _tmp52_;
262 gchar* _tmp53_;
263 ValaCCodeParameter* _tmp54_;
264 ValaCCodeParameter* _tmp55_;
265 ValaHashMap* _tmp56_;
266 ValaCCodeParameter* _tmp57_;
267 _tmp48_ = vala_callable_get_return_type ((ValaCallable*) d);
268 _tmp49_ = _tmp48_;
269 _tmp50_ = vala_get_ccode_name ((ValaCodeNode*) _tmp49_);
270 _tmp51_ = _tmp50_;
271 _tmp52_ = g_strconcat (_tmp51_, "*", NULL);
272 _tmp53_ = _tmp52_;
273 _tmp54_ = vala_ccode_parameter_new ("result", _tmp53_);
274 _tmp55_ = _tmp54_;
275 _g_free0 (_tmp53_);
276 _g_free0 (_tmp51_);
277 cparam = _tmp55_;
278 _tmp56_ = cparam_map;
279 _tmp57_ = cparam;
280 vala_map_set ((ValaMap*) _tmp56_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, (gdouble) -3, FALSE)), _tmp57_);
281 _vala_ccode_node_unref0 (cparam);
282 } else {
283 gboolean _tmp58_ = FALSE;
284 if (vala_get_ccode_array_length ((ValaCodeNode*) d)) {
285 ValaDataType* _tmp59_;
286 ValaDataType* _tmp60_;
287 _tmp59_ = vala_callable_get_return_type ((ValaCallable*) d);
288 _tmp60_ = _tmp59_;
289 _tmp58_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp60_, VALA_TYPE_ARRAY_TYPE);
290 } else {
291 _tmp58_ = FALSE;
292 }
293 if (_tmp58_) {
294 ValaArrayType* array_type = NULL;
295 ValaDataType* _tmp61_;
296 ValaDataType* _tmp62_;
297 ValaArrayType* _tmp63_;
298 gchar* length_ctype = NULL;
299 gchar* _tmp64_;
300 gchar* _tmp65_;
301 gchar* _tmp66_;
302 gchar* _tmp67_;
303 _tmp61_ = vala_callable_get_return_type ((ValaCallable*) d);
304 _tmp62_ = _tmp61_;
305 _tmp63_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp62_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
306 array_type = _tmp63_;
307 _tmp64_ = vala_get_ccode_array_length_type ((ValaCodeNode*) d);
308 _tmp65_ = _tmp64_;
309 _tmp66_ = g_strconcat (_tmp65_, "*", NULL);
310 _tmp67_ = _tmp66_;
311 _g_free0 (_tmp65_);
312 length_ctype = _tmp67_;
313 {
314 gint dim = 0;
315 dim = 1;
316 {
317 gboolean _tmp68_ = FALSE;
318 _tmp68_ = TRUE;
319 while (TRUE) {
320 ValaArrayType* _tmp70_;
321 gint _tmp71_;
322 gint _tmp72_;
323 ValaCCodeParameter* cparam = NULL;
324 gchar* _tmp73_;
325 gchar* _tmp74_;
326 const gchar* _tmp75_;
327 ValaCCodeParameter* _tmp76_;
328 ValaCCodeParameter* _tmp77_;
329 ValaHashMap* _tmp78_;
330 ValaCCodeParameter* _tmp79_;
331 if (!_tmp68_) {
332 gint _tmp69_;
333 _tmp69_ = dim;
334 dim = _tmp69_ + 1;
335 }
336 _tmp68_ = FALSE;
337 _tmp70_ = array_type;
338 _tmp71_ = vala_array_type_get_rank (_tmp70_);
339 _tmp72_ = _tmp71_;
340 if (!(dim <= _tmp72_)) {
341 break;
342 }
343 _tmp73_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, "result", dim);
344 _tmp74_ = _tmp73_;
345 _tmp75_ = length_ctype;
346 _tmp76_ = vala_ccode_parameter_new (_tmp74_, _tmp75_);
347 _tmp77_ = _tmp76_;
348 _g_free0 (_tmp74_);
349 cparam = _tmp77_;
350 _tmp78_ = cparam_map;
351 _tmp79_ = cparam;
352 vala_map_set ((ValaMap*) _tmp78_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_array_length_pos ((ValaCodeNode*) d) + (0.01 * dim), FALSE)), _tmp79_);
353 _vala_ccode_node_unref0 (cparam);
354 }
355 }
356 }
357 _g_free0 (length_ctype);
358 _vala_code_node_unref0 (array_type);
359 } else {
360 gboolean _tmp80_ = FALSE;
361 if (vala_get_ccode_delegate_target ((ValaCodeNode*) d)) {
362 ValaDataType* _tmp81_;
363 ValaDataType* _tmp82_;
364 _tmp81_ = vala_callable_get_return_type ((ValaCallable*) d);
365 _tmp82_ = _tmp81_;
366 _tmp80_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp82_, VALA_TYPE_DELEGATE_TYPE);
367 } else {
368 _tmp80_ = FALSE;
369 }
370 if (_tmp80_) {
371 ValaDelegateType* deleg_type = NULL;
372 ValaDataType* _tmp83_;
373 ValaDataType* _tmp84_;
374 ValaDelegateType* _tmp85_;
375 ValaDelegateType* _tmp86_;
376 ValaDelegate* _tmp87_;
377 ValaDelegate* _tmp88_;
378 gboolean _tmp89_;
379 gboolean _tmp90_;
380 _tmp83_ = vala_callable_get_return_type ((ValaCallable*) d);
381 _tmp84_ = _tmp83_;
382 _tmp85_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp84_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
383 deleg_type = _tmp85_;
384 _tmp86_ = deleg_type;
385 _tmp87_ = vala_delegate_type_get_delegate_symbol (_tmp86_);
386 _tmp88_ = _tmp87_;
387 _tmp89_ = vala_delegate_get_has_target (_tmp88_);
388 _tmp90_ = _tmp89_;
389 if (_tmp90_) {
390 ValaDataType* _tmp91_;
391 ValaCCodeParameter* cparam = NULL;
392 gchar* _tmp92_;
393 gchar* _tmp93_;
394 ValaDataType* _tmp94_;
395 gchar* _tmp95_;
396 gchar* _tmp96_;
397 gchar* _tmp97_;
398 gchar* _tmp98_;
399 ValaCCodeParameter* _tmp99_;
400 ValaCCodeParameter* _tmp100_;
401 ValaHashMap* _tmp101_;
402 ValaCCodeParameter* _tmp102_;
403 ValaDelegateType* _tmp103_;
404 _tmp91_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
405 vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp91_, decl_space);
406 _tmp92_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "result");
407 _tmp93_ = _tmp92_;
408 _tmp94_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
409 _tmp95_ = vala_get_ccode_name ((ValaCodeNode*) _tmp94_);
410 _tmp96_ = _tmp95_;
411 _tmp97_ = g_strconcat (_tmp96_, "*", NULL);
412 _tmp98_ = _tmp97_;
413 _tmp99_ = vala_ccode_parameter_new (_tmp93_, _tmp98_);
414 _tmp100_ = _tmp99_;
415 _g_free0 (_tmp98_);
416 _g_free0 (_tmp96_);
417 _g_free0 (_tmp93_);
418 cparam = _tmp100_;
419 _tmp101_ = cparam_map;
420 _tmp102_ = cparam;
421 vala_map_set ((ValaMap*) _tmp101_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) d), FALSE)), _tmp102_);
422 _tmp103_ = deleg_type;
423 if (vala_data_type_is_disposable ((ValaDataType*) _tmp103_)) {
424 ValaDelegateType* _tmp104_;
425 gchar* _tmp105_;
426 gchar* _tmp106_;
427 ValaDelegateType* _tmp107_;
428 gchar* _tmp108_;
429 gchar* _tmp109_;
430 gchar* _tmp110_;
431 gchar* _tmp111_;
432 ValaCCodeParameter* _tmp112_;
433 ValaHashMap* _tmp113_;
434 ValaCCodeParameter* _tmp114_;
435 _tmp104_ = ((ValaCCodeBaseModule*) self)->delegate_target_destroy_type;
436 vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, (ValaDataType*) _tmp104_, decl_space);
437 _tmp105_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, "result");
438 _tmp106_ = _tmp105_;
439 _tmp107_ = ((ValaCCodeBaseModule*) self)->delegate_target_destroy_type;
440 _tmp108_ = vala_get_ccode_name ((ValaCodeNode*) _tmp107_);
441 _tmp109_ = _tmp108_;
442 _tmp110_ = g_strconcat (_tmp109_, "*", NULL);
443 _tmp111_ = _tmp110_;
444 _tmp112_ = vala_ccode_parameter_new (_tmp106_, _tmp111_);
445 _vala_ccode_node_unref0 (cparam);
446 cparam = _tmp112_;
447 _g_free0 (_tmp111_);
448 _g_free0 (_tmp109_);
449 _g_free0 (_tmp106_);
450 _tmp113_ = cparam_map;
451 _tmp114_ = cparam;
452 vala_map_set ((ValaMap*) _tmp113_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) d), FALSE)), _tmp114_);
453 }
454 _vala_ccode_node_unref0 (cparam);
455 }
456 _vala_code_node_unref0 (deleg_type);
457 }
458 }
459 }
460 _tmp115_ = vala_delegate_get_has_target (d);
461 _tmp116_ = _tmp115_;
462 if (_tmp116_) {
463 ValaDataType* _tmp117_;
464 ValaCCodeParameter* cparam = NULL;
465 ValaDataType* _tmp118_;
466 gchar* _tmp119_;
467 gchar* _tmp120_;
468 ValaCCodeParameter* _tmp121_;
469 ValaCCodeParameter* _tmp122_;
470 ValaHashMap* _tmp123_;
471 ValaCCodeParameter* _tmp124_;
472 _tmp117_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
473 vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp117_, decl_space);
474 _tmp118_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
475 _tmp119_ = vala_get_ccode_name ((ValaCodeNode*) _tmp118_);
476 _tmp120_ = _tmp119_;
477 _tmp121_ = vala_ccode_parameter_new ("user_data", _tmp120_);
478 _tmp122_ = _tmp121_;
479 _g_free0 (_tmp120_);
480 cparam = _tmp122_;
481 _tmp123_ = cparam_map;
482 _tmp124_ = cparam;
483 vala_map_set ((ValaMap*) _tmp123_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_instance_pos ((ValaCodeNode*) d), FALSE)), _tmp124_);
484 _vala_ccode_node_unref0 (cparam);
485 }
486 _tmp125_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) d);
487 _tmp126_ = _tmp125_;
488 if (_tmp126_) {
489 ValaErrorType* _tmp127_;
490 ValaCCodeParameter* cparam = NULL;
491 ValaCCodeParameter* _tmp128_;
492 ValaHashMap* _tmp129_;
493 ValaCCodeParameter* _tmp130_;
494 _tmp127_ = ((ValaCCodeBaseModule*) self)->gerror_type;
495 vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, (ValaDataType*) _tmp127_, decl_space);
496 _tmp128_ = vala_ccode_parameter_new ("error", "GError**");
497 cparam = _tmp128_;
498 _tmp129_ = cparam_map;
499 _tmp130_ = cparam;
500 vala_map_set ((ValaMap*) _tmp129_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_error_pos ((ValaCallable*) d), FALSE)), _tmp130_);
501 _vala_ccode_node_unref0 (cparam);
502 }
503 last_pos = -1;
504 while (TRUE) {
505 ValaCCodeFunctionDeclarator* _tmp141_;
506 ValaHashMap* _tmp142_;
507 gpointer _tmp143_;
508 ValaCCodeParameter* _tmp144_;
509 min_pos = -1;
510 {
511 ValaIterator* _pos_it = NULL;
512 ValaHashMap* _tmp131_;
513 ValaSet* _tmp132_;
514 ValaSet* _tmp133_;
515 ValaIterator* _tmp134_;
516 ValaIterator* _tmp135_;
517 _tmp131_ = cparam_map;
518 _tmp132_ = vala_map_get_keys ((ValaMap*) _tmp131_);
519 _tmp133_ = _tmp132_;
520 _tmp134_ = vala_iterable_iterator ((ValaIterable*) _tmp133_);
521 _tmp135_ = _tmp134_;
522 _vala_iterable_unref0 (_tmp133_);
523 _pos_it = _tmp135_;
524 while (TRUE) {
525 ValaIterator* _tmp136_;
526 gint pos = 0;
527 ValaIterator* _tmp137_;
528 gpointer _tmp138_;
529 gboolean _tmp139_ = FALSE;
530 _tmp136_ = _pos_it;
531 if (!vala_iterator_next (_tmp136_)) {
532 break;
533 }
534 _tmp137_ = _pos_it;
535 _tmp138_ = vala_iterator_get (_tmp137_);
536 pos = (gint) ((gintptr) _tmp138_);
537 if (pos > last_pos) {
538 gboolean _tmp140_ = FALSE;
539 if (min_pos == -1) {
540 _tmp140_ = TRUE;
541 } else {
542 _tmp140_ = pos < min_pos;
543 }
544 _tmp139_ = _tmp140_;
545 } else {
546 _tmp139_ = FALSE;
547 }
548 if (_tmp139_) {
549 min_pos = pos;
550 }
551 }
552 _vala_iterator_unref0 (_pos_it);
553 }
554 if (min_pos == -1) {
555 break;
556 }
557 _tmp141_ = cfundecl;
558 _tmp142_ = cparam_map;
559 _tmp143_ = vala_map_get ((ValaMap*) _tmp142_, (gpointer) ((gintptr) min_pos));
560 _tmp144_ = (ValaCCodeParameter*) _tmp143_;
561 vala_ccode_function_declarator_add_parameter (_tmp141_, _tmp144_);
562 _vala_ccode_node_unref0 (_tmp144_);
563 last_pos = min_pos;
564 }
565 _tmp145_ = creturn_type;
566 _tmp146_ = vala_get_ccode_name ((ValaCodeNode*) _tmp145_);
567 _tmp147_ = _tmp146_;
568 _tmp148_ = cfundecl;
569 _tmp149_ = vala_ccode_type_definition_new (_tmp147_, (ValaCCodeDeclarator*) _tmp148_);
570 _tmp150_ = _tmp149_;
571 _g_free0 (_tmp147_);
572 ctypedef = _tmp150_;
573 _tmp151_ = vala_symbol_get_version ((ValaSymbol*) d);
574 _tmp152_ = _tmp151_;
575 _tmp153_ = vala_version_attribute_get_deprecated (_tmp152_);
576 _tmp154_ = _tmp153_;
577 if (_tmp154_) {
578 ValaCodeContext* _tmp155_;
579 ValaCodeContext* _tmp156_;
580 ValaProfile _tmp157_;
581 ValaProfile _tmp158_;
582 ValaCCodeTypeDefinition* _tmp159_;
583 ValaCCodeTypeDefinition* _tmp160_;
584 ValaCCodeModifiers _tmp161_;
585 ValaCCodeModifiers _tmp162_;
586 _tmp155_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
587 _tmp156_ = _tmp155_;
588 _tmp157_ = vala_code_context_get_profile (_tmp156_);
589 _tmp158_ = _tmp157_;
590 if (_tmp158_ == VALA_PROFILE_GOBJECT) {
591 vala_ccode_file_add_include (decl_space, "glib.h", FALSE);
592 }
593 _tmp159_ = ctypedef;
594 _tmp160_ = ctypedef;
595 _tmp161_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) _tmp160_);
596 _tmp162_ = _tmp161_;
597 vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp160_, _tmp162_ | VALA_CCODE_MODIFIERS_DEPRECATED);
598 }
599 _tmp163_ = ctypedef;
600 vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp163_);
601 _vala_ccode_node_unref0 (ctypedef);
602 _vala_ccode_node_unref0 (cfundecl);
603 _vala_map_unref0 (cparam_map);
604 _vala_code_node_unref0 (creturn_type);
605 }
606
607 static void
vala_ccode_delegate_module_real_visit_delegate(ValaCodeVisitor * base,ValaDelegate * d)608 vala_ccode_delegate_module_real_visit_delegate (ValaCodeVisitor* base,
609 ValaDelegate* d)
610 {
611 ValaCCodeDelegateModule * self;
612 ValaCCodeFile* _tmp0_;
613 self = (ValaCCodeDelegateModule*) base;
614 g_return_if_fail (d != NULL);
615 _tmp0_ = ((ValaCCodeBaseModule*) self)->cfile;
616 vala_ccode_base_module_generate_delegate_declaration ((ValaCCodeBaseModule*) self, d, _tmp0_);
617 if (!vala_symbol_is_internal_symbol ((ValaSymbol*) d)) {
618 ValaCCodeFile* _tmp1_;
619 _tmp1_ = ((ValaCCodeBaseModule*) self)->header_file;
620 vala_ccode_base_module_generate_delegate_declaration ((ValaCCodeBaseModule*) self, d, _tmp1_);
621 }
622 if (!vala_symbol_is_private_symbol ((ValaSymbol*) d)) {
623 ValaCCodeFile* _tmp2_;
624 _tmp2_ = ((ValaCCodeBaseModule*) self)->internal_header_file;
625 vala_ccode_base_module_generate_delegate_declaration ((ValaCCodeBaseModule*) self, d, _tmp2_);
626 }
627 vala_code_node_accept_children ((ValaCodeNode*) d, (ValaCodeVisitor*) self);
628 }
629
630 static gchar*
vala_ccode_delegate_module_real_get_delegate_target_cname(ValaCCodeBaseModule * base,const gchar * delegate_cname)631 vala_ccode_delegate_module_real_get_delegate_target_cname (ValaCCodeBaseModule* base,
632 const gchar* delegate_cname)
633 {
634 ValaCCodeDelegateModule * self;
635 gchar* _tmp0_;
636 gchar* result = NULL;
637 self = (ValaCCodeDelegateModule*) base;
638 g_return_val_if_fail (delegate_cname != NULL, NULL);
639 _tmp0_ = g_strdup_printf ("%s_target", delegate_cname);
640 result = _tmp0_;
641 return result;
642 }
643
644 static ValaCCodeExpression*
vala_ccode_delegate_module_real_get_delegate_target_cexpression(ValaCCodeBaseModule * base,ValaExpression * delegate_expr,ValaCCodeExpression ** delegate_target_destroy_notify)645 vala_ccode_delegate_module_real_get_delegate_target_cexpression (ValaCCodeBaseModule* base,
646 ValaExpression* delegate_expr,
647 ValaCCodeExpression* * delegate_target_destroy_notify)
648 {
649 ValaCCodeDelegateModule * self;
650 ValaCCodeExpression* _vala_delegate_target_destroy_notify = NULL;
651 ValaTargetValue* _tmp0_;
652 ValaTargetValue* _tmp1_;
653 ValaCCodeExpression* _tmp2_;
654 ValaTargetValue* _tmp3_;
655 ValaTargetValue* _tmp4_;
656 ValaCCodeExpression* _tmp5_;
657 ValaCCodeExpression* result = NULL;
658 self = (ValaCCodeDelegateModule*) base;
659 g_return_val_if_fail (delegate_expr != NULL, NULL);
660 _tmp0_ = vala_expression_get_target_value (delegate_expr);
661 _tmp1_ = _tmp0_;
662 _tmp2_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cvalue ((ValaCCodeBaseModule*) self, _tmp1_);
663 _vala_ccode_node_unref0 (_vala_delegate_target_destroy_notify);
664 _vala_delegate_target_destroy_notify = _tmp2_;
665 _tmp3_ = vala_expression_get_target_value (delegate_expr);
666 _tmp4_ = _tmp3_;
667 _tmp5_ = vala_ccode_base_module_get_delegate_target_cvalue ((ValaCCodeBaseModule*) self, _tmp4_);
668 result = _tmp5_;
669 if (delegate_target_destroy_notify) {
670 *delegate_target_destroy_notify = _vala_delegate_target_destroy_notify;
671 } else {
672 _vala_ccode_node_unref0 (_vala_delegate_target_destroy_notify);
673 }
674 return result;
675 }
676
677 static gpointer
_vala_ccode_node_ref0(gpointer self)678 _vala_ccode_node_ref0 (gpointer self)
679 {
680 return self ? vala_ccode_node_ref (self) : NULL;
681 }
682
683 static ValaCCodeExpression*
vala_ccode_delegate_module_real_get_delegate_target_cvalue(ValaCCodeBaseModule * base,ValaTargetValue * value)684 vala_ccode_delegate_module_real_get_delegate_target_cvalue (ValaCCodeBaseModule* base,
685 ValaTargetValue* value)
686 {
687 ValaCCodeDelegateModule * self;
688 ValaCCodeExpression* _tmp0_;
689 ValaCCodeExpression* _tmp1_;
690 ValaCCodeExpression* result = NULL;
691 self = (ValaCCodeDelegateModule*) base;
692 g_return_val_if_fail (value != NULL, NULL);
693 _tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (value, VALA_TYPE_GLIB_VALUE, ValaGLibValue)->delegate_target_cvalue;
694 _tmp1_ = _vala_ccode_node_ref0 (_tmp0_);
695 result = _tmp1_;
696 return result;
697 }
698
699 static ValaCCodeExpression*
vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cvalue(ValaCCodeBaseModule * base,ValaTargetValue * value)700 vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cvalue (ValaCCodeBaseModule* base,
701 ValaTargetValue* value)
702 {
703 ValaCCodeDelegateModule * self;
704 ValaCCodeExpression* _tmp0_;
705 ValaCCodeExpression* _tmp1_;
706 ValaCCodeExpression* result = NULL;
707 self = (ValaCCodeDelegateModule*) base;
708 g_return_val_if_fail (value != NULL, NULL);
709 _tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (value, VALA_TYPE_GLIB_VALUE, ValaGLibValue)->delegate_target_destroy_notify_cvalue;
710 _tmp1_ = _vala_ccode_node_ref0 (_tmp0_);
711 result = _tmp1_;
712 return result;
713 }
714
715 static gchar*
vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cname(ValaCCodeBaseModule * base,const gchar * delegate_cname)716 vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cname (ValaCCodeBaseModule* base,
717 const gchar* delegate_cname)
718 {
719 ValaCCodeDelegateModule * self;
720 gchar* _tmp0_;
721 gchar* result = NULL;
722 self = (ValaCCodeDelegateModule*) base;
723 g_return_val_if_fail (delegate_cname != NULL, NULL);
724 _tmp0_ = g_strdup_printf ("%s_target_destroy_notify", delegate_cname);
725 result = _tmp0_;
726 return result;
727 }
728
729 static ValaCCodeExpression*
vala_ccode_delegate_module_real_get_implicit_cast_expression(ValaCCodeBaseModule * base,ValaCCodeExpression * source_cexpr,ValaDataType * expression_type,ValaDataType * target_type,ValaCodeNode * node)730 vala_ccode_delegate_module_real_get_implicit_cast_expression (ValaCCodeBaseModule* base,
731 ValaCCodeExpression* source_cexpr,
732 ValaDataType* expression_type,
733 ValaDataType* target_type,
734 ValaCodeNode* node)
735 {
736 ValaCCodeDelegateModule * self;
737 gboolean _tmp0_ = FALSE;
738 ValaCCodeExpression* _tmp27_;
739 ValaCCodeExpression* result = NULL;
740 self = (ValaCCodeDelegateModule*) base;
741 g_return_val_if_fail (source_cexpr != NULL, NULL);
742 if (G_TYPE_CHECK_INSTANCE_TYPE (target_type, VALA_TYPE_DELEGATE_TYPE)) {
743 _tmp0_ = G_TYPE_CHECK_INSTANCE_TYPE (expression_type, VALA_TYPE_METHOD_TYPE);
744 } else {
745 _tmp0_ = FALSE;
746 }
747 if (_tmp0_) {
748 ValaDelegateType* dt = NULL;
749 ValaDelegateType* _tmp1_;
750 ValaMethodType* mt = NULL;
751 ValaMethodType* _tmp2_;
752 ValaMethod* method = NULL;
753 ValaMethodType* _tmp3_;
754 ValaMethod* _tmp4_;
755 ValaMethod* _tmp5_;
756 ValaMethod* _tmp6_;
757 ValaMethod* _tmp7_;
758 ValaMethod* _tmp8_;
759 ValaMethod* _tmp9_;
760 ValaMethod* _tmp21_;
761 ValaDelegateType* _tmp22_;
762 gchar* _tmp23_;
763 gchar* _tmp24_;
764 ValaCCodeIdentifier* _tmp25_;
765 ValaCCodeExpression* _tmp26_;
766 _tmp1_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (target_type, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
767 dt = _tmp1_;
768 _tmp2_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (expression_type, VALA_TYPE_METHOD_TYPE, ValaMethodType));
769 mt = _tmp2_;
770 _tmp3_ = mt;
771 _tmp4_ = vala_method_type_get_method_symbol (_tmp3_);
772 _tmp5_ = _tmp4_;
773 _tmp6_ = _vala_code_node_ref0 (_tmp5_);
774 method = _tmp6_;
775 _tmp7_ = method;
776 _tmp8_ = vala_method_get_base_method (_tmp7_);
777 _tmp9_ = _tmp8_;
778 if (_tmp9_ != NULL) {
779 ValaMethod* _tmp10_;
780 ValaMethod* _tmp11_;
781 ValaMethod* _tmp12_;
782 ValaMethod* _tmp13_;
783 _tmp10_ = method;
784 _tmp11_ = vala_method_get_base_method (_tmp10_);
785 _tmp12_ = _tmp11_;
786 _tmp13_ = _vala_code_node_ref0 (_tmp12_);
787 _vala_code_node_unref0 (method);
788 method = _tmp13_;
789 } else {
790 ValaMethod* _tmp14_;
791 ValaMethod* _tmp15_;
792 ValaMethod* _tmp16_;
793 _tmp14_ = method;
794 _tmp15_ = vala_method_get_base_interface_method (_tmp14_);
795 _tmp16_ = _tmp15_;
796 if (_tmp16_ != NULL) {
797 ValaMethod* _tmp17_;
798 ValaMethod* _tmp18_;
799 ValaMethod* _tmp19_;
800 ValaMethod* _tmp20_;
801 _tmp17_ = method;
802 _tmp18_ = vala_method_get_base_interface_method (_tmp17_);
803 _tmp19_ = _tmp18_;
804 _tmp20_ = _vala_code_node_ref0 (_tmp19_);
805 _vala_code_node_unref0 (method);
806 method = _tmp20_;
807 }
808 }
809 _tmp21_ = method;
810 _tmp22_ = dt;
811 _tmp23_ = vala_ccode_delegate_module_generate_delegate_wrapper (self, _tmp21_, _tmp22_, node);
812 _tmp24_ = _tmp23_;
813 _tmp25_ = vala_ccode_identifier_new (_tmp24_);
814 _tmp26_ = (ValaCCodeExpression*) _tmp25_;
815 _g_free0 (_tmp24_);
816 result = _tmp26_;
817 _vala_code_node_unref0 (method);
818 _vala_code_node_unref0 (mt);
819 _vala_code_node_unref0 (dt);
820 return result;
821 }
822 _tmp27_ = VALA_CCODE_BASE_MODULE_CLASS (vala_ccode_delegate_module_parent_class)->get_implicit_cast_expression ((ValaCCodeBaseModule*) G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_CCODE_ARRAY_MODULE, ValaCCodeArrayModule), source_cexpr, expression_type, target_type, node);
823 result = _tmp27_;
824 return result;
825 }
826
827 gchar*
vala_ccode_delegate_module_generate_delegate_wrapper(ValaCCodeDelegateModule * self,ValaMethod * m,ValaDelegateType * dt,ValaCodeNode * node)828 vala_ccode_delegate_module_generate_delegate_wrapper (ValaCCodeDelegateModule* self,
829 ValaMethod* m,
830 ValaDelegateType* dt,
831 ValaCodeNode* node)
832 {
833 ValaDelegate* d = NULL;
834 ValaDelegate* _tmp0_;
835 ValaDelegate* _tmp1_;
836 ValaDelegate* _tmp2_;
837 gchar* delegate_name = NULL;
838 ValaSignal* sig = NULL;
839 ValaDelegate* _tmp3_;
840 ValaSymbol* _tmp4_;
841 ValaSymbol* _tmp5_;
842 ValaSignal* _tmp6_;
843 ValaDynamicSignal* dynamic_sig = NULL;
844 ValaSignal* _tmp7_;
845 ValaDynamicSignal* _tmp8_;
846 ValaDynamicSignal* _tmp9_;
847 gchar* wrapper_name = NULL;
848 gchar* _tmp26_;
849 gchar* _tmp27_;
850 const gchar* _tmp28_;
851 gchar* _tmp29_;
852 gchar* _tmp30_;
853 const gchar* _tmp31_;
854 ValaDataType* creturn_type = NULL;
855 ValaDelegate* _tmp32_;
856 ValaDataType* _tmp33_;
857 ValaCCodeFunction* function = NULL;
858 const gchar* _tmp34_;
859 ValaDataType* _tmp35_;
860 gchar* _tmp36_;
861 gchar* _tmp37_;
862 ValaCCodeFunction* _tmp38_;
863 ValaCCodeFunction* _tmp39_;
864 ValaCCodeFunction* _tmp40_;
865 ValaCCodeFunction* _tmp41_;
866 ValaHashMap* cparam_map = NULL;
867 GHashFunc _tmp42_;
868 GEqualFunc _tmp43_;
869 GEqualFunc _tmp44_;
870 ValaHashMap* _tmp45_;
871 ValaDelegate* _tmp46_;
872 gboolean _tmp47_;
873 gboolean _tmp48_;
874 ValaDelegate* _tmp57_;
875 ValaDataType* _tmp58_;
876 ValaDataType* _tmp59_;
877 ValaList* d_params = NULL;
878 ValaDelegate* _tmp69_;
879 ValaList* _tmp70_;
880 ValaList* _tmp71_;
881 gboolean _tmp104_ = FALSE;
882 ValaDelegate* _tmp105_;
883 gboolean _tmp183_;
884 gboolean _tmp184_;
885 gint last_pos = 0;
886 gint min_pos = 0;
887 ValaHashMap* carg_map = NULL;
888 GHashFunc _tmp203_;
889 GEqualFunc _tmp204_;
890 GEqualFunc _tmp205_;
891 ValaHashMap* _tmp206_;
892 gint i = 0;
893 gboolean _tmp207_ = FALSE;
894 ValaMemberBinding _tmp208_;
895 ValaMemberBinding _tmp209_;
896 gboolean first = FALSE;
897 gboolean _tmp371_ = FALSE;
898 gboolean _tmp418_;
899 gboolean _tmp419_;
900 ValaCCodeFunctionCall* ccall = NULL;
901 gchar* _tmp423_;
902 gchar* _tmp424_;
903 ValaCCodeIdentifier* _tmp425_;
904 ValaCCodeIdentifier* _tmp426_;
905 ValaCCodeFunctionCall* _tmp427_;
906 ValaCCodeFunctionCall* _tmp428_;
907 gboolean _tmp443_;
908 gboolean _tmp444_;
909 gboolean _tmp451_ = FALSE;
910 ValaDataType* _tmp452_;
911 ValaDataType* _tmp453_;
912 gboolean _tmp495_ = FALSE;
913 ValaDelegate* _tmp496_;
914 gboolean _tmp497_;
915 gboolean _tmp498_;
916 gboolean _tmp536_ = FALSE;
917 gboolean _tmp537_ = FALSE;
918 ValaDataType* _tmp538_;
919 ValaDataType* _tmp539_;
920 ValaCCodeFile* _tmp553_;
921 ValaCCodeFunction* _tmp554_;
922 ValaCCodeFile* _tmp555_;
923 ValaCCodeFunction* _tmp556_;
924 gchar* result = NULL;
925 g_return_val_if_fail (self != NULL, NULL);
926 g_return_val_if_fail (m != NULL, NULL);
927 g_return_val_if_fail (dt != NULL, NULL);
928 _tmp0_ = vala_delegate_type_get_delegate_symbol (dt);
929 _tmp1_ = _tmp0_;
930 _tmp2_ = _vala_code_node_ref0 (_tmp1_);
931 d = _tmp2_;
932 _tmp3_ = d;
933 _tmp4_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp3_);
934 _tmp5_ = _tmp4_;
935 _tmp6_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, VALA_TYPE_SIGNAL) ? ((ValaSignal*) _tmp5_) : NULL);
936 sig = _tmp6_;
937 _tmp7_ = sig;
938 _tmp8_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_DYNAMIC_SIGNAL) ? ((ValaDynamicSignal*) _tmp7_) : NULL);
939 dynamic_sig = _tmp8_;
940 _tmp9_ = dynamic_sig;
941 if (_tmp9_ != NULL) {
942 ValaDynamicSignal* _tmp10_;
943 gchar* _tmp11_;
944 _tmp10_ = dynamic_sig;
945 _tmp11_ = vala_ccode_base_module_get_dynamic_signal_cname ((ValaCCodeBaseModule*) self, _tmp10_);
946 _g_free0 (delegate_name);
947 delegate_name = _tmp11_;
948 } else {
949 ValaSignal* _tmp12_;
950 _tmp12_ = sig;
951 if (_tmp12_ != NULL) {
952 ValaSignal* _tmp13_;
953 ValaSymbol* _tmp14_;
954 ValaSymbol* _tmp15_;
955 gchar* _tmp16_;
956 gchar* _tmp17_;
957 ValaSignal* _tmp18_;
958 gchar* _tmp19_;
959 gchar* _tmp20_;
960 gchar* _tmp21_;
961 _tmp13_ = sig;
962 _tmp14_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp13_);
963 _tmp15_ = _tmp14_;
964 _tmp16_ = vala_get_ccode_lower_case_prefix (_tmp15_);
965 _tmp17_ = _tmp16_;
966 _tmp18_ = sig;
967 _tmp19_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) _tmp18_, NULL);
968 _tmp20_ = _tmp19_;
969 _tmp21_ = g_strconcat (_tmp17_, _tmp20_, NULL);
970 _g_free0 (delegate_name);
971 delegate_name = _tmp21_;
972 _g_free0 (_tmp20_);
973 _g_free0 (_tmp17_);
974 } else {
975 ValaDelegate* _tmp22_;
976 gchar* _tmp23_;
977 gchar* _tmp24_;
978 gchar* _tmp25_;
979 _tmp22_ = d;
980 _tmp23_ = vala_get_ccode_name ((ValaCodeNode*) _tmp22_);
981 _tmp24_ = _tmp23_;
982 _tmp25_ = vala_symbol_camel_case_to_lower_case (_tmp24_);
983 _g_free0 (delegate_name);
984 delegate_name = _tmp25_;
985 _g_free0 (_tmp24_);
986 }
987 }
988 _tmp26_ = vala_get_ccode_name ((ValaCodeNode*) m);
989 _tmp27_ = _tmp26_;
990 _tmp28_ = delegate_name;
991 _tmp29_ = g_strdup_printf ("_%s_%s", _tmp27_, _tmp28_);
992 _tmp30_ = _tmp29_;
993 _g_free0 (_tmp27_);
994 wrapper_name = _tmp30_;
995 _tmp31_ = wrapper_name;
996 if (!vala_ccode_base_module_add_wrapper ((ValaCCodeBaseModule*) self, _tmp31_)) {
997 result = wrapper_name;
998 _vala_code_node_unref0 (dynamic_sig);
999 _vala_code_node_unref0 (sig);
1000 _g_free0 (delegate_name);
1001 _vala_code_node_unref0 (d);
1002 return result;
1003 }
1004 _tmp32_ = d;
1005 _tmp33_ = vala_ccode_base_module_get_callable_creturn_type ((ValaCallable*) _tmp32_);
1006 creturn_type = _tmp33_;
1007 _tmp34_ = wrapper_name;
1008 _tmp35_ = creturn_type;
1009 _tmp36_ = vala_get_ccode_name ((ValaCodeNode*) _tmp35_);
1010 _tmp37_ = _tmp36_;
1011 _tmp38_ = vala_ccode_function_new (_tmp34_, _tmp37_);
1012 _tmp39_ = _tmp38_;
1013 _g_free0 (_tmp37_);
1014 function = _tmp39_;
1015 _tmp40_ = function;
1016 vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp40_, VALA_CCODE_MODIFIERS_STATIC);
1017 _tmp41_ = function;
1018 vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, _tmp41_);
1019 _tmp42_ = g_direct_hash;
1020 _tmp43_ = g_direct_equal;
1021 _tmp44_ = g_direct_equal;
1022 _tmp45_ = vala_hash_map_new (G_TYPE_INT, NULL, NULL, VALA_TYPE_CCODE_PARAMETER, (GBoxedCopyFunc) vala_ccode_node_ref, (GDestroyNotify) vala_ccode_node_unref, _tmp42_, _tmp43_, _tmp44_);
1023 cparam_map = _tmp45_;
1024 _tmp46_ = d;
1025 _tmp47_ = vala_delegate_get_has_target (_tmp46_);
1026 _tmp48_ = _tmp47_;
1027 if (_tmp48_) {
1028 ValaCCodeParameter* cparam = NULL;
1029 ValaDataType* _tmp49_;
1030 gchar* _tmp50_;
1031 gchar* _tmp51_;
1032 ValaCCodeParameter* _tmp52_;
1033 ValaCCodeParameter* _tmp53_;
1034 ValaHashMap* _tmp54_;
1035 ValaDelegate* _tmp55_;
1036 ValaCCodeParameter* _tmp56_;
1037 _tmp49_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
1038 _tmp50_ = vala_get_ccode_name ((ValaCodeNode*) _tmp49_);
1039 _tmp51_ = _tmp50_;
1040 _tmp52_ = vala_ccode_parameter_new ("self", _tmp51_);
1041 _tmp53_ = _tmp52_;
1042 _g_free0 (_tmp51_);
1043 cparam = _tmp53_;
1044 _tmp54_ = cparam_map;
1045 _tmp55_ = d;
1046 _tmp56_ = cparam;
1047 vala_map_set ((ValaMap*) _tmp54_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_instance_pos ((ValaCodeNode*) _tmp55_), FALSE)), _tmp56_);
1048 _vala_ccode_node_unref0 (cparam);
1049 }
1050 _tmp57_ = d;
1051 _tmp58_ = vala_delegate_get_sender_type (_tmp57_);
1052 _tmp59_ = _tmp58_;
1053 if (_tmp59_ != NULL) {
1054 ValaParameter* param = NULL;
1055 ValaDelegate* _tmp60_;
1056 ValaDataType* _tmp61_;
1057 ValaDataType* _tmp62_;
1058 ValaParameter* _tmp63_;
1059 ValaParameter* _tmp64_;
1060 ValaCCodeFile* _tmp65_;
1061 ValaHashMap* _tmp66_;
1062 ValaCCodeParameter* _tmp67_;
1063 ValaCCodeParameter* _tmp68_;
1064 _tmp60_ = d;
1065 _tmp61_ = vala_delegate_get_sender_type (_tmp60_);
1066 _tmp62_ = _tmp61_;
1067 _tmp63_ = vala_parameter_new ("_sender", _tmp62_, NULL);
1068 param = _tmp63_;
1069 _tmp64_ = param;
1070 _tmp65_ = ((ValaCCodeBaseModule*) self)->cfile;
1071 _tmp66_ = cparam_map;
1072 _tmp67_ = vala_ccode_method_module_generate_parameter ((ValaCCodeMethodModule*) self, _tmp64_, _tmp65_, (ValaMap*) _tmp66_, NULL);
1073 _tmp68_ = _tmp67_;
1074 _vala_ccode_node_unref0 (_tmp68_);
1075 _vala_code_node_unref0 (param);
1076 }
1077 _tmp69_ = d;
1078 _tmp70_ = vala_callable_get_parameters ((ValaCallable*) _tmp69_);
1079 _tmp71_ = _vala_iterable_ref0 (_tmp70_);
1080 d_params = _tmp71_;
1081 {
1082 ValaList* _param_list = NULL;
1083 ValaList* _tmp72_;
1084 ValaList* _tmp73_;
1085 gint _param_size = 0;
1086 ValaList* _tmp74_;
1087 gint _tmp75_;
1088 gint _tmp76_;
1089 gint _param_index = 0;
1090 _tmp72_ = d_params;
1091 _tmp73_ = _vala_iterable_ref0 (_tmp72_);
1092 _param_list = _tmp73_;
1093 _tmp74_ = _param_list;
1094 _tmp75_ = vala_collection_get_size ((ValaCollection*) _tmp74_);
1095 _tmp76_ = _tmp75_;
1096 _param_size = _tmp76_;
1097 _param_index = -1;
1098 while (TRUE) {
1099 gint _tmp77_;
1100 gint _tmp78_;
1101 ValaParameter* param = NULL;
1102 ValaList* _tmp79_;
1103 gpointer _tmp80_;
1104 gboolean _tmp81_ = FALSE;
1105 gboolean _tmp82_ = FALSE;
1106 ValaDynamicSignal* _tmp83_;
1107 ValaParameter* _tmp99_;
1108 ValaCCodeFile* _tmp100_;
1109 ValaHashMap* _tmp101_;
1110 ValaCCodeParameter* _tmp102_;
1111 ValaCCodeParameter* _tmp103_;
1112 _param_index = _param_index + 1;
1113 _tmp77_ = _param_index;
1114 _tmp78_ = _param_size;
1115 if (!(_tmp77_ < _tmp78_)) {
1116 break;
1117 }
1118 _tmp79_ = _param_list;
1119 _tmp80_ = vala_list_get (_tmp79_, _param_index);
1120 param = (ValaParameter*) _tmp80_;
1121 _tmp83_ = dynamic_sig;
1122 if (_tmp83_ != NULL) {
1123 ValaParameter* _tmp84_;
1124 ValaDataType* _tmp85_;
1125 ValaDataType* _tmp86_;
1126 _tmp84_ = param;
1127 _tmp85_ = vala_variable_get_variable_type ((ValaVariable*) _tmp84_);
1128 _tmp86_ = _tmp85_;
1129 _tmp82_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp86_, VALA_TYPE_ARRAY_TYPE);
1130 } else {
1131 _tmp82_ = FALSE;
1132 }
1133 if (_tmp82_) {
1134 ValaParameter* _tmp87_;
1135 ValaDataType* _tmp88_;
1136 ValaDataType* _tmp89_;
1137 ValaDataType* _tmp90_;
1138 ValaDataType* _tmp91_;
1139 ValaTypeSymbol* _tmp92_;
1140 ValaTypeSymbol* _tmp93_;
1141 ValaDataType* _tmp94_;
1142 ValaTypeSymbol* _tmp95_;
1143 ValaTypeSymbol* _tmp96_;
1144 _tmp87_ = param;
1145 _tmp88_ = vala_variable_get_variable_type ((ValaVariable*) _tmp87_);
1146 _tmp89_ = _tmp88_;
1147 _tmp90_ = vala_array_type_get_element_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp89_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
1148 _tmp91_ = _tmp90_;
1149 _tmp92_ = vala_data_type_get_type_symbol (_tmp91_);
1150 _tmp93_ = _tmp92_;
1151 _tmp94_ = ((ValaCCodeBaseModule*) self)->string_type;
1152 _tmp95_ = vala_data_type_get_type_symbol (_tmp94_);
1153 _tmp96_ = _tmp95_;
1154 _tmp81_ = _tmp93_ == _tmp96_;
1155 } else {
1156 _tmp81_ = FALSE;
1157 }
1158 if (_tmp81_) {
1159 ValaParameter* _tmp97_;
1160 ValaParameter* _tmp98_;
1161 _tmp97_ = param;
1162 vala_code_node_set_attribute_bool ((ValaCodeNode*) _tmp97_, "CCode", "array_length", FALSE, NULL);
1163 _tmp98_ = param;
1164 vala_code_node_set_attribute_bool ((ValaCodeNode*) _tmp98_, "CCode", "array_null_terminated", TRUE, NULL);
1165 }
1166 _tmp99_ = param;
1167 _tmp100_ = ((ValaCCodeBaseModule*) self)->cfile;
1168 _tmp101_ = cparam_map;
1169 _tmp102_ = vala_ccode_method_module_generate_parameter ((ValaCCodeMethodModule*) self, _tmp99_, _tmp100_, (ValaMap*) _tmp101_, NULL);
1170 _tmp103_ = _tmp102_;
1171 _vala_ccode_node_unref0 (_tmp103_);
1172 _vala_code_node_unref0 (param);
1173 }
1174 _vala_iterable_unref0 (_param_list);
1175 }
1176 _tmp105_ = d;
1177 if (vala_get_ccode_array_length ((ValaCodeNode*) _tmp105_)) {
1178 ValaDelegate* _tmp106_;
1179 ValaDataType* _tmp107_;
1180 ValaDataType* _tmp108_;
1181 _tmp106_ = d;
1182 _tmp107_ = vala_callable_get_return_type ((ValaCallable*) _tmp106_);
1183 _tmp108_ = _tmp107_;
1184 _tmp104_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp108_, VALA_TYPE_ARRAY_TYPE);
1185 } else {
1186 _tmp104_ = FALSE;
1187 }
1188 if (_tmp104_) {
1189 ValaArrayType* array_type = NULL;
1190 ValaDelegate* _tmp109_;
1191 ValaDataType* _tmp110_;
1192 ValaDataType* _tmp111_;
1193 ValaArrayType* _tmp112_;
1194 gchar* length_ctype = NULL;
1195 ValaDelegate* _tmp113_;
1196 gchar* _tmp114_;
1197 gchar* _tmp115_;
1198 gchar* _tmp116_;
1199 gchar* _tmp117_;
1200 _tmp109_ = d;
1201 _tmp110_ = vala_callable_get_return_type ((ValaCallable*) _tmp109_);
1202 _tmp111_ = _tmp110_;
1203 _tmp112_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp111_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
1204 array_type = _tmp112_;
1205 _tmp113_ = d;
1206 _tmp114_ = vala_get_ccode_array_length_type ((ValaCodeNode*) _tmp113_);
1207 _tmp115_ = _tmp114_;
1208 _tmp116_ = g_strconcat (_tmp115_, "*", NULL);
1209 _tmp117_ = _tmp116_;
1210 _g_free0 (_tmp115_);
1211 length_ctype = _tmp117_;
1212 {
1213 gint dim = 0;
1214 dim = 1;
1215 {
1216 gboolean _tmp118_ = FALSE;
1217 _tmp118_ = TRUE;
1218 while (TRUE) {
1219 ValaArrayType* _tmp120_;
1220 gint _tmp121_;
1221 gint _tmp122_;
1222 ValaCCodeParameter* cparam = NULL;
1223 gchar* _tmp123_;
1224 gchar* _tmp124_;
1225 const gchar* _tmp125_;
1226 ValaCCodeParameter* _tmp126_;
1227 ValaCCodeParameter* _tmp127_;
1228 ValaHashMap* _tmp128_;
1229 ValaDelegate* _tmp129_;
1230 ValaCCodeParameter* _tmp130_;
1231 if (!_tmp118_) {
1232 gint _tmp119_;
1233 _tmp119_ = dim;
1234 dim = _tmp119_ + 1;
1235 }
1236 _tmp118_ = FALSE;
1237 _tmp120_ = array_type;
1238 _tmp121_ = vala_array_type_get_rank (_tmp120_);
1239 _tmp122_ = _tmp121_;
1240 if (!(dim <= _tmp122_)) {
1241 break;
1242 }
1243 _tmp123_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, "result", dim);
1244 _tmp124_ = _tmp123_;
1245 _tmp125_ = length_ctype;
1246 _tmp126_ = vala_ccode_parameter_new (_tmp124_, _tmp125_);
1247 _tmp127_ = _tmp126_;
1248 _g_free0 (_tmp124_);
1249 cparam = _tmp127_;
1250 _tmp128_ = cparam_map;
1251 _tmp129_ = d;
1252 _tmp130_ = cparam;
1253 vala_map_set ((ValaMap*) _tmp128_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_array_length_pos ((ValaCodeNode*) _tmp129_) + (0.01 * dim), FALSE)), _tmp130_);
1254 _vala_ccode_node_unref0 (cparam);
1255 }
1256 }
1257 }
1258 _g_free0 (length_ctype);
1259 _vala_code_node_unref0 (array_type);
1260 } else {
1261 ValaDelegate* _tmp131_;
1262 ValaDataType* _tmp132_;
1263 ValaDataType* _tmp133_;
1264 _tmp131_ = d;
1265 _tmp132_ = vala_callable_get_return_type ((ValaCallable*) _tmp131_);
1266 _tmp133_ = _tmp132_;
1267 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp133_, VALA_TYPE_DELEGATE_TYPE)) {
1268 ValaDelegateType* deleg_type = NULL;
1269 ValaDelegate* _tmp134_;
1270 ValaDataType* _tmp135_;
1271 ValaDataType* _tmp136_;
1272 ValaDelegateType* _tmp137_;
1273 gboolean _tmp138_ = FALSE;
1274 ValaDelegate* _tmp139_;
1275 _tmp134_ = d;
1276 _tmp135_ = vala_callable_get_return_type ((ValaCallable*) _tmp134_);
1277 _tmp136_ = _tmp135_;
1278 _tmp137_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp136_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
1279 deleg_type = _tmp137_;
1280 _tmp139_ = d;
1281 if (vala_get_ccode_delegate_target ((ValaCodeNode*) _tmp139_)) {
1282 ValaDelegateType* _tmp140_;
1283 ValaDelegate* _tmp141_;
1284 ValaDelegate* _tmp142_;
1285 gboolean _tmp143_;
1286 gboolean _tmp144_;
1287 _tmp140_ = deleg_type;
1288 _tmp141_ = vala_delegate_type_get_delegate_symbol (_tmp140_);
1289 _tmp142_ = _tmp141_;
1290 _tmp143_ = vala_delegate_get_has_target (_tmp142_);
1291 _tmp144_ = _tmp143_;
1292 _tmp138_ = _tmp144_;
1293 } else {
1294 _tmp138_ = FALSE;
1295 }
1296 if (_tmp138_) {
1297 ValaCCodeParameter* cparam = NULL;
1298 gchar* _tmp145_;
1299 gchar* _tmp146_;
1300 ValaDataType* _tmp147_;
1301 gchar* _tmp148_;
1302 gchar* _tmp149_;
1303 gchar* _tmp150_;
1304 gchar* _tmp151_;
1305 ValaCCodeParameter* _tmp152_;
1306 ValaCCodeParameter* _tmp153_;
1307 ValaHashMap* _tmp154_;
1308 ValaDelegate* _tmp155_;
1309 ValaCCodeParameter* _tmp156_;
1310 ValaDelegateType* _tmp157_;
1311 _tmp145_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "result");
1312 _tmp146_ = _tmp145_;
1313 _tmp147_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
1314 _tmp148_ = vala_get_ccode_name ((ValaCodeNode*) _tmp147_);
1315 _tmp149_ = _tmp148_;
1316 _tmp150_ = g_strconcat (_tmp149_, "*", NULL);
1317 _tmp151_ = _tmp150_;
1318 _tmp152_ = vala_ccode_parameter_new (_tmp146_, _tmp151_);
1319 _tmp153_ = _tmp152_;
1320 _g_free0 (_tmp151_);
1321 _g_free0 (_tmp149_);
1322 _g_free0 (_tmp146_);
1323 cparam = _tmp153_;
1324 _tmp154_ = cparam_map;
1325 _tmp155_ = d;
1326 _tmp156_ = cparam;
1327 vala_map_set ((ValaMap*) _tmp154_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) _tmp155_), FALSE)), _tmp156_);
1328 _tmp157_ = deleg_type;
1329 if (vala_data_type_is_disposable ((ValaDataType*) _tmp157_)) {
1330 gchar* _tmp158_;
1331 gchar* _tmp159_;
1332 ValaDelegateType* _tmp160_;
1333 gchar* _tmp161_;
1334 gchar* _tmp162_;
1335 gchar* _tmp163_;
1336 gchar* _tmp164_;
1337 ValaCCodeParameter* _tmp165_;
1338 ValaHashMap* _tmp166_;
1339 ValaDelegate* _tmp167_;
1340 ValaCCodeParameter* _tmp168_;
1341 _tmp158_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, "result");
1342 _tmp159_ = _tmp158_;
1343 _tmp160_ = ((ValaCCodeBaseModule*) self)->delegate_target_destroy_type;
1344 _tmp161_ = vala_get_ccode_name ((ValaCodeNode*) _tmp160_);
1345 _tmp162_ = _tmp161_;
1346 _tmp163_ = g_strconcat (_tmp162_, "*", NULL);
1347 _tmp164_ = _tmp163_;
1348 _tmp165_ = vala_ccode_parameter_new (_tmp159_, _tmp164_);
1349 _vala_ccode_node_unref0 (cparam);
1350 cparam = _tmp165_;
1351 _g_free0 (_tmp164_);
1352 _g_free0 (_tmp162_);
1353 _g_free0 (_tmp159_);
1354 _tmp166_ = cparam_map;
1355 _tmp167_ = d;
1356 _tmp168_ = cparam;
1357 vala_map_set ((ValaMap*) _tmp166_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) _tmp167_), FALSE)), _tmp168_);
1358 }
1359 _vala_ccode_node_unref0 (cparam);
1360 }
1361 _vala_code_node_unref0 (deleg_type);
1362 } else {
1363 ValaDelegate* _tmp169_;
1364 ValaDataType* _tmp170_;
1365 ValaDataType* _tmp171_;
1366 _tmp169_ = d;
1367 _tmp170_ = vala_callable_get_return_type ((ValaCallable*) _tmp169_);
1368 _tmp171_ = _tmp170_;
1369 if (vala_data_type_is_real_non_null_struct_type (_tmp171_)) {
1370 ValaCCodeParameter* cparam = NULL;
1371 ValaDelegate* _tmp172_;
1372 ValaDataType* _tmp173_;
1373 ValaDataType* _tmp174_;
1374 gchar* _tmp175_;
1375 gchar* _tmp176_;
1376 gchar* _tmp177_;
1377 gchar* _tmp178_;
1378 ValaCCodeParameter* _tmp179_;
1379 ValaCCodeParameter* _tmp180_;
1380 ValaHashMap* _tmp181_;
1381 ValaCCodeParameter* _tmp182_;
1382 _tmp172_ = d;
1383 _tmp173_ = vala_callable_get_return_type ((ValaCallable*) _tmp172_);
1384 _tmp174_ = _tmp173_;
1385 _tmp175_ = vala_get_ccode_name ((ValaCodeNode*) _tmp174_);
1386 _tmp176_ = _tmp175_;
1387 _tmp177_ = g_strdup_printf ("%s*", _tmp176_);
1388 _tmp178_ = _tmp177_;
1389 _tmp179_ = vala_ccode_parameter_new ("result", _tmp178_);
1390 _tmp180_ = _tmp179_;
1391 _g_free0 (_tmp178_);
1392 _g_free0 (_tmp176_);
1393 cparam = _tmp180_;
1394 _tmp181_ = cparam_map;
1395 _tmp182_ = cparam;
1396 vala_map_set ((ValaMap*) _tmp181_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, (gdouble) -3, FALSE)), _tmp182_);
1397 _vala_ccode_node_unref0 (cparam);
1398 }
1399 }
1400 }
1401 _tmp183_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) m);
1402 _tmp184_ = _tmp183_;
1403 if (_tmp184_) {
1404 ValaCCodeParameter* cparam = NULL;
1405 ValaCCodeParameter* _tmp185_;
1406 ValaHashMap* _tmp186_;
1407 ValaDelegate* _tmp187_;
1408 ValaCCodeParameter* _tmp188_;
1409 _tmp185_ = vala_ccode_parameter_new ("error", "GError**");
1410 cparam = _tmp185_;
1411 _tmp186_ = cparam_map;
1412 _tmp187_ = d;
1413 _tmp188_ = cparam;
1414 vala_map_set ((ValaMap*) _tmp186_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_error_pos ((ValaCallable*) _tmp187_), FALSE)), _tmp188_);
1415 _vala_ccode_node_unref0 (cparam);
1416 }
1417 last_pos = -1;
1418 while (TRUE) {
1419 ValaCCodeFunction* _tmp199_;
1420 ValaHashMap* _tmp200_;
1421 gpointer _tmp201_;
1422 ValaCCodeParameter* _tmp202_;
1423 min_pos = -1;
1424 {
1425 ValaIterator* _pos_it = NULL;
1426 ValaHashMap* _tmp189_;
1427 ValaSet* _tmp190_;
1428 ValaSet* _tmp191_;
1429 ValaIterator* _tmp192_;
1430 ValaIterator* _tmp193_;
1431 _tmp189_ = cparam_map;
1432 _tmp190_ = vala_map_get_keys ((ValaMap*) _tmp189_);
1433 _tmp191_ = _tmp190_;
1434 _tmp192_ = vala_iterable_iterator ((ValaIterable*) _tmp191_);
1435 _tmp193_ = _tmp192_;
1436 _vala_iterable_unref0 (_tmp191_);
1437 _pos_it = _tmp193_;
1438 while (TRUE) {
1439 ValaIterator* _tmp194_;
1440 gint pos = 0;
1441 ValaIterator* _tmp195_;
1442 gpointer _tmp196_;
1443 gboolean _tmp197_ = FALSE;
1444 _tmp194_ = _pos_it;
1445 if (!vala_iterator_next (_tmp194_)) {
1446 break;
1447 }
1448 _tmp195_ = _pos_it;
1449 _tmp196_ = vala_iterator_get (_tmp195_);
1450 pos = (gint) ((gintptr) _tmp196_);
1451 if (pos > last_pos) {
1452 gboolean _tmp198_ = FALSE;
1453 if (min_pos == -1) {
1454 _tmp198_ = TRUE;
1455 } else {
1456 _tmp198_ = pos < min_pos;
1457 }
1458 _tmp197_ = _tmp198_;
1459 } else {
1460 _tmp197_ = FALSE;
1461 }
1462 if (_tmp197_) {
1463 min_pos = pos;
1464 }
1465 }
1466 _vala_iterator_unref0 (_pos_it);
1467 }
1468 if (min_pos == -1) {
1469 break;
1470 }
1471 _tmp199_ = function;
1472 _tmp200_ = cparam_map;
1473 _tmp201_ = vala_map_get ((ValaMap*) _tmp200_, (gpointer) ((gintptr) min_pos));
1474 _tmp202_ = (ValaCCodeParameter*) _tmp201_;
1475 vala_ccode_function_add_parameter (_tmp199_, _tmp202_);
1476 _vala_ccode_node_unref0 (_tmp202_);
1477 last_pos = min_pos;
1478 }
1479 _tmp203_ = g_direct_hash;
1480 _tmp204_ = g_direct_equal;
1481 _tmp205_ = g_direct_equal;
1482 _tmp206_ = vala_hash_map_new (G_TYPE_INT, NULL, NULL, VALA_TYPE_CCODE_EXPRESSION, (GBoxedCopyFunc) vala_ccode_node_ref, (GDestroyNotify) vala_ccode_node_unref, _tmp203_, _tmp204_, _tmp205_);
1483 carg_map = _tmp206_;
1484 i = 0;
1485 _tmp208_ = vala_method_get_binding (m);
1486 _tmp209_ = _tmp208_;
1487 if (_tmp209_ == VALA_MEMBER_BINDING_INSTANCE) {
1488 _tmp207_ = TRUE;
1489 } else {
1490 gboolean _tmp210_;
1491 gboolean _tmp211_;
1492 _tmp210_ = vala_method_get_closure (m);
1493 _tmp211_ = _tmp210_;
1494 _tmp207_ = _tmp211_;
1495 }
1496 if (_tmp207_) {
1497 ValaCCodeExpression* arg = NULL;
1498 ValaDelegate* _tmp212_;
1499 gboolean _tmp213_;
1500 gboolean _tmp214_;
1501 ValaHashMap* _tmp243_;
1502 ValaCCodeExpression* _tmp244_;
1503 _tmp212_ = d;
1504 _tmp213_ = vala_delegate_get_has_target (_tmp212_);
1505 _tmp214_ = _tmp213_;
1506 if (_tmp214_) {
1507 ValaCCodeIdentifier* _tmp215_;
1508 gboolean _tmp216_ = FALSE;
1509 gboolean _tmp217_;
1510 gboolean _tmp218_;
1511 _tmp215_ = vala_ccode_identifier_new ("self");
1512 _vala_ccode_node_unref0 (arg);
1513 arg = (ValaCCodeExpression*) _tmp215_;
1514 _tmp217_ = vala_method_get_closure (m);
1515 _tmp218_ = _tmp217_;
1516 if (!_tmp218_) {
1517 ValaParameter* _tmp219_;
1518 ValaParameter* _tmp220_;
1519 _tmp219_ = vala_method_get_this_parameter (m);
1520 _tmp220_ = _tmp219_;
1521 _tmp216_ = _tmp220_ != NULL;
1522 } else {
1523 _tmp216_ = FALSE;
1524 }
1525 if (_tmp216_) {
1526 ValaCCodeExpression* _tmp221_;
1527 ValaParameter* _tmp222_;
1528 ValaParameter* _tmp223_;
1529 ValaDataType* _tmp224_;
1530 ValaDataType* _tmp225_;
1531 ValaCCodeExpression* _tmp226_;
1532 _tmp221_ = arg;
1533 _tmp222_ = vala_method_get_this_parameter (m);
1534 _tmp223_ = _tmp222_;
1535 _tmp224_ = vala_variable_get_variable_type ((ValaVariable*) _tmp223_);
1536 _tmp225_ = _tmp224_;
1537 _tmp226_ = vala_ccode_base_module_convert_from_generic_pointer ((ValaCCodeBaseModule*) self, _tmp221_, _tmp225_);
1538 _vala_ccode_node_unref0 (arg);
1539 arg = _tmp226_;
1540 }
1541 } else {
1542 gboolean _tmp227_ = FALSE;
1543 ValaList* _tmp228_;
1544 gint _tmp229_;
1545 gint _tmp230_;
1546 _tmp228_ = d_params;
1547 _tmp229_ = vala_collection_get_size ((ValaCollection*) _tmp228_);
1548 _tmp230_ = _tmp229_;
1549 if (_tmp230_ == 0) {
1550 _tmp227_ = TRUE;
1551 } else {
1552 gboolean _tmp231_;
1553 gboolean _tmp232_;
1554 _tmp231_ = vala_method_get_closure (m);
1555 _tmp232_ = _tmp231_;
1556 _tmp227_ = _tmp232_;
1557 }
1558 if (_tmp227_) {
1559 ValaSourceReference* _tmp233_ = NULL;
1560 ValaCCodeInvalidExpression* _tmp236_;
1561 if (node != NULL) {
1562 ValaSourceReference* _tmp234_;
1563 ValaSourceReference* _tmp235_;
1564 _tmp234_ = vala_code_node_get_source_reference (node);
1565 _tmp235_ = _tmp234_;
1566 _tmp233_ = _tmp235_;
1567 } else {
1568 _tmp233_ = NULL;
1569 }
1570 vala_report_error (_tmp233_, "internal: Cannot create delegate wrapper");
1571 _tmp236_ = vala_ccode_invalid_expression_new ();
1572 _vala_ccode_node_unref0 (arg);
1573 arg = (ValaCCodeExpression*) _tmp236_;
1574 } else {
1575 ValaList* _tmp237_;
1576 gpointer _tmp238_;
1577 ValaParameter* _tmp239_;
1578 gchar* _tmp240_;
1579 gchar* _tmp241_;
1580 ValaCCodeIdentifier* _tmp242_;
1581 _tmp237_ = d_params;
1582 _tmp238_ = vala_list_get (_tmp237_, 0);
1583 _tmp239_ = (ValaParameter*) _tmp238_;
1584 _tmp240_ = vala_get_ccode_name ((ValaCodeNode*) _tmp239_);
1585 _tmp241_ = _tmp240_;
1586 _tmp242_ = vala_ccode_identifier_new (_tmp241_);
1587 _vala_ccode_node_unref0 (arg);
1588 arg = (ValaCCodeExpression*) _tmp242_;
1589 _g_free0 (_tmp241_);
1590 _vala_code_node_unref0 (_tmp239_);
1591 i = 1;
1592 }
1593 }
1594 _tmp243_ = carg_map;
1595 _tmp244_ = arg;
1596 vala_map_set ((ValaMap*) _tmp243_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_instance_pos ((ValaCodeNode*) m), FALSE)), _tmp244_);
1597 _vala_ccode_node_unref0 (arg);
1598 }
1599 first = TRUE;
1600 {
1601 ValaList* _param_list = NULL;
1602 ValaList* _tmp245_;
1603 ValaList* _tmp246_;
1604 gint _param_size = 0;
1605 ValaList* _tmp247_;
1606 gint _tmp248_;
1607 gint _tmp249_;
1608 gint _param_index = 0;
1609 _tmp245_ = vala_callable_get_parameters ((ValaCallable*) m);
1610 _tmp246_ = _vala_iterable_ref0 (_tmp245_);
1611 _param_list = _tmp246_;
1612 _tmp247_ = _param_list;
1613 _tmp248_ = vala_collection_get_size ((ValaCollection*) _tmp247_);
1614 _tmp249_ = _tmp248_;
1615 _param_size = _tmp249_;
1616 _param_index = -1;
1617 while (TRUE) {
1618 gint _tmp250_;
1619 gint _tmp251_;
1620 ValaParameter* param = NULL;
1621 ValaList* _tmp252_;
1622 gpointer _tmp253_;
1623 gboolean _tmp254_ = FALSE;
1624 gboolean _tmp255_ = FALSE;
1625 ValaCCodeExpression* arg = NULL;
1626 ValaList* _tmp270_;
1627 gpointer _tmp271_;
1628 ValaParameter* _tmp272_;
1629 gchar* _tmp273_;
1630 gchar* _tmp274_;
1631 ValaCCodeIdentifier* _tmp275_;
1632 ValaList* _tmp276_;
1633 gpointer _tmp277_;
1634 ValaParameter* _tmp278_;
1635 ValaDataType* _tmp279_;
1636 ValaDataType* _tmp280_;
1637 gboolean _tmp281_;
1638 ValaHashMap* _tmp287_;
1639 ValaParameter* _tmp288_;
1640 ValaCCodeExpression* _tmp289_;
1641 gboolean _tmp290_ = FALSE;
1642 ValaParameter* _tmp291_;
1643 gint _tmp370_;
1644 _param_index = _param_index + 1;
1645 _tmp250_ = _param_index;
1646 _tmp251_ = _param_size;
1647 if (!(_tmp250_ < _tmp251_)) {
1648 break;
1649 }
1650 _tmp252_ = _param_list;
1651 _tmp253_ = vala_list_get (_tmp252_, _param_index);
1652 param = (ValaParameter*) _tmp253_;
1653 if (first) {
1654 ValaDelegate* _tmp256_;
1655 ValaDataType* _tmp257_;
1656 ValaDataType* _tmp258_;
1657 _tmp256_ = d;
1658 _tmp257_ = vala_delegate_get_sender_type (_tmp256_);
1659 _tmp258_ = _tmp257_;
1660 _tmp255_ = _tmp258_ != NULL;
1661 } else {
1662 _tmp255_ = FALSE;
1663 }
1664 if (_tmp255_) {
1665 ValaList* _tmp259_;
1666 gint _tmp260_;
1667 gint _tmp261_;
1668 ValaDelegate* _tmp262_;
1669 ValaList* _tmp263_;
1670 gint _tmp264_;
1671 gint _tmp265_;
1672 _tmp259_ = vala_callable_get_parameters ((ValaCallable*) m);
1673 _tmp260_ = vala_collection_get_size ((ValaCollection*) _tmp259_);
1674 _tmp261_ = _tmp260_;
1675 _tmp262_ = d;
1676 _tmp263_ = vala_callable_get_parameters ((ValaCallable*) _tmp262_);
1677 _tmp264_ = vala_collection_get_size ((ValaCollection*) _tmp263_);
1678 _tmp265_ = _tmp264_;
1679 _tmp254_ = _tmp261_ == (_tmp265_ + 1);
1680 } else {
1681 _tmp254_ = FALSE;
1682 }
1683 if (_tmp254_) {
1684 ValaHashMap* _tmp266_;
1685 ValaParameter* _tmp267_;
1686 ValaCCodeIdentifier* _tmp268_;
1687 ValaCCodeIdentifier* _tmp269_;
1688 _tmp266_ = carg_map;
1689 _tmp267_ = param;
1690 _tmp268_ = vala_ccode_identifier_new ("_sender");
1691 _tmp269_ = _tmp268_;
1692 vala_map_set ((ValaMap*) _tmp266_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_pos (_tmp267_), FALSE)), (ValaCCodeExpression*) _tmp269_);
1693 _vala_ccode_node_unref0 (_tmp269_);
1694 first = FALSE;
1695 _vala_code_node_unref0 (param);
1696 continue;
1697 }
1698 _tmp270_ = d_params;
1699 _tmp271_ = vala_list_get (_tmp270_, i);
1700 _tmp272_ = (ValaParameter*) _tmp271_;
1701 _tmp273_ = vala_get_ccode_name ((ValaCodeNode*) _tmp272_);
1702 _tmp274_ = _tmp273_;
1703 _tmp275_ = vala_ccode_identifier_new (_tmp274_);
1704 _vala_ccode_node_unref0 (arg);
1705 arg = (ValaCCodeExpression*) _tmp275_;
1706 _g_free0 (_tmp274_);
1707 _vala_code_node_unref0 (_tmp272_);
1708 _tmp276_ = d_params;
1709 _tmp277_ = vala_list_get (_tmp276_, i);
1710 _tmp278_ = (ValaParameter*) _tmp277_;
1711 _tmp279_ = vala_variable_get_variable_type ((ValaVariable*) _tmp278_);
1712 _tmp280_ = _tmp279_;
1713 _tmp281_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp280_, VALA_TYPE_GENERIC_TYPE);
1714 _vala_code_node_unref0 (_tmp278_);
1715 if (_tmp281_) {
1716 ValaCCodeExpression* _tmp282_;
1717 ValaParameter* _tmp283_;
1718 ValaDataType* _tmp284_;
1719 ValaDataType* _tmp285_;
1720 ValaCCodeExpression* _tmp286_;
1721 _tmp282_ = arg;
1722 _tmp283_ = param;
1723 _tmp284_ = vala_variable_get_variable_type ((ValaVariable*) _tmp283_);
1724 _tmp285_ = _tmp284_;
1725 _tmp286_ = vala_ccode_base_module_convert_from_generic_pointer ((ValaCCodeBaseModule*) self, _tmp282_, _tmp285_);
1726 _vala_ccode_node_unref0 (arg);
1727 arg = _tmp286_;
1728 }
1729 _tmp287_ = carg_map;
1730 _tmp288_ = param;
1731 _tmp289_ = arg;
1732 vala_map_set ((ValaMap*) _tmp287_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_pos (_tmp288_), FALSE)), _tmp289_);
1733 _tmp291_ = param;
1734 if (vala_get_ccode_array_length ((ValaCodeNode*) _tmp291_)) {
1735 ValaParameter* _tmp292_;
1736 ValaDataType* _tmp293_;
1737 ValaDataType* _tmp294_;
1738 _tmp292_ = param;
1739 _tmp293_ = vala_variable_get_variable_type ((ValaVariable*) _tmp292_);
1740 _tmp294_ = _tmp293_;
1741 _tmp290_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp294_, VALA_TYPE_ARRAY_TYPE);
1742 } else {
1743 _tmp290_ = FALSE;
1744 }
1745 if (_tmp290_) {
1746 ValaArrayType* array_type = NULL;
1747 ValaParameter* _tmp295_;
1748 ValaDataType* _tmp296_;
1749 ValaDataType* _tmp297_;
1750 ValaArrayType* _tmp298_;
1751 _tmp295_ = param;
1752 _tmp296_ = vala_variable_get_variable_type ((ValaVariable*) _tmp295_);
1753 _tmp297_ = _tmp296_;
1754 _tmp298_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp297_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
1755 array_type = _tmp298_;
1756 {
1757 gint dim = 0;
1758 dim = 1;
1759 {
1760 gboolean _tmp299_ = FALSE;
1761 _tmp299_ = TRUE;
1762 while (TRUE) {
1763 ValaArrayType* _tmp301_;
1764 gint _tmp302_;
1765 gint _tmp303_;
1766 ValaCCodeExpression* clength = NULL;
1767 ValaList* _tmp304_;
1768 gpointer _tmp305_;
1769 ValaParameter* _tmp306_;
1770 gboolean _tmp307_;
1771 ValaHashMap* _tmp333_;
1772 ValaParameter* _tmp334_;
1773 ValaCCodeExpression* _tmp335_;
1774 if (!_tmp299_) {
1775 gint _tmp300_;
1776 _tmp300_ = dim;
1777 dim = _tmp300_ + 1;
1778 }
1779 _tmp299_ = FALSE;
1780 _tmp301_ = array_type;
1781 _tmp302_ = vala_array_type_get_rank (_tmp301_);
1782 _tmp303_ = _tmp302_;
1783 if (!(dim <= _tmp303_)) {
1784 break;
1785 }
1786 _tmp304_ = d_params;
1787 _tmp305_ = vala_list_get (_tmp304_, i);
1788 _tmp306_ = (ValaParameter*) _tmp305_;
1789 _tmp307_ = vala_get_ccode_array_null_terminated ((ValaCodeNode*) _tmp306_);
1790 _vala_code_node_unref0 (_tmp306_);
1791 if (_tmp307_) {
1792 ValaCCodeFunctionCall* len_call = NULL;
1793 ValaCCodeIdentifier* _tmp308_;
1794 ValaCCodeIdentifier* _tmp309_;
1795 ValaCCodeFunctionCall* _tmp310_;
1796 ValaCCodeFunctionCall* _tmp311_;
1797 ValaCCodeFunctionCall* _tmp312_;
1798 ValaList* _tmp313_;
1799 gpointer _tmp314_;
1800 ValaParameter* _tmp315_;
1801 const gchar* _tmp316_;
1802 const gchar* _tmp317_;
1803 ValaCCodeIdentifier* _tmp318_;
1804 ValaCCodeIdentifier* _tmp319_;
1805 ValaCCodeFunctionCall* _tmp320_;
1806 ValaCCodeExpression* _tmp321_;
1807 ((ValaCCodeBaseModule*) self)->requires_array_length = TRUE;
1808 _tmp308_ = vala_ccode_identifier_new ("_vala_array_length");
1809 _tmp309_ = _tmp308_;
1810 _tmp310_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp309_);
1811 _tmp311_ = _tmp310_;
1812 _vala_ccode_node_unref0 (_tmp309_);
1813 len_call = _tmp311_;
1814 _tmp312_ = len_call;
1815 _tmp313_ = d_params;
1816 _tmp314_ = vala_list_get (_tmp313_, i);
1817 _tmp315_ = (ValaParameter*) _tmp314_;
1818 _tmp316_ = vala_symbol_get_name ((ValaSymbol*) _tmp315_);
1819 _tmp317_ = _tmp316_;
1820 _tmp318_ = vala_ccode_identifier_new (_tmp317_);
1821 _tmp319_ = _tmp318_;
1822 vala_ccode_function_call_add_argument (_tmp312_, (ValaCCodeExpression*) _tmp319_);
1823 _vala_ccode_node_unref0 (_tmp319_);
1824 _vala_code_node_unref0 (_tmp315_);
1825 _tmp320_ = len_call;
1826 _tmp321_ = _vala_ccode_node_ref0 ((ValaCCodeExpression*) _tmp320_);
1827 _vala_ccode_node_unref0 (clength);
1828 clength = _tmp321_;
1829 _vala_ccode_node_unref0 (len_call);
1830 } else {
1831 ValaList* _tmp322_;
1832 gpointer _tmp323_;
1833 ValaParameter* _tmp324_;
1834 gboolean _tmp325_;
1835 _tmp322_ = d_params;
1836 _tmp323_ = vala_list_get (_tmp322_, i);
1837 _tmp324_ = (ValaParameter*) _tmp323_;
1838 _tmp325_ = !vala_get_ccode_array_length ((ValaCodeNode*) _tmp324_);
1839 _vala_code_node_unref0 (_tmp324_);
1840 if (_tmp325_) {
1841 ValaCCodeConstant* _tmp326_;
1842 _tmp326_ = vala_ccode_constant_new ("-1");
1843 _vala_ccode_node_unref0 (clength);
1844 clength = (ValaCCodeExpression*) _tmp326_;
1845 } else {
1846 ValaList* _tmp327_;
1847 gpointer _tmp328_;
1848 ValaParameter* _tmp329_;
1849 gchar* _tmp330_;
1850 gchar* _tmp331_;
1851 ValaCCodeIdentifier* _tmp332_;
1852 _tmp327_ = d_params;
1853 _tmp328_ = vala_list_get (_tmp327_, i);
1854 _tmp329_ = (ValaParameter*) _tmp328_;
1855 _tmp330_ = vala_ccode_base_module_get_variable_array_length_cname ((ValaCCodeBaseModule*) self, (ValaVariable*) _tmp329_, dim);
1856 _tmp331_ = _tmp330_;
1857 _tmp332_ = vala_ccode_identifier_new (_tmp331_);
1858 _vala_ccode_node_unref0 (clength);
1859 clength = (ValaCCodeExpression*) _tmp332_;
1860 _g_free0 (_tmp331_);
1861 _vala_code_node_unref0 (_tmp329_);
1862 }
1863 }
1864 _tmp333_ = carg_map;
1865 _tmp334_ = param;
1866 _tmp335_ = clength;
1867 vala_map_set ((ValaMap*) _tmp333_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_array_length_pos ((ValaCodeNode*) _tmp334_) + (0.01 * dim), FALSE)), _tmp335_);
1868 _vala_ccode_node_unref0 (clength);
1869 }
1870 }
1871 }
1872 _vala_code_node_unref0 (array_type);
1873 } else {
1874 gboolean _tmp336_ = FALSE;
1875 ValaParameter* _tmp337_;
1876 _tmp337_ = param;
1877 if (vala_get_ccode_delegate_target ((ValaCodeNode*) _tmp337_)) {
1878 ValaParameter* _tmp338_;
1879 ValaDataType* _tmp339_;
1880 ValaDataType* _tmp340_;
1881 _tmp338_ = param;
1882 _tmp339_ = vala_variable_get_variable_type ((ValaVariable*) _tmp338_);
1883 _tmp340_ = _tmp339_;
1884 _tmp336_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp340_, VALA_TYPE_DELEGATE_TYPE);
1885 } else {
1886 _tmp336_ = FALSE;
1887 }
1888 if (_tmp336_) {
1889 ValaDelegateType* deleg_type = NULL;
1890 ValaParameter* _tmp341_;
1891 ValaDataType* _tmp342_;
1892 ValaDataType* _tmp343_;
1893 ValaDelegateType* _tmp344_;
1894 ValaDelegateType* _tmp345_;
1895 ValaDelegate* _tmp346_;
1896 ValaDelegate* _tmp347_;
1897 gboolean _tmp348_;
1898 gboolean _tmp349_;
1899 _tmp341_ = param;
1900 _tmp342_ = vala_variable_get_variable_type ((ValaVariable*) _tmp341_);
1901 _tmp343_ = _tmp342_;
1902 _tmp344_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp343_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
1903 deleg_type = _tmp344_;
1904 _tmp345_ = deleg_type;
1905 _tmp346_ = vala_delegate_type_get_delegate_symbol (_tmp345_);
1906 _tmp347_ = _tmp346_;
1907 _tmp348_ = vala_delegate_get_has_target (_tmp347_);
1908 _tmp349_ = _tmp348_;
1909 if (_tmp349_) {
1910 ValaCCodeIdentifier* ctarget = NULL;
1911 ValaList* _tmp350_;
1912 gpointer _tmp351_;
1913 ValaParameter* _tmp352_;
1914 gchar* _tmp353_;
1915 gchar* _tmp354_;
1916 ValaCCodeIdentifier* _tmp355_;
1917 ValaCCodeIdentifier* _tmp356_;
1918 ValaHashMap* _tmp357_;
1919 ValaParameter* _tmp358_;
1920 ValaCCodeIdentifier* _tmp359_;
1921 ValaDelegateType* _tmp360_;
1922 _tmp350_ = d_params;
1923 _tmp351_ = vala_list_get (_tmp350_, i);
1924 _tmp352_ = (ValaParameter*) _tmp351_;
1925 _tmp353_ = vala_get_ccode_delegate_target_name ((ValaVariable*) _tmp352_);
1926 _tmp354_ = _tmp353_;
1927 _tmp355_ = vala_ccode_identifier_new (_tmp354_);
1928 _tmp356_ = _tmp355_;
1929 _g_free0 (_tmp354_);
1930 _vala_code_node_unref0 (_tmp352_);
1931 ctarget = _tmp356_;
1932 _tmp357_ = carg_map;
1933 _tmp358_ = param;
1934 _tmp359_ = ctarget;
1935 vala_map_set ((ValaMap*) _tmp357_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) _tmp358_), FALSE)), (ValaCCodeExpression*) _tmp359_);
1936 _tmp360_ = deleg_type;
1937 if (vala_data_type_is_disposable ((ValaDataType*) _tmp360_)) {
1938 ValaCCodeIdentifier* ctarget_destroy_notify = NULL;
1939 ValaList* _tmp361_;
1940 gpointer _tmp362_;
1941 ValaParameter* _tmp363_;
1942 gchar* _tmp364_;
1943 gchar* _tmp365_;
1944 ValaCCodeIdentifier* _tmp366_;
1945 ValaCCodeIdentifier* _tmp367_;
1946 ValaHashMap* _tmp368_;
1947 ValaCCodeIdentifier* _tmp369_;
1948 _tmp361_ = d_params;
1949 _tmp362_ = vala_list_get (_tmp361_, i);
1950 _tmp363_ = (ValaParameter*) _tmp362_;
1951 _tmp364_ = vala_get_ccode_delegate_target_destroy_notify_name ((ValaVariable*) _tmp363_);
1952 _tmp365_ = _tmp364_;
1953 _tmp366_ = vala_ccode_identifier_new (_tmp365_);
1954 _tmp367_ = _tmp366_;
1955 _g_free0 (_tmp365_);
1956 _vala_code_node_unref0 (_tmp363_);
1957 ctarget_destroy_notify = _tmp367_;
1958 _tmp368_ = carg_map;
1959 _tmp369_ = ctarget_destroy_notify;
1960 vala_map_set ((ValaMap*) _tmp368_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) m), FALSE)), (ValaCCodeExpression*) _tmp369_);
1961 _vala_ccode_node_unref0 (ctarget_destroy_notify);
1962 }
1963 _vala_ccode_node_unref0 (ctarget);
1964 }
1965 _vala_code_node_unref0 (deleg_type);
1966 }
1967 }
1968 _tmp370_ = i;
1969 i = _tmp370_ + 1;
1970 _vala_ccode_node_unref0 (arg);
1971 _vala_code_node_unref0 (param);
1972 }
1973 _vala_iterable_unref0 (_param_list);
1974 }
1975 if (vala_get_ccode_array_length ((ValaCodeNode*) m)) {
1976 ValaDataType* _tmp372_;
1977 ValaDataType* _tmp373_;
1978 _tmp372_ = vala_callable_get_return_type ((ValaCallable*) m);
1979 _tmp373_ = _tmp372_;
1980 _tmp371_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp373_, VALA_TYPE_ARRAY_TYPE);
1981 } else {
1982 _tmp371_ = FALSE;
1983 }
1984 if (_tmp371_) {
1985 ValaArrayType* array_type = NULL;
1986 ValaDataType* _tmp374_;
1987 ValaDataType* _tmp375_;
1988 ValaArrayType* _tmp376_;
1989 _tmp374_ = vala_callable_get_return_type ((ValaCallable*) m);
1990 _tmp375_ = _tmp374_;
1991 _tmp376_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp375_, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
1992 array_type = _tmp376_;
1993 {
1994 gint dim = 0;
1995 dim = 1;
1996 {
1997 gboolean _tmp377_ = FALSE;
1998 _tmp377_ = TRUE;
1999 while (TRUE) {
2000 ValaArrayType* _tmp379_;
2001 gint _tmp380_;
2002 gint _tmp381_;
2003 ValaCCodeExpression* clength = NULL;
2004 ValaDelegate* _tmp382_;
2005 ValaHashMap* _tmp387_;
2006 ValaCCodeExpression* _tmp388_;
2007 if (!_tmp377_) {
2008 gint _tmp378_;
2009 _tmp378_ = dim;
2010 dim = _tmp378_ + 1;
2011 }
2012 _tmp377_ = FALSE;
2013 _tmp379_ = array_type;
2014 _tmp380_ = vala_array_type_get_rank (_tmp379_);
2015 _tmp381_ = _tmp380_;
2016 if (!(dim <= _tmp381_)) {
2017 break;
2018 }
2019 _tmp382_ = d;
2020 if (!vala_get_ccode_array_length ((ValaCodeNode*) _tmp382_)) {
2021 ValaCCodeConstant* _tmp383_;
2022 _tmp383_ = vala_ccode_constant_new ("NULL");
2023 _vala_ccode_node_unref0 (clength);
2024 clength = (ValaCCodeExpression*) _tmp383_;
2025 } else {
2026 gchar* _tmp384_;
2027 gchar* _tmp385_;
2028 ValaCCodeIdentifier* _tmp386_;
2029 _tmp384_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, "result", dim);
2030 _tmp385_ = _tmp384_;
2031 _tmp386_ = vala_ccode_identifier_new (_tmp385_);
2032 _vala_ccode_node_unref0 (clength);
2033 clength = (ValaCCodeExpression*) _tmp386_;
2034 _g_free0 (_tmp385_);
2035 }
2036 _tmp387_ = carg_map;
2037 _tmp388_ = clength;
2038 vala_map_set ((ValaMap*) _tmp387_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_array_length_pos ((ValaCodeNode*) m) + (0.01 * dim), FALSE)), _tmp388_);
2039 _vala_ccode_node_unref0 (clength);
2040 }
2041 }
2042 }
2043 _vala_code_node_unref0 (array_type);
2044 } else {
2045 gboolean _tmp389_ = FALSE;
2046 if (vala_get_ccode_delegate_target ((ValaCodeNode*) m)) {
2047 ValaDataType* _tmp390_;
2048 ValaDataType* _tmp391_;
2049 _tmp390_ = vala_callable_get_return_type ((ValaCallable*) m);
2050 _tmp391_ = _tmp390_;
2051 _tmp389_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp391_, VALA_TYPE_DELEGATE_TYPE);
2052 } else {
2053 _tmp389_ = FALSE;
2054 }
2055 if (_tmp389_) {
2056 ValaDelegateType* deleg_type = NULL;
2057 ValaDataType* _tmp392_;
2058 ValaDataType* _tmp393_;
2059 ValaDelegateType* _tmp394_;
2060 ValaDelegateType* _tmp395_;
2061 ValaDelegate* _tmp396_;
2062 ValaDelegate* _tmp397_;
2063 gboolean _tmp398_;
2064 gboolean _tmp399_;
2065 _tmp392_ = vala_callable_get_return_type ((ValaCallable*) m);
2066 _tmp393_ = _tmp392_;
2067 _tmp394_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp393_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
2068 deleg_type = _tmp394_;
2069 _tmp395_ = deleg_type;
2070 _tmp396_ = vala_delegate_type_get_delegate_symbol (_tmp395_);
2071 _tmp397_ = _tmp396_;
2072 _tmp398_ = vala_delegate_get_has_target (_tmp397_);
2073 _tmp399_ = _tmp398_;
2074 if (_tmp399_) {
2075 ValaCCodeIdentifier* ctarget = NULL;
2076 gchar* _tmp400_;
2077 gchar* _tmp401_;
2078 ValaCCodeIdentifier* _tmp402_;
2079 ValaCCodeIdentifier* _tmp403_;
2080 ValaHashMap* _tmp404_;
2081 ValaCCodeIdentifier* _tmp405_;
2082 ValaDelegateType* _tmp406_;
2083 _tmp400_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "result");
2084 _tmp401_ = _tmp400_;
2085 _tmp402_ = vala_ccode_identifier_new (_tmp401_);
2086 _tmp403_ = _tmp402_;
2087 _g_free0 (_tmp401_);
2088 ctarget = _tmp403_;
2089 _tmp404_ = carg_map;
2090 _tmp405_ = ctarget;
2091 vala_map_set ((ValaMap*) _tmp404_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) m), FALSE)), (ValaCCodeExpression*) _tmp405_);
2092 _tmp406_ = deleg_type;
2093 if (vala_data_type_is_disposable ((ValaDataType*) _tmp406_)) {
2094 ValaCCodeIdentifier* ctarget_destroy_notify = NULL;
2095 gchar* _tmp407_;
2096 gchar* _tmp408_;
2097 ValaCCodeIdentifier* _tmp409_;
2098 ValaCCodeIdentifier* _tmp410_;
2099 ValaHashMap* _tmp411_;
2100 ValaCCodeIdentifier* _tmp412_;
2101 _tmp407_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, "result");
2102 _tmp408_ = _tmp407_;
2103 _tmp409_ = vala_ccode_identifier_new (_tmp408_);
2104 _tmp410_ = _tmp409_;
2105 _g_free0 (_tmp408_);
2106 ctarget_destroy_notify = _tmp410_;
2107 _tmp411_ = carg_map;
2108 _tmp412_ = ctarget_destroy_notify;
2109 vala_map_set ((ValaMap*) _tmp411_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) m), FALSE)), (ValaCCodeExpression*) _tmp412_);
2110 _vala_ccode_node_unref0 (ctarget_destroy_notify);
2111 }
2112 _vala_ccode_node_unref0 (ctarget);
2113 }
2114 _vala_code_node_unref0 (deleg_type);
2115 } else {
2116 ValaDataType* _tmp413_;
2117 ValaDataType* _tmp414_;
2118 _tmp413_ = vala_callable_get_return_type ((ValaCallable*) m);
2119 _tmp414_ = _tmp413_;
2120 if (vala_data_type_is_real_non_null_struct_type (_tmp414_)) {
2121 ValaHashMap* _tmp415_;
2122 ValaCCodeIdentifier* _tmp416_;
2123 ValaCCodeIdentifier* _tmp417_;
2124 _tmp415_ = carg_map;
2125 _tmp416_ = vala_ccode_identifier_new ("result");
2126 _tmp417_ = _tmp416_;
2127 vala_map_set ((ValaMap*) _tmp415_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, (gdouble) -3, FALSE)), (ValaCCodeExpression*) _tmp417_);
2128 _vala_ccode_node_unref0 (_tmp417_);
2129 }
2130 }
2131 }
2132 _tmp418_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) m);
2133 _tmp419_ = _tmp418_;
2134 if (_tmp419_) {
2135 ValaHashMap* _tmp420_;
2136 ValaCCodeIdentifier* _tmp421_;
2137 ValaCCodeIdentifier* _tmp422_;
2138 _tmp420_ = carg_map;
2139 _tmp421_ = vala_ccode_identifier_new ("error");
2140 _tmp422_ = _tmp421_;
2141 vala_map_set ((ValaMap*) _tmp420_, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_error_pos ((ValaCallable*) m), FALSE)), (ValaCCodeExpression*) _tmp422_);
2142 _vala_ccode_node_unref0 (_tmp422_);
2143 }
2144 _tmp423_ = vala_get_ccode_name ((ValaCodeNode*) m);
2145 _tmp424_ = _tmp423_;
2146 _tmp425_ = vala_ccode_identifier_new (_tmp424_);
2147 _tmp426_ = _tmp425_;
2148 _tmp427_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp426_);
2149 _tmp428_ = _tmp427_;
2150 _vala_ccode_node_unref0 (_tmp426_);
2151 _g_free0 (_tmp424_);
2152 ccall = _tmp428_;
2153 last_pos = -1;
2154 while (TRUE) {
2155 ValaCCodeFunctionCall* _tmp439_;
2156 ValaHashMap* _tmp440_;
2157 gpointer _tmp441_;
2158 ValaCCodeExpression* _tmp442_;
2159 min_pos = -1;
2160 {
2161 ValaIterator* _pos_it = NULL;
2162 ValaHashMap* _tmp429_;
2163 ValaSet* _tmp430_;
2164 ValaSet* _tmp431_;
2165 ValaIterator* _tmp432_;
2166 ValaIterator* _tmp433_;
2167 _tmp429_ = carg_map;
2168 _tmp430_ = vala_map_get_keys ((ValaMap*) _tmp429_);
2169 _tmp431_ = _tmp430_;
2170 _tmp432_ = vala_iterable_iterator ((ValaIterable*) _tmp431_);
2171 _tmp433_ = _tmp432_;
2172 _vala_iterable_unref0 (_tmp431_);
2173 _pos_it = _tmp433_;
2174 while (TRUE) {
2175 ValaIterator* _tmp434_;
2176 gint pos = 0;
2177 ValaIterator* _tmp435_;
2178 gpointer _tmp436_;
2179 gboolean _tmp437_ = FALSE;
2180 _tmp434_ = _pos_it;
2181 if (!vala_iterator_next (_tmp434_)) {
2182 break;
2183 }
2184 _tmp435_ = _pos_it;
2185 _tmp436_ = vala_iterator_get (_tmp435_);
2186 pos = (gint) ((gintptr) _tmp436_);
2187 if (pos > last_pos) {
2188 gboolean _tmp438_ = FALSE;
2189 if (min_pos == -1) {
2190 _tmp438_ = TRUE;
2191 } else {
2192 _tmp438_ = pos < min_pos;
2193 }
2194 _tmp437_ = _tmp438_;
2195 } else {
2196 _tmp437_ = FALSE;
2197 }
2198 if (_tmp437_) {
2199 min_pos = pos;
2200 }
2201 }
2202 _vala_iterator_unref0 (_pos_it);
2203 }
2204 if (min_pos == -1) {
2205 break;
2206 }
2207 _tmp439_ = ccall;
2208 _tmp440_ = carg_map;
2209 _tmp441_ = vala_map_get ((ValaMap*) _tmp440_, (gpointer) ((gintptr) min_pos));
2210 _tmp442_ = (ValaCCodeExpression*) _tmp441_;
2211 vala_ccode_function_call_add_argument (_tmp439_, _tmp442_);
2212 _vala_ccode_node_unref0 (_tmp442_);
2213 last_pos = min_pos;
2214 }
2215 _tmp443_ = vala_method_get_coroutine (m);
2216 _tmp444_ = _tmp443_;
2217 if (_tmp444_) {
2218 ValaCCodeFunctionCall* _tmp445_;
2219 ValaCCodeConstant* _tmp446_;
2220 ValaCCodeConstant* _tmp447_;
2221 ValaCCodeFunctionCall* _tmp448_;
2222 ValaCCodeConstant* _tmp449_;
2223 ValaCCodeConstant* _tmp450_;
2224 _tmp445_ = ccall;
2225 _tmp446_ = vala_ccode_constant_new ("NULL");
2226 _tmp447_ = _tmp446_;
2227 vala_ccode_function_call_add_argument (_tmp445_, (ValaCCodeExpression*) _tmp447_);
2228 _vala_ccode_node_unref0 (_tmp447_);
2229 _tmp448_ = ccall;
2230 _tmp449_ = vala_ccode_constant_new ("NULL");
2231 _tmp450_ = _tmp449_;
2232 vala_ccode_function_call_add_argument (_tmp448_, (ValaCCodeExpression*) _tmp450_);
2233 _vala_ccode_node_unref0 (_tmp450_);
2234 }
2235 _tmp452_ = vala_callable_get_return_type ((ValaCallable*) m);
2236 _tmp453_ = _tmp452_;
2237 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp453_, VALA_TYPE_VOID_TYPE)) {
2238 _tmp451_ = TRUE;
2239 } else {
2240 ValaDataType* _tmp454_;
2241 ValaDataType* _tmp455_;
2242 _tmp454_ = vala_callable_get_return_type ((ValaCallable*) m);
2243 _tmp455_ = _tmp454_;
2244 _tmp451_ = vala_data_type_is_real_non_null_struct_type (_tmp455_);
2245 }
2246 if (_tmp451_) {
2247 ValaCCodeFunction* _tmp456_;
2248 ValaCCodeFunction* _tmp457_;
2249 ValaCCodeFunctionCall* _tmp458_;
2250 gboolean _tmp459_ = FALSE;
2251 ValaDelegate* _tmp460_;
2252 ValaDataType* _tmp461_;
2253 ValaDataType* _tmp462_;
2254 _tmp456_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
2255 _tmp457_ = _tmp456_;
2256 _tmp458_ = ccall;
2257 vala_ccode_function_add_expression (_tmp457_, (ValaCCodeExpression*) _tmp458_);
2258 _tmp460_ = d;
2259 _tmp461_ = vala_callable_get_return_type ((ValaCallable*) _tmp460_);
2260 _tmp462_ = _tmp461_;
2261 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp462_, VALA_TYPE_VOID_TYPE)) {
2262 _tmp459_ = TRUE;
2263 } else {
2264 ValaDelegate* _tmp463_;
2265 ValaDataType* _tmp464_;
2266 ValaDataType* _tmp465_;
2267 _tmp463_ = d;
2268 _tmp464_ = vala_callable_get_return_type ((ValaCallable*) _tmp463_);
2269 _tmp465_ = _tmp464_;
2270 _tmp459_ = vala_data_type_is_real_non_null_struct_type (_tmp465_);
2271 }
2272 if (!_tmp459_) {
2273 ValaCCodeFunction* _tmp466_;
2274 ValaCCodeFunction* _tmp467_;
2275 ValaDataType* _tmp468_;
2276 gchar* _tmp469_;
2277 gchar* _tmp470_;
2278 ValaDelegate* _tmp471_;
2279 ValaDataType* _tmp472_;
2280 ValaDataType* _tmp473_;
2281 ValaCCodeExpression* _tmp474_;
2282 ValaCCodeExpression* _tmp475_;
2283 ValaCCodeVariableDeclarator* _tmp476_;
2284 ValaCCodeVariableDeclarator* _tmp477_;
2285 _tmp466_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
2286 _tmp467_ = _tmp466_;
2287 _tmp468_ = creturn_type;
2288 _tmp469_ = vala_get_ccode_name ((ValaCodeNode*) _tmp468_);
2289 _tmp470_ = _tmp469_;
2290 _tmp471_ = d;
2291 _tmp472_ = vala_callable_get_return_type ((ValaCallable*) _tmp471_);
2292 _tmp473_ = _tmp472_;
2293 _tmp474_ = vala_ccode_base_module_default_value_for_type ((ValaCCodeBaseModule*) self, _tmp473_, TRUE, FALSE);
2294 _tmp475_ = _tmp474_;
2295 _tmp476_ = vala_ccode_variable_declarator_new ("result", _tmp475_, NULL);
2296 _tmp477_ = _tmp476_;
2297 vala_ccode_function_add_declaration (_tmp467_, _tmp470_, (ValaCCodeDeclarator*) _tmp477_, 0);
2298 _vala_ccode_node_unref0 (_tmp477_);
2299 _vala_ccode_node_unref0 (_tmp475_);
2300 _g_free0 (_tmp470_);
2301 }
2302 } else {
2303 ValaCCodeExpression* _result_ = NULL;
2304 ValaCCodeFunctionCall* _tmp478_;
2305 ValaCCodeExpression* _tmp479_;
2306 ValaDelegate* _tmp480_;
2307 ValaDataType* _tmp481_;
2308 ValaDataType* _tmp482_;
2309 ValaCCodeFunction* _tmp487_;
2310 ValaCCodeFunction* _tmp488_;
2311 ValaDataType* _tmp489_;
2312 gchar* _tmp490_;
2313 gchar* _tmp491_;
2314 ValaCCodeExpression* _tmp492_;
2315 ValaCCodeVariableDeclarator* _tmp493_;
2316 ValaCCodeVariableDeclarator* _tmp494_;
2317 _tmp478_ = ccall;
2318 _tmp479_ = _vala_ccode_node_ref0 ((ValaCCodeExpression*) _tmp478_);
2319 _result_ = _tmp479_;
2320 _tmp480_ = d;
2321 _tmp481_ = vala_callable_get_return_type ((ValaCallable*) _tmp480_);
2322 _tmp482_ = _tmp481_;
2323 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp482_, VALA_TYPE_GENERIC_TYPE)) {
2324 ValaCCodeExpression* _tmp483_;
2325 ValaDataType* _tmp484_;
2326 ValaDataType* _tmp485_;
2327 ValaCCodeExpression* _tmp486_;
2328 _tmp483_ = _result_;
2329 _tmp484_ = vala_callable_get_return_type ((ValaCallable*) m);
2330 _tmp485_ = _tmp484_;
2331 _tmp486_ = vala_ccode_base_module_convert_to_generic_pointer ((ValaCCodeBaseModule*) self, _tmp483_, _tmp485_);
2332 _vala_ccode_node_unref0 (_result_);
2333 _result_ = _tmp486_;
2334 }
2335 _tmp487_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
2336 _tmp488_ = _tmp487_;
2337 _tmp489_ = creturn_type;
2338 _tmp490_ = vala_get_ccode_name ((ValaCodeNode*) _tmp489_);
2339 _tmp491_ = _tmp490_;
2340 _tmp492_ = _result_;
2341 _tmp493_ = vala_ccode_variable_declarator_new ("result", _tmp492_, NULL);
2342 _tmp494_ = _tmp493_;
2343 vala_ccode_function_add_declaration (_tmp488_, _tmp491_, (ValaCCodeDeclarator*) _tmp494_, 0);
2344 _vala_ccode_node_unref0 (_tmp494_);
2345 _g_free0 (_tmp491_);
2346 _vala_ccode_node_unref0 (_result_);
2347 }
2348 _tmp496_ = d;
2349 _tmp497_ = vala_delegate_get_has_target (_tmp496_);
2350 _tmp498_ = _tmp497_;
2351 if (_tmp498_) {
2352 gboolean _tmp499_;
2353 gboolean _tmp500_;
2354 _tmp499_ = vala_delegate_type_get_is_called_once (dt);
2355 _tmp500_ = _tmp499_;
2356 _tmp495_ = _tmp500_;
2357 } else {
2358 _tmp495_ = FALSE;
2359 }
2360 if (_tmp495_) {
2361 ValaCCodeExpression* destroy_notify = NULL;
2362 gboolean _tmp501_;
2363 gboolean _tmp502_;
2364 ValaCCodeExpression* _tmp527_;
2365 destroy_notify = NULL;
2366 _tmp501_ = vala_method_get_closure (m);
2367 _tmp502_ = _tmp501_;
2368 if (_tmp502_) {
2369 gint block_id = 0;
2370 ValaBlock* _tmp503_;
2371 ValaBlock* _tmp504_;
2372 gchar* _tmp505_;
2373 gchar* _tmp506_;
2374 ValaCCodeIdentifier* _tmp507_;
2375 _tmp503_ = vala_ccode_base_module_get_current_closure_block ((ValaCCodeBaseModule*) self);
2376 _tmp504_ = _tmp503_;
2377 block_id = vala_ccode_base_module_get_block_id ((ValaCCodeBaseModule*) self, _tmp504_);
2378 _tmp505_ = g_strdup_printf ("block%d_data_unref", block_id);
2379 _tmp506_ = _tmp505_;
2380 _tmp507_ = vala_ccode_identifier_new (_tmp506_);
2381 _vala_ccode_node_unref0 (destroy_notify);
2382 destroy_notify = (ValaCCodeExpression*) _tmp507_;
2383 _g_free0 (_tmp506_);
2384 } else {
2385 gboolean _tmp508_ = FALSE;
2386 gboolean _tmp509_ = FALSE;
2387 gboolean _tmp510_ = FALSE;
2388 ValaDataType* _tmp511_;
2389 _tmp511_ = vala_ccode_base_module_get_this_type ((ValaCCodeBaseModule*) self);
2390 if (_tmp511_ != NULL) {
2391 ValaMemberBinding _tmp512_;
2392 ValaMemberBinding _tmp513_;
2393 _tmp512_ = vala_method_get_binding (m);
2394 _tmp513_ = _tmp512_;
2395 _tmp510_ = _tmp513_ != VALA_MEMBER_BINDING_STATIC;
2396 } else {
2397 _tmp510_ = FALSE;
2398 }
2399 if (_tmp510_) {
2400 gboolean _tmp514_;
2401 gboolean _tmp515_;
2402 _tmp514_ = vala_method_get_is_async_callback (m);
2403 _tmp515_ = _tmp514_;
2404 _tmp509_ = !_tmp515_;
2405 } else {
2406 _tmp509_ = FALSE;
2407 }
2408 if (_tmp509_) {
2409 ValaParameter* _tmp516_;
2410 ValaParameter* _tmp517_;
2411 ValaDataType* _tmp518_;
2412 ValaDataType* _tmp519_;
2413 ValaTypeSymbol* _tmp520_;
2414 ValaTypeSymbol* _tmp521_;
2415 _tmp516_ = vala_method_get_this_parameter (m);
2416 _tmp517_ = _tmp516_;
2417 _tmp518_ = vala_variable_get_variable_type ((ValaVariable*) _tmp517_);
2418 _tmp519_ = _tmp518_;
2419 _tmp520_ = vala_data_type_get_type_symbol (_tmp519_);
2420 _tmp521_ = _tmp520_;
2421 _tmp508_ = vala_is_reference_counting (_tmp521_);
2422 } else {
2423 _tmp508_ = FALSE;
2424 }
2425 if (_tmp508_) {
2426 ValaParameter* _tmp522_;
2427 ValaParameter* _tmp523_;
2428 ValaDataType* _tmp524_;
2429 ValaDataType* _tmp525_;
2430 ValaCCodeExpression* _tmp526_;
2431 _tmp522_ = vala_method_get_this_parameter (m);
2432 _tmp523_ = _tmp522_;
2433 _tmp524_ = vala_variable_get_variable_type ((ValaVariable*) _tmp523_);
2434 _tmp525_ = _tmp524_;
2435 _tmp526_ = vala_ccode_base_module_get_destroy_func_expression ((ValaCCodeBaseModule*) self, _tmp525_, FALSE);
2436 _vala_ccode_node_unref0 (destroy_notify);
2437 destroy_notify = _tmp526_;
2438 }
2439 }
2440 _tmp527_ = destroy_notify;
2441 if (_tmp527_ != NULL) {
2442 ValaCCodeFunctionCall* unref_call = NULL;
2443 ValaCCodeExpression* _tmp528_;
2444 ValaCCodeFunctionCall* _tmp529_;
2445 ValaCCodeFunctionCall* _tmp530_;
2446 ValaCCodeIdentifier* _tmp531_;
2447 ValaCCodeIdentifier* _tmp532_;
2448 ValaCCodeFunction* _tmp533_;
2449 ValaCCodeFunction* _tmp534_;
2450 ValaCCodeFunctionCall* _tmp535_;
2451 _tmp528_ = destroy_notify;
2452 _tmp529_ = vala_ccode_function_call_new (_tmp528_);
2453 unref_call = _tmp529_;
2454 _tmp530_ = unref_call;
2455 _tmp531_ = vala_ccode_identifier_new ("self");
2456 _tmp532_ = _tmp531_;
2457 vala_ccode_function_call_add_argument (_tmp530_, (ValaCCodeExpression*) _tmp532_);
2458 _vala_ccode_node_unref0 (_tmp532_);
2459 _tmp533_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
2460 _tmp534_ = _tmp533_;
2461 _tmp535_ = unref_call;
2462 vala_ccode_function_add_expression (_tmp534_, (ValaCCodeExpression*) _tmp535_);
2463 _vala_ccode_node_unref0 (unref_call);
2464 }
2465 _vala_ccode_node_unref0 (destroy_notify);
2466 }
2467 _tmp538_ = vala_callable_get_return_type ((ValaCallable*) m);
2468 _tmp539_ = _tmp538_;
2469 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp539_, VALA_TYPE_VOID_TYPE)) {
2470 _tmp537_ = TRUE;
2471 } else {
2472 ValaDataType* _tmp540_;
2473 ValaDataType* _tmp541_;
2474 _tmp540_ = vala_callable_get_return_type ((ValaCallable*) m);
2475 _tmp541_ = _tmp540_;
2476 _tmp537_ = vala_data_type_is_real_non_null_struct_type (_tmp541_);
2477 }
2478 if (!_tmp537_) {
2479 _tmp536_ = TRUE;
2480 } else {
2481 gboolean _tmp542_ = FALSE;
2482 ValaDelegate* _tmp543_;
2483 ValaDataType* _tmp544_;
2484 ValaDataType* _tmp545_;
2485 _tmp543_ = d;
2486 _tmp544_ = vala_callable_get_return_type ((ValaCallable*) _tmp543_);
2487 _tmp545_ = _tmp544_;
2488 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp545_, VALA_TYPE_VOID_TYPE)) {
2489 _tmp542_ = TRUE;
2490 } else {
2491 ValaDelegate* _tmp546_;
2492 ValaDataType* _tmp547_;
2493 ValaDataType* _tmp548_;
2494 _tmp546_ = d;
2495 _tmp547_ = vala_callable_get_return_type ((ValaCallable*) _tmp546_);
2496 _tmp548_ = _tmp547_;
2497 _tmp542_ = vala_data_type_is_real_non_null_struct_type (_tmp548_);
2498 }
2499 _tmp536_ = !_tmp542_;
2500 }
2501 if (_tmp536_) {
2502 ValaCCodeFunction* _tmp549_;
2503 ValaCCodeFunction* _tmp550_;
2504 ValaCCodeIdentifier* _tmp551_;
2505 ValaCCodeIdentifier* _tmp552_;
2506 _tmp549_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
2507 _tmp550_ = _tmp549_;
2508 _tmp551_ = vala_ccode_identifier_new ("result");
2509 _tmp552_ = _tmp551_;
2510 vala_ccode_function_add_return (_tmp550_, (ValaCCodeExpression*) _tmp552_);
2511 _vala_ccode_node_unref0 (_tmp552_);
2512 }
2513 vala_ccode_base_module_pop_function ((ValaCCodeBaseModule*) self);
2514 _tmp553_ = ((ValaCCodeBaseModule*) self)->cfile;
2515 _tmp554_ = function;
2516 vala_ccode_file_add_function_declaration (_tmp553_, _tmp554_);
2517 _tmp555_ = ((ValaCCodeBaseModule*) self)->cfile;
2518 _tmp556_ = function;
2519 vala_ccode_file_add_function (_tmp555_, _tmp556_);
2520 result = wrapper_name;
2521 _vala_ccode_node_unref0 (ccall);
2522 _vala_map_unref0 (carg_map);
2523 _vala_iterable_unref0 (d_params);
2524 _vala_map_unref0 (cparam_map);
2525 _vala_ccode_node_unref0 (function);
2526 _vala_code_node_unref0 (creturn_type);
2527 _vala_code_node_unref0 (dynamic_sig);
2528 _vala_code_node_unref0 (sig);
2529 _g_free0 (delegate_name);
2530 _vala_code_node_unref0 (d);
2531 return result;
2532 }
2533
2534 static ValaCCodeParameter*
vala_ccode_delegate_module_real_generate_parameter(ValaCCodeMethodModule * base,ValaParameter * param,ValaCCodeFile * decl_space,ValaMap * cparam_map,ValaMap * carg_map)2535 vala_ccode_delegate_module_real_generate_parameter (ValaCCodeMethodModule* base,
2536 ValaParameter* param,
2537 ValaCCodeFile* decl_space,
2538 ValaMap* cparam_map,
2539 ValaMap* carg_map)
2540 {
2541 ValaCCodeDelegateModule * self;
2542 gboolean _tmp0_ = FALSE;
2543 ValaDataType* _tmp1_;
2544 ValaDataType* _tmp2_;
2545 ValaDataType* param_type = NULL;
2546 ValaDataType* _tmp6_;
2547 ValaDataType* _tmp7_;
2548 ValaDataType* _tmp8_;
2549 gboolean _tmp9_ = FALSE;
2550 ValaDataType* _tmp10_;
2551 ValaDataType* _tmp29_;
2552 gchar* ctypename = NULL;
2553 ValaDataType* _tmp30_;
2554 gchar* _tmp31_;
2555 gchar* target_ctypename = NULL;
2556 ValaDataType* _tmp32_;
2557 gchar* _tmp33_;
2558 gchar* target_destroy_notify_ctypename = NULL;
2559 ValaDelegateType* _tmp34_;
2560 gchar* _tmp35_;
2561 ValaParameterDirection _tmp36_;
2562 ValaParameterDirection _tmp37_;
2563 ValaCCodeParameter* main_cparam = NULL;
2564 gchar* _tmp44_;
2565 gchar* _tmp45_;
2566 const gchar* _tmp46_;
2567 ValaCCodeParameter* _tmp47_;
2568 ValaCCodeParameter* _tmp48_;
2569 ValaCCodeParameter* _tmp49_;
2570 ValaDataType* _tmp52_;
2571 ValaCCodeParameter* result = NULL;
2572 self = (ValaCCodeDelegateModule*) base;
2573 g_return_val_if_fail (param != NULL, NULL);
2574 g_return_val_if_fail (decl_space != NULL, NULL);
2575 g_return_val_if_fail (cparam_map != NULL, NULL);
2576 _tmp1_ = vala_variable_get_variable_type ((ValaVariable*) param);
2577 _tmp2_ = _tmp1_;
2578 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, VALA_TYPE_DELEGATE_TYPE)) {
2579 _tmp0_ = TRUE;
2580 } else {
2581 ValaDataType* _tmp3_;
2582 ValaDataType* _tmp4_;
2583 _tmp3_ = vala_variable_get_variable_type ((ValaVariable*) param);
2584 _tmp4_ = _tmp3_;
2585 _tmp0_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, VALA_TYPE_METHOD_TYPE);
2586 }
2587 if (!_tmp0_) {
2588 ValaCCodeParameter* _tmp5_;
2589 _tmp5_ = VALA_CCODE_METHOD_MODULE_CLASS (vala_ccode_delegate_module_parent_class)->generate_parameter ((ValaCCodeMethodModule*) G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_CCODE_ARRAY_MODULE, ValaCCodeArrayModule), param, decl_space, cparam_map, carg_map);
2590 result = _tmp5_;
2591 return result;
2592 }
2593 _tmp6_ = vala_variable_get_variable_type ((ValaVariable*) param);
2594 _tmp7_ = _tmp6_;
2595 _tmp8_ = _vala_code_node_ref0 (_tmp7_);
2596 param_type = _tmp8_;
2597 _tmp10_ = param_type;
2598 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, VALA_TYPE_DELEGATE_TYPE)) {
2599 ValaDataType* _tmp11_;
2600 ValaDelegate* _tmp12_;
2601 ValaDelegate* _tmp13_;
2602 ValaSymbol* _tmp14_;
2603 ValaSymbol* _tmp15_;
2604 _tmp11_ = param_type;
2605 _tmp12_ = vala_delegate_type_get_delegate_symbol (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
2606 _tmp13_ = _tmp12_;
2607 _tmp14_ = vala_symbol_get_parent_symbol ((ValaSymbol*) param);
2608 _tmp15_ = _tmp14_;
2609 _tmp9_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, VALA_TYPE_SYMBOL, ValaSymbol) == _tmp15_;
2610 } else {
2611 _tmp9_ = FALSE;
2612 }
2613 if (_tmp9_) {
2614 ValaCodeContext* _tmp16_;
2615 ValaCodeContext* _tmp17_;
2616 ValaNamespace* _tmp18_;
2617 ValaNamespace* _tmp19_;
2618 ValaScope* _tmp20_;
2619 ValaScope* _tmp21_;
2620 ValaSymbol* _tmp22_;
2621 ValaSymbol* _tmp23_;
2622 ValaScope* _tmp24_;
2623 ValaScope* _tmp25_;
2624 ValaSymbol* _tmp26_;
2625 ValaDelegate* _tmp27_;
2626 ValaDelegateType* _tmp28_;
2627 _tmp16_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
2628 _tmp17_ = _tmp16_;
2629 _tmp18_ = vala_code_context_get_root (_tmp17_);
2630 _tmp19_ = _tmp18_;
2631 _tmp20_ = vala_symbol_get_scope ((ValaSymbol*) _tmp19_);
2632 _tmp21_ = _tmp20_;
2633 _tmp22_ = vala_scope_lookup (_tmp21_, "GLib");
2634 _tmp23_ = _tmp22_;
2635 _tmp24_ = vala_symbol_get_scope (_tmp23_);
2636 _tmp25_ = _tmp24_;
2637 _tmp26_ = vala_scope_lookup (_tmp25_, "Callback");
2638 _tmp27_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, VALA_TYPE_DELEGATE, ValaDelegate);
2639 _tmp28_ = vala_delegate_type_new (_tmp27_);
2640 _vala_code_node_unref0 (param_type);
2641 param_type = (ValaDataType*) _tmp28_;
2642 _vala_code_node_unref0 (_tmp27_);
2643 _vala_code_node_unref0 (_tmp23_);
2644 }
2645 _tmp29_ = param_type;
2646 vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp29_, decl_space);
2647 _tmp30_ = param_type;
2648 _tmp31_ = vala_get_ccode_name ((ValaCodeNode*) _tmp30_);
2649 ctypename = _tmp31_;
2650 _tmp32_ = ((ValaCCodeBaseModule*) self)->delegate_target_type;
2651 _tmp33_ = vala_get_ccode_name ((ValaCodeNode*) _tmp32_);
2652 target_ctypename = _tmp33_;
2653 _tmp34_ = ((ValaCCodeBaseModule*) self)->delegate_target_destroy_type;
2654 _tmp35_ = vala_get_ccode_name ((ValaCodeNode*) _tmp34_);
2655 target_destroy_notify_ctypename = _tmp35_;
2656 _tmp36_ = vala_parameter_get_direction (param);
2657 _tmp37_ = _tmp36_;
2658 if (_tmp37_ != VALA_PARAMETER_DIRECTION_IN) {
2659 const gchar* _tmp38_;
2660 gchar* _tmp39_;
2661 const gchar* _tmp40_;
2662 gchar* _tmp41_;
2663 const gchar* _tmp42_;
2664 gchar* _tmp43_;
2665 _tmp38_ = ctypename;
2666 _tmp39_ = g_strconcat (_tmp38_, "*", NULL);
2667 _g_free0 (ctypename);
2668 ctypename = _tmp39_;
2669 _tmp40_ = target_ctypename;
2670 _tmp41_ = g_strconcat (_tmp40_, "*", NULL);
2671 _g_free0 (target_ctypename);
2672 target_ctypename = _tmp41_;
2673 _tmp42_ = target_destroy_notify_ctypename;
2674 _tmp43_ = g_strconcat (_tmp42_, "*", NULL);
2675 _g_free0 (target_destroy_notify_ctypename);
2676 target_destroy_notify_ctypename = _tmp43_;
2677 }
2678 _tmp44_ = vala_get_ccode_name ((ValaCodeNode*) param);
2679 _tmp45_ = _tmp44_;
2680 _tmp46_ = ctypename;
2681 _tmp47_ = vala_ccode_parameter_new (_tmp45_, _tmp46_);
2682 _tmp48_ = _tmp47_;
2683 _g_free0 (_tmp45_);
2684 main_cparam = _tmp48_;
2685 _tmp49_ = main_cparam;
2686 vala_map_set (cparam_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_pos (param), FALSE)), _tmp49_);
2687 if (carg_map != NULL) {
2688 ValaCCodeExpression* _tmp50_;
2689 ValaCCodeExpression* _tmp51_;
2690 _tmp50_ = vala_ccode_base_module_get_parameter_cexpression ((ValaCCodeBaseModule*) self, param);
2691 _tmp51_ = _tmp50_;
2692 vala_map_set (carg_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_pos (param), FALSE)), _tmp51_);
2693 _vala_ccode_node_unref0 (_tmp51_);
2694 }
2695 _tmp52_ = param_type;
2696 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp52_, VALA_TYPE_DELEGATE_TYPE)) {
2697 ValaDelegateType* deleg_type = NULL;
2698 ValaDataType* _tmp53_;
2699 gboolean _tmp54_ = FALSE;
2700 _tmp53_ = param_type;
2701 deleg_type = G_TYPE_CHECK_INSTANCE_CAST (_tmp53_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType);
2702 if (vala_get_ccode_delegate_target ((ValaCodeNode*) param)) {
2703 ValaDelegateType* _tmp55_;
2704 ValaDelegate* _tmp56_;
2705 ValaDelegate* _tmp57_;
2706 gboolean _tmp58_;
2707 gboolean _tmp59_;
2708 _tmp55_ = deleg_type;
2709 _tmp56_ = vala_delegate_type_get_delegate_symbol (_tmp55_);
2710 _tmp57_ = _tmp56_;
2711 _tmp58_ = vala_delegate_get_has_target (_tmp57_);
2712 _tmp59_ = _tmp58_;
2713 _tmp54_ = _tmp59_;
2714 } else {
2715 _tmp54_ = FALSE;
2716 }
2717 if (_tmp54_) {
2718 ValaCCodeParameter* cparam = NULL;
2719 gchar* _tmp60_;
2720 gchar* _tmp61_;
2721 const gchar* _tmp62_;
2722 ValaCCodeParameter* _tmp63_;
2723 ValaCCodeParameter* _tmp64_;
2724 ValaCCodeParameter* _tmp65_;
2725 ValaDelegateType* _tmp71_;
2726 _tmp60_ = vala_get_ccode_delegate_target_name ((ValaVariable*) param);
2727 _tmp61_ = _tmp60_;
2728 _tmp62_ = target_ctypename;
2729 _tmp63_ = vala_ccode_parameter_new (_tmp61_, _tmp62_);
2730 _tmp64_ = _tmp63_;
2731 _g_free0 (_tmp61_);
2732 cparam = _tmp64_;
2733 _tmp65_ = cparam;
2734 vala_map_set (cparam_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) param), FALSE)), _tmp65_);
2735 if (carg_map != NULL) {
2736 ValaCCodeParameter* _tmp66_;
2737 const gchar* _tmp67_;
2738 const gchar* _tmp68_;
2739 ValaCCodeExpression* _tmp69_;
2740 ValaCCodeExpression* _tmp70_;
2741 _tmp66_ = cparam;
2742 _tmp67_ = vala_ccode_parameter_get_name (_tmp66_);
2743 _tmp68_ = _tmp67_;
2744 _tmp69_ = vala_ccode_base_module_get_cexpression ((ValaCCodeBaseModule*) self, _tmp68_);
2745 _tmp70_ = _tmp69_;
2746 vala_map_set (carg_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) param), FALSE)), _tmp70_);
2747 _vala_ccode_node_unref0 (_tmp70_);
2748 }
2749 _tmp71_ = deleg_type;
2750 if (vala_data_type_is_disposable ((ValaDataType*) _tmp71_)) {
2751 gchar* _tmp72_;
2752 gchar* _tmp73_;
2753 const gchar* _tmp74_;
2754 ValaCCodeParameter* _tmp75_;
2755 ValaCCodeParameter* _tmp76_;
2756 _tmp72_ = vala_get_ccode_delegate_target_destroy_notify_name ((ValaVariable*) param);
2757 _tmp73_ = _tmp72_;
2758 _tmp74_ = target_destroy_notify_ctypename;
2759 _tmp75_ = vala_ccode_parameter_new (_tmp73_, _tmp74_);
2760 _vala_ccode_node_unref0 (cparam);
2761 cparam = _tmp75_;
2762 _g_free0 (_tmp73_);
2763 _tmp76_ = cparam;
2764 vala_map_set (cparam_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) param), FALSE)), _tmp76_);
2765 if (carg_map != NULL) {
2766 ValaCCodeParameter* _tmp77_;
2767 const gchar* _tmp78_;
2768 const gchar* _tmp79_;
2769 ValaCCodeExpression* _tmp80_;
2770 ValaCCodeExpression* _tmp81_;
2771 _tmp77_ = cparam;
2772 _tmp78_ = vala_ccode_parameter_get_name (_tmp77_);
2773 _tmp79_ = _tmp78_;
2774 _tmp80_ = vala_ccode_base_module_get_cexpression ((ValaCCodeBaseModule*) self, _tmp79_);
2775 _tmp81_ = _tmp80_;
2776 vala_map_set (carg_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_destroy_notify_pos ((ValaCodeNode*) param), FALSE)), _tmp81_);
2777 _vala_ccode_node_unref0 (_tmp81_);
2778 }
2779 }
2780 _vala_ccode_node_unref0 (cparam);
2781 }
2782 } else {
2783 ValaDataType* _tmp82_;
2784 _tmp82_ = param_type;
2785 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp82_, VALA_TYPE_METHOD_TYPE)) {
2786 ValaCCodeParameter* cparam = NULL;
2787 gchar* _tmp83_;
2788 gchar* _tmp84_;
2789 const gchar* _tmp85_;
2790 ValaCCodeParameter* _tmp86_;
2791 ValaCCodeParameter* _tmp87_;
2792 ValaCCodeParameter* _tmp88_;
2793 _tmp83_ = vala_get_ccode_delegate_target_name ((ValaVariable*) param);
2794 _tmp84_ = _tmp83_;
2795 _tmp85_ = target_ctypename;
2796 _tmp86_ = vala_ccode_parameter_new (_tmp84_, _tmp85_);
2797 _tmp87_ = _tmp86_;
2798 _g_free0 (_tmp84_);
2799 cparam = _tmp87_;
2800 _tmp88_ = cparam;
2801 vala_map_set (cparam_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) param), FALSE)), _tmp88_);
2802 if (carg_map != NULL) {
2803 ValaCCodeParameter* _tmp89_;
2804 const gchar* _tmp90_;
2805 const gchar* _tmp91_;
2806 ValaCCodeExpression* _tmp92_;
2807 ValaCCodeExpression* _tmp93_;
2808 _tmp89_ = cparam;
2809 _tmp90_ = vala_ccode_parameter_get_name (_tmp89_);
2810 _tmp91_ = _tmp90_;
2811 _tmp92_ = vala_ccode_base_module_get_cexpression ((ValaCCodeBaseModule*) self, _tmp91_);
2812 _tmp93_ = _tmp92_;
2813 vala_map_set (carg_map, (gpointer) ((gintptr) vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, vala_get_ccode_delegate_target_pos ((ValaCodeNode*) param), FALSE)), _tmp93_);
2814 _vala_ccode_node_unref0 (_tmp93_);
2815 }
2816 _vala_ccode_node_unref0 (cparam);
2817 }
2818 }
2819 result = main_cparam;
2820 _g_free0 (target_destroy_notify_ctypename);
2821 _g_free0 (target_ctypename);
2822 _g_free0 (ctypename);
2823 _vala_code_node_unref0 (param_type);
2824 return result;
2825 }
2826
2827 ValaCCodeDelegateModule*
vala_ccode_delegate_module_construct(GType object_type)2828 vala_ccode_delegate_module_construct (GType object_type)
2829 {
2830 ValaCCodeDelegateModule* self = NULL;
2831 self = (ValaCCodeDelegateModule*) vala_ccode_array_module_construct (object_type);
2832 return self;
2833 }
2834
2835 ValaCCodeDelegateModule*
vala_ccode_delegate_module_new(void)2836 vala_ccode_delegate_module_new (void)
2837 {
2838 return vala_ccode_delegate_module_construct (VALA_TYPE_CCODE_DELEGATE_MODULE);
2839 }
2840
2841 static void
vala_ccode_delegate_module_class_init(ValaCCodeDelegateModuleClass * klass,gpointer klass_data)2842 vala_ccode_delegate_module_class_init (ValaCCodeDelegateModuleClass * klass,
2843 gpointer klass_data)
2844 {
2845 vala_ccode_delegate_module_parent_class = g_type_class_peek_parent (klass);
2846 ((ValaCCodeBaseModuleClass *) klass)->generate_delegate_declaration = (void (*) (ValaCCodeBaseModule*, ValaDelegate*, ValaCCodeFile*)) vala_ccode_delegate_module_real_generate_delegate_declaration;
2847 ((ValaCodeVisitorClass *) klass)->visit_delegate = (void (*) (ValaCodeVisitor*, ValaDelegate*)) vala_ccode_delegate_module_real_visit_delegate;
2848 ((ValaCCodeBaseModuleClass *) klass)->get_delegate_target_cname = (gchar* (*) (ValaCCodeBaseModule*, const gchar*)) vala_ccode_delegate_module_real_get_delegate_target_cname;
2849 ((ValaCCodeBaseModuleClass *) klass)->get_delegate_target_cexpression = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaExpression*, ValaCCodeExpression* *)) vala_ccode_delegate_module_real_get_delegate_target_cexpression;
2850 ((ValaCCodeBaseModuleClass *) klass)->get_delegate_target_cvalue = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaTargetValue*)) vala_ccode_delegate_module_real_get_delegate_target_cvalue;
2851 ((ValaCCodeBaseModuleClass *) klass)->get_delegate_target_destroy_notify_cvalue = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaTargetValue*)) vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cvalue;
2852 ((ValaCCodeBaseModuleClass *) klass)->get_delegate_target_destroy_notify_cname = (gchar* (*) (ValaCCodeBaseModule*, const gchar*)) vala_ccode_delegate_module_real_get_delegate_target_destroy_notify_cname;
2853 ((ValaCCodeBaseModuleClass *) klass)->get_implicit_cast_expression = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaCCodeExpression*, ValaDataType*, ValaDataType*, ValaCodeNode*)) vala_ccode_delegate_module_real_get_implicit_cast_expression;
2854 ((ValaCCodeMethodModuleClass *) klass)->generate_parameter = (ValaCCodeParameter* (*) (ValaCCodeMethodModule*, ValaParameter*, ValaCCodeFile*, ValaMap*, ValaMap*)) vala_ccode_delegate_module_real_generate_parameter;
2855 }
2856
2857 static void
vala_ccode_delegate_module_instance_init(ValaCCodeDelegateModule * self,gpointer klass)2858 vala_ccode_delegate_module_instance_init (ValaCCodeDelegateModule * self,
2859 gpointer klass)
2860 {
2861 }
2862
2863 /**
2864 * The link between an assignment and generated code.
2865 */
2866 static GType
vala_ccode_delegate_module_get_type_once(void)2867 vala_ccode_delegate_module_get_type_once (void)
2868 {
2869 static const GTypeInfo g_define_type_info = { sizeof (ValaCCodeDelegateModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_ccode_delegate_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCCodeDelegateModule), 0, (GInstanceInitFunc) vala_ccode_delegate_module_instance_init, NULL };
2870 GType vala_ccode_delegate_module_type_id;
2871 vala_ccode_delegate_module_type_id = g_type_register_static (VALA_TYPE_CCODE_ARRAY_MODULE, "ValaCCodeDelegateModule", &g_define_type_info, 0);
2872 return vala_ccode_delegate_module_type_id;
2873 }
2874
2875 GType
vala_ccode_delegate_module_get_type(void)2876 vala_ccode_delegate_module_get_type (void)
2877 {
2878 static volatile gsize vala_ccode_delegate_module_type_id__volatile = 0;
2879 if (g_once_init_enter (&vala_ccode_delegate_module_type_id__volatile)) {
2880 GType vala_ccode_delegate_module_type_id;
2881 vala_ccode_delegate_module_type_id = vala_ccode_delegate_module_get_type_once ();
2882 g_once_init_leave (&vala_ccode_delegate_module_type_id__volatile, vala_ccode_delegate_module_type_id);
2883 }
2884 return vala_ccode_delegate_module_type_id__volatile;
2885 }
2886
2887