1 /* valacreationmethod.c generated by valac, the Vala compiler
2 * generated from valacreationmethod.vala, do not modify */
3
4 /* valacreationmethod.vala
5 *
6 * Copyright (C) 2007-2010 Jürg Billeter
7 * Copyright (C) 2007-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 * Raffaele Sandrini <raffaele@sandrini.ch>
25 * Jürg Billeter <j@bitron.ch>
26 */
27
28 #include "vala.h"
29 #include <stdlib.h>
30 #include <string.h>
31 #include <glib.h>
32 #include <valagee.h>
33 #include <glib-object.h>
34
35 #define _g_free0(var) (var = (g_free (var), NULL))
36 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
37 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
38 #define _vala_source_file_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_file_unref (var), NULL)))
39
40 struct _ValaCreationMethodPrivate {
41 gchar* _class_name;
42 gboolean _chain_up;
43 };
44
45 static gint ValaCreationMethod_private_offset;
46 static gpointer vala_creation_method_parent_class = NULL;
47
48 static void vala_creation_method_real_accept (ValaCodeNode* base,
49 ValaCodeVisitor* visitor);
50 static void vala_creation_method_real_accept_children (ValaCodeNode* base,
51 ValaCodeVisitor* visitor);
52 static gboolean vala_creation_method_real_check (ValaCodeNode* base,
53 ValaCodeContext* context);
54 static void vala_creation_method_finalize (ValaCodeNode * obj);
55 static GType vala_creation_method_get_type_once (void);
56
57 static inline gpointer
vala_creation_method_get_instance_private(ValaCreationMethod * self)58 vala_creation_method_get_instance_private (ValaCreationMethod* self)
59 {
60 return G_STRUCT_MEMBER_P (self, ValaCreationMethod_private_offset);
61 }
62
63 const gchar*
vala_creation_method_get_class_name(ValaCreationMethod * self)64 vala_creation_method_get_class_name (ValaCreationMethod* self)
65 {
66 const gchar* result;
67 const gchar* _tmp0_;
68 g_return_val_if_fail (self != NULL, NULL);
69 _tmp0_ = self->priv->_class_name;
70 result = _tmp0_;
71 return result;
72 }
73
74 void
vala_creation_method_set_class_name(ValaCreationMethod * self,const gchar * value)75 vala_creation_method_set_class_name (ValaCreationMethod* self,
76 const gchar* value)
77 {
78 gchar* _tmp0_;
79 g_return_if_fail (self != NULL);
80 _tmp0_ = g_strdup (value);
81 _g_free0 (self->priv->_class_name);
82 self->priv->_class_name = _tmp0_;
83 }
84
85 gboolean
vala_creation_method_get_chain_up(ValaCreationMethod * self)86 vala_creation_method_get_chain_up (ValaCreationMethod* self)
87 {
88 gboolean result;
89 g_return_val_if_fail (self != NULL, FALSE);
90 result = self->priv->_chain_up;
91 return result;
92 }
93
94 void
vala_creation_method_set_chain_up(ValaCreationMethod * self,gboolean value)95 vala_creation_method_set_chain_up (ValaCreationMethod* self,
96 gboolean value)
97 {
98 g_return_if_fail (self != NULL);
99 self->priv->_chain_up = value;
100 }
101
102 /**
103 * Creates a new method.
104 *
105 * @param name method name
106 * @param source_reference reference to source code
107 * @return newly created method
108 */
109 ValaCreationMethod*
vala_creation_method_construct(GType object_type,const gchar * class_name,const gchar * name,ValaSourceReference * source_reference,ValaComment * comment)110 vala_creation_method_construct (GType object_type,
111 const gchar* class_name,
112 const gchar* name,
113 ValaSourceReference* source_reference,
114 ValaComment* comment)
115 {
116 ValaCreationMethod* self = NULL;
117 ValaVoidType* _tmp0_;
118 ValaVoidType* _tmp1_;
119 _tmp0_ = vala_void_type_new (NULL);
120 _tmp1_ = _tmp0_;
121 self = (ValaCreationMethod*) vala_method_construct (object_type, name, (ValaDataType*) _tmp1_, source_reference, comment);
122 _vala_code_node_unref0 (_tmp1_);
123 vala_creation_method_set_class_name (self, class_name);
124 return self;
125 }
126
127 ValaCreationMethod*
vala_creation_method_new(const gchar * class_name,const gchar * name,ValaSourceReference * source_reference,ValaComment * comment)128 vala_creation_method_new (const gchar* class_name,
129 const gchar* name,
130 ValaSourceReference* source_reference,
131 ValaComment* comment)
132 {
133 return vala_creation_method_construct (VALA_TYPE_CREATION_METHOD, class_name, name, source_reference, comment);
134 }
135
136 static void
vala_creation_method_real_accept(ValaCodeNode * base,ValaCodeVisitor * visitor)137 vala_creation_method_real_accept (ValaCodeNode* base,
138 ValaCodeVisitor* visitor)
139 {
140 ValaCreationMethod * self;
141 self = (ValaCreationMethod*) base;
142 g_return_if_fail (visitor != NULL);
143 vala_code_visitor_visit_creation_method (visitor, self);
144 }
145
146 static gpointer
_vala_iterable_ref0(gpointer self)147 _vala_iterable_ref0 (gpointer self)
148 {
149 return self ? vala_iterable_ref (self) : NULL;
150 }
151
152 static void
vala_creation_method_real_accept_children(ValaCodeNode * base,ValaCodeVisitor * visitor)153 vala_creation_method_real_accept_children (ValaCodeNode* base,
154 ValaCodeVisitor* visitor)
155 {
156 ValaCreationMethod * self;
157 ValaList* _tmp10_;
158 ValaBlock* _tmp41_;
159 ValaBlock* _tmp42_;
160 self = (ValaCreationMethod*) base;
161 g_return_if_fail (visitor != NULL);
162 {
163 ValaList* _param_list = NULL;
164 ValaList* _tmp0_;
165 ValaList* _tmp1_;
166 gint _param_size = 0;
167 ValaList* _tmp2_;
168 gint _tmp3_;
169 gint _tmp4_;
170 gint _param_index = 0;
171 _tmp0_ = vala_callable_get_parameters ((ValaCallable*) self);
172 _tmp1_ = _vala_iterable_ref0 (_tmp0_);
173 _param_list = _tmp1_;
174 _tmp2_ = _param_list;
175 _tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
176 _tmp4_ = _tmp3_;
177 _param_size = _tmp4_;
178 _param_index = -1;
179 while (TRUE) {
180 gint _tmp5_;
181 gint _tmp6_;
182 ValaParameter* param = NULL;
183 ValaList* _tmp7_;
184 gpointer _tmp8_;
185 ValaParameter* _tmp9_;
186 _param_index = _param_index + 1;
187 _tmp5_ = _param_index;
188 _tmp6_ = _param_size;
189 if (!(_tmp5_ < _tmp6_)) {
190 break;
191 }
192 _tmp7_ = _param_list;
193 _tmp8_ = vala_list_get (_tmp7_, _param_index);
194 param = (ValaParameter*) _tmp8_;
195 _tmp9_ = param;
196 vala_code_node_accept ((ValaCodeNode*) _tmp9_, visitor);
197 _vala_code_node_unref0 (param);
198 }
199 _vala_iterable_unref0 (_param_list);
200 }
201 _tmp10_ = ((ValaMethod*) self)->error_types;
202 if (_tmp10_ != NULL) {
203 {
204 ValaList* _error_type_list = NULL;
205 ValaList* _tmp11_;
206 ValaList* _tmp12_;
207 gint _error_type_size = 0;
208 ValaList* _tmp13_;
209 gint _tmp14_;
210 gint _tmp15_;
211 gint _error_type_index = 0;
212 _tmp11_ = ((ValaMethod*) self)->error_types;
213 _tmp12_ = _vala_iterable_ref0 (_tmp11_);
214 _error_type_list = _tmp12_;
215 _tmp13_ = _error_type_list;
216 _tmp14_ = vala_collection_get_size ((ValaCollection*) _tmp13_);
217 _tmp15_ = _tmp14_;
218 _error_type_size = _tmp15_;
219 _error_type_index = -1;
220 while (TRUE) {
221 gint _tmp16_;
222 gint _tmp17_;
223 ValaDataType* error_type = NULL;
224 ValaList* _tmp18_;
225 gpointer _tmp19_;
226 ValaDataType* _tmp20_;
227 _error_type_index = _error_type_index + 1;
228 _tmp16_ = _error_type_index;
229 _tmp17_ = _error_type_size;
230 if (!(_tmp16_ < _tmp17_)) {
231 break;
232 }
233 _tmp18_ = _error_type_list;
234 _tmp19_ = vala_list_get (_tmp18_, _error_type_index);
235 error_type = (ValaDataType*) _tmp19_;
236 _tmp20_ = error_type;
237 vala_code_node_accept ((ValaCodeNode*) _tmp20_, visitor);
238 _vala_code_node_unref0 (error_type);
239 }
240 _vala_iterable_unref0 (_error_type_list);
241 }
242 }
243 {
244 ValaList* _precondition_list = NULL;
245 ValaList* _tmp21_;
246 ValaList* _tmp22_;
247 gint _precondition_size = 0;
248 ValaList* _tmp23_;
249 gint _tmp24_;
250 gint _tmp25_;
251 gint _precondition_index = 0;
252 _tmp21_ = vala_method_get_preconditions ((ValaMethod*) self);
253 _tmp22_ = _vala_iterable_ref0 (_tmp21_);
254 _precondition_list = _tmp22_;
255 _tmp23_ = _precondition_list;
256 _tmp24_ = vala_collection_get_size ((ValaCollection*) _tmp23_);
257 _tmp25_ = _tmp24_;
258 _precondition_size = _tmp25_;
259 _precondition_index = -1;
260 while (TRUE) {
261 gint _tmp26_;
262 gint _tmp27_;
263 ValaExpression* precondition = NULL;
264 ValaList* _tmp28_;
265 gpointer _tmp29_;
266 ValaExpression* _tmp30_;
267 _precondition_index = _precondition_index + 1;
268 _tmp26_ = _precondition_index;
269 _tmp27_ = _precondition_size;
270 if (!(_tmp26_ < _tmp27_)) {
271 break;
272 }
273 _tmp28_ = _precondition_list;
274 _tmp29_ = vala_list_get (_tmp28_, _precondition_index);
275 precondition = (ValaExpression*) _tmp29_;
276 _tmp30_ = precondition;
277 vala_code_node_accept ((ValaCodeNode*) _tmp30_, visitor);
278 _vala_code_node_unref0 (precondition);
279 }
280 _vala_iterable_unref0 (_precondition_list);
281 }
282 {
283 ValaList* _postcondition_list = NULL;
284 ValaList* _tmp31_;
285 ValaList* _tmp32_;
286 gint _postcondition_size = 0;
287 ValaList* _tmp33_;
288 gint _tmp34_;
289 gint _tmp35_;
290 gint _postcondition_index = 0;
291 _tmp31_ = vala_method_get_postconditions ((ValaMethod*) self);
292 _tmp32_ = _vala_iterable_ref0 (_tmp31_);
293 _postcondition_list = _tmp32_;
294 _tmp33_ = _postcondition_list;
295 _tmp34_ = vala_collection_get_size ((ValaCollection*) _tmp33_);
296 _tmp35_ = _tmp34_;
297 _postcondition_size = _tmp35_;
298 _postcondition_index = -1;
299 while (TRUE) {
300 gint _tmp36_;
301 gint _tmp37_;
302 ValaExpression* postcondition = NULL;
303 ValaList* _tmp38_;
304 gpointer _tmp39_;
305 ValaExpression* _tmp40_;
306 _postcondition_index = _postcondition_index + 1;
307 _tmp36_ = _postcondition_index;
308 _tmp37_ = _postcondition_size;
309 if (!(_tmp36_ < _tmp37_)) {
310 break;
311 }
312 _tmp38_ = _postcondition_list;
313 _tmp39_ = vala_list_get (_tmp38_, _postcondition_index);
314 postcondition = (ValaExpression*) _tmp39_;
315 _tmp40_ = postcondition;
316 vala_code_node_accept ((ValaCodeNode*) _tmp40_, visitor);
317 _vala_code_node_unref0 (postcondition);
318 }
319 _vala_iterable_unref0 (_postcondition_list);
320 }
321 _tmp41_ = vala_subroutine_get_body ((ValaSubroutine*) self);
322 _tmp42_ = _tmp41_;
323 if (_tmp42_ != NULL) {
324 ValaBlock* _tmp43_;
325 ValaBlock* _tmp44_;
326 _tmp43_ = vala_subroutine_get_body ((ValaSubroutine*) self);
327 _tmp44_ = _tmp43_;
328 vala_code_node_accept ((ValaCodeNode*) _tmp44_, visitor);
329 }
330 }
331
332 static gpointer
_vala_source_file_ref0(gpointer self)333 _vala_source_file_ref0 (gpointer self)
334 {
335 return self ? vala_source_file_ref (self) : NULL;
336 }
337
338 static gpointer
_vala_code_node_ref0(gpointer self)339 _vala_code_node_ref0 (gpointer self)
340 {
341 return self ? vala_code_node_ref (self) : NULL;
342 }
343
344 static gboolean
vala_creation_method_real_check(ValaCodeNode * base,ValaCodeContext * context)345 vala_creation_method_real_check (ValaCodeNode* base,
346 ValaCodeContext* context)
347 {
348 ValaCreationMethod * self;
349 gboolean _tmp0_;
350 gboolean _tmp1_;
351 gboolean _tmp4_ = FALSE;
352 const gchar* _tmp5_;
353 ValaParameter* _tmp22_;
354 ValaParameter* _tmp23_;
355 ValaSourceFile* old_source_file = NULL;
356 ValaSemanticAnalyzer* _tmp26_;
357 ValaSemanticAnalyzer* _tmp27_;
358 ValaSourceFile* _tmp28_;
359 ValaSourceFile* _tmp29_;
360 ValaSourceFile* _tmp30_;
361 ValaSymbol* old_symbol = NULL;
362 ValaSemanticAnalyzer* _tmp31_;
363 ValaSemanticAnalyzer* _tmp32_;
364 ValaSymbol* _tmp33_;
365 ValaSymbol* _tmp34_;
366 ValaSymbol* _tmp35_;
367 ValaSourceReference* _tmp36_;
368 ValaSourceReference* _tmp37_;
369 ValaSemanticAnalyzer* _tmp44_;
370 ValaSemanticAnalyzer* _tmp45_;
371 gint i = 0;
372 ValaList* _tmp130_;
373 ValaBlock* _tmp173_;
374 ValaBlock* _tmp174_;
375 ValaSemanticAnalyzer* _tmp298_;
376 ValaSemanticAnalyzer* _tmp299_;
377 ValaSourceFile* _tmp300_;
378 ValaSemanticAnalyzer* _tmp301_;
379 ValaSemanticAnalyzer* _tmp302_;
380 ValaSymbol* _tmp303_;
381 gboolean _tmp304_ = FALSE;
382 gboolean _tmp305_ = FALSE;
383 gboolean _tmp306_;
384 gboolean _tmp307_;
385 gboolean _tmp318_ = FALSE;
386 ValaBlock* _tmp319_;
387 ValaBlock* _tmp320_;
388 gboolean _tmp363_;
389 gboolean _tmp364_;
390 gboolean result = FALSE;
391 self = (ValaCreationMethod*) base;
392 g_return_val_if_fail (context != NULL, FALSE);
393 _tmp0_ = vala_code_node_get_checked ((ValaCodeNode*) self);
394 _tmp1_ = _tmp0_;
395 if (_tmp1_) {
396 gboolean _tmp2_;
397 gboolean _tmp3_;
398 _tmp2_ = vala_code_node_get_error ((ValaCodeNode*) self);
399 _tmp3_ = _tmp2_;
400 result = !_tmp3_;
401 return result;
402 }
403 vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
404 _tmp5_ = self->priv->_class_name;
405 if (_tmp5_ != NULL) {
406 const gchar* _tmp6_;
407 ValaSymbol* _tmp7_;
408 ValaSymbol* _tmp8_;
409 const gchar* _tmp9_;
410 const gchar* _tmp10_;
411 _tmp6_ = self->priv->_class_name;
412 _tmp7_ = vala_symbol_get_parent_symbol ((ValaSymbol*) self);
413 _tmp8_ = _tmp7_;
414 _tmp9_ = vala_symbol_get_name (_tmp8_);
415 _tmp10_ = _tmp9_;
416 _tmp4_ = g_strcmp0 (_tmp6_, _tmp10_) != 0;
417 } else {
418 _tmp4_ = FALSE;
419 }
420 if (_tmp4_) {
421 ValaSourceReference* _tmp11_;
422 ValaSourceReference* _tmp12_;
423 ValaSemanticAnalyzer* _tmp13_;
424 ValaSemanticAnalyzer* _tmp14_;
425 ValaSymbol* _tmp15_;
426 ValaSymbol* _tmp16_;
427 gchar* _tmp17_;
428 gchar* _tmp18_;
429 const gchar* _tmp19_;
430 gchar* _tmp20_;
431 gchar* _tmp21_;
432 _tmp11_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
433 _tmp12_ = _tmp11_;
434 _tmp13_ = vala_code_context_get_analyzer (context);
435 _tmp14_ = _tmp13_;
436 _tmp15_ = vala_semantic_analyzer_get_current_symbol (_tmp14_);
437 _tmp16_ = _tmp15_;
438 _tmp17_ = vala_symbol_get_full_name (_tmp16_);
439 _tmp18_ = _tmp17_;
440 _tmp19_ = self->priv->_class_name;
441 _tmp20_ = g_strdup_printf ("missing return type in method `%s.%s´", _tmp18_, _tmp19_);
442 _tmp21_ = _tmp20_;
443 vala_report_error (_tmp12_, _tmp21_);
444 _g_free0 (_tmp21_);
445 _g_free0 (_tmp18_);
446 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
447 result = FALSE;
448 return result;
449 }
450 _tmp22_ = vala_method_get_this_parameter ((ValaMethod*) self);
451 _tmp23_ = _tmp22_;
452 if (_tmp23_ != NULL) {
453 ValaParameter* _tmp24_;
454 ValaParameter* _tmp25_;
455 _tmp24_ = vala_method_get_this_parameter ((ValaMethod*) self);
456 _tmp25_ = _tmp24_;
457 vala_code_node_check ((ValaCodeNode*) _tmp25_, context);
458 }
459 _tmp26_ = vala_code_context_get_analyzer (context);
460 _tmp27_ = _tmp26_;
461 _tmp28_ = vala_semantic_analyzer_get_current_source_file (_tmp27_);
462 _tmp29_ = _tmp28_;
463 _tmp30_ = _vala_source_file_ref0 (_tmp29_);
464 old_source_file = _tmp30_;
465 _tmp31_ = vala_code_context_get_analyzer (context);
466 _tmp32_ = _tmp31_;
467 _tmp33_ = vala_semantic_analyzer_get_current_symbol (_tmp32_);
468 _tmp34_ = _tmp33_;
469 _tmp35_ = _vala_code_node_ref0 (_tmp34_);
470 old_symbol = _tmp35_;
471 _tmp36_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
472 _tmp37_ = _tmp36_;
473 if (_tmp37_ != NULL) {
474 ValaSemanticAnalyzer* _tmp38_;
475 ValaSemanticAnalyzer* _tmp39_;
476 ValaSourceReference* _tmp40_;
477 ValaSourceReference* _tmp41_;
478 ValaSourceFile* _tmp42_;
479 ValaSourceFile* _tmp43_;
480 _tmp38_ = vala_code_context_get_analyzer (context);
481 _tmp39_ = _tmp38_;
482 _tmp40_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
483 _tmp41_ = _tmp40_;
484 _tmp42_ = vala_source_reference_get_file (_tmp41_);
485 _tmp43_ = _tmp42_;
486 vala_semantic_analyzer_set_current_source_file (_tmp39_, _tmp43_);
487 }
488 _tmp44_ = vala_code_context_get_analyzer (context);
489 _tmp45_ = _tmp44_;
490 vala_semantic_analyzer_set_current_symbol (_tmp45_, (ValaSymbol*) self);
491 i = 0;
492 {
493 ValaList* _param_list = NULL;
494 ValaList* _tmp46_;
495 ValaList* _tmp47_;
496 gint _param_size = 0;
497 ValaList* _tmp48_;
498 gint _tmp49_;
499 gint _tmp50_;
500 gint _param_index = 0;
501 _tmp46_ = vala_callable_get_parameters ((ValaCallable*) self);
502 _tmp47_ = _vala_iterable_ref0 (_tmp46_);
503 _param_list = _tmp47_;
504 _tmp48_ = _param_list;
505 _tmp49_ = vala_collection_get_size ((ValaCollection*) _tmp48_);
506 _tmp50_ = _tmp49_;
507 _param_size = _tmp50_;
508 _param_index = -1;
509 while (TRUE) {
510 gint _tmp51_;
511 gint _tmp52_;
512 ValaParameter* param = NULL;
513 ValaList* _tmp53_;
514 gpointer _tmp54_;
515 ValaParameter* _tmp55_;
516 gboolean _tmp56_ = FALSE;
517 gboolean _tmp57_ = FALSE;
518 gint _tmp66_;
519 gboolean _tmp67_ = FALSE;
520 ValaParameter* _tmp68_;
521 gboolean _tmp69_;
522 gboolean _tmp70_;
523 _param_index = _param_index + 1;
524 _tmp51_ = _param_index;
525 _tmp52_ = _param_size;
526 if (!(_tmp51_ < _tmp52_)) {
527 break;
528 }
529 _tmp53_ = _param_list;
530 _tmp54_ = vala_list_get (_tmp53_, _param_index);
531 param = (ValaParameter*) _tmp54_;
532 _tmp55_ = param;
533 if (!vala_code_node_check ((ValaCodeNode*) _tmp55_, context)) {
534 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
535 }
536 if (i == 0) {
537 ValaParameter* _tmp58_;
538 gboolean _tmp59_;
539 gboolean _tmp60_;
540 _tmp58_ = param;
541 _tmp59_ = vala_parameter_get_ellipsis (_tmp58_);
542 _tmp60_ = _tmp59_;
543 _tmp57_ = _tmp60_;
544 } else {
545 _tmp57_ = FALSE;
546 }
547 if (_tmp57_) {
548 ValaBlock* _tmp61_;
549 ValaBlock* _tmp62_;
550 _tmp61_ = vala_subroutine_get_body ((ValaSubroutine*) self);
551 _tmp62_ = _tmp61_;
552 _tmp56_ = _tmp62_ != NULL;
553 } else {
554 _tmp56_ = FALSE;
555 }
556 if (_tmp56_) {
557 ValaParameter* _tmp63_;
558 ValaSourceReference* _tmp64_;
559 ValaSourceReference* _tmp65_;
560 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
561 _tmp63_ = param;
562 _tmp64_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp63_);
563 _tmp65_ = _tmp64_;
564 vala_report_error (_tmp65_, "Named parameter required before `...'");
565 }
566 _tmp66_ = i;
567 i = _tmp66_ + 1;
568 _tmp68_ = param;
569 _tmp69_ = vala_parameter_get_params_array (_tmp68_);
570 _tmp70_ = _tmp69_;
571 if (_tmp70_) {
572 ValaBlock* _tmp71_;
573 ValaBlock* _tmp72_;
574 _tmp71_ = vala_subroutine_get_body ((ValaSubroutine*) self);
575 _tmp72_ = _tmp71_;
576 _tmp67_ = _tmp72_ != NULL;
577 } else {
578 _tmp67_ = FALSE;
579 }
580 if (_tmp67_) {
581 ValaLocalVariable* _tmp73_;
582 ValaLocalVariable* _tmp74_;
583 gboolean _tmp78_;
584 gboolean _tmp79_;
585 ValaArrayType* type = NULL;
586 ValaParameter* _tmp83_;
587 ValaDataType* _tmp84_;
588 ValaDataType* _tmp85_;
589 ValaDataType* _tmp86_;
590 ValaArrayType* _tmp87_;
591 ValaDataType* _tmp88_;
592 ValaDataType* _tmp89_;
593 ValaArrayType* _tmp90_;
594 gboolean _tmp91_;
595 gboolean _tmp92_;
596 ValaArrayType* _tmp93_;
597 gboolean _tmp94_ = FALSE;
598 ValaArrayType* _tmp95_;
599 ValaDataType* _tmp96_;
600 ValaDataType* _tmp97_;
601 ValaArrayType* _tmp106_;
602 ValaExpression* _tmp107_;
603 ValaExpression* _tmp108_;
604 ValaArrayType* _tmp112_;
605 ValaParameter* _tmp113_;
606 const gchar* _tmp114_;
607 const gchar* _tmp115_;
608 ValaParameter* _tmp116_;
609 ValaSourceReference* _tmp117_;
610 ValaSourceReference* _tmp118_;
611 ValaLocalVariable* _tmp119_;
612 ValaLocalVariable* _tmp120_;
613 ValaBlock* _tmp121_;
614 ValaBlock* _tmp122_;
615 ValaLocalVariable* _tmp123_;
616 ValaLocalVariable* _tmp124_;
617 ValaParameter* _tmp125_;
618 ValaSourceReference* _tmp126_;
619 ValaSourceReference* _tmp127_;
620 ValaDeclarationStatement* _tmp128_;
621 ValaDeclarationStatement* _tmp129_;
622 _tmp73_ = vala_method_get_params_array_var ((ValaMethod*) self);
623 _tmp74_ = _tmp73_;
624 if (_tmp74_ != NULL) {
625 ValaParameter* _tmp75_;
626 ValaSourceReference* _tmp76_;
627 ValaSourceReference* _tmp77_;
628 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
629 _tmp75_ = param;
630 _tmp76_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp75_);
631 _tmp77_ = _tmp76_;
632 vala_report_error (_tmp77_, "Only one params-array parameter is allowed");
633 _vala_code_node_unref0 (param);
634 continue;
635 }
636 _tmp78_ = vala_code_context_get_experimental (context);
637 _tmp79_ = _tmp78_;
638 if (!_tmp79_) {
639 ValaParameter* _tmp80_;
640 ValaSourceReference* _tmp81_;
641 ValaSourceReference* _tmp82_;
642 _tmp80_ = param;
643 _tmp81_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp80_);
644 _tmp82_ = _tmp81_;
645 vala_report_warning (_tmp82_, "Support of params-arrays is experimental");
646 }
647 _tmp83_ = param;
648 _tmp84_ = vala_variable_get_variable_type ((ValaVariable*) _tmp83_);
649 _tmp85_ = _tmp84_;
650 _tmp86_ = vala_data_type_copy (_tmp85_);
651 type = G_TYPE_CHECK_INSTANCE_CAST (_tmp86_, VALA_TYPE_ARRAY_TYPE, ValaArrayType);
652 _tmp87_ = type;
653 _tmp88_ = vala_array_type_get_element_type (_tmp87_);
654 _tmp89_ = _tmp88_;
655 _tmp90_ = type;
656 _tmp91_ = vala_data_type_get_value_owned ((ValaDataType*) _tmp90_);
657 _tmp92_ = _tmp91_;
658 vala_data_type_set_value_owned (_tmp89_, _tmp92_);
659 _tmp93_ = type;
660 vala_data_type_set_value_owned ((ValaDataType*) _tmp93_, TRUE);
661 _tmp95_ = type;
662 _tmp96_ = vala_array_type_get_element_type (_tmp95_);
663 _tmp97_ = _tmp96_;
664 if (vala_data_type_is_real_struct_type (_tmp97_)) {
665 ValaArrayType* _tmp98_;
666 ValaDataType* _tmp99_;
667 ValaDataType* _tmp100_;
668 gboolean _tmp101_;
669 gboolean _tmp102_;
670 _tmp98_ = type;
671 _tmp99_ = vala_array_type_get_element_type (_tmp98_);
672 _tmp100_ = _tmp99_;
673 _tmp101_ = vala_data_type_get_nullable (_tmp100_);
674 _tmp102_ = _tmp101_;
675 _tmp94_ = !_tmp102_;
676 } else {
677 _tmp94_ = FALSE;
678 }
679 if (_tmp94_) {
680 ValaParameter* _tmp103_;
681 ValaSourceReference* _tmp104_;
682 ValaSourceReference* _tmp105_;
683 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
684 _tmp103_ = param;
685 _tmp104_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp103_);
686 _tmp105_ = _tmp104_;
687 vala_report_error (_tmp105_, "Only nullable struct elements are supported in params-array");
688 }
689 _tmp106_ = type;
690 _tmp107_ = vala_array_type_get_length (_tmp106_);
691 _tmp108_ = _tmp107_;
692 if (_tmp108_ != NULL) {
693 ValaParameter* _tmp109_;
694 ValaSourceReference* _tmp110_;
695 ValaSourceReference* _tmp111_;
696 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
697 _tmp109_ = param;
698 _tmp110_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp109_);
699 _tmp111_ = _tmp110_;
700 vala_report_error (_tmp111_, "Passing length to params-array is not supported yet");
701 }
702 _tmp112_ = type;
703 _tmp113_ = param;
704 _tmp114_ = vala_symbol_get_name ((ValaSymbol*) _tmp113_);
705 _tmp115_ = _tmp114_;
706 _tmp116_ = param;
707 _tmp117_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp116_);
708 _tmp118_ = _tmp117_;
709 _tmp119_ = vala_local_variable_new ((ValaDataType*) _tmp112_, _tmp115_, NULL, _tmp118_);
710 _tmp120_ = _tmp119_;
711 vala_method_set_params_array_var ((ValaMethod*) self, _tmp120_);
712 _vala_code_node_unref0 (_tmp120_);
713 _tmp121_ = vala_subroutine_get_body ((ValaSubroutine*) self);
714 _tmp122_ = _tmp121_;
715 _tmp123_ = vala_method_get_params_array_var ((ValaMethod*) self);
716 _tmp124_ = _tmp123_;
717 _tmp125_ = param;
718 _tmp126_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp125_);
719 _tmp127_ = _tmp126_;
720 _tmp128_ = vala_declaration_statement_new ((ValaSymbol*) _tmp124_, _tmp127_);
721 _tmp129_ = _tmp128_;
722 vala_block_insert_statement (_tmp122_, 0, (ValaStatement*) _tmp129_);
723 _vala_code_node_unref0 (_tmp129_);
724 _vala_code_node_unref0 (type);
725 }
726 _vala_code_node_unref0 (param);
727 }
728 _vala_iterable_unref0 (_param_list);
729 }
730 _tmp130_ = ((ValaMethod*) self)->error_types;
731 if (_tmp130_ != NULL) {
732 {
733 ValaList* _error_type_list = NULL;
734 ValaList* _tmp131_;
735 ValaList* _tmp132_;
736 gint _error_type_size = 0;
737 ValaList* _tmp133_;
738 gint _tmp134_;
739 gint _tmp135_;
740 gint _error_type_index = 0;
741 _tmp131_ = ((ValaMethod*) self)->error_types;
742 _tmp132_ = _vala_iterable_ref0 (_tmp131_);
743 _error_type_list = _tmp132_;
744 _tmp133_ = _error_type_list;
745 _tmp134_ = vala_collection_get_size ((ValaCollection*) _tmp133_);
746 _tmp135_ = _tmp134_;
747 _error_type_size = _tmp135_;
748 _error_type_index = -1;
749 while (TRUE) {
750 gint _tmp136_;
751 gint _tmp137_;
752 ValaDataType* error_type = NULL;
753 ValaList* _tmp138_;
754 gpointer _tmp139_;
755 ValaDataType* _tmp140_;
756 ValaSemanticAnalyzer* _tmp141_;
757 ValaSemanticAnalyzer* _tmp142_;
758 ValaDataType* _tmp143_;
759 _error_type_index = _error_type_index + 1;
760 _tmp136_ = _error_type_index;
761 _tmp137_ = _error_type_size;
762 if (!(_tmp136_ < _tmp137_)) {
763 break;
764 }
765 _tmp138_ = _error_type_list;
766 _tmp139_ = vala_list_get (_tmp138_, _error_type_index);
767 error_type = (ValaDataType*) _tmp139_;
768 _tmp140_ = error_type;
769 vala_code_node_check ((ValaCodeNode*) _tmp140_, context);
770 _tmp141_ = vala_code_context_get_analyzer (context);
771 _tmp142_ = _tmp141_;
772 _tmp143_ = error_type;
773 if (!vala_semantic_analyzer_is_type_accessible (_tmp142_, (ValaSymbol*) self, _tmp143_)) {
774 ValaSourceReference* _tmp144_;
775 ValaSourceReference* _tmp145_;
776 ValaDataType* _tmp146_;
777 gchar* _tmp147_;
778 gchar* _tmp148_;
779 gchar* _tmp149_;
780 gchar* _tmp150_;
781 gchar* _tmp151_;
782 gchar* _tmp152_;
783 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
784 _tmp144_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
785 _tmp145_ = _tmp144_;
786 _tmp146_ = error_type;
787 _tmp147_ = vala_code_node_to_string ((ValaCodeNode*) _tmp146_);
788 _tmp148_ = _tmp147_;
789 _tmp149_ = vala_symbol_get_full_name ((ValaSymbol*) self);
790 _tmp150_ = _tmp149_;
791 _tmp151_ = g_strdup_printf ("error type `%s' is less accessible than creation method `%s'", _tmp148_, _tmp150_);
792 _tmp152_ = _tmp151_;
793 vala_report_error (_tmp145_, _tmp152_);
794 _g_free0 (_tmp152_);
795 _g_free0 (_tmp150_);
796 _g_free0 (_tmp148_);
797 result = FALSE;
798 _vala_code_node_unref0 (error_type);
799 _vala_iterable_unref0 (_error_type_list);
800 _vala_code_node_unref0 (old_symbol);
801 _vala_source_file_unref0 (old_source_file);
802 return result;
803 }
804 _vala_code_node_unref0 (error_type);
805 }
806 _vala_iterable_unref0 (_error_type_list);
807 }
808 }
809 {
810 ValaList* _precondition_list = NULL;
811 ValaList* _tmp153_;
812 ValaList* _tmp154_;
813 gint _precondition_size = 0;
814 ValaList* _tmp155_;
815 gint _tmp156_;
816 gint _tmp157_;
817 gint _precondition_index = 0;
818 _tmp153_ = vala_method_get_preconditions ((ValaMethod*) self);
819 _tmp154_ = _vala_iterable_ref0 (_tmp153_);
820 _precondition_list = _tmp154_;
821 _tmp155_ = _precondition_list;
822 _tmp156_ = vala_collection_get_size ((ValaCollection*) _tmp155_);
823 _tmp157_ = _tmp156_;
824 _precondition_size = _tmp157_;
825 _precondition_index = -1;
826 while (TRUE) {
827 gint _tmp158_;
828 gint _tmp159_;
829 ValaExpression* precondition = NULL;
830 ValaList* _tmp160_;
831 gpointer _tmp161_;
832 ValaExpression* _tmp162_;
833 _precondition_index = _precondition_index + 1;
834 _tmp158_ = _precondition_index;
835 _tmp159_ = _precondition_size;
836 if (!(_tmp158_ < _tmp159_)) {
837 break;
838 }
839 _tmp160_ = _precondition_list;
840 _tmp161_ = vala_list_get (_tmp160_, _precondition_index);
841 precondition = (ValaExpression*) _tmp161_;
842 _tmp162_ = precondition;
843 vala_code_node_check ((ValaCodeNode*) _tmp162_, context);
844 _vala_code_node_unref0 (precondition);
845 }
846 _vala_iterable_unref0 (_precondition_list);
847 }
848 {
849 ValaList* _postcondition_list = NULL;
850 ValaList* _tmp163_;
851 ValaList* _tmp164_;
852 gint _postcondition_size = 0;
853 ValaList* _tmp165_;
854 gint _tmp166_;
855 gint _tmp167_;
856 gint _postcondition_index = 0;
857 _tmp163_ = vala_method_get_postconditions ((ValaMethod*) self);
858 _tmp164_ = _vala_iterable_ref0 (_tmp163_);
859 _postcondition_list = _tmp164_;
860 _tmp165_ = _postcondition_list;
861 _tmp166_ = vala_collection_get_size ((ValaCollection*) _tmp165_);
862 _tmp167_ = _tmp166_;
863 _postcondition_size = _tmp167_;
864 _postcondition_index = -1;
865 while (TRUE) {
866 gint _tmp168_;
867 gint _tmp169_;
868 ValaExpression* postcondition = NULL;
869 ValaList* _tmp170_;
870 gpointer _tmp171_;
871 ValaExpression* _tmp172_;
872 _postcondition_index = _postcondition_index + 1;
873 _tmp168_ = _postcondition_index;
874 _tmp169_ = _postcondition_size;
875 if (!(_tmp168_ < _tmp169_)) {
876 break;
877 }
878 _tmp170_ = _postcondition_list;
879 _tmp171_ = vala_list_get (_tmp170_, _postcondition_index);
880 postcondition = (ValaExpression*) _tmp171_;
881 _tmp172_ = postcondition;
882 vala_code_node_check ((ValaCodeNode*) _tmp172_, context);
883 _vala_code_node_unref0 (postcondition);
884 }
885 _vala_iterable_unref0 (_postcondition_list);
886 }
887 _tmp173_ = vala_subroutine_get_body ((ValaSubroutine*) self);
888 _tmp174_ = _tmp173_;
889 if (_tmp174_ != NULL) {
890 ValaBlock* _tmp175_;
891 ValaBlock* _tmp176_;
892 ValaClass* cl = NULL;
893 ValaSymbol* _tmp177_;
894 ValaSymbol* _tmp178_;
895 gboolean _tmp179_ = FALSE;
896 gboolean _tmp180_ = FALSE;
897 gboolean _tmp181_;
898 _tmp175_ = vala_subroutine_get_body ((ValaSubroutine*) self);
899 _tmp176_ = _tmp175_;
900 vala_code_node_check ((ValaCodeNode*) _tmp176_, context);
901 _tmp177_ = vala_symbol_get_parent_symbol ((ValaSymbol*) self);
902 _tmp178_ = _tmp177_;
903 cl = VALA_IS_CLASS (_tmp178_) ? ((ValaClass*) _tmp178_) : NULL;
904 _tmp181_ = self->priv->_chain_up;
905 if (!_tmp181_) {
906 ValaClass* _tmp182_;
907 _tmp182_ = cl;
908 _tmp180_ = _tmp182_ != NULL;
909 } else {
910 _tmp180_ = FALSE;
911 }
912 if (_tmp180_) {
913 ValaClass* _tmp183_;
914 ValaClass* _tmp184_;
915 ValaClass* _tmp185_;
916 _tmp183_ = cl;
917 _tmp184_ = vala_class_get_base_class (_tmp183_);
918 _tmp185_ = _tmp184_;
919 _tmp179_ = _tmp185_ != NULL;
920 } else {
921 _tmp179_ = FALSE;
922 }
923 if (_tmp179_) {
924 gboolean _tmp186_ = FALSE;
925 gboolean _tmp187_ = FALSE;
926 ValaProfile _tmp188_;
927 ValaProfile _tmp189_;
928 _tmp188_ = vala_code_context_get_profile (context);
929 _tmp189_ = _tmp188_;
930 if (_tmp189_ == VALA_PROFILE_GOBJECT) {
931 ValaClass* _tmp190_;
932 ValaClass* _tmp191_;
933 ValaClass* _tmp192_;
934 ValaCreationMethod* _tmp193_;
935 ValaCreationMethod* _tmp194_;
936 _tmp190_ = cl;
937 _tmp191_ = vala_class_get_base_class (_tmp190_);
938 _tmp192_ = _tmp191_;
939 _tmp193_ = vala_class_get_default_construction_method (_tmp192_);
940 _tmp194_ = _tmp193_;
941 _tmp187_ = _tmp194_ != NULL;
942 } else {
943 _tmp187_ = FALSE;
944 }
945 if (_tmp187_) {
946 ValaClass* _tmp195_;
947 ValaClass* _tmp196_;
948 ValaClass* _tmp197_;
949 ValaCreationMethod* _tmp198_;
950 ValaCreationMethod* _tmp199_;
951 gboolean _tmp200_;
952 gboolean _tmp201_;
953 _tmp195_ = cl;
954 _tmp196_ = vala_class_get_base_class (_tmp195_);
955 _tmp197_ = _tmp196_;
956 _tmp198_ = vala_class_get_default_construction_method (_tmp197_);
957 _tmp199_ = _tmp198_;
958 _tmp200_ = vala_method_get_has_construct_function ((ValaMethod*) _tmp199_);
959 _tmp201_ = _tmp200_;
960 _tmp186_ = !_tmp201_;
961 } else {
962 _tmp186_ = FALSE;
963 }
964 if (_tmp186_) {
965 ValaBlock* old_insert_block = NULL;
966 ValaSemanticAnalyzer* _tmp202_;
967 ValaSemanticAnalyzer* _tmp203_;
968 ValaBlock* _tmp204_;
969 ValaBlock* _tmp205_;
970 ValaSemanticAnalyzer* _tmp206_;
971 ValaSemanticAnalyzer* _tmp207_;
972 ValaBlock* _tmp208_;
973 ValaBlock* _tmp209_;
974 ValaSemanticAnalyzer* _tmp210_;
975 ValaSemanticAnalyzer* _tmp211_;
976 ValaBlock* _tmp212_;
977 ValaBlock* _tmp213_;
978 ValaBlock* _tmp214_;
979 ValaExpressionStatement* stmt = NULL;
980 ValaSourceReference* _tmp215_;
981 ValaSourceReference* _tmp216_;
982 ValaMemberAccess* _tmp217_;
983 ValaMemberAccess* _tmp218_;
984 ValaSourceReference* _tmp219_;
985 ValaSourceReference* _tmp220_;
986 ValaMemberAccess* _tmp221_;
987 ValaMemberAccess* _tmp222_;
988 ValaSourceReference* _tmp223_;
989 ValaSourceReference* _tmp224_;
990 ValaMethodCall* _tmp225_;
991 ValaMethodCall* _tmp226_;
992 ValaSourceReference* _tmp227_;
993 ValaSourceReference* _tmp228_;
994 ValaExpressionStatement* _tmp229_;
995 ValaExpressionStatement* _tmp230_;
996 ValaBlock* _tmp231_;
997 ValaBlock* _tmp232_;
998 ValaExpressionStatement* _tmp233_;
999 ValaExpressionStatement* _tmp234_;
1000 ValaSemanticAnalyzer* _tmp235_;
1001 ValaSemanticAnalyzer* _tmp236_;
1002 ValaSemanticAnalyzer* _tmp237_;
1003 ValaSemanticAnalyzer* _tmp238_;
1004 ValaBlock* _tmp239_;
1005 ValaBlock* _tmp240_;
1006 _tmp202_ = vala_code_context_get_analyzer (context);
1007 _tmp203_ = _tmp202_;
1008 _tmp204_ = _tmp203_->insert_block;
1009 _tmp205_ = _vala_code_node_ref0 (_tmp204_);
1010 old_insert_block = _tmp205_;
1011 _tmp206_ = vala_code_context_get_analyzer (context);
1012 _tmp207_ = _tmp206_;
1013 _tmp208_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1014 _tmp209_ = _tmp208_;
1015 vala_semantic_analyzer_set_current_symbol (_tmp207_, (ValaSymbol*) _tmp209_);
1016 _tmp210_ = vala_code_context_get_analyzer (context);
1017 _tmp211_ = _tmp210_;
1018 _tmp212_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1019 _tmp213_ = _tmp212_;
1020 _tmp214_ = _vala_code_node_ref0 (_tmp213_);
1021 _vala_code_node_unref0 (_tmp211_->insert_block);
1022 _tmp211_->insert_block = _tmp214_;
1023 _tmp215_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1024 _tmp216_ = _tmp215_;
1025 _tmp217_ = vala_member_access_new_simple ("GLib", _tmp216_);
1026 _tmp218_ = _tmp217_;
1027 _tmp219_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1028 _tmp220_ = _tmp219_;
1029 _tmp221_ = vala_member_access_new ((ValaExpression*) _tmp218_, "Object", _tmp220_);
1030 _tmp222_ = _tmp221_;
1031 _tmp223_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1032 _tmp224_ = _tmp223_;
1033 _tmp225_ = vala_method_call_new ((ValaExpression*) _tmp222_, _tmp224_);
1034 _tmp226_ = _tmp225_;
1035 _tmp227_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1036 _tmp228_ = _tmp227_;
1037 _tmp229_ = vala_expression_statement_new ((ValaExpression*) _tmp226_, _tmp228_);
1038 _tmp230_ = _tmp229_;
1039 _vala_code_node_unref0 (_tmp226_);
1040 _vala_code_node_unref0 (_tmp222_);
1041 _vala_code_node_unref0 (_tmp218_);
1042 stmt = _tmp230_;
1043 _tmp231_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1044 _tmp232_ = _tmp231_;
1045 _tmp233_ = stmt;
1046 vala_block_insert_statement (_tmp232_, 0, (ValaStatement*) _tmp233_);
1047 _tmp234_ = stmt;
1048 vala_code_node_check ((ValaCodeNode*) _tmp234_, context);
1049 _tmp235_ = vala_code_context_get_analyzer (context);
1050 _tmp236_ = _tmp235_;
1051 vala_semantic_analyzer_set_current_symbol (_tmp236_, (ValaSymbol*) self);
1052 _tmp237_ = vala_code_context_get_analyzer (context);
1053 _tmp238_ = _tmp237_;
1054 _tmp239_ = old_insert_block;
1055 _tmp240_ = _vala_code_node_ref0 (_tmp239_);
1056 _vala_code_node_unref0 (_tmp238_->insert_block);
1057 _tmp238_->insert_block = _tmp240_;
1058 _vala_code_node_unref0 (stmt);
1059 _vala_code_node_unref0 (old_insert_block);
1060 } else {
1061 gboolean _tmp241_ = FALSE;
1062 ValaClass* _tmp242_;
1063 ValaClass* _tmp243_;
1064 ValaClass* _tmp244_;
1065 ValaCreationMethod* _tmp245_;
1066 ValaCreationMethod* _tmp246_;
1067 _tmp242_ = cl;
1068 _tmp243_ = vala_class_get_base_class (_tmp242_);
1069 _tmp244_ = _tmp243_;
1070 _tmp245_ = vala_class_get_default_construction_method (_tmp244_);
1071 _tmp246_ = _tmp245_;
1072 if (_tmp246_ == NULL) {
1073 _tmp241_ = TRUE;
1074 } else {
1075 ValaClass* _tmp247_;
1076 ValaClass* _tmp248_;
1077 ValaClass* _tmp249_;
1078 ValaCreationMethod* _tmp250_;
1079 ValaCreationMethod* _tmp251_;
1080 ValaSymbolAccessibility _tmp252_;
1081 ValaSymbolAccessibility _tmp253_;
1082 _tmp247_ = cl;
1083 _tmp248_ = vala_class_get_base_class (_tmp247_);
1084 _tmp249_ = _tmp248_;
1085 _tmp250_ = vala_class_get_default_construction_method (_tmp249_);
1086 _tmp251_ = _tmp250_;
1087 _tmp252_ = vala_symbol_get_access ((ValaSymbol*) _tmp251_);
1088 _tmp253_ = _tmp252_;
1089 _tmp241_ = _tmp253_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE;
1090 }
1091 if (_tmp241_) {
1092 ValaSourceReference* _tmp254_;
1093 ValaSourceReference* _tmp255_;
1094 _tmp254_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1095 _tmp255_ = _tmp254_;
1096 vala_report_error (_tmp255_, "unable to chain up to private base constructor");
1097 } else {
1098 ValaClass* _tmp256_;
1099 ValaClass* _tmp257_;
1100 ValaClass* _tmp258_;
1101 ValaCreationMethod* _tmp259_;
1102 ValaCreationMethod* _tmp260_;
1103 _tmp256_ = cl;
1104 _tmp257_ = vala_class_get_base_class (_tmp256_);
1105 _tmp258_ = _tmp257_;
1106 _tmp259_ = vala_class_get_default_construction_method (_tmp258_);
1107 _tmp260_ = _tmp259_;
1108 if (vala_method_get_required_arguments ((ValaMethod*) _tmp260_) > 0) {
1109 ValaSourceReference* _tmp261_;
1110 ValaSourceReference* _tmp262_;
1111 _tmp261_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1112 _tmp262_ = _tmp261_;
1113 vala_report_error (_tmp262_, "unable to chain up to base constructor requiring arguments");
1114 } else {
1115 ValaBlock* old_insert_block = NULL;
1116 ValaSemanticAnalyzer* _tmp263_;
1117 ValaSemanticAnalyzer* _tmp264_;
1118 ValaBlock* _tmp265_;
1119 ValaBlock* _tmp266_;
1120 ValaSemanticAnalyzer* _tmp267_;
1121 ValaSemanticAnalyzer* _tmp268_;
1122 ValaBlock* _tmp269_;
1123 ValaBlock* _tmp270_;
1124 ValaSemanticAnalyzer* _tmp271_;
1125 ValaSemanticAnalyzer* _tmp272_;
1126 ValaBlock* _tmp273_;
1127 ValaBlock* _tmp274_;
1128 ValaBlock* _tmp275_;
1129 ValaExpressionStatement* stmt = NULL;
1130 ValaSourceReference* _tmp276_;
1131 ValaSourceReference* _tmp277_;
1132 ValaBaseAccess* _tmp278_;
1133 ValaBaseAccess* _tmp279_;
1134 ValaSourceReference* _tmp280_;
1135 ValaSourceReference* _tmp281_;
1136 ValaMethodCall* _tmp282_;
1137 ValaMethodCall* _tmp283_;
1138 ValaSourceReference* _tmp284_;
1139 ValaSourceReference* _tmp285_;
1140 ValaExpressionStatement* _tmp286_;
1141 ValaExpressionStatement* _tmp287_;
1142 ValaBlock* _tmp288_;
1143 ValaBlock* _tmp289_;
1144 ValaExpressionStatement* _tmp290_;
1145 ValaExpressionStatement* _tmp291_;
1146 ValaSemanticAnalyzer* _tmp292_;
1147 ValaSemanticAnalyzer* _tmp293_;
1148 ValaSemanticAnalyzer* _tmp294_;
1149 ValaSemanticAnalyzer* _tmp295_;
1150 ValaBlock* _tmp296_;
1151 ValaBlock* _tmp297_;
1152 _tmp263_ = vala_code_context_get_analyzer (context);
1153 _tmp264_ = _tmp263_;
1154 _tmp265_ = _tmp264_->insert_block;
1155 _tmp266_ = _vala_code_node_ref0 (_tmp265_);
1156 old_insert_block = _tmp266_;
1157 _tmp267_ = vala_code_context_get_analyzer (context);
1158 _tmp268_ = _tmp267_;
1159 _tmp269_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1160 _tmp270_ = _tmp269_;
1161 vala_semantic_analyzer_set_current_symbol (_tmp268_, (ValaSymbol*) _tmp270_);
1162 _tmp271_ = vala_code_context_get_analyzer (context);
1163 _tmp272_ = _tmp271_;
1164 _tmp273_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1165 _tmp274_ = _tmp273_;
1166 _tmp275_ = _vala_code_node_ref0 (_tmp274_);
1167 _vala_code_node_unref0 (_tmp272_->insert_block);
1168 _tmp272_->insert_block = _tmp275_;
1169 _tmp276_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1170 _tmp277_ = _tmp276_;
1171 _tmp278_ = vala_base_access_new (_tmp277_);
1172 _tmp279_ = _tmp278_;
1173 _tmp280_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1174 _tmp281_ = _tmp280_;
1175 _tmp282_ = vala_method_call_new ((ValaExpression*) _tmp279_, _tmp281_);
1176 _tmp283_ = _tmp282_;
1177 _tmp284_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1178 _tmp285_ = _tmp284_;
1179 _tmp286_ = vala_expression_statement_new ((ValaExpression*) _tmp283_, _tmp285_);
1180 _tmp287_ = _tmp286_;
1181 _vala_code_node_unref0 (_tmp283_);
1182 _vala_code_node_unref0 (_tmp279_);
1183 stmt = _tmp287_;
1184 _tmp288_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1185 _tmp289_ = _tmp288_;
1186 _tmp290_ = stmt;
1187 vala_block_insert_statement (_tmp289_, 0, (ValaStatement*) _tmp290_);
1188 _tmp291_ = stmt;
1189 vala_code_node_check ((ValaCodeNode*) _tmp291_, context);
1190 _tmp292_ = vala_code_context_get_analyzer (context);
1191 _tmp293_ = _tmp292_;
1192 vala_semantic_analyzer_set_current_symbol (_tmp293_, (ValaSymbol*) self);
1193 _tmp294_ = vala_code_context_get_analyzer (context);
1194 _tmp295_ = _tmp294_;
1195 _tmp296_ = old_insert_block;
1196 _tmp297_ = _vala_code_node_ref0 (_tmp296_);
1197 _vala_code_node_unref0 (_tmp295_->insert_block);
1198 _tmp295_->insert_block = _tmp297_;
1199 _vala_code_node_unref0 (stmt);
1200 _vala_code_node_unref0 (old_insert_block);
1201 }
1202 }
1203 }
1204 }
1205 }
1206 _tmp298_ = vala_code_context_get_analyzer (context);
1207 _tmp299_ = _tmp298_;
1208 _tmp300_ = old_source_file;
1209 vala_semantic_analyzer_set_current_source_file (_tmp299_, _tmp300_);
1210 _tmp301_ = vala_code_context_get_analyzer (context);
1211 _tmp302_ = _tmp301_;
1212 _tmp303_ = old_symbol;
1213 vala_semantic_analyzer_set_current_symbol (_tmp302_, _tmp303_);
1214 _tmp306_ = vala_method_get_is_abstract ((ValaMethod*) self);
1215 _tmp307_ = _tmp306_;
1216 if (_tmp307_) {
1217 _tmp305_ = TRUE;
1218 } else {
1219 gboolean _tmp308_;
1220 gboolean _tmp309_;
1221 _tmp308_ = vala_method_get_is_virtual ((ValaMethod*) self);
1222 _tmp309_ = _tmp308_;
1223 _tmp305_ = _tmp309_;
1224 }
1225 if (_tmp305_) {
1226 _tmp304_ = TRUE;
1227 } else {
1228 gboolean _tmp310_;
1229 gboolean _tmp311_;
1230 _tmp310_ = vala_method_get_overrides ((ValaMethod*) self);
1231 _tmp311_ = _tmp310_;
1232 _tmp304_ = _tmp311_;
1233 }
1234 if (_tmp304_) {
1235 ValaSourceReference* _tmp312_;
1236 ValaSourceReference* _tmp313_;
1237 gchar* _tmp314_;
1238 gchar* _tmp315_;
1239 gchar* _tmp316_;
1240 gchar* _tmp317_;
1241 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1242 _tmp312_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1243 _tmp313_ = _tmp312_;
1244 _tmp314_ = vala_symbol_get_full_name ((ValaSymbol*) self);
1245 _tmp315_ = _tmp314_;
1246 _tmp316_ = g_strdup_printf ("The creation method `%s' cannot be marked as override, virtual, or abs" \
1247 "tract", _tmp315_);
1248 _tmp317_ = _tmp316_;
1249 vala_report_error (_tmp313_, _tmp317_);
1250 _g_free0 (_tmp317_);
1251 _g_free0 (_tmp315_);
1252 result = FALSE;
1253 _vala_code_node_unref0 (old_symbol);
1254 _vala_source_file_unref0 (old_source_file);
1255 return result;
1256 }
1257 _tmp319_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1258 _tmp320_ = _tmp319_;
1259 if (_tmp320_ != NULL) {
1260 ValaBlock* _tmp321_;
1261 ValaBlock* _tmp322_;
1262 gboolean _tmp323_;
1263 gboolean _tmp324_;
1264 _tmp321_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1265 _tmp322_ = _tmp321_;
1266 _tmp323_ = vala_code_node_get_error ((ValaCodeNode*) _tmp322_);
1267 _tmp324_ = _tmp323_;
1268 _tmp318_ = !_tmp324_;
1269 } else {
1270 _tmp318_ = FALSE;
1271 }
1272 if (_tmp318_) {
1273 ValaArrayList* body_errors = NULL;
1274 GEqualFunc _tmp325_;
1275 ValaArrayList* _tmp326_;
1276 ValaBlock* _tmp327_;
1277 ValaBlock* _tmp328_;
1278 ValaArrayList* _tmp329_;
1279 _tmp325_ = g_direct_equal;
1280 _tmp326_ = vala_array_list_new (VALA_TYPE_DATA_TYPE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp325_);
1281 body_errors = _tmp326_;
1282 _tmp327_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1283 _tmp328_ = _tmp327_;
1284 _tmp329_ = body_errors;
1285 vala_code_node_get_error_types ((ValaCodeNode*) _tmp328_, (ValaCollection*) _tmp329_, NULL);
1286 {
1287 ValaArrayList* _body_error_type_list = NULL;
1288 ValaArrayList* _tmp330_;
1289 ValaArrayList* _tmp331_;
1290 gint _body_error_type_size = 0;
1291 ValaArrayList* _tmp332_;
1292 gint _tmp333_;
1293 gint _tmp334_;
1294 gint _body_error_type_index = 0;
1295 _tmp330_ = body_errors;
1296 _tmp331_ = _vala_iterable_ref0 (_tmp330_);
1297 _body_error_type_list = _tmp331_;
1298 _tmp332_ = _body_error_type_list;
1299 _tmp333_ = vala_collection_get_size ((ValaCollection*) _tmp332_);
1300 _tmp334_ = _tmp333_;
1301 _body_error_type_size = _tmp334_;
1302 _body_error_type_index = -1;
1303 while (TRUE) {
1304 gint _tmp335_;
1305 gint _tmp336_;
1306 ValaDataType* body_error_type = NULL;
1307 ValaArrayList* _tmp337_;
1308 gpointer _tmp338_;
1309 gboolean can_propagate_error = FALSE;
1310 ValaList* _tmp339_;
1311 gboolean _tmp351_ = FALSE;
1312 _body_error_type_index = _body_error_type_index + 1;
1313 _tmp335_ = _body_error_type_index;
1314 _tmp336_ = _body_error_type_size;
1315 if (!(_tmp335_ < _tmp336_)) {
1316 break;
1317 }
1318 _tmp337_ = _body_error_type_list;
1319 _tmp338_ = vala_list_get ((ValaList*) _tmp337_, _body_error_type_index);
1320 body_error_type = (ValaDataType*) _tmp338_;
1321 can_propagate_error = FALSE;
1322 _tmp339_ = ((ValaMethod*) self)->error_types;
1323 if (_tmp339_ != NULL) {
1324 {
1325 ValaList* _method_error_type_list = NULL;
1326 ValaList* _tmp340_;
1327 ValaList* _tmp341_;
1328 gint _method_error_type_size = 0;
1329 ValaList* _tmp342_;
1330 gint _tmp343_;
1331 gint _tmp344_;
1332 gint _method_error_type_index = 0;
1333 _tmp340_ = ((ValaMethod*) self)->error_types;
1334 _tmp341_ = _vala_iterable_ref0 (_tmp340_);
1335 _method_error_type_list = _tmp341_;
1336 _tmp342_ = _method_error_type_list;
1337 _tmp343_ = vala_collection_get_size ((ValaCollection*) _tmp342_);
1338 _tmp344_ = _tmp343_;
1339 _method_error_type_size = _tmp344_;
1340 _method_error_type_index = -1;
1341 while (TRUE) {
1342 gint _tmp345_;
1343 gint _tmp346_;
1344 ValaDataType* method_error_type = NULL;
1345 ValaList* _tmp347_;
1346 gpointer _tmp348_;
1347 ValaDataType* _tmp349_;
1348 ValaDataType* _tmp350_;
1349 _method_error_type_index = _method_error_type_index + 1;
1350 _tmp345_ = _method_error_type_index;
1351 _tmp346_ = _method_error_type_size;
1352 if (!(_tmp345_ < _tmp346_)) {
1353 break;
1354 }
1355 _tmp347_ = _method_error_type_list;
1356 _tmp348_ = vala_list_get (_tmp347_, _method_error_type_index);
1357 method_error_type = (ValaDataType*) _tmp348_;
1358 _tmp349_ = body_error_type;
1359 _tmp350_ = method_error_type;
1360 if (vala_data_type_compatible (_tmp349_, _tmp350_)) {
1361 can_propagate_error = TRUE;
1362 }
1363 _vala_code_node_unref0 (method_error_type);
1364 }
1365 _vala_iterable_unref0 (_method_error_type_list);
1366 }
1367 }
1368 if (!can_propagate_error) {
1369 ValaDataType* _tmp352_;
1370 gboolean _tmp353_;
1371 gboolean _tmp354_;
1372 _tmp352_ = body_error_type;
1373 _tmp353_ = vala_error_type_get_dynamic_error (G_TYPE_CHECK_INSTANCE_CAST (_tmp352_, VALA_TYPE_ERROR_TYPE, ValaErrorType));
1374 _tmp354_ = _tmp353_;
1375 _tmp351_ = !_tmp354_;
1376 } else {
1377 _tmp351_ = FALSE;
1378 }
1379 if (_tmp351_) {
1380 ValaDataType* _tmp355_;
1381 ValaSourceReference* _tmp356_;
1382 ValaSourceReference* _tmp357_;
1383 ValaDataType* _tmp358_;
1384 gchar* _tmp359_;
1385 gchar* _tmp360_;
1386 gchar* _tmp361_;
1387 gchar* _tmp362_;
1388 _tmp355_ = body_error_type;
1389 _tmp356_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp355_);
1390 _tmp357_ = _tmp356_;
1391 _tmp358_ = body_error_type;
1392 _tmp359_ = vala_code_node_to_string ((ValaCodeNode*) _tmp358_);
1393 _tmp360_ = _tmp359_;
1394 _tmp361_ = g_strdup_printf ("unhandled error `%s'", _tmp360_);
1395 _tmp362_ = _tmp361_;
1396 vala_report_warning (_tmp357_, _tmp362_);
1397 _g_free0 (_tmp362_);
1398 _g_free0 (_tmp360_);
1399 }
1400 _vala_code_node_unref0 (body_error_type);
1401 }
1402 _vala_iterable_unref0 (_body_error_type_list);
1403 }
1404 _vala_iterable_unref0 (body_errors);
1405 }
1406 _tmp363_ = vala_code_node_get_error ((ValaCodeNode*) self);
1407 _tmp364_ = _tmp363_;
1408 result = !_tmp364_;
1409 _vala_code_node_unref0 (old_symbol);
1410 _vala_source_file_unref0 (old_source_file);
1411 return result;
1412 }
1413
1414 static void
vala_creation_method_class_init(ValaCreationMethodClass * klass,gpointer klass_data)1415 vala_creation_method_class_init (ValaCreationMethodClass * klass,
1416 gpointer klass_data)
1417 {
1418 vala_creation_method_parent_class = g_type_class_peek_parent (klass);
1419 ((ValaCodeNodeClass *) klass)->finalize = vala_creation_method_finalize;
1420 g_type_class_adjust_private_offset (klass, &ValaCreationMethod_private_offset);
1421 ((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_creation_method_real_accept;
1422 ((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_creation_method_real_accept_children;
1423 ((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_creation_method_real_check;
1424 }
1425
1426 static void
vala_creation_method_instance_init(ValaCreationMethod * self,gpointer klass)1427 vala_creation_method_instance_init (ValaCreationMethod * self,
1428 gpointer klass)
1429 {
1430 self->priv = vala_creation_method_get_instance_private (self);
1431 }
1432
1433 static void
vala_creation_method_finalize(ValaCodeNode * obj)1434 vala_creation_method_finalize (ValaCodeNode * obj)
1435 {
1436 ValaCreationMethod * self;
1437 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_CREATION_METHOD, ValaCreationMethod);
1438 _g_free0 (self->priv->_class_name);
1439 VALA_CODE_NODE_CLASS (vala_creation_method_parent_class)->finalize (obj);
1440 }
1441
1442 /**
1443 * Represents a type creation method.
1444 */
1445 static GType
vala_creation_method_get_type_once(void)1446 vala_creation_method_get_type_once (void)
1447 {
1448 static const GTypeInfo g_define_type_info = { sizeof (ValaCreationMethodClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_creation_method_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCreationMethod), 0, (GInstanceInitFunc) vala_creation_method_instance_init, NULL };
1449 GType vala_creation_method_type_id;
1450 vala_creation_method_type_id = g_type_register_static (VALA_TYPE_METHOD, "ValaCreationMethod", &g_define_type_info, 0);
1451 ValaCreationMethod_private_offset = g_type_add_instance_private (vala_creation_method_type_id, sizeof (ValaCreationMethodPrivate));
1452 return vala_creation_method_type_id;
1453 }
1454
1455 GType
vala_creation_method_get_type(void)1456 vala_creation_method_get_type (void)
1457 {
1458 static volatile gsize vala_creation_method_type_id__volatile = 0;
1459 if (g_once_init_enter (&vala_creation_method_type_id__volatile)) {
1460 GType vala_creation_method_type_id;
1461 vala_creation_method_type_id = vala_creation_method_get_type_once ();
1462 g_once_init_leave (&vala_creation_method_type_id__volatile, vala_creation_method_type_id);
1463 }
1464 return vala_creation_method_type_id__volatile;
1465 }
1466
1467