1 /* valaparameter.c generated by valac, the Vala compiler
2 * generated from valaparameter.vala, do not modify */
3
4 /* valaparameter.vala
5 *
6 * Copyright (C) 2006-2012 Jürg Billeter
7 * Copyright (C) 2006-2008 Raffaele Sandrini
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 * Author:
24 * Jürg Billeter <j@bitron.ch>
25 * Raffaele Sandrini <raffaele@sandrini.ch>
26 */
27
28 #include "vala.h"
29 #include <glib.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <valagee.h>
33
34 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
35 #define _vala_source_file_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_file_unref (var), NULL)))
36 #define _g_free0(var) (var = (g_free (var), NULL))
37
38 struct _ValaParameterPrivate {
39 ValaParameterDirection _direction;
40 gboolean _ellipsis;
41 gboolean _params_array;
42 gboolean _captured;
43 ValaParameter* _base_parameter;
44 };
45
46 static gint ValaParameter_private_offset;
47 static gpointer vala_parameter_parent_class = NULL;
48
49 static void vala_parameter_real_accept (ValaCodeNode* base,
50 ValaCodeVisitor* visitor);
51 static void vala_parameter_real_accept_children (ValaCodeNode* base,
52 ValaCodeVisitor* visitor);
53 static void vala_parameter_real_replace_type (ValaCodeNode* base,
54 ValaDataType* old_type,
55 ValaDataType* new_type);
56 static void vala_parameter_real_replace_expression (ValaCodeNode* base,
57 ValaExpression* old_node,
58 ValaExpression* new_node);
59 static gboolean vala_parameter_real_check (ValaCodeNode* base,
60 ValaCodeContext* context);
61 static void vala_parameter_finalize (ValaCodeNode * obj);
62 static GType vala_parameter_get_type_once (void);
63
64 static inline gpointer
vala_parameter_get_instance_private(ValaParameter * self)65 vala_parameter_get_instance_private (ValaParameter* self)
66 {
67 return G_STRUCT_MEMBER_P (self, ValaParameter_private_offset);
68 }
69
70 ValaParameterDirection
vala_parameter_get_direction(ValaParameter * self)71 vala_parameter_get_direction (ValaParameter* self)
72 {
73 ValaParameterDirection result;
74 ValaParameterDirection _tmp0_;
75 g_return_val_if_fail (self != NULL, 0);
76 _tmp0_ = self->priv->_direction;
77 result = _tmp0_;
78 return result;
79 }
80
81 void
vala_parameter_set_direction(ValaParameter * self,ValaParameterDirection value)82 vala_parameter_set_direction (ValaParameter* self,
83 ValaParameterDirection value)
84 {
85 g_return_if_fail (self != NULL);
86 self->priv->_direction = value;
87 }
88
89 gboolean
vala_parameter_get_ellipsis(ValaParameter * self)90 vala_parameter_get_ellipsis (ValaParameter* self)
91 {
92 gboolean result;
93 g_return_val_if_fail (self != NULL, FALSE);
94 result = self->priv->_ellipsis;
95 return result;
96 }
97
98 void
vala_parameter_set_ellipsis(ValaParameter * self,gboolean value)99 vala_parameter_set_ellipsis (ValaParameter* self,
100 gboolean value)
101 {
102 g_return_if_fail (self != NULL);
103 self->priv->_ellipsis = value;
104 }
105
106 gboolean
vala_parameter_get_params_array(ValaParameter * self)107 vala_parameter_get_params_array (ValaParameter* self)
108 {
109 gboolean result;
110 g_return_val_if_fail (self != NULL, FALSE);
111 result = self->priv->_params_array;
112 return result;
113 }
114
115 void
vala_parameter_set_params_array(ValaParameter * self,gboolean value)116 vala_parameter_set_params_array (ValaParameter* self,
117 gboolean value)
118 {
119 g_return_if_fail (self != NULL);
120 self->priv->_params_array = value;
121 }
122
123 gboolean
vala_parameter_get_captured(ValaParameter * self)124 vala_parameter_get_captured (ValaParameter* self)
125 {
126 gboolean result;
127 g_return_val_if_fail (self != NULL, FALSE);
128 result = self->priv->_captured;
129 return result;
130 }
131
132 void
vala_parameter_set_captured(ValaParameter * self,gboolean value)133 vala_parameter_set_captured (ValaParameter* self,
134 gboolean value)
135 {
136 g_return_if_fail (self != NULL);
137 self->priv->_captured = value;
138 }
139
140 gboolean
vala_parameter_get_format_arg(ValaParameter * self)141 vala_parameter_get_format_arg (ValaParameter* self)
142 {
143 gboolean result;
144 ValaAttribute* _tmp0_;
145 g_return_val_if_fail (self != NULL, FALSE);
146 _tmp0_ = vala_code_node_get_attribute ((ValaCodeNode*) self, "FormatArg");
147 result = _tmp0_ != NULL;
148 return result;
149 }
150
151 ValaParameter*
vala_parameter_get_base_parameter(ValaParameter * self)152 vala_parameter_get_base_parameter (ValaParameter* self)
153 {
154 ValaParameter* result;
155 ValaParameter* _tmp0_;
156 g_return_val_if_fail (self != NULL, NULL);
157 _tmp0_ = self->priv->_base_parameter;
158 result = _tmp0_;
159 return result;
160 }
161
162 static gpointer
_vala_code_node_ref0(gpointer self)163 _vala_code_node_ref0 (gpointer self)
164 {
165 return self ? vala_code_node_ref (self) : NULL;
166 }
167
168 void
vala_parameter_set_base_parameter(ValaParameter * self,ValaParameter * value)169 vala_parameter_set_base_parameter (ValaParameter* self,
170 ValaParameter* value)
171 {
172 ValaParameter* _tmp0_;
173 g_return_if_fail (self != NULL);
174 _tmp0_ = _vala_code_node_ref0 (value);
175 _vala_code_node_unref0 (self->priv->_base_parameter);
176 self->priv->_base_parameter = _tmp0_;
177 }
178
179 /**
180 * Creates a new formal parameter.
181 *
182 * @param name parameter name
183 * @param variable_type parameter type
184 * @param source_reference reference to source code
185 * @return newly created formal parameter
186 */
187 ValaParameter*
vala_parameter_construct(GType object_type,const gchar * name,ValaDataType * variable_type,ValaSourceReference * source_reference)188 vala_parameter_construct (GType object_type,
189 const gchar* name,
190 ValaDataType* variable_type,
191 ValaSourceReference* source_reference)
192 {
193 ValaParameter* self = NULL;
194 g_return_val_if_fail (name != NULL, NULL);
195 self = (ValaParameter*) vala_variable_construct (object_type, variable_type, name, NULL, source_reference, NULL);
196 vala_symbol_set_access ((ValaSymbol*) self, VALA_SYMBOL_ACCESSIBILITY_PUBLIC);
197 return self;
198 }
199
200 ValaParameter*
vala_parameter_new(const gchar * name,ValaDataType * variable_type,ValaSourceReference * source_reference)201 vala_parameter_new (const gchar* name,
202 ValaDataType* variable_type,
203 ValaSourceReference* source_reference)
204 {
205 return vala_parameter_construct (VALA_TYPE_PARAMETER, name, variable_type, source_reference);
206 }
207
208 /**
209 * Creates a new ellipsis parameter representing an indefinite number of
210 * parameters.
211 */
212 ValaParameter*
vala_parameter_construct_with_ellipsis(GType object_type,ValaSourceReference * source_reference)213 vala_parameter_construct_with_ellipsis (GType object_type,
214 ValaSourceReference* source_reference)
215 {
216 ValaParameter* self = NULL;
217 self = (ValaParameter*) vala_variable_construct (object_type, NULL, NULL, NULL, source_reference, NULL);
218 vala_parameter_set_ellipsis (self, TRUE);
219 vala_symbol_set_access ((ValaSymbol*) self, VALA_SYMBOL_ACCESSIBILITY_PUBLIC);
220 return self;
221 }
222
223 ValaParameter*
vala_parameter_new_with_ellipsis(ValaSourceReference * source_reference)224 vala_parameter_new_with_ellipsis (ValaSourceReference* source_reference)
225 {
226 return vala_parameter_construct_with_ellipsis (VALA_TYPE_PARAMETER, source_reference);
227 }
228
229 static void
vala_parameter_real_accept(ValaCodeNode * base,ValaCodeVisitor * visitor)230 vala_parameter_real_accept (ValaCodeNode* base,
231 ValaCodeVisitor* visitor)
232 {
233 ValaParameter * self;
234 self = (ValaParameter*) base;
235 g_return_if_fail (visitor != NULL);
236 vala_code_visitor_visit_formal_parameter (visitor, self);
237 }
238
239 static void
vala_parameter_real_accept_children(ValaCodeNode * base,ValaCodeVisitor * visitor)240 vala_parameter_real_accept_children (ValaCodeNode* base,
241 ValaCodeVisitor* visitor)
242 {
243 ValaParameter * self;
244 gboolean _tmp0_;
245 self = (ValaParameter*) base;
246 g_return_if_fail (visitor != NULL);
247 _tmp0_ = self->priv->_ellipsis;
248 if (!_tmp0_) {
249 ValaDataType* _tmp1_;
250 ValaDataType* _tmp2_;
251 ValaExpression* _tmp3_;
252 ValaExpression* _tmp4_;
253 _tmp1_ = vala_variable_get_variable_type ((ValaVariable*) self);
254 _tmp2_ = _tmp1_;
255 vala_code_node_accept ((ValaCodeNode*) _tmp2_, visitor);
256 _tmp3_ = vala_variable_get_initializer ((ValaVariable*) self);
257 _tmp4_ = _tmp3_;
258 if (_tmp4_ != NULL) {
259 ValaExpression* _tmp5_;
260 ValaExpression* _tmp6_;
261 _tmp5_ = vala_variable_get_initializer ((ValaVariable*) self);
262 _tmp6_ = _tmp5_;
263 vala_code_node_accept ((ValaCodeNode*) _tmp6_, visitor);
264 }
265 }
266 }
267
268 static void
vala_parameter_real_replace_type(ValaCodeNode * base,ValaDataType * old_type,ValaDataType * new_type)269 vala_parameter_real_replace_type (ValaCodeNode* base,
270 ValaDataType* old_type,
271 ValaDataType* new_type)
272 {
273 ValaParameter * self;
274 ValaDataType* _tmp0_;
275 ValaDataType* _tmp1_;
276 self = (ValaParameter*) base;
277 g_return_if_fail (old_type != NULL);
278 g_return_if_fail (new_type != NULL);
279 _tmp0_ = vala_variable_get_variable_type ((ValaVariable*) self);
280 _tmp1_ = _tmp0_;
281 if (_tmp1_ == old_type) {
282 vala_variable_set_variable_type ((ValaVariable*) self, new_type);
283 }
284 }
285
286 static void
vala_parameter_real_replace_expression(ValaCodeNode * base,ValaExpression * old_node,ValaExpression * new_node)287 vala_parameter_real_replace_expression (ValaCodeNode* base,
288 ValaExpression* old_node,
289 ValaExpression* new_node)
290 {
291 ValaParameter * self;
292 ValaExpression* _tmp0_;
293 ValaExpression* _tmp1_;
294 self = (ValaParameter*) base;
295 g_return_if_fail (old_node != NULL);
296 g_return_if_fail (new_node != NULL);
297 _tmp0_ = vala_variable_get_initializer ((ValaVariable*) self);
298 _tmp1_ = _tmp0_;
299 if (_tmp1_ == old_node) {
300 vala_variable_set_initializer ((ValaVariable*) self, new_node);
301 }
302 }
303
304 ValaParameter*
vala_parameter_copy(ValaParameter * self)305 vala_parameter_copy (ValaParameter* self)
306 {
307 gboolean _tmp0_;
308 ValaParameter* result = NULL;
309 g_return_val_if_fail (self != NULL, NULL);
310 _tmp0_ = self->priv->_ellipsis;
311 if (!_tmp0_) {
312 ValaParameter* _result_ = NULL;
313 const gchar* _tmp1_;
314 const gchar* _tmp2_;
315 ValaDataType* _tmp3_;
316 ValaDataType* _tmp4_;
317 ValaDataType* _tmp5_;
318 ValaDataType* _tmp6_;
319 ValaSourceReference* _tmp7_;
320 ValaSourceReference* _tmp8_;
321 ValaParameter* _tmp9_;
322 ValaParameter* _tmp10_;
323 ValaParameter* _tmp11_;
324 gboolean _tmp12_;
325 ValaParameter* _tmp13_;
326 ValaParameterDirection _tmp14_;
327 ValaParameter* _tmp15_;
328 ValaExpression* _tmp16_;
329 ValaExpression* _tmp17_;
330 GList* _tmp18_;
331 _tmp1_ = vala_symbol_get_name ((ValaSymbol*) self);
332 _tmp2_ = _tmp1_;
333 _tmp3_ = vala_variable_get_variable_type ((ValaVariable*) self);
334 _tmp4_ = _tmp3_;
335 _tmp5_ = vala_data_type_copy (_tmp4_);
336 _tmp6_ = _tmp5_;
337 _tmp7_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
338 _tmp8_ = _tmp7_;
339 _tmp9_ = vala_parameter_new (_tmp2_, _tmp6_, _tmp8_);
340 _tmp10_ = _tmp9_;
341 _vala_code_node_unref0 (_tmp6_);
342 _result_ = _tmp10_;
343 _tmp11_ = _result_;
344 _tmp12_ = self->priv->_params_array;
345 vala_parameter_set_params_array (_tmp11_, _tmp12_);
346 _tmp13_ = _result_;
347 _tmp14_ = self->priv->_direction;
348 vala_parameter_set_direction (_tmp13_, _tmp14_);
349 _tmp15_ = _result_;
350 _tmp16_ = vala_variable_get_initializer ((ValaVariable*) self);
351 _tmp17_ = _tmp16_;
352 vala_variable_set_initializer ((ValaVariable*) _tmp15_, _tmp17_);
353 _tmp18_ = ((ValaCodeNode*) self)->attributes;
354 {
355 GList* a_collection = NULL;
356 GList* a_it = NULL;
357 a_collection = _tmp18_;
358 for (a_it = a_collection; a_it != NULL; a_it = a_it->next) {
359 ValaAttribute* _tmp19_;
360 ValaAttribute* a = NULL;
361 _tmp19_ = _vala_code_node_ref0 ((ValaAttribute*) a_it->data);
362 a = _tmp19_;
363 {
364 ValaParameter* _tmp20_;
365 ValaAttribute* _tmp21_;
366 ValaAttribute* _tmp22_;
367 _tmp20_ = _result_;
368 _tmp21_ = a;
369 _tmp22_ = _vala_code_node_ref0 (_tmp21_);
370 ((ValaCodeNode*) _tmp20_)->attributes = g_list_append (((ValaCodeNode*) _tmp20_)->attributes, _tmp22_);
371 _vala_code_node_unref0 (a);
372 }
373 }
374 }
375 result = _result_;
376 return result;
377 } else {
378 ValaParameter* _tmp23_;
379 _tmp23_ = vala_parameter_new_with_ellipsis (NULL);
380 result = _tmp23_;
381 return result;
382 }
383 }
384
385 static gpointer
_vala_source_file_ref0(gpointer self)386 _vala_source_file_ref0 (gpointer self)
387 {
388 return self ? vala_source_file_ref (self) : NULL;
389 }
390
391 static gboolean
vala_parameter_real_check(ValaCodeNode * base,ValaCodeContext * context)392 vala_parameter_real_check (ValaCodeNode* base,
393 ValaCodeContext* context)
394 {
395 ValaParameter * self;
396 gboolean _tmp0_;
397 gboolean _tmp1_;
398 ValaSourceFile* old_source_file = NULL;
399 ValaSemanticAnalyzer* _tmp4_;
400 ValaSemanticAnalyzer* _tmp5_;
401 ValaSourceFile* _tmp6_;
402 ValaSourceFile* _tmp7_;
403 ValaSourceFile* _tmp8_;
404 ValaSymbol* old_symbol = NULL;
405 ValaSemanticAnalyzer* _tmp9_;
406 ValaSemanticAnalyzer* _tmp10_;
407 ValaSymbol* _tmp11_;
408 ValaSymbol* _tmp12_;
409 ValaSymbol* _tmp13_;
410 ValaSourceReference* _tmp14_;
411 ValaSourceReference* _tmp15_;
412 ValaSemanticAnalyzer* _tmp22_;
413 ValaSemanticAnalyzer* _tmp23_;
414 ValaSymbol* _tmp24_;
415 ValaSymbol* _tmp25_;
416 ValaDataType* _tmp26_;
417 ValaDataType* _tmp27_;
418 gboolean _tmp34_;
419 gboolean _tmp83_ = FALSE;
420 ValaExpression* _tmp84_;
421 ValaExpression* _tmp85_;
422 gboolean _tmp152_;
423 ValaMethod* m = NULL;
424 ValaSymbol* _tmp195_;
425 ValaSymbol* _tmp196_;
426 ValaMethod* _tmp197_;
427 ValaSemanticAnalyzer* _tmp227_;
428 ValaSemanticAnalyzer* _tmp228_;
429 ValaSourceFile* _tmp229_;
430 ValaSemanticAnalyzer* _tmp230_;
431 ValaSemanticAnalyzer* _tmp231_;
432 ValaSymbol* _tmp232_;
433 gboolean _tmp233_;
434 gboolean _tmp234_;
435 gboolean result = FALSE;
436 self = (ValaParameter*) base;
437 g_return_val_if_fail (context != NULL, FALSE);
438 _tmp0_ = vala_code_node_get_checked ((ValaCodeNode*) self);
439 _tmp1_ = _tmp0_;
440 if (_tmp1_) {
441 gboolean _tmp2_;
442 gboolean _tmp3_;
443 _tmp2_ = vala_code_node_get_error ((ValaCodeNode*) self);
444 _tmp3_ = _tmp2_;
445 result = !_tmp3_;
446 return result;
447 }
448 vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
449 _tmp4_ = vala_code_context_get_analyzer (context);
450 _tmp5_ = _tmp4_;
451 _tmp6_ = vala_semantic_analyzer_get_current_source_file (_tmp5_);
452 _tmp7_ = _tmp6_;
453 _tmp8_ = _vala_source_file_ref0 (_tmp7_);
454 old_source_file = _tmp8_;
455 _tmp9_ = vala_code_context_get_analyzer (context);
456 _tmp10_ = _tmp9_;
457 _tmp11_ = vala_semantic_analyzer_get_current_symbol (_tmp10_);
458 _tmp12_ = _tmp11_;
459 _tmp13_ = _vala_code_node_ref0 (_tmp12_);
460 old_symbol = _tmp13_;
461 _tmp14_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
462 _tmp15_ = _tmp14_;
463 if (_tmp15_ != NULL) {
464 ValaSemanticAnalyzer* _tmp16_;
465 ValaSemanticAnalyzer* _tmp17_;
466 ValaSourceReference* _tmp18_;
467 ValaSourceReference* _tmp19_;
468 ValaSourceFile* _tmp20_;
469 ValaSourceFile* _tmp21_;
470 _tmp16_ = vala_code_context_get_analyzer (context);
471 _tmp17_ = _tmp16_;
472 _tmp18_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
473 _tmp19_ = _tmp18_;
474 _tmp20_ = vala_source_reference_get_file (_tmp19_);
475 _tmp21_ = _tmp20_;
476 vala_semantic_analyzer_set_current_source_file (_tmp17_, _tmp21_);
477 }
478 _tmp22_ = vala_code_context_get_analyzer (context);
479 _tmp23_ = _tmp22_;
480 _tmp24_ = vala_symbol_get_parent_symbol ((ValaSymbol*) self);
481 _tmp25_ = _tmp24_;
482 vala_semantic_analyzer_set_current_symbol (_tmp23_, _tmp25_);
483 _tmp26_ = vala_variable_get_variable_type ((ValaVariable*) self);
484 _tmp27_ = _tmp26_;
485 if (_tmp27_ != NULL) {
486 ValaDataType* _tmp28_;
487 ValaDataType* _tmp29_;
488 ValaDataType* _tmp32_;
489 ValaDataType* _tmp33_;
490 _tmp28_ = vala_variable_get_variable_type ((ValaVariable*) self);
491 _tmp29_ = _tmp28_;
492 if (VALA_IS_VOID_TYPE (_tmp29_)) {
493 ValaSourceReference* _tmp30_;
494 ValaSourceReference* _tmp31_;
495 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
496 _tmp30_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
497 _tmp31_ = _tmp30_;
498 vala_report_error (_tmp31_, "'void' not supported as parameter type");
499 result = FALSE;
500 _vala_code_node_unref0 (old_symbol);
501 _vala_source_file_unref0 (old_source_file);
502 return result;
503 }
504 _tmp32_ = vala_variable_get_variable_type ((ValaVariable*) self);
505 _tmp33_ = _tmp32_;
506 vala_code_node_check ((ValaCodeNode*) _tmp33_, context);
507 }
508 _tmp34_ = self->priv->_ellipsis;
509 if (!_tmp34_) {
510 ValaDataType* _tmp35_;
511 ValaDataType* _tmp36_;
512 gboolean _tmp37_ = FALSE;
513 gboolean _tmp38_;
514 gboolean _tmp43_ = FALSE;
515 ValaExpression* _tmp52_;
516 ValaExpression* _tmp53_;
517 ValaArrayType* variable_array_type = NULL;
518 ValaDataType* _tmp70_;
519 ValaDataType* _tmp71_;
520 gboolean _tmp72_ = FALSE;
521 gboolean _tmp73_ = FALSE;
522 ValaArrayType* _tmp74_;
523 _tmp35_ = vala_variable_get_variable_type ((ValaVariable*) self);
524 _tmp36_ = _tmp35_;
525 vala_code_node_check ((ValaCodeNode*) _tmp36_, context);
526 _tmp38_ = self->priv->_params_array;
527 if (_tmp38_) {
528 ValaDataType* _tmp39_;
529 ValaDataType* _tmp40_;
530 _tmp39_ = vala_variable_get_variable_type ((ValaVariable*) self);
531 _tmp40_ = _tmp39_;
532 _tmp37_ = !VALA_IS_ARRAY_TYPE (_tmp40_);
533 } else {
534 _tmp37_ = FALSE;
535 }
536 if (_tmp37_) {
537 ValaSourceReference* _tmp41_;
538 ValaSourceReference* _tmp42_;
539 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
540 _tmp41_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
541 _tmp42_ = _tmp41_;
542 vala_report_error (_tmp42_, "parameter array expected");
543 result = FALSE;
544 _vala_code_node_unref0 (old_symbol);
545 _vala_source_file_unref0 (old_source_file);
546 return result;
547 }
548 if (vala_code_node_has_attribute_argument ((ValaCodeNode*) self, "CCode", "scope")) {
549 ValaDataType* _tmp44_;
550 ValaDataType* _tmp45_;
551 _tmp44_ = vala_variable_get_variable_type ((ValaVariable*) self);
552 _tmp45_ = _tmp44_;
553 _tmp43_ = VALA_IS_DELEGATE_TYPE (_tmp45_);
554 } else {
555 _tmp43_ = FALSE;
556 }
557 if (_tmp43_) {
558 ValaDelegateType* delegate_type = NULL;
559 ValaDataType* _tmp46_;
560 ValaDataType* _tmp47_;
561 ValaDelegateType* _tmp48_;
562 ValaDelegateType* _tmp49_;
563 gchar* _tmp50_;
564 gchar* _tmp51_;
565 _tmp46_ = vala_variable_get_variable_type ((ValaVariable*) self);
566 _tmp47_ = _tmp46_;
567 _tmp48_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp47_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
568 delegate_type = _tmp48_;
569 _tmp49_ = delegate_type;
570 _tmp50_ = vala_code_node_get_attribute_string ((ValaCodeNode*) self, "CCode", "scope", NULL);
571 _tmp51_ = _tmp50_;
572 vala_delegate_type_set_is_called_once (_tmp49_, g_strcmp0 (_tmp51_, "async") == 0);
573 _g_free0 (_tmp51_);
574 _vala_code_node_unref0 (delegate_type);
575 }
576 _tmp52_ = vala_variable_get_initializer ((ValaVariable*) self);
577 _tmp53_ = _tmp52_;
578 if (_tmp53_ != NULL) {
579 ValaExpression* _tmp54_;
580 ValaExpression* _tmp55_;
581 ValaDataType* _tmp56_;
582 ValaDataType* _tmp57_;
583 ValaDataType* _tmp58_;
584 ValaDataType* _tmp59_;
585 ValaExpression* _tmp60_;
586 ValaExpression* _tmp61_;
587 ValaExpression* _tmp62_;
588 ValaExpression* _tmp63_;
589 ValaDataType* _tmp64_;
590 ValaDataType* _tmp65_;
591 _tmp54_ = vala_variable_get_initializer ((ValaVariable*) self);
592 _tmp55_ = _tmp54_;
593 _tmp56_ = vala_variable_get_variable_type ((ValaVariable*) self);
594 _tmp57_ = _tmp56_;
595 _tmp58_ = vala_data_type_copy (_tmp57_);
596 _tmp59_ = _tmp58_;
597 vala_expression_set_target_type (_tmp55_, _tmp59_);
598 _vala_code_node_unref0 (_tmp59_);
599 _tmp60_ = vala_variable_get_initializer ((ValaVariable*) self);
600 _tmp61_ = _tmp60_;
601 vala_code_node_check ((ValaCodeNode*) _tmp61_, context);
602 _tmp62_ = vala_variable_get_initializer ((ValaVariable*) self);
603 _tmp63_ = _tmp62_;
604 _tmp64_ = vala_expression_get_value_type (_tmp63_);
605 _tmp65_ = _tmp64_;
606 if (_tmp65_ == NULL) {
607 ValaExpression* _tmp66_;
608 ValaExpression* _tmp67_;
609 ValaInvalidType* _tmp68_;
610 ValaInvalidType* _tmp69_;
611 _tmp66_ = vala_variable_get_initializer ((ValaVariable*) self);
612 _tmp67_ = _tmp66_;
613 _tmp68_ = vala_invalid_type_new ();
614 _tmp69_ = _tmp68_;
615 vala_expression_set_value_type (_tmp67_, (ValaDataType*) _tmp69_);
616 _vala_code_node_unref0 (_tmp69_);
617 }
618 }
619 _tmp70_ = vala_variable_get_variable_type ((ValaVariable*) self);
620 _tmp71_ = _tmp70_;
621 variable_array_type = VALA_IS_ARRAY_TYPE (_tmp71_) ? ((ValaArrayType*) _tmp71_) : NULL;
622 _tmp74_ = variable_array_type;
623 if (_tmp74_ != NULL) {
624 ValaArrayType* _tmp75_;
625 gboolean _tmp76_;
626 gboolean _tmp77_;
627 _tmp75_ = variable_array_type;
628 _tmp76_ = vala_array_type_get_inline_allocated (_tmp75_);
629 _tmp77_ = _tmp76_;
630 _tmp73_ = _tmp77_;
631 } else {
632 _tmp73_ = FALSE;
633 }
634 if (_tmp73_) {
635 ValaArrayType* _tmp78_;
636 gboolean _tmp79_;
637 gboolean _tmp80_;
638 _tmp78_ = variable_array_type;
639 _tmp79_ = vala_array_type_get_fixed_length (_tmp78_);
640 _tmp80_ = _tmp79_;
641 _tmp72_ = !_tmp80_;
642 } else {
643 _tmp72_ = FALSE;
644 }
645 if (_tmp72_) {
646 ValaSourceReference* _tmp81_;
647 ValaSourceReference* _tmp82_;
648 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
649 _tmp81_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
650 _tmp82_ = _tmp81_;
651 vala_report_error (_tmp82_, "Inline allocated array as parameter requires to have fixed length");
652 }
653 }
654 _tmp84_ = vala_variable_get_initializer ((ValaVariable*) self);
655 _tmp85_ = _tmp84_;
656 if (_tmp85_ != NULL) {
657 ValaExpression* _tmp86_;
658 ValaExpression* _tmp87_;
659 gboolean _tmp88_;
660 gboolean _tmp89_;
661 _tmp86_ = vala_variable_get_initializer ((ValaVariable*) self);
662 _tmp87_ = _tmp86_;
663 _tmp88_ = vala_code_node_get_error ((ValaCodeNode*) _tmp87_);
664 _tmp89_ = _tmp88_;
665 _tmp83_ = !_tmp89_;
666 } else {
667 _tmp83_ = FALSE;
668 }
669 if (_tmp83_) {
670 gboolean _tmp90_ = FALSE;
671 gboolean _tmp91_ = FALSE;
672 ValaExpression* _tmp92_;
673 ValaExpression* _tmp93_;
674 _tmp92_ = vala_variable_get_initializer ((ValaVariable*) self);
675 _tmp93_ = _tmp92_;
676 if (VALA_IS_NULL_LITERAL (_tmp93_)) {
677 ValaDataType* _tmp94_;
678 ValaDataType* _tmp95_;
679 gboolean _tmp96_;
680 gboolean _tmp97_;
681 _tmp94_ = vala_variable_get_variable_type ((ValaVariable*) self);
682 _tmp95_ = _tmp94_;
683 _tmp96_ = vala_data_type_get_nullable (_tmp95_);
684 _tmp97_ = _tmp96_;
685 _tmp91_ = !_tmp97_;
686 } else {
687 _tmp91_ = FALSE;
688 }
689 if (_tmp91_) {
690 ValaParameterDirection _tmp98_;
691 _tmp98_ = self->priv->_direction;
692 _tmp90_ = _tmp98_ != VALA_PARAMETER_DIRECTION_OUT;
693 } else {
694 _tmp90_ = FALSE;
695 }
696 if (_tmp90_) {
697 ValaSourceReference* _tmp99_;
698 ValaSourceReference* _tmp100_;
699 ValaDataType* _tmp101_;
700 ValaDataType* _tmp102_;
701 gchar* _tmp103_;
702 gchar* _tmp104_;
703 gchar* _tmp105_;
704 gchar* _tmp106_;
705 _tmp99_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
706 _tmp100_ = _tmp99_;
707 _tmp101_ = vala_variable_get_variable_type ((ValaVariable*) self);
708 _tmp102_ = _tmp101_;
709 _tmp103_ = vala_code_node_to_string ((ValaCodeNode*) _tmp102_);
710 _tmp104_ = _tmp103_;
711 _tmp105_ = g_strdup_printf ("`null' incompatible with parameter type `%s'", _tmp104_);
712 _tmp106_ = _tmp105_;
713 vala_report_warning (_tmp100_, _tmp106_);
714 _g_free0 (_tmp106_);
715 _g_free0 (_tmp104_);
716 } else {
717 gboolean _tmp107_ = FALSE;
718 ValaExpression* _tmp108_;
719 ValaExpression* _tmp109_;
720 _tmp108_ = vala_variable_get_initializer ((ValaVariable*) self);
721 _tmp109_ = _tmp108_;
722 if (!VALA_IS_NULL_LITERAL (_tmp109_)) {
723 ValaParameterDirection _tmp110_;
724 _tmp110_ = self->priv->_direction;
725 _tmp107_ = _tmp110_ == VALA_PARAMETER_DIRECTION_OUT;
726 } else {
727 _tmp107_ = FALSE;
728 }
729 if (_tmp107_) {
730 ValaSourceReference* _tmp111_;
731 ValaSourceReference* _tmp112_;
732 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
733 _tmp111_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
734 _tmp112_ = _tmp111_;
735 vala_report_error (_tmp112_, "only `null' is allowed as default value for out parameters");
736 } else {
737 gboolean _tmp113_ = FALSE;
738 ValaParameterDirection _tmp114_;
739 _tmp114_ = self->priv->_direction;
740 if (_tmp114_ == VALA_PARAMETER_DIRECTION_IN) {
741 ValaExpression* _tmp115_;
742 ValaExpression* _tmp116_;
743 ValaDataType* _tmp117_;
744 ValaDataType* _tmp118_;
745 ValaDataType* _tmp119_;
746 ValaDataType* _tmp120_;
747 _tmp115_ = vala_variable_get_initializer ((ValaVariable*) self);
748 _tmp116_ = _tmp115_;
749 _tmp117_ = vala_expression_get_value_type (_tmp116_);
750 _tmp118_ = _tmp117_;
751 _tmp119_ = vala_variable_get_variable_type ((ValaVariable*) self);
752 _tmp120_ = _tmp119_;
753 _tmp113_ = !vala_data_type_compatible (_tmp118_, _tmp120_);
754 } else {
755 _tmp113_ = FALSE;
756 }
757 if (_tmp113_) {
758 ValaExpression* _tmp121_;
759 ValaExpression* _tmp122_;
760 ValaSourceReference* _tmp123_;
761 ValaSourceReference* _tmp124_;
762 ValaExpression* _tmp125_;
763 ValaExpression* _tmp126_;
764 ValaDataType* _tmp127_;
765 ValaDataType* _tmp128_;
766 gchar* _tmp129_;
767 gchar* _tmp130_;
768 ValaDataType* _tmp131_;
769 ValaDataType* _tmp132_;
770 gchar* _tmp133_;
771 gchar* _tmp134_;
772 gchar* _tmp135_;
773 gchar* _tmp136_;
774 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
775 _tmp121_ = vala_variable_get_initializer ((ValaVariable*) self);
776 _tmp122_ = _tmp121_;
777 _tmp123_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp122_);
778 _tmp124_ = _tmp123_;
779 _tmp125_ = vala_variable_get_initializer ((ValaVariable*) self);
780 _tmp126_ = _tmp125_;
781 _tmp127_ = vala_expression_get_value_type (_tmp126_);
782 _tmp128_ = _tmp127_;
783 _tmp129_ = vala_code_node_to_string ((ValaCodeNode*) _tmp128_);
784 _tmp130_ = _tmp129_;
785 _tmp131_ = vala_variable_get_variable_type ((ValaVariable*) self);
786 _tmp132_ = _tmp131_;
787 _tmp133_ = vala_code_node_to_string ((ValaCodeNode*) _tmp132_);
788 _tmp134_ = _tmp133_;
789 _tmp135_ = g_strdup_printf ("Cannot convert from `%s' to `%s'", _tmp130_, _tmp134_);
790 _tmp136_ = _tmp135_;
791 vala_report_error (_tmp124_, _tmp136_);
792 _g_free0 (_tmp136_);
793 _g_free0 (_tmp134_);
794 _g_free0 (_tmp130_);
795 } else {
796 ValaParameterDirection _tmp137_;
797 _tmp137_ = self->priv->_direction;
798 if (_tmp137_ == VALA_PARAMETER_DIRECTION_REF) {
799 ValaSourceReference* _tmp138_;
800 ValaSourceReference* _tmp139_;
801 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
802 _tmp138_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
803 _tmp139_ = _tmp138_;
804 vala_report_error (_tmp139_, "default value not allowed for ref parameter");
805 } else {
806 ValaExpression* _tmp140_;
807 ValaExpression* _tmp141_;
808 _tmp140_ = vala_variable_get_initializer ((ValaVariable*) self);
809 _tmp141_ = _tmp140_;
810 if (!vala_expression_is_accessible (_tmp141_, (ValaSymbol*) self)) {
811 ValaExpression* _tmp142_;
812 ValaExpression* _tmp143_;
813 ValaSourceReference* _tmp144_;
814 ValaSourceReference* _tmp145_;
815 ValaSymbol* _tmp146_;
816 ValaSymbol* _tmp147_;
817 gchar* _tmp148_;
818 gchar* _tmp149_;
819 gchar* _tmp150_;
820 gchar* _tmp151_;
821 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
822 _tmp142_ = vala_variable_get_initializer ((ValaVariable*) self);
823 _tmp143_ = _tmp142_;
824 _tmp144_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp143_);
825 _tmp145_ = _tmp144_;
826 _tmp146_ = vala_symbol_get_parent_symbol ((ValaSymbol*) self);
827 _tmp147_ = _tmp146_;
828 _tmp148_ = vala_symbol_get_full_name (_tmp147_);
829 _tmp149_ = _tmp148_;
830 _tmp150_ = g_strdup_printf ("default value is less accessible than method `%s'", _tmp149_);
831 _tmp151_ = _tmp150_;
832 vala_report_error (_tmp145_, _tmp151_);
833 _g_free0 (_tmp151_);
834 _g_free0 (_tmp149_);
835 }
836 }
837 }
838 }
839 }
840 }
841 _tmp152_ = self->priv->_ellipsis;
842 if (!_tmp152_) {
843 gboolean _tmp153_;
844 gboolean _tmp154_;
845 ValaSemanticAnalyzer* _tmp179_;
846 ValaSemanticAnalyzer* _tmp180_;
847 ValaDataType* _tmp181_;
848 ValaDataType* _tmp182_;
849 _tmp153_ = vala_symbol_get_external_package ((ValaSymbol*) self);
850 _tmp154_ = _tmp153_;
851 if (!_tmp154_) {
852 ValaSemanticAnalyzer* _tmp155_;
853 ValaSemanticAnalyzer* _tmp156_;
854 ValaDataType* _tmp157_;
855 ValaDataType* _tmp158_;
856 gboolean _tmp159_ = FALSE;
857 gboolean _tmp160_ = FALSE;
858 ValaSymbol* _tmp161_;
859 ValaSymbol* _tmp162_;
860 _tmp155_ = vala_code_context_get_analyzer (context);
861 _tmp156_ = _tmp155_;
862 _tmp157_ = vala_variable_get_variable_type ((ValaVariable*) self);
863 _tmp158_ = _tmp157_;
864 vala_semantic_analyzer_check_type (_tmp156_, _tmp158_);
865 _tmp161_ = vala_symbol_get_parent_symbol ((ValaSymbol*) self);
866 _tmp162_ = _tmp161_;
867 if (_tmp162_ == NULL) {
868 _tmp160_ = TRUE;
869 } else {
870 ValaSymbol* _tmp163_;
871 ValaSymbol* _tmp164_;
872 gboolean _tmp165_;
873 gboolean _tmp166_;
874 _tmp163_ = vala_symbol_get_parent_symbol ((ValaSymbol*) self);
875 _tmp164_ = _tmp163_;
876 _tmp165_ = vala_symbol_get_external_package (_tmp164_);
877 _tmp166_ = _tmp165_;
878 _tmp160_ = !_tmp166_;
879 }
880 if (_tmp160_) {
881 ValaDataType* _tmp167_;
882 ValaDataType* _tmp168_;
883 ValaTypeSymbol* _tmp169_;
884 ValaTypeSymbol* _tmp170_;
885 _tmp167_ = vala_variable_get_variable_type ((ValaVariable*) self);
886 _tmp168_ = _tmp167_;
887 _tmp169_ = vala_data_type_get_type_symbol (_tmp168_);
888 _tmp170_ = _tmp169_;
889 _tmp159_ = _tmp170_ != NULL;
890 } else {
891 _tmp159_ = FALSE;
892 }
893 if (_tmp159_) {
894 ValaDataType* _tmp171_;
895 ValaDataType* _tmp172_;
896 ValaTypeSymbol* _tmp173_;
897 ValaTypeSymbol* _tmp174_;
898 ValaVersionAttribute* _tmp175_;
899 ValaVersionAttribute* _tmp176_;
900 ValaSourceReference* _tmp177_;
901 ValaSourceReference* _tmp178_;
902 _tmp171_ = vala_variable_get_variable_type ((ValaVariable*) self);
903 _tmp172_ = _tmp171_;
904 _tmp173_ = vala_data_type_get_type_symbol (_tmp172_);
905 _tmp174_ = _tmp173_;
906 _tmp175_ = vala_symbol_get_version ((ValaSymbol*) _tmp174_);
907 _tmp176_ = _tmp175_;
908 _tmp177_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
909 _tmp178_ = _tmp177_;
910 vala_version_attribute_check (_tmp176_, _tmp178_);
911 }
912 }
913 _tmp179_ = vala_code_context_get_analyzer (context);
914 _tmp180_ = _tmp179_;
915 _tmp181_ = vala_variable_get_variable_type ((ValaVariable*) self);
916 _tmp182_ = _tmp181_;
917 if (!vala_semantic_analyzer_is_type_accessible (_tmp180_, (ValaSymbol*) self, _tmp182_)) {
918 ValaSourceReference* _tmp183_;
919 ValaSourceReference* _tmp184_;
920 ValaDataType* _tmp185_;
921 ValaDataType* _tmp186_;
922 gchar* _tmp187_;
923 gchar* _tmp188_;
924 ValaSymbol* _tmp189_;
925 ValaSymbol* _tmp190_;
926 gchar* _tmp191_;
927 gchar* _tmp192_;
928 gchar* _tmp193_;
929 gchar* _tmp194_;
930 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
931 _tmp183_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
932 _tmp184_ = _tmp183_;
933 _tmp185_ = vala_variable_get_variable_type ((ValaVariable*) self);
934 _tmp186_ = _tmp185_;
935 _tmp187_ = vala_code_node_to_string ((ValaCodeNode*) _tmp186_);
936 _tmp188_ = _tmp187_;
937 _tmp189_ = vala_symbol_get_parent_symbol ((ValaSymbol*) self);
938 _tmp190_ = _tmp189_;
939 _tmp191_ = vala_symbol_get_full_name (_tmp190_);
940 _tmp192_ = _tmp191_;
941 _tmp193_ = g_strdup_printf ("parameter type `%s' is less accessible than method `%s'", _tmp188_, _tmp192_);
942 _tmp194_ = _tmp193_;
943 vala_report_error (_tmp184_, _tmp194_);
944 _g_free0 (_tmp194_);
945 _g_free0 (_tmp192_);
946 _g_free0 (_tmp188_);
947 }
948 }
949 _tmp195_ = vala_symbol_get_parent_symbol ((ValaSymbol*) self);
950 _tmp196_ = _tmp195_;
951 m = VALA_IS_METHOD (_tmp196_) ? ((ValaMethod*) _tmp196_) : NULL;
952 _tmp197_ = m;
953 if (_tmp197_ != NULL) {
954 ValaMethod* base_method = NULL;
955 gboolean _tmp198_ = FALSE;
956 ValaMethod* _tmp199_;
957 ValaMethod* _tmp200_;
958 ValaMethod* _tmp201_;
959 ValaMethod* _tmp220_;
960 base_method = NULL;
961 _tmp199_ = m;
962 _tmp200_ = vala_method_get_base_method (_tmp199_);
963 _tmp201_ = _tmp200_;
964 if (_tmp201_ != NULL) {
965 ValaMethod* _tmp202_;
966 ValaMethod* _tmp203_;
967 ValaMethod* _tmp204_;
968 ValaMethod* _tmp205_;
969 _tmp202_ = m;
970 _tmp203_ = vala_method_get_base_method (_tmp202_);
971 _tmp204_ = _tmp203_;
972 _tmp205_ = m;
973 _tmp198_ = _tmp204_ != _tmp205_;
974 } else {
975 _tmp198_ = FALSE;
976 }
977 if (_tmp198_) {
978 ValaMethod* _tmp206_;
979 ValaMethod* _tmp207_;
980 ValaMethod* _tmp208_;
981 _tmp206_ = m;
982 _tmp207_ = vala_method_get_base_method (_tmp206_);
983 _tmp208_ = _tmp207_;
984 base_method = _tmp208_;
985 } else {
986 gboolean _tmp209_ = FALSE;
987 ValaMethod* _tmp210_;
988 ValaMethod* _tmp211_;
989 ValaMethod* _tmp212_;
990 _tmp210_ = m;
991 _tmp211_ = vala_method_get_base_interface_method (_tmp210_);
992 _tmp212_ = _tmp211_;
993 if (_tmp212_ != NULL) {
994 ValaMethod* _tmp213_;
995 ValaMethod* _tmp214_;
996 ValaMethod* _tmp215_;
997 ValaMethod* _tmp216_;
998 _tmp213_ = m;
999 _tmp214_ = vala_method_get_base_interface_method (_tmp213_);
1000 _tmp215_ = _tmp214_;
1001 _tmp216_ = m;
1002 _tmp209_ = _tmp215_ != _tmp216_;
1003 } else {
1004 _tmp209_ = FALSE;
1005 }
1006 if (_tmp209_) {
1007 ValaMethod* _tmp217_;
1008 ValaMethod* _tmp218_;
1009 ValaMethod* _tmp219_;
1010 _tmp217_ = m;
1011 _tmp218_ = vala_method_get_base_interface_method (_tmp217_);
1012 _tmp219_ = _tmp218_;
1013 base_method = _tmp219_;
1014 }
1015 }
1016 _tmp220_ = base_method;
1017 if (_tmp220_ != NULL) {
1018 gint index = 0;
1019 ValaMethod* _tmp221_;
1020 ValaList* _tmp222_;
1021 _tmp221_ = m;
1022 _tmp222_ = vala_callable_get_parameters ((ValaCallable*) _tmp221_);
1023 index = vala_list_index_of (_tmp222_, self);
1024 if (index >= 0) {
1025 ValaMethod* _tmp223_;
1026 ValaList* _tmp224_;
1027 gpointer _tmp225_;
1028 ValaParameter* _tmp226_;
1029 _tmp223_ = base_method;
1030 _tmp224_ = vala_callable_get_parameters ((ValaCallable*) _tmp223_);
1031 _tmp225_ = vala_list_get (_tmp224_, index);
1032 _tmp226_ = (ValaParameter*) _tmp225_;
1033 vala_parameter_set_base_parameter (self, _tmp226_);
1034 _vala_code_node_unref0 (_tmp226_);
1035 }
1036 }
1037 }
1038 _tmp227_ = vala_code_context_get_analyzer (context);
1039 _tmp228_ = _tmp227_;
1040 _tmp229_ = old_source_file;
1041 vala_semantic_analyzer_set_current_source_file (_tmp228_, _tmp229_);
1042 _tmp230_ = vala_code_context_get_analyzer (context);
1043 _tmp231_ = _tmp230_;
1044 _tmp232_ = old_symbol;
1045 vala_semantic_analyzer_set_current_symbol (_tmp231_, _tmp232_);
1046 _tmp233_ = vala_code_node_get_error ((ValaCodeNode*) self);
1047 _tmp234_ = _tmp233_;
1048 result = !_tmp234_;
1049 _vala_code_node_unref0 (old_symbol);
1050 _vala_source_file_unref0 (old_source_file);
1051 return result;
1052 }
1053
1054 static void
vala_parameter_class_init(ValaParameterClass * klass,gpointer klass_data)1055 vala_parameter_class_init (ValaParameterClass * klass,
1056 gpointer klass_data)
1057 {
1058 vala_parameter_parent_class = g_type_class_peek_parent (klass);
1059 ((ValaCodeNodeClass *) klass)->finalize = vala_parameter_finalize;
1060 g_type_class_adjust_private_offset (klass, &ValaParameter_private_offset);
1061 ((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_parameter_real_accept;
1062 ((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_parameter_real_accept_children;
1063 ((ValaCodeNodeClass *) klass)->replace_type = (void (*) (ValaCodeNode*, ValaDataType*, ValaDataType*)) vala_parameter_real_replace_type;
1064 ((ValaCodeNodeClass *) klass)->replace_expression = (void (*) (ValaCodeNode*, ValaExpression*, ValaExpression*)) vala_parameter_real_replace_expression;
1065 ((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_parameter_real_check;
1066 }
1067
1068 static void
vala_parameter_instance_init(ValaParameter * self,gpointer klass)1069 vala_parameter_instance_init (ValaParameter * self,
1070 gpointer klass)
1071 {
1072 self->priv = vala_parameter_get_instance_private (self);
1073 self->priv->_direction = VALA_PARAMETER_DIRECTION_IN;
1074 }
1075
1076 static void
vala_parameter_finalize(ValaCodeNode * obj)1077 vala_parameter_finalize (ValaCodeNode * obj)
1078 {
1079 ValaParameter * self;
1080 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_PARAMETER, ValaParameter);
1081 _vala_code_node_unref0 (self->priv->_base_parameter);
1082 VALA_CODE_NODE_CLASS (vala_parameter_parent_class)->finalize (obj);
1083 }
1084
1085 /**
1086 * Represents a formal parameter in method and callback signatures.
1087 */
1088 static GType
vala_parameter_get_type_once(void)1089 vala_parameter_get_type_once (void)
1090 {
1091 static const GTypeInfo g_define_type_info = { sizeof (ValaParameterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_parameter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaParameter), 0, (GInstanceInitFunc) vala_parameter_instance_init, NULL };
1092 GType vala_parameter_type_id;
1093 vala_parameter_type_id = g_type_register_static (VALA_TYPE_VARIABLE, "ValaParameter", &g_define_type_info, 0);
1094 ValaParameter_private_offset = g_type_add_instance_private (vala_parameter_type_id, sizeof (ValaParameterPrivate));
1095 return vala_parameter_type_id;
1096 }
1097
1098 GType
vala_parameter_get_type(void)1099 vala_parameter_get_type (void)
1100 {
1101 static volatile gsize vala_parameter_type_id__volatile = 0;
1102 if (g_once_init_enter (&vala_parameter_type_id__volatile)) {
1103 GType vala_parameter_type_id;
1104 vala_parameter_type_id = vala_parameter_get_type_once ();
1105 g_once_init_leave (&vala_parameter_type_id__volatile, vala_parameter_type_id);
1106 }
1107 return vala_parameter_type_id__volatile;
1108 }
1109
1110 static GType
vala_parameter_direction_get_type_once(void)1111 vala_parameter_direction_get_type_once (void)
1112 {
1113 static const GEnumValue values[] = {{VALA_PARAMETER_DIRECTION_IN, "VALA_PARAMETER_DIRECTION_IN", "in"}, {VALA_PARAMETER_DIRECTION_OUT, "VALA_PARAMETER_DIRECTION_OUT", "out"}, {VALA_PARAMETER_DIRECTION_REF, "VALA_PARAMETER_DIRECTION_REF", "ref"}, {0, NULL, NULL}};
1114 GType vala_parameter_direction_type_id;
1115 vala_parameter_direction_type_id = g_enum_register_static ("ValaParameterDirection", values);
1116 return vala_parameter_direction_type_id;
1117 }
1118
1119 GType
vala_parameter_direction_get_type(void)1120 vala_parameter_direction_get_type (void)
1121 {
1122 static volatile gsize vala_parameter_direction_type_id__volatile = 0;
1123 if (g_once_init_enter (&vala_parameter_direction_type_id__volatile)) {
1124 GType vala_parameter_direction_type_id;
1125 vala_parameter_direction_type_id = vala_parameter_direction_get_type_once ();
1126 g_once_init_leave (&vala_parameter_direction_type_id__volatile, vala_parameter_direction_type_id);
1127 }
1128 return vala_parameter_direction_type_id__volatile;
1129 }
1130
1131