1 /* valalocalvariable.c generated by valac, the Vala compiler
2 * generated from valalocalvariable.vala, do not modify */
3
4 /* valalocalvariable.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 <glib.h>
28 #include <stdlib.h>
29 #include <string.h>
30
31 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
32 #define _g_free0(var) (var = (g_free (var), NULL))
33
34 struct _ValaLocalVariablePrivate {
35 gboolean _is_result;
36 gboolean _captured;
37 gboolean _init;
38 };
39
40 static gint ValaLocalVariable_private_offset;
41 static gpointer vala_local_variable_parent_class = NULL;
42
43 static void vala_local_variable_real_accept (ValaCodeNode* base,
44 ValaCodeVisitor* visitor);
45 static void vala_local_variable_real_accept_children (ValaCodeNode* base,
46 ValaCodeVisitor* visitor);
47 static void vala_local_variable_real_replace_expression (ValaCodeNode* base,
48 ValaExpression* old_node,
49 ValaExpression* new_node);
50 static void vala_local_variable_real_replace_type (ValaCodeNode* base,
51 ValaDataType* old_type,
52 ValaDataType* new_type);
53 static gboolean vala_local_variable_real_check (ValaCodeNode* base,
54 ValaCodeContext* context);
55 static void vala_local_variable_finalize (ValaCodeNode * obj);
56 static GType vala_local_variable_get_type_once (void);
57
58 static inline gpointer
vala_local_variable_get_instance_private(ValaLocalVariable * self)59 vala_local_variable_get_instance_private (ValaLocalVariable* self)
60 {
61 return G_STRUCT_MEMBER_P (self, ValaLocalVariable_private_offset);
62 }
63
64 gboolean
vala_local_variable_get_is_result(ValaLocalVariable * self)65 vala_local_variable_get_is_result (ValaLocalVariable* self)
66 {
67 gboolean result;
68 g_return_val_if_fail (self != NULL, FALSE);
69 result = self->priv->_is_result;
70 return result;
71 }
72
73 void
vala_local_variable_set_is_result(ValaLocalVariable * self,gboolean value)74 vala_local_variable_set_is_result (ValaLocalVariable* self,
75 gboolean value)
76 {
77 g_return_if_fail (self != NULL);
78 self->priv->_is_result = value;
79 }
80
81 gboolean
vala_local_variable_get_captured(ValaLocalVariable * self)82 vala_local_variable_get_captured (ValaLocalVariable* self)
83 {
84 gboolean result;
85 g_return_val_if_fail (self != NULL, FALSE);
86 result = self->priv->_captured;
87 return result;
88 }
89
90 void
vala_local_variable_set_captured(ValaLocalVariable * self,gboolean value)91 vala_local_variable_set_captured (ValaLocalVariable* self,
92 gboolean value)
93 {
94 g_return_if_fail (self != NULL);
95 self->priv->_captured = value;
96 }
97
98 gboolean
vala_local_variable_get_init(ValaLocalVariable * self)99 vala_local_variable_get_init (ValaLocalVariable* self)
100 {
101 gboolean result;
102 g_return_val_if_fail (self != NULL, FALSE);
103 result = self->priv->_init;
104 return result;
105 }
106
107 void
vala_local_variable_set_init(ValaLocalVariable * self,gboolean value)108 vala_local_variable_set_init (ValaLocalVariable* self,
109 gboolean value)
110 {
111 g_return_if_fail (self != NULL);
112 self->priv->_init = value;
113 }
114
115 /**
116 * Creates a new local variable.
117 *
118 * @param name name of the variable
119 * @param initializer optional initializer expression
120 * @param source_reference reference to source code
121 * @return newly created variable declarator
122 */
123 ValaLocalVariable*
vala_local_variable_construct(GType object_type,ValaDataType * variable_type,const gchar * name,ValaExpression * initializer,ValaSourceReference * source_reference)124 vala_local_variable_construct (GType object_type,
125 ValaDataType* variable_type,
126 const gchar* name,
127 ValaExpression* initializer,
128 ValaSourceReference* source_reference)
129 {
130 ValaLocalVariable* self = NULL;
131 g_return_val_if_fail (name != NULL, NULL);
132 self = (ValaLocalVariable*) vala_variable_construct (object_type, variable_type, name, initializer, source_reference, NULL);
133 return self;
134 }
135
136 ValaLocalVariable*
vala_local_variable_new(ValaDataType * variable_type,const gchar * name,ValaExpression * initializer,ValaSourceReference * source_reference)137 vala_local_variable_new (ValaDataType* variable_type,
138 const gchar* name,
139 ValaExpression* initializer,
140 ValaSourceReference* source_reference)
141 {
142 return vala_local_variable_construct (VALA_TYPE_LOCAL_VARIABLE, variable_type, name, initializer, source_reference);
143 }
144
145 static void
vala_local_variable_real_accept(ValaCodeNode * base,ValaCodeVisitor * visitor)146 vala_local_variable_real_accept (ValaCodeNode* base,
147 ValaCodeVisitor* visitor)
148 {
149 ValaLocalVariable * self;
150 self = (ValaLocalVariable*) base;
151 g_return_if_fail (visitor != NULL);
152 vala_code_visitor_visit_local_variable (visitor, self);
153 }
154
155 static void
vala_local_variable_real_accept_children(ValaCodeNode * base,ValaCodeVisitor * visitor)156 vala_local_variable_real_accept_children (ValaCodeNode* base,
157 ValaCodeVisitor* visitor)
158 {
159 ValaLocalVariable * self;
160 ValaExpression* _tmp0_;
161 ValaExpression* _tmp1_;
162 ValaDataType* _tmp6_;
163 ValaDataType* _tmp7_;
164 self = (ValaLocalVariable*) base;
165 g_return_if_fail (visitor != NULL);
166 _tmp0_ = vala_variable_get_initializer ((ValaVariable*) self);
167 _tmp1_ = _tmp0_;
168 if (_tmp1_ != NULL) {
169 ValaExpression* _tmp2_;
170 ValaExpression* _tmp3_;
171 ValaExpression* _tmp4_;
172 ValaExpression* _tmp5_;
173 _tmp2_ = vala_variable_get_initializer ((ValaVariable*) self);
174 _tmp3_ = _tmp2_;
175 vala_code_node_accept ((ValaCodeNode*) _tmp3_, visitor);
176 _tmp4_ = vala_variable_get_initializer ((ValaVariable*) self);
177 _tmp5_ = _tmp4_;
178 vala_code_visitor_visit_end_full_expression (visitor, _tmp5_);
179 }
180 _tmp6_ = vala_variable_get_variable_type ((ValaVariable*) self);
181 _tmp7_ = _tmp6_;
182 if (_tmp7_ != NULL) {
183 ValaDataType* _tmp8_;
184 ValaDataType* _tmp9_;
185 _tmp8_ = vala_variable_get_variable_type ((ValaVariable*) self);
186 _tmp9_ = _tmp8_;
187 vala_code_node_accept ((ValaCodeNode*) _tmp9_, visitor);
188 }
189 }
190
191 static void
vala_local_variable_real_replace_expression(ValaCodeNode * base,ValaExpression * old_node,ValaExpression * new_node)192 vala_local_variable_real_replace_expression (ValaCodeNode* base,
193 ValaExpression* old_node,
194 ValaExpression* new_node)
195 {
196 ValaLocalVariable * self;
197 ValaExpression* _tmp0_;
198 ValaExpression* _tmp1_;
199 self = (ValaLocalVariable*) base;
200 g_return_if_fail (old_node != NULL);
201 g_return_if_fail (new_node != NULL);
202 _tmp0_ = vala_variable_get_initializer ((ValaVariable*) self);
203 _tmp1_ = _tmp0_;
204 if (_tmp1_ == old_node) {
205 vala_variable_set_initializer ((ValaVariable*) self, new_node);
206 }
207 }
208
209 static void
vala_local_variable_real_replace_type(ValaCodeNode * base,ValaDataType * old_type,ValaDataType * new_type)210 vala_local_variable_real_replace_type (ValaCodeNode* base,
211 ValaDataType* old_type,
212 ValaDataType* new_type)
213 {
214 ValaLocalVariable * self;
215 ValaDataType* _tmp0_;
216 ValaDataType* _tmp1_;
217 self = (ValaLocalVariable*) base;
218 g_return_if_fail (old_type != NULL);
219 g_return_if_fail (new_type != NULL);
220 _tmp0_ = vala_variable_get_variable_type ((ValaVariable*) self);
221 _tmp1_ = _tmp0_;
222 if (_tmp1_ == old_type) {
223 vala_variable_set_variable_type ((ValaVariable*) self, new_type);
224 }
225 }
226
227 static gboolean
vala_local_variable_real_check(ValaCodeNode * base,ValaCodeContext * context)228 vala_local_variable_real_check (ValaCodeNode* base,
229 ValaCodeContext* context)
230 {
231 ValaLocalVariable * self;
232 gboolean _tmp0_;
233 gboolean _tmp1_;
234 ValaDataType* _tmp4_;
235 ValaDataType* _tmp5_;
236 gboolean _tmp8_;
237 gboolean _tmp9_;
238 ValaDataType* _tmp21_;
239 ValaDataType* _tmp22_;
240 gboolean is_initializer_list = FALSE;
241 gint initializer_size = 0;
242 gboolean _tmp35_ = FALSE;
243 ValaExpression* _tmp36_;
244 ValaExpression* _tmp37_;
245 ValaSemanticAnalyzer* _tmp60_;
246 ValaSemanticAnalyzer* _tmp61_;
247 ValaSymbol* _tmp62_;
248 ValaSymbol* _tmp63_;
249 ValaScope* _tmp64_;
250 ValaScope* _tmp65_;
251 const gchar* _tmp66_;
252 const gchar* _tmp67_;
253 gboolean _tmp68_;
254 gboolean _tmp69_;
255 ValaDataType* _tmp70_;
256 ValaDataType* _tmp71_;
257 gboolean _tmp123_;
258 gboolean _tmp124_;
259 ValaArrayType* variable_array_type = NULL;
260 ValaDataType* _tmp137_;
261 ValaDataType* _tmp138_;
262 gboolean _tmp139_ = FALSE;
263 gboolean _tmp140_ = FALSE;
264 gboolean _tmp141_ = FALSE;
265 ValaArrayType* _tmp142_;
266 gboolean _tmp154_ = FALSE;
267 gboolean _tmp155_ = FALSE;
268 gboolean _tmp156_ = FALSE;
269 ValaArrayType* _tmp157_;
270 gboolean _tmp168_ = FALSE;
271 ValaExpression* _tmp169_;
272 ValaExpression* _tmp170_;
273 ValaBlock* block = NULL;
274 ValaSemanticAnalyzer* _tmp276_;
275 ValaSemanticAnalyzer* _tmp277_;
276 ValaSymbol* _tmp278_;
277 ValaSymbol* _tmp279_;
278 ValaBlock* _tmp280_;
279 gboolean _tmp282_;
280 gboolean _tmp283_;
281 gboolean result = FALSE;
282 self = (ValaLocalVariable*) base;
283 g_return_val_if_fail (context != NULL, FALSE);
284 _tmp0_ = vala_code_node_get_checked ((ValaCodeNode*) self);
285 _tmp1_ = _tmp0_;
286 if (_tmp1_) {
287 gboolean _tmp2_;
288 gboolean _tmp3_;
289 _tmp2_ = vala_code_node_get_error ((ValaCodeNode*) self);
290 _tmp3_ = _tmp2_;
291 result = !_tmp3_;
292 return result;
293 }
294 vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
295 _tmp4_ = vala_variable_get_variable_type ((ValaVariable*) self);
296 _tmp5_ = _tmp4_;
297 if (_tmp5_ == NULL) {
298 ValaVarType* _tmp6_;
299 ValaVarType* _tmp7_;
300 _tmp6_ = vala_var_type_new (TRUE);
301 _tmp7_ = _tmp6_;
302 vala_variable_set_variable_type ((ValaVariable*) self, (ValaDataType*) _tmp7_);
303 _vala_code_node_unref0 (_tmp7_);
304 }
305 _tmp8_ = vala_code_context_get_experimental_non_null (context);
306 _tmp9_ = _tmp8_;
307 if (!_tmp9_) {
308 ValaDataType* _tmp10_;
309 ValaDataType* _tmp11_;
310 _tmp10_ = vala_variable_get_variable_type ((ValaVariable*) self);
311 _tmp11_ = _tmp10_;
312 if (VALA_IS_REFERENCE_TYPE (_tmp11_)) {
313 ValaArrayType* array_type = NULL;
314 ValaDataType* _tmp12_;
315 ValaDataType* _tmp13_;
316 gboolean _tmp14_ = FALSE;
317 ValaArrayType* _tmp15_;
318 _tmp12_ = vala_variable_get_variable_type ((ValaVariable*) self);
319 _tmp13_ = _tmp12_;
320 array_type = VALA_IS_ARRAY_TYPE (_tmp13_) ? ((ValaArrayType*) _tmp13_) : NULL;
321 _tmp15_ = array_type;
322 if (_tmp15_ != NULL) {
323 ValaArrayType* _tmp16_;
324 gboolean _tmp17_;
325 gboolean _tmp18_;
326 _tmp16_ = array_type;
327 _tmp17_ = vala_array_type_get_fixed_length (_tmp16_);
328 _tmp18_ = _tmp17_;
329 _tmp14_ = _tmp18_;
330 } else {
331 _tmp14_ = FALSE;
332 }
333 if (_tmp14_) {
334 } else {
335 ValaDataType* _tmp19_;
336 ValaDataType* _tmp20_;
337 _tmp19_ = vala_variable_get_variable_type ((ValaVariable*) self);
338 _tmp20_ = _tmp19_;
339 vala_data_type_set_nullable (_tmp20_, TRUE);
340 }
341 }
342 }
343 _tmp21_ = vala_variable_get_variable_type ((ValaVariable*) self);
344 _tmp22_ = _tmp21_;
345 if (!VALA_IS_VAR_TYPE (_tmp22_)) {
346 ValaDataType* _tmp23_;
347 ValaDataType* _tmp24_;
348 gboolean _tmp29_;
349 gboolean _tmp30_;
350 _tmp23_ = vala_variable_get_variable_type ((ValaVariable*) self);
351 _tmp24_ = _tmp23_;
352 if (VALA_IS_VOID_TYPE (_tmp24_)) {
353 ValaSourceReference* _tmp25_;
354 ValaSourceReference* _tmp26_;
355 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
356 _tmp25_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
357 _tmp26_ = _tmp25_;
358 vala_report_error (_tmp26_, "'void' not supported as variable type");
359 } else {
360 ValaDataType* _tmp27_;
361 ValaDataType* _tmp28_;
362 _tmp27_ = vala_variable_get_variable_type ((ValaVariable*) self);
363 _tmp28_ = _tmp27_;
364 if (!vala_code_node_check ((ValaCodeNode*) _tmp28_, context)) {
365 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
366 }
367 }
368 _tmp29_ = vala_symbol_get_external_package ((ValaSymbol*) self);
369 _tmp30_ = _tmp29_;
370 if (!_tmp30_) {
371 ValaSemanticAnalyzer* _tmp31_;
372 ValaSemanticAnalyzer* _tmp32_;
373 ValaDataType* _tmp33_;
374 ValaDataType* _tmp34_;
375 _tmp31_ = vala_code_context_get_analyzer (context);
376 _tmp32_ = _tmp31_;
377 _tmp33_ = vala_variable_get_variable_type ((ValaVariable*) self);
378 _tmp34_ = _tmp33_;
379 vala_semantic_analyzer_check_type (_tmp32_, _tmp34_);
380 }
381 }
382 is_initializer_list = FALSE;
383 initializer_size = -1;
384 _tmp36_ = vala_variable_get_initializer ((ValaVariable*) self);
385 _tmp37_ = _tmp36_;
386 if (_tmp37_ != NULL) {
387 gboolean _tmp38_;
388 gboolean _tmp39_;
389 _tmp38_ = vala_code_node_get_error ((ValaCodeNode*) self);
390 _tmp39_ = _tmp38_;
391 _tmp35_ = !_tmp39_;
392 } else {
393 _tmp35_ = FALSE;
394 }
395 if (_tmp35_) {
396 ValaExpression* _tmp40_;
397 ValaExpression* _tmp41_;
398 ValaDataType* _tmp42_;
399 ValaDataType* _tmp43_;
400 ValaExpression* _tmp44_;
401 ValaExpression* _tmp45_;
402 ValaExpression* _tmp50_;
403 ValaExpression* _tmp51_;
404 _tmp40_ = vala_variable_get_initializer ((ValaVariable*) self);
405 _tmp41_ = _tmp40_;
406 _tmp42_ = vala_variable_get_variable_type ((ValaVariable*) self);
407 _tmp43_ = _tmp42_;
408 vala_expression_set_target_type (_tmp41_, _tmp43_);
409 _tmp44_ = vala_variable_get_initializer ((ValaVariable*) self);
410 _tmp45_ = _tmp44_;
411 if (VALA_IS_INITIALIZER_LIST (_tmp45_)) {
412 ValaExpression* _tmp46_;
413 ValaExpression* _tmp47_;
414 gint _tmp48_;
415 gint _tmp49_;
416 _tmp46_ = vala_variable_get_initializer ((ValaVariable*) self);
417 _tmp47_ = _tmp46_;
418 _tmp48_ = vala_initializer_list_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp47_, VALA_TYPE_INITIALIZER_LIST, ValaInitializerList));
419 _tmp49_ = _tmp48_;
420 initializer_size = _tmp49_;
421 is_initializer_list = TRUE;
422 }
423 _tmp50_ = vala_variable_get_initializer ((ValaVariable*) self);
424 _tmp51_ = _tmp50_;
425 if (!vala_code_node_check ((ValaCodeNode*) _tmp51_, context)) {
426 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
427 } else {
428 ValaExpression* _tmp52_;
429 ValaExpression* _tmp53_;
430 ValaDataType* _tmp54_;
431 ValaDataType* _tmp55_;
432 _tmp52_ = vala_variable_get_initializer ((ValaVariable*) self);
433 _tmp53_ = _tmp52_;
434 _tmp54_ = vala_expression_get_value_type (_tmp53_);
435 _tmp55_ = _tmp54_;
436 if (VALA_IS_VOID_TYPE (_tmp55_)) {
437 ValaExpression* _tmp56_;
438 ValaExpression* _tmp57_;
439 ValaSourceReference* _tmp58_;
440 ValaSourceReference* _tmp59_;
441 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
442 _tmp56_ = vala_variable_get_initializer ((ValaVariable*) self);
443 _tmp57_ = _tmp56_;
444 _tmp58_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp57_);
445 _tmp59_ = _tmp58_;
446 vala_report_error (_tmp59_, "'void' not supported as initializer type");
447 }
448 }
449 }
450 _tmp60_ = vala_code_context_get_analyzer (context);
451 _tmp61_ = _tmp60_;
452 _tmp62_ = vala_semantic_analyzer_get_current_symbol (_tmp61_);
453 _tmp63_ = _tmp62_;
454 _tmp64_ = vala_symbol_get_scope (_tmp63_);
455 _tmp65_ = _tmp64_;
456 _tmp66_ = vala_symbol_get_name ((ValaSymbol*) self);
457 _tmp67_ = _tmp66_;
458 vala_scope_add (_tmp65_, _tmp67_, (ValaSymbol*) self);
459 _tmp68_ = vala_code_node_get_error ((ValaCodeNode*) self);
460 _tmp69_ = _tmp68_;
461 if (_tmp69_) {
462 result = FALSE;
463 return result;
464 }
465 _tmp70_ = vala_variable_get_variable_type ((ValaVariable*) self);
466 _tmp71_ = _tmp70_;
467 if (VALA_IS_VAR_TYPE (_tmp71_)) {
468 ValaExpression* _tmp72_;
469 ValaExpression* _tmp73_;
470 ValaExpression* _tmp76_;
471 ValaExpression* _tmp77_;
472 ValaDataType* _tmp78_;
473 ValaDataType* _tmp79_;
474 gboolean _tmp82_ = FALSE;
475 ValaExpression* _tmp83_;
476 ValaExpression* _tmp84_;
477 ValaDataType* _tmp85_;
478 ValaDataType* _tmp86_;
479 gboolean value_owned = FALSE;
480 ValaDataType* _tmp103_;
481 ValaDataType* _tmp104_;
482 gboolean _tmp105_;
483 gboolean _tmp106_;
484 ValaExpression* _tmp107_;
485 ValaExpression* _tmp108_;
486 ValaDataType* _tmp109_;
487 ValaDataType* _tmp110_;
488 ValaDataType* _tmp111_;
489 ValaDataType* _tmp112_;
490 ValaDataType* _tmp113_;
491 ValaDataType* _tmp114_;
492 ValaDataType* _tmp115_;
493 ValaDataType* _tmp116_;
494 ValaExpression* _tmp117_;
495 ValaExpression* _tmp118_;
496 ValaDataType* _tmp119_;
497 ValaDataType* _tmp120_;
498 ValaDataType* _tmp121_;
499 ValaDataType* _tmp122_;
500 _tmp72_ = vala_variable_get_initializer ((ValaVariable*) self);
501 _tmp73_ = _tmp72_;
502 if (_tmp73_ == NULL) {
503 ValaSourceReference* _tmp74_;
504 ValaSourceReference* _tmp75_;
505 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
506 _tmp74_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
507 _tmp75_ = _tmp74_;
508 vala_report_error (_tmp75_, "var declaration not allowed without initializer");
509 result = FALSE;
510 return result;
511 }
512 _tmp76_ = vala_variable_get_initializer ((ValaVariable*) self);
513 _tmp77_ = _tmp76_;
514 _tmp78_ = vala_expression_get_value_type (_tmp77_);
515 _tmp79_ = _tmp78_;
516 if (_tmp79_ == NULL) {
517 ValaSourceReference* _tmp80_;
518 ValaSourceReference* _tmp81_;
519 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
520 _tmp80_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
521 _tmp81_ = _tmp80_;
522 vala_report_error (_tmp81_, "var declaration not allowed with non-typed initializer");
523 result = FALSE;
524 return result;
525 }
526 _tmp83_ = vala_variable_get_initializer ((ValaVariable*) self);
527 _tmp84_ = _tmp83_;
528 _tmp85_ = vala_expression_get_value_type (_tmp84_);
529 _tmp86_ = _tmp85_;
530 if (VALA_IS_FIELD_PROTOTYPE (_tmp86_)) {
531 _tmp82_ = TRUE;
532 } else {
533 ValaExpression* _tmp87_;
534 ValaExpression* _tmp88_;
535 ValaDataType* _tmp89_;
536 ValaDataType* _tmp90_;
537 _tmp87_ = vala_variable_get_initializer ((ValaVariable*) self);
538 _tmp88_ = _tmp87_;
539 _tmp89_ = vala_expression_get_value_type (_tmp88_);
540 _tmp90_ = _tmp89_;
541 _tmp82_ = VALA_IS_PROPERTY_PROTOTYPE (_tmp90_);
542 }
543 if (_tmp82_) {
544 ValaExpression* _tmp91_;
545 ValaExpression* _tmp92_;
546 ValaSourceReference* _tmp93_;
547 ValaSourceReference* _tmp94_;
548 ValaExpression* _tmp95_;
549 ValaExpression* _tmp96_;
550 ValaSymbol* _tmp97_;
551 ValaSymbol* _tmp98_;
552 gchar* _tmp99_;
553 gchar* _tmp100_;
554 gchar* _tmp101_;
555 gchar* _tmp102_;
556 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
557 _tmp91_ = vala_variable_get_initializer ((ValaVariable*) self);
558 _tmp92_ = _tmp91_;
559 _tmp93_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp92_);
560 _tmp94_ = _tmp93_;
561 _tmp95_ = vala_variable_get_initializer ((ValaVariable*) self);
562 _tmp96_ = _tmp95_;
563 _tmp97_ = vala_expression_get_symbol_reference (_tmp96_);
564 _tmp98_ = _tmp97_;
565 _tmp99_ = vala_symbol_get_full_name (_tmp98_);
566 _tmp100_ = _tmp99_;
567 _tmp101_ = g_strdup_printf ("Access to instance member `%s' denied", _tmp100_);
568 _tmp102_ = _tmp101_;
569 vala_report_error (_tmp94_, _tmp102_);
570 _g_free0 (_tmp102_);
571 _g_free0 (_tmp100_);
572 result = FALSE;
573 return result;
574 }
575 _tmp103_ = vala_variable_get_variable_type ((ValaVariable*) self);
576 _tmp104_ = _tmp103_;
577 _tmp105_ = vala_data_type_get_value_owned (_tmp104_);
578 _tmp106_ = _tmp105_;
579 value_owned = _tmp106_;
580 _tmp107_ = vala_variable_get_initializer ((ValaVariable*) self);
581 _tmp108_ = _tmp107_;
582 _tmp109_ = vala_expression_get_value_type (_tmp108_);
583 _tmp110_ = _tmp109_;
584 _tmp111_ = vala_data_type_copy (_tmp110_);
585 _tmp112_ = _tmp111_;
586 vala_variable_set_variable_type ((ValaVariable*) self, _tmp112_);
587 _vala_code_node_unref0 (_tmp112_);
588 _tmp113_ = vala_variable_get_variable_type ((ValaVariable*) self);
589 _tmp114_ = _tmp113_;
590 vala_data_type_set_value_owned (_tmp114_, value_owned);
591 _tmp115_ = vala_variable_get_variable_type ((ValaVariable*) self);
592 _tmp116_ = _tmp115_;
593 vala_data_type_set_floating_reference (_tmp116_, FALSE);
594 _tmp117_ = vala_variable_get_initializer ((ValaVariable*) self);
595 _tmp118_ = _tmp117_;
596 _tmp119_ = vala_variable_get_variable_type ((ValaVariable*) self);
597 _tmp120_ = _tmp119_;
598 vala_expression_set_target_type (_tmp118_, _tmp120_);
599 _tmp121_ = vala_variable_get_variable_type ((ValaVariable*) self);
600 _tmp122_ = _tmp121_;
601 vala_code_node_check ((ValaCodeNode*) _tmp122_, context);
602 }
603 _tmp123_ = vala_symbol_get_external_package ((ValaSymbol*) self);
604 _tmp124_ = _tmp123_;
605 if (!_tmp124_) {
606 ValaDataType* _tmp125_;
607 ValaDataType* _tmp126_;
608 ValaTypeSymbol* _tmp127_;
609 ValaTypeSymbol* _tmp128_;
610 _tmp125_ = vala_variable_get_variable_type ((ValaVariable*) self);
611 _tmp126_ = _tmp125_;
612 _tmp127_ = vala_data_type_get_type_symbol (_tmp126_);
613 _tmp128_ = _tmp127_;
614 if (_tmp128_ != NULL) {
615 ValaDataType* _tmp129_;
616 ValaDataType* _tmp130_;
617 ValaTypeSymbol* _tmp131_;
618 ValaTypeSymbol* _tmp132_;
619 ValaVersionAttribute* _tmp133_;
620 ValaVersionAttribute* _tmp134_;
621 ValaSourceReference* _tmp135_;
622 ValaSourceReference* _tmp136_;
623 _tmp129_ = vala_variable_get_variable_type ((ValaVariable*) self);
624 _tmp130_ = _tmp129_;
625 _tmp131_ = vala_data_type_get_type_symbol (_tmp130_);
626 _tmp132_ = _tmp131_;
627 _tmp133_ = vala_symbol_get_version ((ValaSymbol*) _tmp132_);
628 _tmp134_ = _tmp133_;
629 _tmp135_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
630 _tmp136_ = _tmp135_;
631 vala_version_attribute_check (_tmp134_, _tmp136_);
632 }
633 }
634 _tmp137_ = vala_variable_get_variable_type ((ValaVariable*) self);
635 _tmp138_ = _tmp137_;
636 variable_array_type = VALA_IS_ARRAY_TYPE (_tmp138_) ? ((ValaArrayType*) _tmp138_) : NULL;
637 _tmp142_ = variable_array_type;
638 if (_tmp142_ != NULL) {
639 ValaArrayType* _tmp143_;
640 gboolean _tmp144_;
641 gboolean _tmp145_;
642 _tmp143_ = variable_array_type;
643 _tmp144_ = vala_array_type_get_inline_allocated (_tmp143_);
644 _tmp145_ = _tmp144_;
645 _tmp141_ = _tmp145_;
646 } else {
647 _tmp141_ = FALSE;
648 }
649 if (_tmp141_) {
650 ValaExpression* _tmp146_;
651 ValaExpression* _tmp147_;
652 _tmp146_ = vala_variable_get_initializer ((ValaVariable*) self);
653 _tmp147_ = _tmp146_;
654 _tmp140_ = VALA_IS_ARRAY_CREATION_EXPRESSION (_tmp147_);
655 } else {
656 _tmp140_ = FALSE;
657 }
658 if (_tmp140_) {
659 ValaExpression* _tmp148_;
660 ValaExpression* _tmp149_;
661 ValaInitializerList* _tmp150_;
662 ValaInitializerList* _tmp151_;
663 _tmp148_ = vala_variable_get_initializer ((ValaVariable*) self);
664 _tmp149_ = _tmp148_;
665 _tmp150_ = vala_array_creation_expression_get_initializer_list (G_TYPE_CHECK_INSTANCE_CAST (_tmp149_, VALA_TYPE_ARRAY_CREATION_EXPRESSION, ValaArrayCreationExpression));
666 _tmp151_ = _tmp150_;
667 _tmp139_ = _tmp151_ == NULL;
668 } else {
669 _tmp139_ = FALSE;
670 }
671 if (_tmp139_) {
672 ValaSourceReference* _tmp152_;
673 ValaSourceReference* _tmp153_;
674 _tmp152_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
675 _tmp153_ = _tmp152_;
676 vala_report_warning (_tmp153_, "Inline allocated arrays don't require an explicit instantiation");
677 vala_variable_set_initializer ((ValaVariable*) self, NULL);
678 }
679 _tmp157_ = variable_array_type;
680 if (_tmp157_ != NULL) {
681 ValaArrayType* _tmp158_;
682 gboolean _tmp159_;
683 gboolean _tmp160_;
684 _tmp158_ = variable_array_type;
685 _tmp159_ = vala_array_type_get_inline_allocated (_tmp158_);
686 _tmp160_ = _tmp159_;
687 _tmp156_ = _tmp160_;
688 } else {
689 _tmp156_ = FALSE;
690 }
691 if (_tmp156_) {
692 ValaArrayType* _tmp161_;
693 ValaExpression* _tmp162_;
694 ValaExpression* _tmp163_;
695 _tmp161_ = variable_array_type;
696 _tmp162_ = vala_array_type_get_length (_tmp161_);
697 _tmp163_ = _tmp162_;
698 _tmp155_ = _tmp163_ == NULL;
699 } else {
700 _tmp155_ = FALSE;
701 }
702 if (_tmp155_) {
703 ValaExpression* _tmp164_;
704 ValaExpression* _tmp165_;
705 _tmp164_ = vala_variable_get_initializer ((ValaVariable*) self);
706 _tmp165_ = _tmp164_;
707 _tmp154_ = !VALA_IS_ARRAY_CREATION_EXPRESSION (_tmp165_);
708 } else {
709 _tmp154_ = FALSE;
710 }
711 if (_tmp154_) {
712 ValaSourceReference* _tmp166_;
713 ValaSourceReference* _tmp167_;
714 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
715 _tmp166_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
716 _tmp167_ = _tmp166_;
717 vala_report_error (_tmp167_, "Inline allocated array requires either a given length or an initialize" \
718 "r");
719 }
720 _tmp169_ = vala_variable_get_initializer ((ValaVariable*) self);
721 _tmp170_ = _tmp169_;
722 if (_tmp170_ != NULL) {
723 ValaExpression* _tmp171_;
724 ValaExpression* _tmp172_;
725 gboolean _tmp173_;
726 gboolean _tmp174_;
727 _tmp171_ = vala_variable_get_initializer ((ValaVariable*) self);
728 _tmp172_ = _tmp171_;
729 _tmp173_ = vala_code_node_get_error ((ValaCodeNode*) _tmp172_);
730 _tmp174_ = _tmp173_;
731 _tmp168_ = !_tmp174_;
732 } else {
733 _tmp168_ = FALSE;
734 }
735 if (_tmp168_) {
736 ValaExpression* _tmp175_;
737 ValaExpression* _tmp176_;
738 ValaDataType* _tmp177_;
739 ValaDataType* _tmp178_;
740 ValaExpression* _tmp214_;
741 ValaExpression* _tmp215_;
742 ValaDataType* _tmp216_;
743 ValaDataType* _tmp217_;
744 ValaDataType* _tmp218_;
745 ValaDataType* _tmp219_;
746 gboolean _tmp234_ = FALSE;
747 gboolean _tmp235_ = FALSE;
748 gboolean _tmp236_ = FALSE;
749 ValaArrayType* _tmp237_;
750 gboolean _tmp251_ = FALSE;
751 gboolean _tmp252_ = FALSE;
752 ValaArrayType* _tmp253_;
753 ValaExpression* _tmp263_;
754 ValaExpression* _tmp264_;
755 ValaDataType* _tmp265_;
756 ValaDataType* _tmp266_;
757 _tmp175_ = vala_variable_get_initializer ((ValaVariable*) self);
758 _tmp176_ = _tmp175_;
759 _tmp177_ = vala_expression_get_value_type (_tmp176_);
760 _tmp178_ = _tmp177_;
761 if (VALA_IS_METHOD_TYPE (_tmp178_)) {
762 gboolean _tmp179_ = FALSE;
763 ValaExpression* _tmp180_;
764 ValaExpression* _tmp181_;
765 ValaDataType* _tmp186_;
766 ValaDataType* _tmp187_;
767 _tmp180_ = vala_variable_get_initializer ((ValaVariable*) self);
768 _tmp181_ = _tmp180_;
769 if (!VALA_IS_MEMBER_ACCESS (_tmp181_)) {
770 ValaExpression* _tmp182_;
771 ValaExpression* _tmp183_;
772 _tmp182_ = vala_variable_get_initializer ((ValaVariable*) self);
773 _tmp183_ = _tmp182_;
774 _tmp179_ = !VALA_IS_LAMBDA_EXPRESSION (_tmp183_);
775 } else {
776 _tmp179_ = FALSE;
777 }
778 if (_tmp179_) {
779 ValaSourceReference* _tmp184_;
780 ValaSourceReference* _tmp185_;
781 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
782 _tmp184_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
783 _tmp185_ = _tmp184_;
784 vala_report_error (_tmp185_, "expression type not allowed as initializer");
785 result = FALSE;
786 return result;
787 }
788 _tmp186_ = vala_variable_get_variable_type ((ValaVariable*) self);
789 _tmp187_ = _tmp186_;
790 if (VALA_IS_DELEGATE_TYPE (_tmp187_)) {
791 ValaExpression* _tmp188_;
792 ValaExpression* _tmp189_;
793 ValaDataType* _tmp190_;
794 ValaDataType* _tmp191_;
795 ValaDataType* _tmp192_;
796 ValaDataType* _tmp193_;
797 _tmp188_ = vala_variable_get_initializer ((ValaVariable*) self);
798 _tmp189_ = _tmp188_;
799 _tmp190_ = vala_expression_get_value_type (_tmp189_);
800 _tmp191_ = _tmp190_;
801 _tmp192_ = vala_variable_get_variable_type ((ValaVariable*) self);
802 _tmp193_ = _tmp192_;
803 if (!vala_data_type_compatible (_tmp191_, _tmp193_)) {
804 ValaMethod* m = NULL;
805 ValaExpression* _tmp194_;
806 ValaExpression* _tmp195_;
807 ValaSymbol* _tmp196_;
808 ValaSymbol* _tmp197_;
809 ValaDelegate* cb = NULL;
810 ValaDataType* _tmp198_;
811 ValaDataType* _tmp199_;
812 ValaDelegate* _tmp200_;
813 ValaDelegate* _tmp201_;
814 ValaSourceReference* _tmp202_;
815 ValaSourceReference* _tmp203_;
816 ValaMethod* _tmp204_;
817 gchar* _tmp205_;
818 gchar* _tmp206_;
819 ValaDelegate* _tmp207_;
820 gchar* _tmp208_;
821 gchar* _tmp209_;
822 gchar* _tmp210_;
823 gchar* _tmp211_;
824 _tmp194_ = vala_variable_get_initializer ((ValaVariable*) self);
825 _tmp195_ = _tmp194_;
826 _tmp196_ = vala_expression_get_symbol_reference (_tmp195_);
827 _tmp197_ = _tmp196_;
828 m = G_TYPE_CHECK_INSTANCE_CAST (_tmp197_, VALA_TYPE_METHOD, ValaMethod);
829 _tmp198_ = vala_variable_get_variable_type ((ValaVariable*) self);
830 _tmp199_ = _tmp198_;
831 _tmp200_ = vala_delegate_type_get_delegate_symbol (G_TYPE_CHECK_INSTANCE_CAST (_tmp199_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
832 _tmp201_ = _tmp200_;
833 cb = _tmp201_;
834 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
835 _tmp202_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
836 _tmp203_ = _tmp202_;
837 _tmp204_ = m;
838 _tmp205_ = vala_symbol_get_full_name ((ValaSymbol*) _tmp204_);
839 _tmp206_ = _tmp205_;
840 _tmp207_ = cb;
841 _tmp208_ = vala_symbol_get_full_name ((ValaSymbol*) _tmp207_);
842 _tmp209_ = _tmp208_;
843 _tmp210_ = g_strdup_printf ("Declaration of method `%s' is not compatible with delegate `%s'", _tmp206_, _tmp209_);
844 _tmp211_ = _tmp210_;
845 vala_report_error (_tmp203_, _tmp211_);
846 _g_free0 (_tmp211_);
847 _g_free0 (_tmp209_);
848 _g_free0 (_tmp206_);
849 result = FALSE;
850 return result;
851 }
852 } else {
853 ValaSourceReference* _tmp212_;
854 ValaSourceReference* _tmp213_;
855 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
856 _tmp212_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
857 _tmp213_ = _tmp212_;
858 vala_report_error (_tmp213_, "expression type not allowed as initializer");
859 result = FALSE;
860 return result;
861 }
862 }
863 _tmp214_ = vala_variable_get_initializer ((ValaVariable*) self);
864 _tmp215_ = _tmp214_;
865 _tmp216_ = vala_expression_get_value_type (_tmp215_);
866 _tmp217_ = _tmp216_;
867 _tmp218_ = vala_variable_get_variable_type ((ValaVariable*) self);
868 _tmp219_ = _tmp218_;
869 if (!vala_data_type_compatible (_tmp217_, _tmp219_)) {
870 ValaSourceReference* _tmp220_;
871 ValaSourceReference* _tmp221_;
872 ValaExpression* _tmp222_;
873 ValaExpression* _tmp223_;
874 ValaDataType* _tmp224_;
875 ValaDataType* _tmp225_;
876 gchar* _tmp226_;
877 gchar* _tmp227_;
878 ValaDataType* _tmp228_;
879 ValaDataType* _tmp229_;
880 gchar* _tmp230_;
881 gchar* _tmp231_;
882 gchar* _tmp232_;
883 gchar* _tmp233_;
884 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
885 _tmp220_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
886 _tmp221_ = _tmp220_;
887 _tmp222_ = vala_variable_get_initializer ((ValaVariable*) self);
888 _tmp223_ = _tmp222_;
889 _tmp224_ = vala_expression_get_value_type (_tmp223_);
890 _tmp225_ = _tmp224_;
891 _tmp226_ = vala_code_node_to_string ((ValaCodeNode*) _tmp225_);
892 _tmp227_ = _tmp226_;
893 _tmp228_ = vala_variable_get_variable_type ((ValaVariable*) self);
894 _tmp229_ = _tmp228_;
895 _tmp230_ = vala_code_node_to_string ((ValaCodeNode*) _tmp229_);
896 _tmp231_ = _tmp230_;
897 _tmp232_ = g_strdup_printf ("Assignment: Cannot convert from `%s' to `%s'", _tmp227_, _tmp231_);
898 _tmp233_ = _tmp232_;
899 vala_report_error (_tmp221_, _tmp233_);
900 _g_free0 (_tmp233_);
901 _g_free0 (_tmp231_);
902 _g_free0 (_tmp227_);
903 result = FALSE;
904 return result;
905 }
906 _tmp237_ = variable_array_type;
907 if (_tmp237_ != NULL) {
908 ValaArrayType* _tmp238_;
909 gboolean _tmp239_;
910 gboolean _tmp240_;
911 _tmp238_ = variable_array_type;
912 _tmp239_ = vala_array_type_get_inline_allocated (_tmp238_);
913 _tmp240_ = _tmp239_;
914 _tmp236_ = _tmp240_;
915 } else {
916 _tmp236_ = FALSE;
917 }
918 if (_tmp236_) {
919 ValaArrayType* _tmp241_;
920 gboolean _tmp242_;
921 gboolean _tmp243_;
922 _tmp241_ = variable_array_type;
923 _tmp242_ = vala_array_type_get_fixed_length (_tmp241_);
924 _tmp243_ = _tmp242_;
925 _tmp235_ = !_tmp243_;
926 } else {
927 _tmp235_ = FALSE;
928 }
929 if (_tmp235_) {
930 _tmp234_ = is_initializer_list;
931 } else {
932 _tmp234_ = FALSE;
933 }
934 if (_tmp234_) {
935 ValaArrayType* _tmp244_;
936 gchar* _tmp245_;
937 gchar* _tmp246_;
938 ValaIntegerLiteral* _tmp247_;
939 ValaIntegerLiteral* _tmp248_;
940 ValaArrayType* _tmp249_;
941 ValaArrayType* _tmp250_;
942 _tmp244_ = variable_array_type;
943 _tmp245_ = g_strdup_printf ("%i", initializer_size);
944 _tmp246_ = _tmp245_;
945 _tmp247_ = vala_integer_literal_new (_tmp246_, NULL);
946 _tmp248_ = _tmp247_;
947 vala_array_type_set_length (_tmp244_, (ValaExpression*) _tmp248_);
948 _vala_code_node_unref0 (_tmp248_);
949 _g_free0 (_tmp246_);
950 _tmp249_ = variable_array_type;
951 vala_array_type_set_fixed_length (_tmp249_, TRUE);
952 _tmp250_ = variable_array_type;
953 vala_data_type_set_nullable ((ValaDataType*) _tmp250_, FALSE);
954 }
955 _tmp253_ = variable_array_type;
956 if (_tmp253_ != NULL) {
957 ValaArrayType* _tmp254_;
958 gboolean _tmp255_;
959 gboolean _tmp256_;
960 _tmp254_ = variable_array_type;
961 _tmp255_ = vala_array_type_get_inline_allocated (_tmp254_);
962 _tmp256_ = _tmp255_;
963 _tmp252_ = _tmp256_;
964 } else {
965 _tmp252_ = FALSE;
966 }
967 if (_tmp252_) {
968 ValaExpression* _tmp257_;
969 ValaExpression* _tmp258_;
970 ValaDataType* _tmp259_;
971 ValaDataType* _tmp260_;
972 _tmp257_ = vala_variable_get_initializer ((ValaVariable*) self);
973 _tmp258_ = _tmp257_;
974 _tmp259_ = vala_expression_get_value_type (_tmp258_);
975 _tmp260_ = _tmp259_;
976 _tmp251_ = VALA_IS_ARRAY_TYPE (_tmp260_) == FALSE;
977 } else {
978 _tmp251_ = FALSE;
979 }
980 if (_tmp251_) {
981 ValaSourceReference* _tmp261_;
982 ValaSourceReference* _tmp262_;
983 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
984 _tmp261_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
985 _tmp262_ = _tmp261_;
986 vala_report_error (_tmp262_, "only arrays are allowed as initializer for arrays with fixed length");
987 result = FALSE;
988 return result;
989 }
990 _tmp263_ = vala_variable_get_initializer ((ValaVariable*) self);
991 _tmp264_ = _tmp263_;
992 _tmp265_ = vala_expression_get_value_type (_tmp264_);
993 _tmp266_ = _tmp265_;
994 if (vala_data_type_is_disposable (_tmp266_)) {
995 gboolean _tmp267_ = FALSE;
996 ValaDataType* _tmp268_;
997 ValaDataType* _tmp269_;
998 _tmp268_ = vala_variable_get_variable_type ((ValaVariable*) self);
999 _tmp269_ = _tmp268_;
1000 if (!VALA_IS_POINTER_TYPE (_tmp269_)) {
1001 ValaDataType* _tmp270_;
1002 ValaDataType* _tmp271_;
1003 gboolean _tmp272_;
1004 gboolean _tmp273_;
1005 _tmp270_ = vala_variable_get_variable_type ((ValaVariable*) self);
1006 _tmp271_ = _tmp270_;
1007 _tmp272_ = vala_data_type_get_value_owned (_tmp271_);
1008 _tmp273_ = _tmp272_;
1009 _tmp267_ = !_tmp273_;
1010 } else {
1011 _tmp267_ = FALSE;
1012 }
1013 if (_tmp267_) {
1014 ValaSourceReference* _tmp274_;
1015 ValaSourceReference* _tmp275_;
1016 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1017 _tmp274_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1018 _tmp275_ = _tmp274_;
1019 vala_report_error (_tmp275_, "Invalid assignment from owned expression to unowned variable");
1020 result = FALSE;
1021 return result;
1022 }
1023 }
1024 }
1025 _tmp276_ = vala_code_context_get_analyzer (context);
1026 _tmp277_ = _tmp276_;
1027 _tmp278_ = vala_semantic_analyzer_get_current_symbol (_tmp277_);
1028 _tmp279_ = _tmp278_;
1029 block = VALA_IS_BLOCK (_tmp279_) ? ((ValaBlock*) _tmp279_) : NULL;
1030 _tmp280_ = block;
1031 if (_tmp280_ != NULL) {
1032 ValaBlock* _tmp281_;
1033 _tmp281_ = block;
1034 vala_block_add_local_variable (_tmp281_, self);
1035 }
1036 vala_symbol_set_active ((ValaSymbol*) self, TRUE);
1037 _tmp282_ = vala_code_node_get_error ((ValaCodeNode*) self);
1038 _tmp283_ = _tmp282_;
1039 result = !_tmp283_;
1040 return result;
1041 }
1042
1043 static void
vala_local_variable_class_init(ValaLocalVariableClass * klass,gpointer klass_data)1044 vala_local_variable_class_init (ValaLocalVariableClass * klass,
1045 gpointer klass_data)
1046 {
1047 vala_local_variable_parent_class = g_type_class_peek_parent (klass);
1048 ((ValaCodeNodeClass *) klass)->finalize = vala_local_variable_finalize;
1049 g_type_class_adjust_private_offset (klass, &ValaLocalVariable_private_offset);
1050 ((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_local_variable_real_accept;
1051 ((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_local_variable_real_accept_children;
1052 ((ValaCodeNodeClass *) klass)->replace_expression = (void (*) (ValaCodeNode*, ValaExpression*, ValaExpression*)) vala_local_variable_real_replace_expression;
1053 ((ValaCodeNodeClass *) klass)->replace_type = (void (*) (ValaCodeNode*, ValaDataType*, ValaDataType*)) vala_local_variable_real_replace_type;
1054 ((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_local_variable_real_check;
1055 }
1056
1057 static void
vala_local_variable_instance_init(ValaLocalVariable * self,gpointer klass)1058 vala_local_variable_instance_init (ValaLocalVariable * self,
1059 gpointer klass)
1060 {
1061 self->priv = vala_local_variable_get_instance_private (self);
1062 }
1063
1064 static void
vala_local_variable_finalize(ValaCodeNode * obj)1065 vala_local_variable_finalize (ValaCodeNode * obj)
1066 {
1067 ValaLocalVariable * self;
1068 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_LOCAL_VARIABLE, ValaLocalVariable);
1069 VALA_CODE_NODE_CLASS (vala_local_variable_parent_class)->finalize (obj);
1070 }
1071
1072 /**
1073 * Represents a local variable declaration in the source code.
1074 */
1075 static GType
vala_local_variable_get_type_once(void)1076 vala_local_variable_get_type_once (void)
1077 {
1078 static const GTypeInfo g_define_type_info = { sizeof (ValaLocalVariableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_local_variable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaLocalVariable), 0, (GInstanceInitFunc) vala_local_variable_instance_init, NULL };
1079 GType vala_local_variable_type_id;
1080 vala_local_variable_type_id = g_type_register_static (VALA_TYPE_VARIABLE, "ValaLocalVariable", &g_define_type_info, 0);
1081 ValaLocalVariable_private_offset = g_type_add_instance_private (vala_local_variable_type_id, sizeof (ValaLocalVariablePrivate));
1082 return vala_local_variable_type_id;
1083 }
1084
1085 GType
vala_local_variable_get_type(void)1086 vala_local_variable_get_type (void)
1087 {
1088 static volatile gsize vala_local_variable_type_id__volatile = 0;
1089 if (g_once_init_enter (&vala_local_variable_type_id__volatile)) {
1090 GType vala_local_variable_type_id;
1091 vala_local_variable_type_id = vala_local_variable_get_type_once ();
1092 g_once_init_leave (&vala_local_variable_type_id__volatile, vala_local_variable_type_id);
1093 }
1094 return vala_local_variable_type_id__volatile;
1095 }
1096
1097