1 /* valanamespace.c generated by valac, the Vala compiler
2 * generated from valanamespace.vala, do not modify */
3
4 /* valanamespace.vala
5 *
6 * Copyright (C) 2006-2010 Jürg Billeter
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 * Author:
23 * Jürg Billeter <j@bitron.ch>
24 */
25
26 #include "vala.h"
27 #include <valagee.h>
28 #include <glib-object.h>
29 #include <glib.h>
30 #include <stdlib.h>
31 #include <string.h>
32
33 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
34 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
35 #define _vala_comment_unref0(var) ((var == NULL) ? NULL : (var = (vala_comment_unref (var), NULL)))
36 #define _g_free0(var) (var = (g_free (var), NULL))
37
38 struct _ValaNamespacePrivate {
39 ValaList* classes;
40 ValaList* interfaces;
41 ValaList* structs;
42 ValaList* enums;
43 ValaList* error_domains;
44 ValaList* delegates;
45 ValaList* constants;
46 ValaList* fields;
47 ValaList* methods;
48 ValaList* comments;
49 ValaList* namespaces;
50 ValaList* using_directives;
51 };
52
53 static gint ValaNamespace_private_offset;
54 static gpointer vala_namespace_parent_class = NULL;
55
56 static void vala_namespace_real_add_namespace (ValaSymbol* base,
57 ValaNamespace* ns);
58 static void vala_namespace_real_add_class (ValaSymbol* base,
59 ValaClass* cl);
60 static void vala_namespace_real_add_interface (ValaSymbol* base,
61 ValaInterface* iface);
62 static void vala_namespace_real_add_struct (ValaSymbol* base,
63 ValaStruct* st);
64 static void vala_namespace_real_add_enum (ValaSymbol* base,
65 ValaEnum* en);
66 static void vala_namespace_real_add_error_domain (ValaSymbol* base,
67 ValaErrorDomain* edomain);
68 static void vala_namespace_real_add_delegate (ValaSymbol* base,
69 ValaDelegate* d);
70 static void vala_namespace_real_add_constant (ValaSymbol* base,
71 ValaConstant* constant);
72 static void vala_namespace_real_add_field (ValaSymbol* base,
73 ValaField* f);
74 static void vala_namespace_real_add_method (ValaSymbol* base,
75 ValaMethod* m);
76 static void vala_namespace_real_accept (ValaCodeNode* base,
77 ValaCodeVisitor* visitor);
78 static void vala_namespace_real_accept_children (ValaCodeNode* base,
79 ValaCodeVisitor* visitor);
80 static gboolean vala_namespace_real_check (ValaCodeNode* base,
81 ValaCodeContext* context);
82 static gchar* vala_namespace_real_to_string (ValaCodeNode* base);
83 static void vala_namespace_finalize (ValaCodeNode * obj);
84 static GType vala_namespace_get_type_once (void);
85
86 static inline gpointer
vala_namespace_get_instance_private(ValaNamespace * self)87 vala_namespace_get_instance_private (ValaNamespace* self)
88 {
89 return G_STRUCT_MEMBER_P (self, ValaNamespace_private_offset);
90 }
91
92 /**
93 * Creates a new namespace.
94 *
95 * @param name namespace name
96 * @param source_reference reference to source code
97 * @return newly created namespace
98 */
99 ValaNamespace*
vala_namespace_construct(GType object_type,const gchar * name,ValaSourceReference * source_reference)100 vala_namespace_construct (GType object_type,
101 const gchar* name,
102 ValaSourceReference* source_reference)
103 {
104 ValaNamespace* self = NULL;
105 self = (ValaNamespace*) vala_symbol_construct (object_type, name, source_reference, NULL);
106 vala_symbol_set_access ((ValaSymbol*) self, VALA_SYMBOL_ACCESSIBILITY_PUBLIC);
107 return self;
108 }
109
110 ValaNamespace*
vala_namespace_new(const gchar * name,ValaSourceReference * source_reference)111 vala_namespace_new (const gchar* name,
112 ValaSourceReference* source_reference)
113 {
114 return vala_namespace_construct (VALA_TYPE_NAMESPACE, name, source_reference);
115 }
116
117 /**
118 * Adds a new using directive with the specified namespace.
119 *
120 * @param ns reference to namespace
121 */
122 void
vala_namespace_add_using_directive(ValaNamespace * self,ValaUsingDirective * ns)123 vala_namespace_add_using_directive (ValaNamespace* self,
124 ValaUsingDirective* ns)
125 {
126 ValaList* _tmp0_;
127 g_return_if_fail (self != NULL);
128 g_return_if_fail (ns != NULL);
129 _tmp0_ = self->priv->using_directives;
130 vala_collection_add ((ValaCollection*) _tmp0_, ns);
131 }
132
133 void
vala_namespace_add_comment(ValaNamespace * self,ValaComment * comment)134 vala_namespace_add_comment (ValaNamespace* self,
135 ValaComment* comment)
136 {
137 ValaList* _tmp0_;
138 g_return_if_fail (self != NULL);
139 g_return_if_fail (comment != NULL);
140 _tmp0_ = self->priv->comments;
141 vala_collection_add ((ValaCollection*) _tmp0_, comment);
142 }
143
144 /**
145 * Returns the list of namespaces.
146 *
147 * @return comment list
148 */
149 ValaList*
vala_namespace_get_comments(ValaNamespace * self)150 vala_namespace_get_comments (ValaNamespace* self)
151 {
152 ValaList* _tmp0_;
153 ValaList* result = NULL;
154 g_return_val_if_fail (self != NULL, NULL);
155 _tmp0_ = self->priv->comments;
156 result = _tmp0_;
157 return result;
158 }
159
160 /**
161 * Adds the specified namespace to this source file.
162 *
163 * @param ns a namespace
164 */
165 static gpointer
_vala_iterable_ref0(gpointer self)166 _vala_iterable_ref0 (gpointer self)
167 {
168 return self ? vala_iterable_ref (self) : NULL;
169 }
170
171 static gpointer
_vala_code_node_ref0(gpointer self)172 _vala_code_node_ref0 (gpointer self)
173 {
174 return self ? vala_code_node_ref (self) : NULL;
175 }
176
177 static void
vala_namespace_real_add_namespace(ValaSymbol * base,ValaNamespace * ns)178 vala_namespace_real_add_namespace (ValaSymbol* base,
179 ValaNamespace* ns)
180 {
181 ValaNamespace * self;
182 ValaScope* _tmp0_;
183 ValaScope* _tmp1_;
184 ValaScope* _tmp6_;
185 ValaScope* _tmp7_;
186 const gchar* _tmp8_;
187 const gchar* _tmp9_;
188 ValaSymbol* _tmp10_;
189 ValaSymbol* _tmp11_;
190 gboolean _tmp12_;
191 self = (ValaNamespace*) base;
192 g_return_if_fail (ns != NULL);
193 _tmp0_ = vala_symbol_get_owner ((ValaSymbol*) ns);
194 _tmp1_ = _tmp0_;
195 if (_tmp1_ == NULL) {
196 ValaSourceReference* _tmp2_;
197 ValaSourceReference* _tmp3_;
198 ValaSourceFile* _tmp4_;
199 ValaSourceFile* _tmp5_;
200 _tmp2_ = vala_code_node_get_source_reference ((ValaCodeNode*) ns);
201 _tmp3_ = _tmp2_;
202 _tmp4_ = vala_source_reference_get_file (_tmp3_);
203 _tmp5_ = _tmp4_;
204 vala_source_file_add_node (_tmp5_, (ValaCodeNode*) ns);
205 }
206 _tmp6_ = vala_symbol_get_scope ((ValaSymbol*) self);
207 _tmp7_ = _tmp6_;
208 _tmp8_ = vala_symbol_get_name ((ValaSymbol*) ns);
209 _tmp9_ = _tmp8_;
210 _tmp10_ = vala_scope_lookup (_tmp7_, _tmp9_);
211 _tmp11_ = _tmp10_;
212 _tmp12_ = VALA_IS_NAMESPACE (_tmp11_);
213 _vala_code_node_unref0 (_tmp11_);
214 if (_tmp12_) {
215 ValaNamespace* old_ns = NULL;
216 ValaScope* _tmp13_;
217 ValaScope* _tmp14_;
218 const gchar* _tmp15_;
219 const gchar* _tmp16_;
220 ValaSymbol* _tmp17_;
221 gboolean _tmp18_ = FALSE;
222 ValaNamespace* _tmp19_;
223 gboolean _tmp20_;
224 gboolean _tmp21_;
225 GList* _tmp159_;
226 _tmp13_ = vala_symbol_get_scope ((ValaSymbol*) self);
227 _tmp14_ = _tmp13_;
228 _tmp15_ = vala_symbol_get_name ((ValaSymbol*) ns);
229 _tmp16_ = _tmp15_;
230 _tmp17_ = vala_scope_lookup (_tmp14_, _tmp16_);
231 old_ns = G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, VALA_TYPE_NAMESPACE, ValaNamespace);
232 _tmp19_ = old_ns;
233 _tmp20_ = vala_symbol_get_external_package ((ValaSymbol*) _tmp19_);
234 _tmp21_ = _tmp20_;
235 if (_tmp21_) {
236 gboolean _tmp22_;
237 gboolean _tmp23_;
238 _tmp22_ = vala_symbol_get_external_package ((ValaSymbol*) ns);
239 _tmp23_ = _tmp22_;
240 _tmp18_ = !_tmp23_;
241 } else {
242 _tmp18_ = FALSE;
243 }
244 if (_tmp18_) {
245 ValaNamespace* _tmp24_;
246 ValaSourceReference* _tmp25_;
247 ValaSourceReference* _tmp26_;
248 _tmp24_ = old_ns;
249 _tmp25_ = vala_code_node_get_source_reference ((ValaCodeNode*) ns);
250 _tmp26_ = _tmp25_;
251 vala_code_node_set_source_reference ((ValaCodeNode*) _tmp24_, _tmp26_);
252 }
253 {
254 ValaList* _using_directive_list = NULL;
255 ValaList* _tmp27_;
256 ValaList* _tmp28_;
257 gint _using_directive_size = 0;
258 ValaList* _tmp29_;
259 gint _tmp30_;
260 gint _tmp31_;
261 gint _using_directive_index = 0;
262 _tmp27_ = ns->priv->using_directives;
263 _tmp28_ = _vala_iterable_ref0 (_tmp27_);
264 _using_directive_list = _tmp28_;
265 _tmp29_ = _using_directive_list;
266 _tmp30_ = vala_collection_get_size ((ValaCollection*) _tmp29_);
267 _tmp31_ = _tmp30_;
268 _using_directive_size = _tmp31_;
269 _using_directive_index = -1;
270 while (TRUE) {
271 gint _tmp32_;
272 gint _tmp33_;
273 ValaUsingDirective* using_directive = NULL;
274 ValaList* _tmp34_;
275 gpointer _tmp35_;
276 ValaNamespace* _tmp36_;
277 ValaUsingDirective* _tmp37_;
278 _using_directive_index = _using_directive_index + 1;
279 _tmp32_ = _using_directive_index;
280 _tmp33_ = _using_directive_size;
281 if (!(_tmp32_ < _tmp33_)) {
282 break;
283 }
284 _tmp34_ = _using_directive_list;
285 _tmp35_ = vala_list_get (_tmp34_, _using_directive_index);
286 using_directive = (ValaUsingDirective*) _tmp35_;
287 _tmp36_ = old_ns;
288 _tmp37_ = using_directive;
289 vala_namespace_add_using_directive (_tmp36_, _tmp37_);
290 _vala_code_node_unref0 (using_directive);
291 }
292 _vala_iterable_unref0 (_using_directive_list);
293 }
294 {
295 ValaList* _sub_ns_list = NULL;
296 ValaList* _tmp38_;
297 ValaList* _tmp39_;
298 gint _sub_ns_size = 0;
299 ValaList* _tmp40_;
300 gint _tmp41_;
301 gint _tmp42_;
302 gint _sub_ns_index = 0;
303 _tmp38_ = vala_namespace_get_namespaces (ns);
304 _tmp39_ = _vala_iterable_ref0 (_tmp38_);
305 _sub_ns_list = _tmp39_;
306 _tmp40_ = _sub_ns_list;
307 _tmp41_ = vala_collection_get_size ((ValaCollection*) _tmp40_);
308 _tmp42_ = _tmp41_;
309 _sub_ns_size = _tmp42_;
310 _sub_ns_index = -1;
311 while (TRUE) {
312 gint _tmp43_;
313 gint _tmp44_;
314 ValaNamespace* sub_ns = NULL;
315 ValaList* _tmp45_;
316 gpointer _tmp46_;
317 ValaNamespace* _tmp47_;
318 ValaNamespace* _tmp48_;
319 _sub_ns_index = _sub_ns_index + 1;
320 _tmp43_ = _sub_ns_index;
321 _tmp44_ = _sub_ns_size;
322 if (!(_tmp43_ < _tmp44_)) {
323 break;
324 }
325 _tmp45_ = _sub_ns_list;
326 _tmp46_ = vala_list_get (_tmp45_, _sub_ns_index);
327 sub_ns = (ValaNamespace*) _tmp46_;
328 _tmp47_ = old_ns;
329 _tmp48_ = sub_ns;
330 vala_symbol_add_namespace ((ValaSymbol*) _tmp47_, _tmp48_);
331 _vala_code_node_unref0 (sub_ns);
332 }
333 _vala_iterable_unref0 (_sub_ns_list);
334 }
335 {
336 ValaList* _cl_list = NULL;
337 ValaList* _tmp49_;
338 ValaList* _tmp50_;
339 gint _cl_size = 0;
340 ValaList* _tmp51_;
341 gint _tmp52_;
342 gint _tmp53_;
343 gint _cl_index = 0;
344 _tmp49_ = vala_namespace_get_classes (ns);
345 _tmp50_ = _vala_iterable_ref0 (_tmp49_);
346 _cl_list = _tmp50_;
347 _tmp51_ = _cl_list;
348 _tmp52_ = vala_collection_get_size ((ValaCollection*) _tmp51_);
349 _tmp53_ = _tmp52_;
350 _cl_size = _tmp53_;
351 _cl_index = -1;
352 while (TRUE) {
353 gint _tmp54_;
354 gint _tmp55_;
355 ValaClass* cl = NULL;
356 ValaList* _tmp56_;
357 gpointer _tmp57_;
358 ValaNamespace* _tmp58_;
359 ValaClass* _tmp59_;
360 _cl_index = _cl_index + 1;
361 _tmp54_ = _cl_index;
362 _tmp55_ = _cl_size;
363 if (!(_tmp54_ < _tmp55_)) {
364 break;
365 }
366 _tmp56_ = _cl_list;
367 _tmp57_ = vala_list_get (_tmp56_, _cl_index);
368 cl = (ValaClass*) _tmp57_;
369 _tmp58_ = old_ns;
370 _tmp59_ = cl;
371 vala_symbol_add_class ((ValaSymbol*) _tmp58_, _tmp59_);
372 _vala_code_node_unref0 (cl);
373 }
374 _vala_iterable_unref0 (_cl_list);
375 }
376 {
377 ValaList* _st_list = NULL;
378 ValaList* _tmp60_;
379 ValaList* _tmp61_;
380 gint _st_size = 0;
381 ValaList* _tmp62_;
382 gint _tmp63_;
383 gint _tmp64_;
384 gint _st_index = 0;
385 _tmp60_ = vala_namespace_get_structs (ns);
386 _tmp61_ = _vala_iterable_ref0 (_tmp60_);
387 _st_list = _tmp61_;
388 _tmp62_ = _st_list;
389 _tmp63_ = vala_collection_get_size ((ValaCollection*) _tmp62_);
390 _tmp64_ = _tmp63_;
391 _st_size = _tmp64_;
392 _st_index = -1;
393 while (TRUE) {
394 gint _tmp65_;
395 gint _tmp66_;
396 ValaStruct* st = NULL;
397 ValaList* _tmp67_;
398 gpointer _tmp68_;
399 ValaNamespace* _tmp69_;
400 ValaStruct* _tmp70_;
401 _st_index = _st_index + 1;
402 _tmp65_ = _st_index;
403 _tmp66_ = _st_size;
404 if (!(_tmp65_ < _tmp66_)) {
405 break;
406 }
407 _tmp67_ = _st_list;
408 _tmp68_ = vala_list_get (_tmp67_, _st_index);
409 st = (ValaStruct*) _tmp68_;
410 _tmp69_ = old_ns;
411 _tmp70_ = st;
412 vala_symbol_add_struct ((ValaSymbol*) _tmp69_, _tmp70_);
413 _vala_code_node_unref0 (st);
414 }
415 _vala_iterable_unref0 (_st_list);
416 }
417 {
418 ValaList* _iface_list = NULL;
419 ValaList* _tmp71_;
420 ValaList* _tmp72_;
421 gint _iface_size = 0;
422 ValaList* _tmp73_;
423 gint _tmp74_;
424 gint _tmp75_;
425 gint _iface_index = 0;
426 _tmp71_ = vala_namespace_get_interfaces (ns);
427 _tmp72_ = _vala_iterable_ref0 (_tmp71_);
428 _iface_list = _tmp72_;
429 _tmp73_ = _iface_list;
430 _tmp74_ = vala_collection_get_size ((ValaCollection*) _tmp73_);
431 _tmp75_ = _tmp74_;
432 _iface_size = _tmp75_;
433 _iface_index = -1;
434 while (TRUE) {
435 gint _tmp76_;
436 gint _tmp77_;
437 ValaInterface* iface = NULL;
438 ValaList* _tmp78_;
439 gpointer _tmp79_;
440 ValaNamespace* _tmp80_;
441 ValaInterface* _tmp81_;
442 _iface_index = _iface_index + 1;
443 _tmp76_ = _iface_index;
444 _tmp77_ = _iface_size;
445 if (!(_tmp76_ < _tmp77_)) {
446 break;
447 }
448 _tmp78_ = _iface_list;
449 _tmp79_ = vala_list_get (_tmp78_, _iface_index);
450 iface = (ValaInterface*) _tmp79_;
451 _tmp80_ = old_ns;
452 _tmp81_ = iface;
453 vala_symbol_add_interface ((ValaSymbol*) _tmp80_, _tmp81_);
454 _vala_code_node_unref0 (iface);
455 }
456 _vala_iterable_unref0 (_iface_list);
457 }
458 {
459 ValaList* _d_list = NULL;
460 ValaList* _tmp82_;
461 ValaList* _tmp83_;
462 gint _d_size = 0;
463 ValaList* _tmp84_;
464 gint _tmp85_;
465 gint _tmp86_;
466 gint _d_index = 0;
467 _tmp82_ = vala_namespace_get_delegates (ns);
468 _tmp83_ = _vala_iterable_ref0 (_tmp82_);
469 _d_list = _tmp83_;
470 _tmp84_ = _d_list;
471 _tmp85_ = vala_collection_get_size ((ValaCollection*) _tmp84_);
472 _tmp86_ = _tmp85_;
473 _d_size = _tmp86_;
474 _d_index = -1;
475 while (TRUE) {
476 gint _tmp87_;
477 gint _tmp88_;
478 ValaDelegate* d = NULL;
479 ValaList* _tmp89_;
480 gpointer _tmp90_;
481 ValaNamespace* _tmp91_;
482 ValaDelegate* _tmp92_;
483 _d_index = _d_index + 1;
484 _tmp87_ = _d_index;
485 _tmp88_ = _d_size;
486 if (!(_tmp87_ < _tmp88_)) {
487 break;
488 }
489 _tmp89_ = _d_list;
490 _tmp90_ = vala_list_get (_tmp89_, _d_index);
491 d = (ValaDelegate*) _tmp90_;
492 _tmp91_ = old_ns;
493 _tmp92_ = d;
494 vala_symbol_add_delegate ((ValaSymbol*) _tmp91_, _tmp92_);
495 _vala_code_node_unref0 (d);
496 }
497 _vala_iterable_unref0 (_d_list);
498 }
499 {
500 ValaList* _en_list = NULL;
501 ValaList* _tmp93_;
502 ValaList* _tmp94_;
503 gint _en_size = 0;
504 ValaList* _tmp95_;
505 gint _tmp96_;
506 gint _tmp97_;
507 gint _en_index = 0;
508 _tmp93_ = vala_namespace_get_enums (ns);
509 _tmp94_ = _vala_iterable_ref0 (_tmp93_);
510 _en_list = _tmp94_;
511 _tmp95_ = _en_list;
512 _tmp96_ = vala_collection_get_size ((ValaCollection*) _tmp95_);
513 _tmp97_ = _tmp96_;
514 _en_size = _tmp97_;
515 _en_index = -1;
516 while (TRUE) {
517 gint _tmp98_;
518 gint _tmp99_;
519 ValaEnum* en = NULL;
520 ValaList* _tmp100_;
521 gpointer _tmp101_;
522 ValaNamespace* _tmp102_;
523 ValaEnum* _tmp103_;
524 _en_index = _en_index + 1;
525 _tmp98_ = _en_index;
526 _tmp99_ = _en_size;
527 if (!(_tmp98_ < _tmp99_)) {
528 break;
529 }
530 _tmp100_ = _en_list;
531 _tmp101_ = vala_list_get (_tmp100_, _en_index);
532 en = (ValaEnum*) _tmp101_;
533 _tmp102_ = old_ns;
534 _tmp103_ = en;
535 vala_symbol_add_enum ((ValaSymbol*) _tmp102_, _tmp103_);
536 _vala_code_node_unref0 (en);
537 }
538 _vala_iterable_unref0 (_en_list);
539 }
540 {
541 ValaList* _ed_list = NULL;
542 ValaList* _tmp104_;
543 ValaList* _tmp105_;
544 gint _ed_size = 0;
545 ValaList* _tmp106_;
546 gint _tmp107_;
547 gint _tmp108_;
548 gint _ed_index = 0;
549 _tmp104_ = vala_namespace_get_error_domains (ns);
550 _tmp105_ = _vala_iterable_ref0 (_tmp104_);
551 _ed_list = _tmp105_;
552 _tmp106_ = _ed_list;
553 _tmp107_ = vala_collection_get_size ((ValaCollection*) _tmp106_);
554 _tmp108_ = _tmp107_;
555 _ed_size = _tmp108_;
556 _ed_index = -1;
557 while (TRUE) {
558 gint _tmp109_;
559 gint _tmp110_;
560 ValaErrorDomain* ed = NULL;
561 ValaList* _tmp111_;
562 gpointer _tmp112_;
563 ValaNamespace* _tmp113_;
564 ValaErrorDomain* _tmp114_;
565 _ed_index = _ed_index + 1;
566 _tmp109_ = _ed_index;
567 _tmp110_ = _ed_size;
568 if (!(_tmp109_ < _tmp110_)) {
569 break;
570 }
571 _tmp111_ = _ed_list;
572 _tmp112_ = vala_list_get (_tmp111_, _ed_index);
573 ed = (ValaErrorDomain*) _tmp112_;
574 _tmp113_ = old_ns;
575 _tmp114_ = ed;
576 vala_symbol_add_error_domain ((ValaSymbol*) _tmp113_, _tmp114_);
577 _vala_code_node_unref0 (ed);
578 }
579 _vala_iterable_unref0 (_ed_list);
580 }
581 {
582 ValaList* _c_list = NULL;
583 ValaList* _tmp115_;
584 ValaList* _tmp116_;
585 gint _c_size = 0;
586 ValaList* _tmp117_;
587 gint _tmp118_;
588 gint _tmp119_;
589 gint _c_index = 0;
590 _tmp115_ = vala_namespace_get_constants (ns);
591 _tmp116_ = _vala_iterable_ref0 (_tmp115_);
592 _c_list = _tmp116_;
593 _tmp117_ = _c_list;
594 _tmp118_ = vala_collection_get_size ((ValaCollection*) _tmp117_);
595 _tmp119_ = _tmp118_;
596 _c_size = _tmp119_;
597 _c_index = -1;
598 while (TRUE) {
599 gint _tmp120_;
600 gint _tmp121_;
601 ValaConstant* c = NULL;
602 ValaList* _tmp122_;
603 gpointer _tmp123_;
604 ValaNamespace* _tmp124_;
605 ValaConstant* _tmp125_;
606 _c_index = _c_index + 1;
607 _tmp120_ = _c_index;
608 _tmp121_ = _c_size;
609 if (!(_tmp120_ < _tmp121_)) {
610 break;
611 }
612 _tmp122_ = _c_list;
613 _tmp123_ = vala_list_get (_tmp122_, _c_index);
614 c = (ValaConstant*) _tmp123_;
615 _tmp124_ = old_ns;
616 _tmp125_ = c;
617 vala_symbol_add_constant ((ValaSymbol*) _tmp124_, _tmp125_);
618 _vala_code_node_unref0 (c);
619 }
620 _vala_iterable_unref0 (_c_list);
621 }
622 {
623 ValaList* _f_list = NULL;
624 ValaList* _tmp126_;
625 ValaList* _tmp127_;
626 gint _f_size = 0;
627 ValaList* _tmp128_;
628 gint _tmp129_;
629 gint _tmp130_;
630 gint _f_index = 0;
631 _tmp126_ = vala_namespace_get_fields (ns);
632 _tmp127_ = _vala_iterable_ref0 (_tmp126_);
633 _f_list = _tmp127_;
634 _tmp128_ = _f_list;
635 _tmp129_ = vala_collection_get_size ((ValaCollection*) _tmp128_);
636 _tmp130_ = _tmp129_;
637 _f_size = _tmp130_;
638 _f_index = -1;
639 while (TRUE) {
640 gint _tmp131_;
641 gint _tmp132_;
642 ValaField* f = NULL;
643 ValaList* _tmp133_;
644 gpointer _tmp134_;
645 ValaNamespace* _tmp135_;
646 ValaField* _tmp136_;
647 _f_index = _f_index + 1;
648 _tmp131_ = _f_index;
649 _tmp132_ = _f_size;
650 if (!(_tmp131_ < _tmp132_)) {
651 break;
652 }
653 _tmp133_ = _f_list;
654 _tmp134_ = vala_list_get (_tmp133_, _f_index);
655 f = (ValaField*) _tmp134_;
656 _tmp135_ = old_ns;
657 _tmp136_ = f;
658 vala_symbol_add_field ((ValaSymbol*) _tmp135_, _tmp136_);
659 _vala_code_node_unref0 (f);
660 }
661 _vala_iterable_unref0 (_f_list);
662 }
663 {
664 ValaList* _m_list = NULL;
665 ValaList* _tmp137_;
666 ValaList* _tmp138_;
667 gint _m_size = 0;
668 ValaList* _tmp139_;
669 gint _tmp140_;
670 gint _tmp141_;
671 gint _m_index = 0;
672 _tmp137_ = vala_namespace_get_methods (ns);
673 _tmp138_ = _vala_iterable_ref0 (_tmp137_);
674 _m_list = _tmp138_;
675 _tmp139_ = _m_list;
676 _tmp140_ = vala_collection_get_size ((ValaCollection*) _tmp139_);
677 _tmp141_ = _tmp140_;
678 _m_size = _tmp141_;
679 _m_index = -1;
680 while (TRUE) {
681 gint _tmp142_;
682 gint _tmp143_;
683 ValaMethod* m = NULL;
684 ValaList* _tmp144_;
685 gpointer _tmp145_;
686 ValaNamespace* _tmp146_;
687 ValaMethod* _tmp147_;
688 _m_index = _m_index + 1;
689 _tmp142_ = _m_index;
690 _tmp143_ = _m_size;
691 if (!(_tmp142_ < _tmp143_)) {
692 break;
693 }
694 _tmp144_ = _m_list;
695 _tmp145_ = vala_list_get (_tmp144_, _m_index);
696 m = (ValaMethod*) _tmp145_;
697 _tmp146_ = old_ns;
698 _tmp147_ = m;
699 vala_symbol_add_method ((ValaSymbol*) _tmp146_, _tmp147_);
700 _vala_code_node_unref0 (m);
701 }
702 _vala_iterable_unref0 (_m_list);
703 }
704 {
705 ValaList* _c_list = NULL;
706 ValaList* _tmp148_;
707 ValaList* _tmp149_;
708 gint _c_size = 0;
709 ValaList* _tmp150_;
710 gint _tmp151_;
711 gint _tmp152_;
712 gint _c_index = 0;
713 _tmp148_ = vala_namespace_get_comments (ns);
714 _tmp149_ = _vala_iterable_ref0 (_tmp148_);
715 _c_list = _tmp149_;
716 _tmp150_ = _c_list;
717 _tmp151_ = vala_collection_get_size ((ValaCollection*) _tmp150_);
718 _tmp152_ = _tmp151_;
719 _c_size = _tmp152_;
720 _c_index = -1;
721 while (TRUE) {
722 gint _tmp153_;
723 gint _tmp154_;
724 ValaComment* c = NULL;
725 ValaList* _tmp155_;
726 gpointer _tmp156_;
727 ValaNamespace* _tmp157_;
728 ValaComment* _tmp158_;
729 _c_index = _c_index + 1;
730 _tmp153_ = _c_index;
731 _tmp154_ = _c_size;
732 if (!(_tmp153_ < _tmp154_)) {
733 break;
734 }
735 _tmp155_ = _c_list;
736 _tmp156_ = vala_list_get (_tmp155_, _c_index);
737 c = (ValaComment*) _tmp156_;
738 _tmp157_ = old_ns;
739 _tmp158_ = c;
740 vala_namespace_add_comment (_tmp157_, _tmp158_);
741 _vala_comment_unref0 (c);
742 }
743 _vala_iterable_unref0 (_c_list);
744 }
745 _tmp159_ = ((ValaCodeNode*) ns)->attributes;
746 {
747 GList* a_collection = NULL;
748 GList* a_it = NULL;
749 a_collection = _tmp159_;
750 for (a_it = a_collection; a_it != NULL; a_it = a_it->next) {
751 ValaAttribute* _tmp160_;
752 ValaAttribute* a = NULL;
753 _tmp160_ = _vala_code_node_ref0 ((ValaAttribute*) a_it->data);
754 a = _tmp160_;
755 {
756 ValaNamespace* _tmp161_;
757 ValaAttribute* _tmp162_;
758 const gchar* _tmp163_;
759 const gchar* _tmp164_;
760 ValaAttribute* _tmp165_;
761 _tmp161_ = old_ns;
762 _tmp162_ = a;
763 _tmp163_ = vala_attribute_get_name (_tmp162_);
764 _tmp164_ = _tmp163_;
765 _tmp165_ = vala_code_node_get_attribute ((ValaCodeNode*) _tmp161_, _tmp164_);
766 if (_tmp165_ == NULL) {
767 ValaNamespace* _tmp166_;
768 ValaAttribute* _tmp167_;
769 ValaAttribute* _tmp168_;
770 _tmp166_ = old_ns;
771 _tmp167_ = a;
772 _tmp168_ = _vala_code_node_ref0 (_tmp167_);
773 ((ValaCodeNode*) _tmp166_)->attributes = g_list_append (((ValaCodeNode*) _tmp166_)->attributes, _tmp168_);
774 }
775 _vala_code_node_unref0 (a);
776 }
777 }
778 }
779 _vala_code_node_unref0 (old_ns);
780 } else {
781 ValaList* _tmp169_;
782 ValaScope* _tmp170_;
783 ValaScope* _tmp171_;
784 const gchar* _tmp172_;
785 const gchar* _tmp173_;
786 _tmp169_ = self->priv->namespaces;
787 vala_collection_add ((ValaCollection*) _tmp169_, ns);
788 _tmp170_ = vala_symbol_get_scope ((ValaSymbol*) self);
789 _tmp171_ = _tmp170_;
790 _tmp172_ = vala_symbol_get_name ((ValaSymbol*) ns);
791 _tmp173_ = _tmp172_;
792 vala_scope_add (_tmp171_, _tmp173_, (ValaSymbol*) ns);
793 }
794 }
795
796 /**
797 * Returns the list of namespaces.
798 *
799 * @return namespace list
800 */
801 ValaList*
vala_namespace_get_namespaces(ValaNamespace * self)802 vala_namespace_get_namespaces (ValaNamespace* self)
803 {
804 ValaList* _tmp0_;
805 ValaList* result = NULL;
806 g_return_val_if_fail (self != NULL, NULL);
807 _tmp0_ = self->priv->namespaces;
808 result = _tmp0_;
809 return result;
810 }
811
812 /**
813 * Adds the specified class to this namespace.
814 *
815 * @param cl a class
816 */
817 static void
vala_namespace_real_add_class(ValaSymbol * base,ValaClass * cl)818 vala_namespace_real_add_class (ValaSymbol* base,
819 ValaClass* cl)
820 {
821 ValaNamespace * self;
822 ValaSymbolAccessibility _tmp0_;
823 ValaSymbolAccessibility _tmp1_;
824 ValaScope* _tmp2_;
825 ValaScope* _tmp3_;
826 ValaList* _tmp8_;
827 ValaScope* _tmp9_;
828 ValaScope* _tmp10_;
829 const gchar* _tmp11_;
830 const gchar* _tmp12_;
831 self = (ValaNamespace*) base;
832 g_return_if_fail (cl != NULL);
833 _tmp0_ = vala_symbol_get_access ((ValaSymbol*) cl);
834 _tmp1_ = _tmp0_;
835 if (_tmp1_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
836 vala_symbol_set_access ((ValaSymbol*) cl, VALA_SYMBOL_ACCESSIBILITY_INTERNAL);
837 }
838 _tmp2_ = vala_symbol_get_owner ((ValaSymbol*) cl);
839 _tmp3_ = _tmp2_;
840 if (_tmp3_ == NULL) {
841 ValaSourceReference* _tmp4_;
842 ValaSourceReference* _tmp5_;
843 ValaSourceFile* _tmp6_;
844 ValaSourceFile* _tmp7_;
845 _tmp4_ = vala_code_node_get_source_reference ((ValaCodeNode*) cl);
846 _tmp5_ = _tmp4_;
847 _tmp6_ = vala_source_reference_get_file (_tmp5_);
848 _tmp7_ = _tmp6_;
849 vala_source_file_add_node (_tmp7_, (ValaCodeNode*) cl);
850 }
851 _tmp8_ = self->priv->classes;
852 vala_collection_add ((ValaCollection*) _tmp8_, cl);
853 _tmp9_ = vala_symbol_get_scope ((ValaSymbol*) self);
854 _tmp10_ = _tmp9_;
855 _tmp11_ = vala_symbol_get_name ((ValaSymbol*) cl);
856 _tmp12_ = _tmp11_;
857 vala_scope_add (_tmp10_, _tmp12_, (ValaSymbol*) cl);
858 }
859
860 /**
861 * Adds the specified interface to this namespace.
862 *
863 * @param iface an interface
864 */
865 static void
vala_namespace_real_add_interface(ValaSymbol * base,ValaInterface * iface)866 vala_namespace_real_add_interface (ValaSymbol* base,
867 ValaInterface* iface)
868 {
869 ValaNamespace * self;
870 ValaSymbolAccessibility _tmp0_;
871 ValaSymbolAccessibility _tmp1_;
872 ValaScope* _tmp2_;
873 ValaScope* _tmp3_;
874 ValaList* _tmp8_;
875 ValaScope* _tmp9_;
876 ValaScope* _tmp10_;
877 const gchar* _tmp11_;
878 const gchar* _tmp12_;
879 self = (ValaNamespace*) base;
880 g_return_if_fail (iface != NULL);
881 _tmp0_ = vala_symbol_get_access ((ValaSymbol*) iface);
882 _tmp1_ = _tmp0_;
883 if (_tmp1_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
884 vala_symbol_set_access ((ValaSymbol*) iface, VALA_SYMBOL_ACCESSIBILITY_INTERNAL);
885 }
886 _tmp2_ = vala_symbol_get_owner ((ValaSymbol*) iface);
887 _tmp3_ = _tmp2_;
888 if (_tmp3_ == NULL) {
889 ValaSourceReference* _tmp4_;
890 ValaSourceReference* _tmp5_;
891 ValaSourceFile* _tmp6_;
892 ValaSourceFile* _tmp7_;
893 _tmp4_ = vala_code_node_get_source_reference ((ValaCodeNode*) iface);
894 _tmp5_ = _tmp4_;
895 _tmp6_ = vala_source_reference_get_file (_tmp5_);
896 _tmp7_ = _tmp6_;
897 vala_source_file_add_node (_tmp7_, (ValaCodeNode*) iface);
898 }
899 _tmp8_ = self->priv->interfaces;
900 vala_collection_add ((ValaCollection*) _tmp8_, iface);
901 _tmp9_ = vala_symbol_get_scope ((ValaSymbol*) self);
902 _tmp10_ = _tmp9_;
903 _tmp11_ = vala_symbol_get_name ((ValaSymbol*) iface);
904 _tmp12_ = _tmp11_;
905 vala_scope_add (_tmp10_, _tmp12_, (ValaSymbol*) iface);
906 }
907
908 /**
909 * Adds the specified struct to this namespace.
910 *
911 * @param st a struct
912 */
913 static void
vala_namespace_real_add_struct(ValaSymbol * base,ValaStruct * st)914 vala_namespace_real_add_struct (ValaSymbol* base,
915 ValaStruct* st)
916 {
917 ValaNamespace * self;
918 ValaSymbolAccessibility _tmp0_;
919 ValaSymbolAccessibility _tmp1_;
920 ValaScope* _tmp2_;
921 ValaScope* _tmp3_;
922 ValaList* _tmp8_;
923 ValaScope* _tmp9_;
924 ValaScope* _tmp10_;
925 const gchar* _tmp11_;
926 const gchar* _tmp12_;
927 self = (ValaNamespace*) base;
928 g_return_if_fail (st != NULL);
929 _tmp0_ = vala_symbol_get_access ((ValaSymbol*) st);
930 _tmp1_ = _tmp0_;
931 if (_tmp1_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
932 vala_symbol_set_access ((ValaSymbol*) st, VALA_SYMBOL_ACCESSIBILITY_INTERNAL);
933 }
934 _tmp2_ = vala_symbol_get_owner ((ValaSymbol*) st);
935 _tmp3_ = _tmp2_;
936 if (_tmp3_ == NULL) {
937 ValaSourceReference* _tmp4_;
938 ValaSourceReference* _tmp5_;
939 ValaSourceFile* _tmp6_;
940 ValaSourceFile* _tmp7_;
941 _tmp4_ = vala_code_node_get_source_reference ((ValaCodeNode*) st);
942 _tmp5_ = _tmp4_;
943 _tmp6_ = vala_source_reference_get_file (_tmp5_);
944 _tmp7_ = _tmp6_;
945 vala_source_file_add_node (_tmp7_, (ValaCodeNode*) st);
946 }
947 _tmp8_ = self->priv->structs;
948 vala_collection_add ((ValaCollection*) _tmp8_, st);
949 _tmp9_ = vala_symbol_get_scope ((ValaSymbol*) self);
950 _tmp10_ = _tmp9_;
951 _tmp11_ = vala_symbol_get_name ((ValaSymbol*) st);
952 _tmp12_ = _tmp11_;
953 vala_scope_add (_tmp10_, _tmp12_, (ValaSymbol*) st);
954 }
955
956 /**
957 * Adds the specified enum to this namespace.
958 *
959 * @param en an enum
960 */
961 static void
vala_namespace_real_add_enum(ValaSymbol * base,ValaEnum * en)962 vala_namespace_real_add_enum (ValaSymbol* base,
963 ValaEnum* en)
964 {
965 ValaNamespace * self;
966 ValaSymbolAccessibility _tmp0_;
967 ValaSymbolAccessibility _tmp1_;
968 ValaScope* _tmp2_;
969 ValaScope* _tmp3_;
970 ValaList* _tmp8_;
971 ValaScope* _tmp9_;
972 ValaScope* _tmp10_;
973 const gchar* _tmp11_;
974 const gchar* _tmp12_;
975 self = (ValaNamespace*) base;
976 g_return_if_fail (en != NULL);
977 _tmp0_ = vala_symbol_get_access ((ValaSymbol*) en);
978 _tmp1_ = _tmp0_;
979 if (_tmp1_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
980 vala_symbol_set_access ((ValaSymbol*) en, VALA_SYMBOL_ACCESSIBILITY_INTERNAL);
981 }
982 _tmp2_ = vala_symbol_get_owner ((ValaSymbol*) en);
983 _tmp3_ = _tmp2_;
984 if (_tmp3_ == NULL) {
985 ValaSourceReference* _tmp4_;
986 ValaSourceReference* _tmp5_;
987 ValaSourceFile* _tmp6_;
988 ValaSourceFile* _tmp7_;
989 _tmp4_ = vala_code_node_get_source_reference ((ValaCodeNode*) en);
990 _tmp5_ = _tmp4_;
991 _tmp6_ = vala_source_reference_get_file (_tmp5_);
992 _tmp7_ = _tmp6_;
993 vala_source_file_add_node (_tmp7_, (ValaCodeNode*) en);
994 }
995 _tmp8_ = self->priv->enums;
996 vala_collection_add ((ValaCollection*) _tmp8_, en);
997 _tmp9_ = vala_symbol_get_scope ((ValaSymbol*) self);
998 _tmp10_ = _tmp9_;
999 _tmp11_ = vala_symbol_get_name ((ValaSymbol*) en);
1000 _tmp12_ = _tmp11_;
1001 vala_scope_add (_tmp10_, _tmp12_, (ValaSymbol*) en);
1002 }
1003
1004 /**
1005 * Adds the specified error domain to this namespace.
1006 *
1007 * @param edomain an error domain
1008 */
1009 static void
vala_namespace_real_add_error_domain(ValaSymbol * base,ValaErrorDomain * edomain)1010 vala_namespace_real_add_error_domain (ValaSymbol* base,
1011 ValaErrorDomain* edomain)
1012 {
1013 ValaNamespace * self;
1014 ValaSymbolAccessibility _tmp0_;
1015 ValaSymbolAccessibility _tmp1_;
1016 ValaScope* _tmp2_;
1017 ValaScope* _tmp3_;
1018 ValaList* _tmp8_;
1019 ValaScope* _tmp9_;
1020 ValaScope* _tmp10_;
1021 const gchar* _tmp11_;
1022 const gchar* _tmp12_;
1023 self = (ValaNamespace*) base;
1024 g_return_if_fail (edomain != NULL);
1025 _tmp0_ = vala_symbol_get_access ((ValaSymbol*) edomain);
1026 _tmp1_ = _tmp0_;
1027 if (_tmp1_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
1028 vala_symbol_set_access ((ValaSymbol*) edomain, VALA_SYMBOL_ACCESSIBILITY_INTERNAL);
1029 }
1030 _tmp2_ = vala_symbol_get_owner ((ValaSymbol*) edomain);
1031 _tmp3_ = _tmp2_;
1032 if (_tmp3_ == NULL) {
1033 ValaSourceReference* _tmp4_;
1034 ValaSourceReference* _tmp5_;
1035 ValaSourceFile* _tmp6_;
1036 ValaSourceFile* _tmp7_;
1037 _tmp4_ = vala_code_node_get_source_reference ((ValaCodeNode*) edomain);
1038 _tmp5_ = _tmp4_;
1039 _tmp6_ = vala_source_reference_get_file (_tmp5_);
1040 _tmp7_ = _tmp6_;
1041 vala_source_file_add_node (_tmp7_, (ValaCodeNode*) edomain);
1042 }
1043 _tmp8_ = self->priv->error_domains;
1044 vala_collection_add ((ValaCollection*) _tmp8_, edomain);
1045 _tmp9_ = vala_symbol_get_scope ((ValaSymbol*) self);
1046 _tmp10_ = _tmp9_;
1047 _tmp11_ = vala_symbol_get_name ((ValaSymbol*) edomain);
1048 _tmp12_ = _tmp11_;
1049 vala_scope_add (_tmp10_, _tmp12_, (ValaSymbol*) edomain);
1050 }
1051
1052 /**
1053 * Adds the specified delegate to this namespace.
1054 *
1055 * @param d a delegate
1056 */
1057 static void
vala_namespace_real_add_delegate(ValaSymbol * base,ValaDelegate * d)1058 vala_namespace_real_add_delegate (ValaSymbol* base,
1059 ValaDelegate* d)
1060 {
1061 ValaNamespace * self;
1062 ValaSymbolAccessibility _tmp0_;
1063 ValaSymbolAccessibility _tmp1_;
1064 ValaScope* _tmp2_;
1065 ValaScope* _tmp3_;
1066 ValaList* _tmp8_;
1067 ValaScope* _tmp9_;
1068 ValaScope* _tmp10_;
1069 const gchar* _tmp11_;
1070 const gchar* _tmp12_;
1071 self = (ValaNamespace*) base;
1072 g_return_if_fail (d != NULL);
1073 _tmp0_ = vala_symbol_get_access ((ValaSymbol*) d);
1074 _tmp1_ = _tmp0_;
1075 if (_tmp1_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
1076 vala_symbol_set_access ((ValaSymbol*) d, VALA_SYMBOL_ACCESSIBILITY_INTERNAL);
1077 }
1078 _tmp2_ = vala_symbol_get_owner ((ValaSymbol*) d);
1079 _tmp3_ = _tmp2_;
1080 if (_tmp3_ == NULL) {
1081 ValaSourceReference* _tmp4_;
1082 ValaSourceReference* _tmp5_;
1083 ValaSourceFile* _tmp6_;
1084 ValaSourceFile* _tmp7_;
1085 _tmp4_ = vala_code_node_get_source_reference ((ValaCodeNode*) d);
1086 _tmp5_ = _tmp4_;
1087 _tmp6_ = vala_source_reference_get_file (_tmp5_);
1088 _tmp7_ = _tmp6_;
1089 vala_source_file_add_node (_tmp7_, (ValaCodeNode*) d);
1090 }
1091 _tmp8_ = self->priv->delegates;
1092 vala_collection_add ((ValaCollection*) _tmp8_, d);
1093 _tmp9_ = vala_symbol_get_scope ((ValaSymbol*) self);
1094 _tmp10_ = _tmp9_;
1095 _tmp11_ = vala_symbol_get_name ((ValaSymbol*) d);
1096 _tmp12_ = _tmp11_;
1097 vala_scope_add (_tmp10_, _tmp12_, (ValaSymbol*) d);
1098 }
1099
1100 /**
1101 * Returns the list of structs.
1102 *
1103 * @return struct list
1104 */
1105 ValaList*
vala_namespace_get_structs(ValaNamespace * self)1106 vala_namespace_get_structs (ValaNamespace* self)
1107 {
1108 ValaList* _tmp0_;
1109 ValaList* result = NULL;
1110 g_return_val_if_fail (self != NULL, NULL);
1111 _tmp0_ = self->priv->structs;
1112 result = _tmp0_;
1113 return result;
1114 }
1115
1116 /**
1117 * Returns the list of classes.
1118 *
1119 * @return class list
1120 */
1121 ValaList*
vala_namespace_get_classes(ValaNamespace * self)1122 vala_namespace_get_classes (ValaNamespace* self)
1123 {
1124 ValaList* _tmp0_;
1125 ValaList* result = NULL;
1126 g_return_val_if_fail (self != NULL, NULL);
1127 _tmp0_ = self->priv->classes;
1128 result = _tmp0_;
1129 return result;
1130 }
1131
1132 /**
1133 * Returns the list of interfaces.
1134 *
1135 * @return interface list
1136 */
1137 ValaList*
vala_namespace_get_interfaces(ValaNamespace * self)1138 vala_namespace_get_interfaces (ValaNamespace* self)
1139 {
1140 ValaList* _tmp0_;
1141 ValaList* result = NULL;
1142 g_return_val_if_fail (self != NULL, NULL);
1143 _tmp0_ = self->priv->interfaces;
1144 result = _tmp0_;
1145 return result;
1146 }
1147
1148 /**
1149 * Returns the list of enums.
1150 *
1151 * @return enum list
1152 */
1153 ValaList*
vala_namespace_get_enums(ValaNamespace * self)1154 vala_namespace_get_enums (ValaNamespace* self)
1155 {
1156 ValaList* _tmp0_;
1157 ValaList* result = NULL;
1158 g_return_val_if_fail (self != NULL, NULL);
1159 _tmp0_ = self->priv->enums;
1160 result = _tmp0_;
1161 return result;
1162 }
1163
1164 /**
1165 * Returns the list of error domains.
1166 *
1167 * @return error domain list
1168 */
1169 ValaList*
vala_namespace_get_error_domains(ValaNamespace * self)1170 vala_namespace_get_error_domains (ValaNamespace* self)
1171 {
1172 ValaList* _tmp0_;
1173 ValaList* result = NULL;
1174 g_return_val_if_fail (self != NULL, NULL);
1175 _tmp0_ = self->priv->error_domains;
1176 result = _tmp0_;
1177 return result;
1178 }
1179
1180 /**
1181 * Returns the list of fields.
1182 *
1183 * @return field list
1184 */
1185 ValaList*
vala_namespace_get_fields(ValaNamespace * self)1186 vala_namespace_get_fields (ValaNamespace* self)
1187 {
1188 ValaList* _tmp0_;
1189 ValaList* result = NULL;
1190 g_return_val_if_fail (self != NULL, NULL);
1191 _tmp0_ = self->priv->fields;
1192 result = _tmp0_;
1193 return result;
1194 }
1195
1196 /**
1197 * Returns the list of constants.
1198 *
1199 * @return constant list
1200 */
1201 ValaList*
vala_namespace_get_constants(ValaNamespace * self)1202 vala_namespace_get_constants (ValaNamespace* self)
1203 {
1204 ValaList* _tmp0_;
1205 ValaList* result = NULL;
1206 g_return_val_if_fail (self != NULL, NULL);
1207 _tmp0_ = self->priv->constants;
1208 result = _tmp0_;
1209 return result;
1210 }
1211
1212 /**
1213 * Returns the list of delegates.
1214 *
1215 * @return delegate list
1216 */
1217 ValaList*
vala_namespace_get_delegates(ValaNamespace * self)1218 vala_namespace_get_delegates (ValaNamespace* self)
1219 {
1220 ValaList* _tmp0_;
1221 ValaList* result = NULL;
1222 g_return_val_if_fail (self != NULL, NULL);
1223 _tmp0_ = self->priv->delegates;
1224 result = _tmp0_;
1225 return result;
1226 }
1227
1228 /**
1229 * Returns the list of methods.
1230 *
1231 * @return method list
1232 */
1233 ValaList*
vala_namespace_get_methods(ValaNamespace * self)1234 vala_namespace_get_methods (ValaNamespace* self)
1235 {
1236 ValaList* _tmp0_;
1237 ValaList* result = NULL;
1238 g_return_val_if_fail (self != NULL, NULL);
1239 _tmp0_ = self->priv->methods;
1240 result = _tmp0_;
1241 return result;
1242 }
1243
1244 /**
1245 * Adds the specified constant to this namespace.
1246 *
1247 * @param constant a constant
1248 */
1249 static void
vala_namespace_real_add_constant(ValaSymbol * base,ValaConstant * constant)1250 vala_namespace_real_add_constant (ValaSymbol* base,
1251 ValaConstant* constant)
1252 {
1253 ValaNamespace * self;
1254 ValaSymbolAccessibility _tmp0_;
1255 ValaSymbolAccessibility _tmp1_;
1256 ValaScope* _tmp2_;
1257 ValaScope* _tmp3_;
1258 ValaList* _tmp8_;
1259 ValaScope* _tmp9_;
1260 ValaScope* _tmp10_;
1261 const gchar* _tmp11_;
1262 const gchar* _tmp12_;
1263 self = (ValaNamespace*) base;
1264 g_return_if_fail (constant != NULL);
1265 _tmp0_ = vala_symbol_get_access ((ValaSymbol*) constant);
1266 _tmp1_ = _tmp0_;
1267 if (_tmp1_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
1268 vala_symbol_set_access ((ValaSymbol*) constant, VALA_SYMBOL_ACCESSIBILITY_INTERNAL);
1269 }
1270 _tmp2_ = vala_symbol_get_owner ((ValaSymbol*) constant);
1271 _tmp3_ = _tmp2_;
1272 if (_tmp3_ == NULL) {
1273 ValaSourceReference* _tmp4_;
1274 ValaSourceReference* _tmp5_;
1275 ValaSourceFile* _tmp6_;
1276 ValaSourceFile* _tmp7_;
1277 _tmp4_ = vala_code_node_get_source_reference ((ValaCodeNode*) constant);
1278 _tmp5_ = _tmp4_;
1279 _tmp6_ = vala_source_reference_get_file (_tmp5_);
1280 _tmp7_ = _tmp6_;
1281 vala_source_file_add_node (_tmp7_, (ValaCodeNode*) constant);
1282 }
1283 _tmp8_ = self->priv->constants;
1284 vala_collection_add ((ValaCollection*) _tmp8_, constant);
1285 _tmp9_ = vala_symbol_get_scope ((ValaSymbol*) self);
1286 _tmp10_ = _tmp9_;
1287 _tmp11_ = vala_symbol_get_name ((ValaSymbol*) constant);
1288 _tmp12_ = _tmp11_;
1289 vala_scope_add (_tmp10_, _tmp12_, (ValaSymbol*) constant);
1290 }
1291
1292 /**
1293 * Adds the specified field to this namespace.
1294 *
1295 * @param f a field
1296 */
1297 static void
vala_namespace_real_add_field(ValaSymbol * base,ValaField * f)1298 vala_namespace_real_add_field (ValaSymbol* base,
1299 ValaField* f)
1300 {
1301 ValaNamespace * self;
1302 ValaSymbolAccessibility _tmp0_;
1303 ValaSymbolAccessibility _tmp1_;
1304 ValaScope* _tmp2_;
1305 ValaScope* _tmp3_;
1306 ValaList* _tmp8_;
1307 ValaScope* _tmp9_;
1308 ValaScope* _tmp10_;
1309 const gchar* _tmp11_;
1310 const gchar* _tmp12_;
1311 self = (ValaNamespace*) base;
1312 g_return_if_fail (f != NULL);
1313 _tmp0_ = vala_symbol_get_access ((ValaSymbol*) f);
1314 _tmp1_ = _tmp0_;
1315 if (_tmp1_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
1316 vala_symbol_set_access ((ValaSymbol*) f, VALA_SYMBOL_ACCESSIBILITY_INTERNAL);
1317 }
1318 _tmp2_ = vala_symbol_get_owner ((ValaSymbol*) f);
1319 _tmp3_ = _tmp2_;
1320 if (_tmp3_ == NULL) {
1321 ValaSourceReference* _tmp4_;
1322 ValaSourceReference* _tmp5_;
1323 ValaSourceFile* _tmp6_;
1324 ValaSourceFile* _tmp7_;
1325 _tmp4_ = vala_code_node_get_source_reference ((ValaCodeNode*) f);
1326 _tmp5_ = _tmp4_;
1327 _tmp6_ = vala_source_reference_get_file (_tmp5_);
1328 _tmp7_ = _tmp6_;
1329 vala_source_file_add_node (_tmp7_, (ValaCodeNode*) f);
1330 }
1331 _tmp8_ = self->priv->fields;
1332 vala_collection_add ((ValaCollection*) _tmp8_, f);
1333 _tmp9_ = vala_symbol_get_scope ((ValaSymbol*) self);
1334 _tmp10_ = _tmp9_;
1335 _tmp11_ = vala_symbol_get_name ((ValaSymbol*) f);
1336 _tmp12_ = _tmp11_;
1337 vala_scope_add (_tmp10_, _tmp12_, (ValaSymbol*) f);
1338 }
1339
1340 /**
1341 * Adds the specified method to this namespace.
1342 *
1343 * @param m a method
1344 */
1345 static void
vala_namespace_real_add_method(ValaSymbol * base,ValaMethod * m)1346 vala_namespace_real_add_method (ValaSymbol* base,
1347 ValaMethod* m)
1348 {
1349 ValaNamespace * self;
1350 ValaSymbolAccessibility _tmp0_;
1351 ValaSymbolAccessibility _tmp1_;
1352 gboolean _tmp2_ = FALSE;
1353 ValaDataType* _tmp3_;
1354 ValaDataType* _tmp4_;
1355 ValaScope* _tmp18_;
1356 ValaScope* _tmp19_;
1357 ValaList* _tmp24_;
1358 ValaScope* _tmp25_;
1359 ValaScope* _tmp26_;
1360 const gchar* _tmp27_;
1361 const gchar* _tmp28_;
1362 self = (ValaNamespace*) base;
1363 g_return_if_fail (m != NULL);
1364 _tmp0_ = vala_symbol_get_access ((ValaSymbol*) m);
1365 _tmp1_ = _tmp0_;
1366 if (_tmp1_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
1367 vala_symbol_set_access ((ValaSymbol*) m, VALA_SYMBOL_ACCESSIBILITY_INTERNAL);
1368 }
1369 _tmp3_ = vala_callable_get_return_type ((ValaCallable*) m);
1370 _tmp4_ = _tmp3_;
1371 if (!VALA_IS_VOID_TYPE (_tmp4_)) {
1372 ValaList* _tmp5_;
1373 gint _tmp6_;
1374 gint _tmp7_;
1375 _tmp5_ = vala_method_get_postconditions (m);
1376 _tmp6_ = vala_collection_get_size ((ValaCollection*) _tmp5_);
1377 _tmp7_ = _tmp6_;
1378 _tmp2_ = _tmp7_ > 0;
1379 } else {
1380 _tmp2_ = FALSE;
1381 }
1382 if (_tmp2_) {
1383 ValaDataType* _tmp8_;
1384 ValaDataType* _tmp9_;
1385 ValaDataType* _tmp10_;
1386 ValaDataType* _tmp11_;
1387 ValaSourceReference* _tmp12_;
1388 ValaSourceReference* _tmp13_;
1389 ValaLocalVariable* _tmp14_;
1390 ValaLocalVariable* _tmp15_;
1391 ValaLocalVariable* _tmp16_;
1392 ValaLocalVariable* _tmp17_;
1393 _tmp8_ = vala_callable_get_return_type ((ValaCallable*) m);
1394 _tmp9_ = _tmp8_;
1395 _tmp10_ = vala_data_type_copy (_tmp9_);
1396 _tmp11_ = _tmp10_;
1397 _tmp12_ = vala_code_node_get_source_reference ((ValaCodeNode*) m);
1398 _tmp13_ = _tmp12_;
1399 _tmp14_ = vala_local_variable_new (_tmp11_, "result", NULL, _tmp13_);
1400 _tmp15_ = _tmp14_;
1401 vala_subroutine_set_result_var ((ValaSubroutine*) m, _tmp15_);
1402 _vala_code_node_unref0 (_tmp15_);
1403 _vala_code_node_unref0 (_tmp11_);
1404 _tmp16_ = vala_subroutine_get_result_var ((ValaSubroutine*) m);
1405 _tmp17_ = _tmp16_;
1406 vala_local_variable_set_is_result (_tmp17_, TRUE);
1407 }
1408 _tmp18_ = vala_symbol_get_owner ((ValaSymbol*) m);
1409 _tmp19_ = _tmp18_;
1410 if (_tmp19_ == NULL) {
1411 ValaSourceReference* _tmp20_;
1412 ValaSourceReference* _tmp21_;
1413 ValaSourceFile* _tmp22_;
1414 ValaSourceFile* _tmp23_;
1415 _tmp20_ = vala_code_node_get_source_reference ((ValaCodeNode*) m);
1416 _tmp21_ = _tmp20_;
1417 _tmp22_ = vala_source_reference_get_file (_tmp21_);
1418 _tmp23_ = _tmp22_;
1419 vala_source_file_add_node (_tmp23_, (ValaCodeNode*) m);
1420 }
1421 _tmp24_ = self->priv->methods;
1422 vala_collection_add ((ValaCollection*) _tmp24_, m);
1423 _tmp25_ = vala_symbol_get_scope ((ValaSymbol*) self);
1424 _tmp26_ = _tmp25_;
1425 _tmp27_ = vala_symbol_get_name ((ValaSymbol*) m);
1426 _tmp28_ = _tmp27_;
1427 vala_scope_add (_tmp26_, _tmp28_, (ValaSymbol*) m);
1428 }
1429
1430 static void
vala_namespace_real_accept(ValaCodeNode * base,ValaCodeVisitor * visitor)1431 vala_namespace_real_accept (ValaCodeNode* base,
1432 ValaCodeVisitor* visitor)
1433 {
1434 ValaNamespace * self;
1435 self = (ValaNamespace*) base;
1436 g_return_if_fail (visitor != NULL);
1437 vala_code_visitor_visit_namespace (visitor, self);
1438 }
1439
1440 static void
vala_namespace_real_accept_children(ValaCodeNode * base,ValaCodeVisitor * visitor)1441 vala_namespace_real_accept_children (ValaCodeNode* base,
1442 ValaCodeVisitor* visitor)
1443 {
1444 ValaNamespace * self;
1445 self = (ValaNamespace*) base;
1446 g_return_if_fail (visitor != NULL);
1447 {
1448 ValaList* _ns_ref_list = NULL;
1449 ValaList* _tmp0_;
1450 ValaList* _tmp1_;
1451 gint _ns_ref_size = 0;
1452 ValaList* _tmp2_;
1453 gint _tmp3_;
1454 gint _tmp4_;
1455 gint _ns_ref_index = 0;
1456 _tmp0_ = self->priv->using_directives;
1457 _tmp1_ = _vala_iterable_ref0 (_tmp0_);
1458 _ns_ref_list = _tmp1_;
1459 _tmp2_ = _ns_ref_list;
1460 _tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
1461 _tmp4_ = _tmp3_;
1462 _ns_ref_size = _tmp4_;
1463 _ns_ref_index = -1;
1464 while (TRUE) {
1465 gint _tmp5_;
1466 gint _tmp6_;
1467 ValaUsingDirective* ns_ref = NULL;
1468 ValaList* _tmp7_;
1469 gpointer _tmp8_;
1470 ValaUsingDirective* _tmp9_;
1471 _ns_ref_index = _ns_ref_index + 1;
1472 _tmp5_ = _ns_ref_index;
1473 _tmp6_ = _ns_ref_size;
1474 if (!(_tmp5_ < _tmp6_)) {
1475 break;
1476 }
1477 _tmp7_ = _ns_ref_list;
1478 _tmp8_ = vala_list_get (_tmp7_, _ns_ref_index);
1479 ns_ref = (ValaUsingDirective*) _tmp8_;
1480 _tmp9_ = ns_ref;
1481 vala_code_node_accept ((ValaCodeNode*) _tmp9_, visitor);
1482 _vala_code_node_unref0 (ns_ref);
1483 }
1484 _vala_iterable_unref0 (_ns_ref_list);
1485 }
1486 {
1487 ValaList* _ns_list = NULL;
1488 ValaList* _tmp10_;
1489 ValaList* _tmp11_;
1490 gint _ns_size = 0;
1491 ValaList* _tmp12_;
1492 gint _tmp13_;
1493 gint _tmp14_;
1494 gint _ns_index = 0;
1495 _tmp10_ = self->priv->namespaces;
1496 _tmp11_ = _vala_iterable_ref0 (_tmp10_);
1497 _ns_list = _tmp11_;
1498 _tmp12_ = _ns_list;
1499 _tmp13_ = vala_collection_get_size ((ValaCollection*) _tmp12_);
1500 _tmp14_ = _tmp13_;
1501 _ns_size = _tmp14_;
1502 _ns_index = -1;
1503 while (TRUE) {
1504 gint _tmp15_;
1505 gint _tmp16_;
1506 ValaNamespace* ns = NULL;
1507 ValaList* _tmp17_;
1508 gpointer _tmp18_;
1509 ValaNamespace* _tmp19_;
1510 _ns_index = _ns_index + 1;
1511 _tmp15_ = _ns_index;
1512 _tmp16_ = _ns_size;
1513 if (!(_tmp15_ < _tmp16_)) {
1514 break;
1515 }
1516 _tmp17_ = _ns_list;
1517 _tmp18_ = vala_list_get (_tmp17_, _ns_index);
1518 ns = (ValaNamespace*) _tmp18_;
1519 _tmp19_ = ns;
1520 vala_code_node_accept ((ValaCodeNode*) _tmp19_, visitor);
1521 _vala_code_node_unref0 (ns);
1522 }
1523 _vala_iterable_unref0 (_ns_list);
1524 }
1525 {
1526 ValaList* _en_list = NULL;
1527 ValaList* _tmp20_;
1528 ValaList* _tmp21_;
1529 gint _en_size = 0;
1530 ValaList* _tmp22_;
1531 gint _tmp23_;
1532 gint _tmp24_;
1533 gint _en_index = 0;
1534 _tmp20_ = self->priv->enums;
1535 _tmp21_ = _vala_iterable_ref0 (_tmp20_);
1536 _en_list = _tmp21_;
1537 _tmp22_ = _en_list;
1538 _tmp23_ = vala_collection_get_size ((ValaCollection*) _tmp22_);
1539 _tmp24_ = _tmp23_;
1540 _en_size = _tmp24_;
1541 _en_index = -1;
1542 while (TRUE) {
1543 gint _tmp25_;
1544 gint _tmp26_;
1545 ValaEnum* en = NULL;
1546 ValaList* _tmp27_;
1547 gpointer _tmp28_;
1548 ValaEnum* _tmp29_;
1549 _en_index = _en_index + 1;
1550 _tmp25_ = _en_index;
1551 _tmp26_ = _en_size;
1552 if (!(_tmp25_ < _tmp26_)) {
1553 break;
1554 }
1555 _tmp27_ = _en_list;
1556 _tmp28_ = vala_list_get (_tmp27_, _en_index);
1557 en = (ValaEnum*) _tmp28_;
1558 _tmp29_ = en;
1559 vala_code_node_accept ((ValaCodeNode*) _tmp29_, visitor);
1560 _vala_code_node_unref0 (en);
1561 }
1562 _vala_iterable_unref0 (_en_list);
1563 }
1564 {
1565 ValaList* _edomain_list = NULL;
1566 ValaList* _tmp30_;
1567 ValaList* _tmp31_;
1568 gint _edomain_size = 0;
1569 ValaList* _tmp32_;
1570 gint _tmp33_;
1571 gint _tmp34_;
1572 gint _edomain_index = 0;
1573 _tmp30_ = self->priv->error_domains;
1574 _tmp31_ = _vala_iterable_ref0 (_tmp30_);
1575 _edomain_list = _tmp31_;
1576 _tmp32_ = _edomain_list;
1577 _tmp33_ = vala_collection_get_size ((ValaCollection*) _tmp32_);
1578 _tmp34_ = _tmp33_;
1579 _edomain_size = _tmp34_;
1580 _edomain_index = -1;
1581 while (TRUE) {
1582 gint _tmp35_;
1583 gint _tmp36_;
1584 ValaErrorDomain* edomain = NULL;
1585 ValaList* _tmp37_;
1586 gpointer _tmp38_;
1587 ValaErrorDomain* _tmp39_;
1588 _edomain_index = _edomain_index + 1;
1589 _tmp35_ = _edomain_index;
1590 _tmp36_ = _edomain_size;
1591 if (!(_tmp35_ < _tmp36_)) {
1592 break;
1593 }
1594 _tmp37_ = _edomain_list;
1595 _tmp38_ = vala_list_get (_tmp37_, _edomain_index);
1596 edomain = (ValaErrorDomain*) _tmp38_;
1597 _tmp39_ = edomain;
1598 vala_code_node_accept ((ValaCodeNode*) _tmp39_, visitor);
1599 _vala_code_node_unref0 (edomain);
1600 }
1601 _vala_iterable_unref0 (_edomain_list);
1602 }
1603 {
1604 ValaList* _cl_list = NULL;
1605 ValaList* _tmp40_;
1606 ValaList* _tmp41_;
1607 gint _cl_size = 0;
1608 ValaList* _tmp42_;
1609 gint _tmp43_;
1610 gint _tmp44_;
1611 gint _cl_index = 0;
1612 _tmp40_ = self->priv->classes;
1613 _tmp41_ = _vala_iterable_ref0 (_tmp40_);
1614 _cl_list = _tmp41_;
1615 _tmp42_ = _cl_list;
1616 _tmp43_ = vala_collection_get_size ((ValaCollection*) _tmp42_);
1617 _tmp44_ = _tmp43_;
1618 _cl_size = _tmp44_;
1619 _cl_index = -1;
1620 while (TRUE) {
1621 gint _tmp45_;
1622 gint _tmp46_;
1623 ValaClass* cl = NULL;
1624 ValaList* _tmp47_;
1625 gpointer _tmp48_;
1626 ValaClass* _tmp49_;
1627 _cl_index = _cl_index + 1;
1628 _tmp45_ = _cl_index;
1629 _tmp46_ = _cl_size;
1630 if (!(_tmp45_ < _tmp46_)) {
1631 break;
1632 }
1633 _tmp47_ = _cl_list;
1634 _tmp48_ = vala_list_get (_tmp47_, _cl_index);
1635 cl = (ValaClass*) _tmp48_;
1636 _tmp49_ = cl;
1637 vala_code_node_accept ((ValaCodeNode*) _tmp49_, visitor);
1638 _vala_code_node_unref0 (cl);
1639 }
1640 _vala_iterable_unref0 (_cl_list);
1641 }
1642 {
1643 ValaList* _iface_list = NULL;
1644 ValaList* _tmp50_;
1645 ValaList* _tmp51_;
1646 gint _iface_size = 0;
1647 ValaList* _tmp52_;
1648 gint _tmp53_;
1649 gint _tmp54_;
1650 gint _iface_index = 0;
1651 _tmp50_ = self->priv->interfaces;
1652 _tmp51_ = _vala_iterable_ref0 (_tmp50_);
1653 _iface_list = _tmp51_;
1654 _tmp52_ = _iface_list;
1655 _tmp53_ = vala_collection_get_size ((ValaCollection*) _tmp52_);
1656 _tmp54_ = _tmp53_;
1657 _iface_size = _tmp54_;
1658 _iface_index = -1;
1659 while (TRUE) {
1660 gint _tmp55_;
1661 gint _tmp56_;
1662 ValaInterface* iface = NULL;
1663 ValaList* _tmp57_;
1664 gpointer _tmp58_;
1665 ValaInterface* _tmp59_;
1666 _iface_index = _iface_index + 1;
1667 _tmp55_ = _iface_index;
1668 _tmp56_ = _iface_size;
1669 if (!(_tmp55_ < _tmp56_)) {
1670 break;
1671 }
1672 _tmp57_ = _iface_list;
1673 _tmp58_ = vala_list_get (_tmp57_, _iface_index);
1674 iface = (ValaInterface*) _tmp58_;
1675 _tmp59_ = iface;
1676 vala_code_node_accept ((ValaCodeNode*) _tmp59_, visitor);
1677 _vala_code_node_unref0 (iface);
1678 }
1679 _vala_iterable_unref0 (_iface_list);
1680 }
1681 {
1682 ValaList* _st_list = NULL;
1683 ValaList* _tmp60_;
1684 ValaList* _tmp61_;
1685 gint _st_size = 0;
1686 ValaList* _tmp62_;
1687 gint _tmp63_;
1688 gint _tmp64_;
1689 gint _st_index = 0;
1690 _tmp60_ = self->priv->structs;
1691 _tmp61_ = _vala_iterable_ref0 (_tmp60_);
1692 _st_list = _tmp61_;
1693 _tmp62_ = _st_list;
1694 _tmp63_ = vala_collection_get_size ((ValaCollection*) _tmp62_);
1695 _tmp64_ = _tmp63_;
1696 _st_size = _tmp64_;
1697 _st_index = -1;
1698 while (TRUE) {
1699 gint _tmp65_;
1700 gint _tmp66_;
1701 ValaStruct* st = NULL;
1702 ValaList* _tmp67_;
1703 gpointer _tmp68_;
1704 ValaStruct* _tmp69_;
1705 _st_index = _st_index + 1;
1706 _tmp65_ = _st_index;
1707 _tmp66_ = _st_size;
1708 if (!(_tmp65_ < _tmp66_)) {
1709 break;
1710 }
1711 _tmp67_ = _st_list;
1712 _tmp68_ = vala_list_get (_tmp67_, _st_index);
1713 st = (ValaStruct*) _tmp68_;
1714 _tmp69_ = st;
1715 vala_code_node_accept ((ValaCodeNode*) _tmp69_, visitor);
1716 _vala_code_node_unref0 (st);
1717 }
1718 _vala_iterable_unref0 (_st_list);
1719 }
1720 {
1721 ValaList* _d_list = NULL;
1722 ValaList* _tmp70_;
1723 ValaList* _tmp71_;
1724 gint _d_size = 0;
1725 ValaList* _tmp72_;
1726 gint _tmp73_;
1727 gint _tmp74_;
1728 gint _d_index = 0;
1729 _tmp70_ = self->priv->delegates;
1730 _tmp71_ = _vala_iterable_ref0 (_tmp70_);
1731 _d_list = _tmp71_;
1732 _tmp72_ = _d_list;
1733 _tmp73_ = vala_collection_get_size ((ValaCollection*) _tmp72_);
1734 _tmp74_ = _tmp73_;
1735 _d_size = _tmp74_;
1736 _d_index = -1;
1737 while (TRUE) {
1738 gint _tmp75_;
1739 gint _tmp76_;
1740 ValaDelegate* d = NULL;
1741 ValaList* _tmp77_;
1742 gpointer _tmp78_;
1743 ValaDelegate* _tmp79_;
1744 _d_index = _d_index + 1;
1745 _tmp75_ = _d_index;
1746 _tmp76_ = _d_size;
1747 if (!(_tmp75_ < _tmp76_)) {
1748 break;
1749 }
1750 _tmp77_ = _d_list;
1751 _tmp78_ = vala_list_get (_tmp77_, _d_index);
1752 d = (ValaDelegate*) _tmp78_;
1753 _tmp79_ = d;
1754 vala_code_node_accept ((ValaCodeNode*) _tmp79_, visitor);
1755 _vala_code_node_unref0 (d);
1756 }
1757 _vala_iterable_unref0 (_d_list);
1758 }
1759 {
1760 ValaList* _c_list = NULL;
1761 ValaList* _tmp80_;
1762 ValaList* _tmp81_;
1763 gint _c_size = 0;
1764 ValaList* _tmp82_;
1765 gint _tmp83_;
1766 gint _tmp84_;
1767 gint _c_index = 0;
1768 _tmp80_ = self->priv->constants;
1769 _tmp81_ = _vala_iterable_ref0 (_tmp80_);
1770 _c_list = _tmp81_;
1771 _tmp82_ = _c_list;
1772 _tmp83_ = vala_collection_get_size ((ValaCollection*) _tmp82_);
1773 _tmp84_ = _tmp83_;
1774 _c_size = _tmp84_;
1775 _c_index = -1;
1776 while (TRUE) {
1777 gint _tmp85_;
1778 gint _tmp86_;
1779 ValaConstant* c = NULL;
1780 ValaList* _tmp87_;
1781 gpointer _tmp88_;
1782 ValaConstant* _tmp89_;
1783 _c_index = _c_index + 1;
1784 _tmp85_ = _c_index;
1785 _tmp86_ = _c_size;
1786 if (!(_tmp85_ < _tmp86_)) {
1787 break;
1788 }
1789 _tmp87_ = _c_list;
1790 _tmp88_ = vala_list_get (_tmp87_, _c_index);
1791 c = (ValaConstant*) _tmp88_;
1792 _tmp89_ = c;
1793 vala_code_node_accept ((ValaCodeNode*) _tmp89_, visitor);
1794 _vala_code_node_unref0 (c);
1795 }
1796 _vala_iterable_unref0 (_c_list);
1797 }
1798 {
1799 ValaList* _f_list = NULL;
1800 ValaList* _tmp90_;
1801 ValaList* _tmp91_;
1802 gint _f_size = 0;
1803 ValaList* _tmp92_;
1804 gint _tmp93_;
1805 gint _tmp94_;
1806 gint _f_index = 0;
1807 _tmp90_ = self->priv->fields;
1808 _tmp91_ = _vala_iterable_ref0 (_tmp90_);
1809 _f_list = _tmp91_;
1810 _tmp92_ = _f_list;
1811 _tmp93_ = vala_collection_get_size ((ValaCollection*) _tmp92_);
1812 _tmp94_ = _tmp93_;
1813 _f_size = _tmp94_;
1814 _f_index = -1;
1815 while (TRUE) {
1816 gint _tmp95_;
1817 gint _tmp96_;
1818 ValaField* f = NULL;
1819 ValaList* _tmp97_;
1820 gpointer _tmp98_;
1821 ValaField* _tmp99_;
1822 _f_index = _f_index + 1;
1823 _tmp95_ = _f_index;
1824 _tmp96_ = _f_size;
1825 if (!(_tmp95_ < _tmp96_)) {
1826 break;
1827 }
1828 _tmp97_ = _f_list;
1829 _tmp98_ = vala_list_get (_tmp97_, _f_index);
1830 f = (ValaField*) _tmp98_;
1831 _tmp99_ = f;
1832 vala_code_node_accept ((ValaCodeNode*) _tmp99_, visitor);
1833 _vala_code_node_unref0 (f);
1834 }
1835 _vala_iterable_unref0 (_f_list);
1836 }
1837 {
1838 ValaList* _m_list = NULL;
1839 ValaList* _tmp100_;
1840 ValaList* _tmp101_;
1841 gint _m_size = 0;
1842 ValaList* _tmp102_;
1843 gint _tmp103_;
1844 gint _tmp104_;
1845 gint _m_index = 0;
1846 _tmp100_ = self->priv->methods;
1847 _tmp101_ = _vala_iterable_ref0 (_tmp100_);
1848 _m_list = _tmp101_;
1849 _tmp102_ = _m_list;
1850 _tmp103_ = vala_collection_get_size ((ValaCollection*) _tmp102_);
1851 _tmp104_ = _tmp103_;
1852 _m_size = _tmp104_;
1853 _m_index = -1;
1854 while (TRUE) {
1855 gint _tmp105_;
1856 gint _tmp106_;
1857 ValaMethod* m = NULL;
1858 ValaList* _tmp107_;
1859 gpointer _tmp108_;
1860 ValaMethod* _tmp109_;
1861 _m_index = _m_index + 1;
1862 _tmp105_ = _m_index;
1863 _tmp106_ = _m_size;
1864 if (!(_tmp105_ < _tmp106_)) {
1865 break;
1866 }
1867 _tmp107_ = _m_list;
1868 _tmp108_ = vala_list_get (_tmp107_, _m_index);
1869 m = (ValaMethod*) _tmp108_;
1870 _tmp109_ = m;
1871 vala_code_node_accept ((ValaCodeNode*) _tmp109_, visitor);
1872 _vala_code_node_unref0 (m);
1873 }
1874 _vala_iterable_unref0 (_m_list);
1875 }
1876 }
1877
1878 static gboolean
vala_namespace_real_check(ValaCodeNode * base,ValaCodeContext * context)1879 vala_namespace_real_check (ValaCodeNode* base,
1880 ValaCodeContext* context)
1881 {
1882 ValaNamespace * self;
1883 gboolean _tmp0_;
1884 gboolean _tmp1_;
1885 ValaAttribute* a = NULL;
1886 ValaAttribute* _tmp4_;
1887 ValaAttribute* _tmp5_;
1888 gboolean _tmp6_ = FALSE;
1889 ValaAttribute* _tmp7_;
1890 gboolean _tmp16_ = FALSE;
1891 ValaAttribute* _tmp17_;
1892 gboolean _tmp87_;
1893 gboolean _tmp88_;
1894 gboolean result = FALSE;
1895 self = (ValaNamespace*) base;
1896 g_return_val_if_fail (context != NULL, FALSE);
1897 _tmp0_ = vala_code_node_get_checked ((ValaCodeNode*) self);
1898 _tmp1_ = _tmp0_;
1899 if (_tmp1_) {
1900 gboolean _tmp2_;
1901 gboolean _tmp3_;
1902 _tmp2_ = vala_code_node_get_error ((ValaCodeNode*) self);
1903 _tmp3_ = _tmp2_;
1904 result = !_tmp3_;
1905 return result;
1906 }
1907 vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
1908 _tmp4_ = vala_code_node_get_attribute ((ValaCodeNode*) self, "CCode");
1909 _tmp5_ = _vala_code_node_ref0 (_tmp4_);
1910 a = _tmp5_;
1911 _tmp7_ = a;
1912 if (_tmp7_ != NULL) {
1913 ValaAttribute* _tmp8_;
1914 _tmp8_ = a;
1915 _tmp6_ = vala_attribute_has_argument (_tmp8_, "gir_namespace");
1916 } else {
1917 _tmp6_ = FALSE;
1918 }
1919 if (_tmp6_) {
1920 ValaSourceReference* _tmp9_;
1921 ValaSourceReference* _tmp10_;
1922 ValaSourceFile* _tmp11_;
1923 ValaSourceFile* _tmp12_;
1924 ValaAttribute* _tmp13_;
1925 gchar* _tmp14_;
1926 gchar* _tmp15_;
1927 _tmp9_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1928 _tmp10_ = _tmp9_;
1929 _tmp11_ = vala_source_reference_get_file (_tmp10_);
1930 _tmp12_ = _tmp11_;
1931 _tmp13_ = a;
1932 _tmp14_ = vala_attribute_get_string (_tmp13_, "gir_namespace", NULL);
1933 _tmp15_ = _tmp14_;
1934 vala_source_file_set_gir_namespace (_tmp12_, _tmp15_);
1935 _g_free0 (_tmp15_);
1936 }
1937 _tmp17_ = a;
1938 if (_tmp17_ != NULL) {
1939 ValaAttribute* _tmp18_;
1940 _tmp18_ = a;
1941 _tmp16_ = vala_attribute_has_argument (_tmp18_, "gir_version");
1942 } else {
1943 _tmp16_ = FALSE;
1944 }
1945 if (_tmp16_) {
1946 ValaSourceReference* _tmp19_;
1947 ValaSourceReference* _tmp20_;
1948 ValaSourceFile* _tmp21_;
1949 ValaSourceFile* _tmp22_;
1950 ValaAttribute* _tmp23_;
1951 gchar* _tmp24_;
1952 gchar* _tmp25_;
1953 _tmp19_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1954 _tmp20_ = _tmp19_;
1955 _tmp21_ = vala_source_reference_get_file (_tmp20_);
1956 _tmp22_ = _tmp21_;
1957 _tmp23_ = a;
1958 _tmp24_ = vala_attribute_get_string (_tmp23_, "gir_version", NULL);
1959 _tmp25_ = _tmp24_;
1960 vala_source_file_set_gir_version (_tmp22_, _tmp25_);
1961 _g_free0 (_tmp25_);
1962 }
1963 {
1964 ValaList* _f_list = NULL;
1965 ValaList* _tmp26_;
1966 ValaList* _tmp27_;
1967 gint _f_size = 0;
1968 ValaList* _tmp28_;
1969 gint _tmp29_;
1970 gint _tmp30_;
1971 gint _f_index = 0;
1972 _tmp26_ = self->priv->fields;
1973 _tmp27_ = _vala_iterable_ref0 (_tmp26_);
1974 _f_list = _tmp27_;
1975 _tmp28_ = _f_list;
1976 _tmp29_ = vala_collection_get_size ((ValaCollection*) _tmp28_);
1977 _tmp30_ = _tmp29_;
1978 _f_size = _tmp30_;
1979 _f_index = -1;
1980 while (TRUE) {
1981 gint _tmp31_;
1982 gint _tmp32_;
1983 ValaField* f = NULL;
1984 ValaList* _tmp33_;
1985 gpointer _tmp34_;
1986 ValaField* _tmp35_;
1987 ValaMemberBinding _tmp36_;
1988 ValaMemberBinding _tmp37_;
1989 _f_index = _f_index + 1;
1990 _tmp31_ = _f_index;
1991 _tmp32_ = _f_size;
1992 if (!(_tmp31_ < _tmp32_)) {
1993 break;
1994 }
1995 _tmp33_ = _f_list;
1996 _tmp34_ = vala_list_get (_tmp33_, _f_index);
1997 f = (ValaField*) _tmp34_;
1998 _tmp35_ = f;
1999 _tmp36_ = vala_field_get_binding (_tmp35_);
2000 _tmp37_ = _tmp36_;
2001 if (_tmp37_ == VALA_MEMBER_BINDING_INSTANCE) {
2002 ValaField* _tmp38_;
2003 ValaSourceReference* _tmp39_;
2004 ValaSourceReference* _tmp40_;
2005 ValaField* _tmp41_;
2006 _tmp38_ = f;
2007 _tmp39_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp38_);
2008 _tmp40_ = _tmp39_;
2009 vala_report_error (_tmp40_, "instance fields are not allowed outside of data types");
2010 _tmp41_ = f;
2011 vala_code_node_set_error ((ValaCodeNode*) _tmp41_, TRUE);
2012 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2013 } else {
2014 ValaField* _tmp42_;
2015 ValaMemberBinding _tmp43_;
2016 ValaMemberBinding _tmp44_;
2017 _tmp42_ = f;
2018 _tmp43_ = vala_field_get_binding (_tmp42_);
2019 _tmp44_ = _tmp43_;
2020 if (_tmp44_ == VALA_MEMBER_BINDING_CLASS) {
2021 ValaField* _tmp45_;
2022 ValaSourceReference* _tmp46_;
2023 ValaSourceReference* _tmp47_;
2024 ValaField* _tmp48_;
2025 _tmp45_ = f;
2026 _tmp46_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp45_);
2027 _tmp47_ = _tmp46_;
2028 vala_report_error (_tmp47_, "class fields are not allowed outside of classes");
2029 _tmp48_ = f;
2030 vala_code_node_set_error ((ValaCodeNode*) _tmp48_, TRUE);
2031 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2032 }
2033 }
2034 _vala_code_node_unref0 (f);
2035 }
2036 _vala_iterable_unref0 (_f_list);
2037 }
2038 {
2039 ValaList* _m_list = NULL;
2040 ValaList* _tmp49_;
2041 ValaList* _tmp50_;
2042 gint _m_size = 0;
2043 ValaList* _tmp51_;
2044 gint _tmp52_;
2045 gint _tmp53_;
2046 gint _m_index = 0;
2047 _tmp49_ = self->priv->methods;
2048 _tmp50_ = _vala_iterable_ref0 (_tmp49_);
2049 _m_list = _tmp50_;
2050 _tmp51_ = _m_list;
2051 _tmp52_ = vala_collection_get_size ((ValaCollection*) _tmp51_);
2052 _tmp53_ = _tmp52_;
2053 _m_size = _tmp53_;
2054 _m_index = -1;
2055 while (TRUE) {
2056 gint _tmp54_;
2057 gint _tmp55_;
2058 ValaMethod* m = NULL;
2059 ValaList* _tmp56_;
2060 gpointer _tmp57_;
2061 ValaMethod* _tmp58_;
2062 ValaMethod* _tmp63_;
2063 ValaMemberBinding _tmp64_;
2064 ValaMemberBinding _tmp65_;
2065 _m_index = _m_index + 1;
2066 _tmp54_ = _m_index;
2067 _tmp55_ = _m_size;
2068 if (!(_tmp54_ < _tmp55_)) {
2069 break;
2070 }
2071 _tmp56_ = _m_list;
2072 _tmp57_ = vala_list_get (_tmp56_, _m_index);
2073 m = (ValaMethod*) _tmp57_;
2074 _tmp58_ = m;
2075 if (VALA_IS_CREATION_METHOD (_tmp58_)) {
2076 ValaMethod* _tmp59_;
2077 ValaSourceReference* _tmp60_;
2078 ValaSourceReference* _tmp61_;
2079 ValaMethod* _tmp62_;
2080 _tmp59_ = m;
2081 _tmp60_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp59_);
2082 _tmp61_ = _tmp60_;
2083 vala_report_error (_tmp61_, "construction methods may only be declared within classes and structs");
2084 _tmp62_ = m;
2085 vala_code_node_set_error ((ValaCodeNode*) _tmp62_, TRUE);
2086 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2087 }
2088 _tmp63_ = m;
2089 _tmp64_ = vala_method_get_binding (_tmp63_);
2090 _tmp65_ = _tmp64_;
2091 if (_tmp65_ == VALA_MEMBER_BINDING_INSTANCE) {
2092 ValaMethod* _tmp66_;
2093 ValaSourceReference* _tmp67_;
2094 ValaSourceReference* _tmp68_;
2095 ValaMethod* _tmp69_;
2096 _tmp66_ = m;
2097 _tmp67_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp66_);
2098 _tmp68_ = _tmp67_;
2099 vala_report_error (_tmp68_, "instance methods are not allowed outside of data types");
2100 _tmp69_ = m;
2101 vala_code_node_set_error ((ValaCodeNode*) _tmp69_, TRUE);
2102 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2103 } else {
2104 ValaMethod* _tmp70_;
2105 ValaMemberBinding _tmp71_;
2106 ValaMemberBinding _tmp72_;
2107 _tmp70_ = m;
2108 _tmp71_ = vala_method_get_binding (_tmp70_);
2109 _tmp72_ = _tmp71_;
2110 if (_tmp72_ == VALA_MEMBER_BINDING_CLASS) {
2111 ValaMethod* _tmp73_;
2112 ValaSourceReference* _tmp74_;
2113 ValaSourceReference* _tmp75_;
2114 ValaMethod* _tmp76_;
2115 _tmp73_ = m;
2116 _tmp74_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp73_);
2117 _tmp75_ = _tmp74_;
2118 vala_report_error (_tmp75_, "class methods are not allowed outside of classes");
2119 _tmp76_ = m;
2120 vala_code_node_set_error ((ValaCodeNode*) _tmp76_, TRUE);
2121 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2122 }
2123 }
2124 _vala_code_node_unref0 (m);
2125 }
2126 _vala_iterable_unref0 (_m_list);
2127 }
2128 {
2129 ValaList* _ns_list = NULL;
2130 ValaList* _tmp77_;
2131 ValaList* _tmp78_;
2132 gint _ns_size = 0;
2133 ValaList* _tmp79_;
2134 gint _tmp80_;
2135 gint _tmp81_;
2136 gint _ns_index = 0;
2137 _tmp77_ = self->priv->namespaces;
2138 _tmp78_ = _vala_iterable_ref0 (_tmp77_);
2139 _ns_list = _tmp78_;
2140 _tmp79_ = _ns_list;
2141 _tmp80_ = vala_collection_get_size ((ValaCollection*) _tmp79_);
2142 _tmp81_ = _tmp80_;
2143 _ns_size = _tmp81_;
2144 _ns_index = -1;
2145 while (TRUE) {
2146 gint _tmp82_;
2147 gint _tmp83_;
2148 ValaNamespace* ns = NULL;
2149 ValaList* _tmp84_;
2150 gpointer _tmp85_;
2151 ValaNamespace* _tmp86_;
2152 _ns_index = _ns_index + 1;
2153 _tmp82_ = _ns_index;
2154 _tmp83_ = _ns_size;
2155 if (!(_tmp82_ < _tmp83_)) {
2156 break;
2157 }
2158 _tmp84_ = _ns_list;
2159 _tmp85_ = vala_list_get (_tmp84_, _ns_index);
2160 ns = (ValaNamespace*) _tmp85_;
2161 _tmp86_ = ns;
2162 vala_code_node_check ((ValaCodeNode*) _tmp86_, context);
2163 _vala_code_node_unref0 (ns);
2164 }
2165 _vala_iterable_unref0 (_ns_list);
2166 }
2167 _tmp87_ = vala_code_node_get_error ((ValaCodeNode*) self);
2168 _tmp88_ = _tmp87_;
2169 result = !_tmp88_;
2170 _vala_code_node_unref0 (a);
2171 return result;
2172 }
2173
2174 static gchar*
vala_namespace_real_to_string(ValaCodeNode * base)2175 vala_namespace_real_to_string (ValaCodeNode* base)
2176 {
2177 ValaNamespace * self;
2178 const gchar* _tmp0_;
2179 const gchar* _tmp1_;
2180 gchar* result = NULL;
2181 self = (ValaNamespace*) base;
2182 _tmp0_ = vala_symbol_get_name ((ValaSymbol*) self);
2183 _tmp1_ = _tmp0_;
2184 if (_tmp1_ == NULL) {
2185 gchar* _tmp2_;
2186 _tmp2_ = g_strdup ("(root namespace)");
2187 result = _tmp2_;
2188 return result;
2189 } else {
2190 const gchar* _tmp3_;
2191 const gchar* _tmp4_;
2192 gchar* _tmp5_;
2193 _tmp3_ = vala_symbol_get_name ((ValaSymbol*) self);
2194 _tmp4_ = _tmp3_;
2195 _tmp5_ = g_strdup_printf ("namespace %s", _tmp4_);
2196 result = _tmp5_;
2197 return result;
2198 }
2199 }
2200
2201 static void
vala_namespace_class_init(ValaNamespaceClass * klass,gpointer klass_data)2202 vala_namespace_class_init (ValaNamespaceClass * klass,
2203 gpointer klass_data)
2204 {
2205 vala_namespace_parent_class = g_type_class_peek_parent (klass);
2206 ((ValaCodeNodeClass *) klass)->finalize = vala_namespace_finalize;
2207 g_type_class_adjust_private_offset (klass, &ValaNamespace_private_offset);
2208 ((ValaSymbolClass *) klass)->add_namespace = (void (*) (ValaSymbol*, ValaNamespace*)) vala_namespace_real_add_namespace;
2209 ((ValaSymbolClass *) klass)->add_class = (void (*) (ValaSymbol*, ValaClass*)) vala_namespace_real_add_class;
2210 ((ValaSymbolClass *) klass)->add_interface = (void (*) (ValaSymbol*, ValaInterface*)) vala_namespace_real_add_interface;
2211 ((ValaSymbolClass *) klass)->add_struct = (void (*) (ValaSymbol*, ValaStruct*)) vala_namespace_real_add_struct;
2212 ((ValaSymbolClass *) klass)->add_enum = (void (*) (ValaSymbol*, ValaEnum*)) vala_namespace_real_add_enum;
2213 ((ValaSymbolClass *) klass)->add_error_domain = (void (*) (ValaSymbol*, ValaErrorDomain*)) vala_namespace_real_add_error_domain;
2214 ((ValaSymbolClass *) klass)->add_delegate = (void (*) (ValaSymbol*, ValaDelegate*)) vala_namespace_real_add_delegate;
2215 ((ValaSymbolClass *) klass)->add_constant = (void (*) (ValaSymbol*, ValaConstant*)) vala_namespace_real_add_constant;
2216 ((ValaSymbolClass *) klass)->add_field = (void (*) (ValaSymbol*, ValaField*)) vala_namespace_real_add_field;
2217 ((ValaSymbolClass *) klass)->add_method = (void (*) (ValaSymbol*, ValaMethod*)) vala_namespace_real_add_method;
2218 ((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_namespace_real_accept;
2219 ((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_namespace_real_accept_children;
2220 ((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_namespace_real_check;
2221 ((ValaCodeNodeClass *) klass)->to_string = (gchar* (*) (ValaCodeNode*)) vala_namespace_real_to_string;
2222 }
2223
2224 static void
vala_namespace_instance_init(ValaNamespace * self,gpointer klass)2225 vala_namespace_instance_init (ValaNamespace * self,
2226 gpointer klass)
2227 {
2228 GEqualFunc _tmp0_;
2229 ValaArrayList* _tmp1_;
2230 GEqualFunc _tmp2_;
2231 ValaArrayList* _tmp3_;
2232 GEqualFunc _tmp4_;
2233 ValaArrayList* _tmp5_;
2234 GEqualFunc _tmp6_;
2235 ValaArrayList* _tmp7_;
2236 GEqualFunc _tmp8_;
2237 ValaArrayList* _tmp9_;
2238 GEqualFunc _tmp10_;
2239 ValaArrayList* _tmp11_;
2240 GEqualFunc _tmp12_;
2241 ValaArrayList* _tmp13_;
2242 GEqualFunc _tmp14_;
2243 ValaArrayList* _tmp15_;
2244 GEqualFunc _tmp16_;
2245 ValaArrayList* _tmp17_;
2246 GEqualFunc _tmp18_;
2247 ValaArrayList* _tmp19_;
2248 GEqualFunc _tmp20_;
2249 ValaArrayList* _tmp21_;
2250 GEqualFunc _tmp22_;
2251 ValaArrayList* _tmp23_;
2252 self->priv = vala_namespace_get_instance_private (self);
2253 _tmp0_ = g_direct_equal;
2254 _tmp1_ = vala_array_list_new (VALA_TYPE_CLASS, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp0_);
2255 self->priv->classes = (ValaList*) _tmp1_;
2256 _tmp2_ = g_direct_equal;
2257 _tmp3_ = vala_array_list_new (VALA_TYPE_INTERFACE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp2_);
2258 self->priv->interfaces = (ValaList*) _tmp3_;
2259 _tmp4_ = g_direct_equal;
2260 _tmp5_ = vala_array_list_new (VALA_TYPE_STRUCT, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp4_);
2261 self->priv->structs = (ValaList*) _tmp5_;
2262 _tmp6_ = g_direct_equal;
2263 _tmp7_ = vala_array_list_new (VALA_TYPE_ENUM, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp6_);
2264 self->priv->enums = (ValaList*) _tmp7_;
2265 _tmp8_ = g_direct_equal;
2266 _tmp9_ = vala_array_list_new (VALA_TYPE_ERROR_DOMAIN, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp8_);
2267 self->priv->error_domains = (ValaList*) _tmp9_;
2268 _tmp10_ = g_direct_equal;
2269 _tmp11_ = vala_array_list_new (VALA_TYPE_DELEGATE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp10_);
2270 self->priv->delegates = (ValaList*) _tmp11_;
2271 _tmp12_ = g_direct_equal;
2272 _tmp13_ = vala_array_list_new (VALA_TYPE_CONSTANT, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp12_);
2273 self->priv->constants = (ValaList*) _tmp13_;
2274 _tmp14_ = g_direct_equal;
2275 _tmp15_ = vala_array_list_new (VALA_TYPE_FIELD, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp14_);
2276 self->priv->fields = (ValaList*) _tmp15_;
2277 _tmp16_ = g_direct_equal;
2278 _tmp17_ = vala_array_list_new (VALA_TYPE_METHOD, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp16_);
2279 self->priv->methods = (ValaList*) _tmp17_;
2280 _tmp18_ = g_direct_equal;
2281 _tmp19_ = vala_array_list_new (VALA_TYPE_COMMENT, (GBoxedCopyFunc) vala_comment_ref, (GDestroyNotify) vala_comment_unref, _tmp18_);
2282 self->priv->comments = (ValaList*) _tmp19_;
2283 _tmp20_ = g_direct_equal;
2284 _tmp21_ = vala_array_list_new (VALA_TYPE_NAMESPACE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp20_);
2285 self->priv->namespaces = (ValaList*) _tmp21_;
2286 _tmp22_ = g_direct_equal;
2287 _tmp23_ = vala_array_list_new (VALA_TYPE_USING_DIRECTIVE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp22_);
2288 self->priv->using_directives = (ValaList*) _tmp23_;
2289 }
2290
2291 static void
vala_namespace_finalize(ValaCodeNode * obj)2292 vala_namespace_finalize (ValaCodeNode * obj)
2293 {
2294 ValaNamespace * self;
2295 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_NAMESPACE, ValaNamespace);
2296 _vala_iterable_unref0 (self->priv->classes);
2297 _vala_iterable_unref0 (self->priv->interfaces);
2298 _vala_iterable_unref0 (self->priv->structs);
2299 _vala_iterable_unref0 (self->priv->enums);
2300 _vala_iterable_unref0 (self->priv->error_domains);
2301 _vala_iterable_unref0 (self->priv->delegates);
2302 _vala_iterable_unref0 (self->priv->constants);
2303 _vala_iterable_unref0 (self->priv->fields);
2304 _vala_iterable_unref0 (self->priv->methods);
2305 _vala_iterable_unref0 (self->priv->comments);
2306 _vala_iterable_unref0 (self->priv->namespaces);
2307 _vala_iterable_unref0 (self->priv->using_directives);
2308 VALA_CODE_NODE_CLASS (vala_namespace_parent_class)->finalize (obj);
2309 }
2310
2311 /**
2312 * Represents a namespace declaration in the source code.
2313 */
2314 static GType
vala_namespace_get_type_once(void)2315 vala_namespace_get_type_once (void)
2316 {
2317 static const GTypeInfo g_define_type_info = { sizeof (ValaNamespaceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_namespace_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaNamespace), 0, (GInstanceInitFunc) vala_namespace_instance_init, NULL };
2318 GType vala_namespace_type_id;
2319 vala_namespace_type_id = g_type_register_static (VALA_TYPE_SYMBOL, "ValaNamespace", &g_define_type_info, 0);
2320 ValaNamespace_private_offset = g_type_add_instance_private (vala_namespace_type_id, sizeof (ValaNamespacePrivate));
2321 return vala_namespace_type_id;
2322 }
2323
2324 GType
vala_namespace_get_type(void)2325 vala_namespace_get_type (void)
2326 {
2327 static volatile gsize vala_namespace_type_id__volatile = 0;
2328 if (g_once_init_enter (&vala_namespace_type_id__volatile)) {
2329 GType vala_namespace_type_id;
2330 vala_namespace_type_id = vala_namespace_get_type_once ();
2331 g_once_init_leave (&vala_namespace_type_id__volatile, vala_namespace_type_id);
2332 }
2333 return vala_namespace_type_id__volatile;
2334 }
2335
2336