1 /* valapropertyaccessor.c generated by valac, the Vala compiler
2 * generated from valapropertyaccessor.vala, do not modify */
3
4 /* valapropertyaccessor.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 #include <valagee.h>
31 #include <glib-object.h>
32
33 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
34 #define _g_free0(var) (var = (g_free (var), NULL))
35 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
36
37 struct _ValaPropertyAccessorPrivate {
38 gboolean _readable;
39 gboolean _writable;
40 gboolean _construction;
41 gboolean _automatic_body;
42 ValaParameter* _value_parameter;
43 ValaDataType* _value_type;
44 };
45
46 static gint ValaPropertyAccessor_private_offset;
47 static gpointer vala_property_accessor_parent_class = NULL;
48
49 static void vala_property_accessor_set_value_type (ValaPropertyAccessor* self,
50 ValaDataType* value);
51 static void vala_property_accessor_set_readable (ValaPropertyAccessor* self,
52 gboolean value);
53 static void vala_property_accessor_set_writable (ValaPropertyAccessor* self,
54 gboolean value);
55 static void vala_property_accessor_set_construction (ValaPropertyAccessor* self,
56 gboolean value);
57 static void vala_property_accessor_set_automatic_body (ValaPropertyAccessor* self,
58 gboolean value);
59 static void vala_property_accessor_set_value_parameter (ValaPropertyAccessor* self,
60 ValaParameter* value);
61 static void vala_property_accessor_real_accept (ValaCodeNode* base,
62 ValaCodeVisitor* visitor);
63 static void vala_property_accessor_real_accept_children (ValaCodeNode* base,
64 ValaCodeVisitor* visitor);
65 static gboolean vala_property_accessor_real_check (ValaCodeNode* base,
66 ValaCodeContext* context);
67 static void vala_property_accessor_real_replace_type (ValaCodeNode* base,
68 ValaDataType* old_type,
69 ValaDataType* new_type);
70 static void vala_property_accessor_finalize (ValaCodeNode * obj);
71 static GType vala_property_accessor_get_type_once (void);
72
73 static inline gpointer
vala_property_accessor_get_instance_private(ValaPropertyAccessor * self)74 vala_property_accessor_get_instance_private (ValaPropertyAccessor* self)
75 {
76 return G_STRUCT_MEMBER_P (self, ValaPropertyAccessor_private_offset);
77 }
78
79 ValaProperty*
vala_property_accessor_get_prop(ValaPropertyAccessor * self)80 vala_property_accessor_get_prop (ValaPropertyAccessor* self)
81 {
82 ValaProperty* result;
83 ValaSymbol* _tmp0_;
84 ValaSymbol* _tmp1_;
85 g_return_val_if_fail (self != NULL, NULL);
86 _tmp0_ = vala_symbol_get_parent_symbol ((ValaSymbol*) self);
87 _tmp1_ = _tmp0_;
88 result = VALA_IS_PROPERTY (_tmp1_) ? ((ValaProperty*) _tmp1_) : NULL;
89 return result;
90 }
91
92 ValaDataType*
vala_property_accessor_get_value_type(ValaPropertyAccessor * self)93 vala_property_accessor_get_value_type (ValaPropertyAccessor* self)
94 {
95 ValaDataType* result;
96 ValaDataType* _tmp0_;
97 g_return_val_if_fail (self != NULL, NULL);
98 _tmp0_ = self->priv->_value_type;
99 result = _tmp0_;
100 return result;
101 }
102
103 static gpointer
_vala_code_node_ref0(gpointer self)104 _vala_code_node_ref0 (gpointer self)
105 {
106 return self ? vala_code_node_ref (self) : NULL;
107 }
108
109 static void
vala_property_accessor_set_value_type(ValaPropertyAccessor * self,ValaDataType * value)110 vala_property_accessor_set_value_type (ValaPropertyAccessor* self,
111 ValaDataType* value)
112 {
113 ValaDataType* _tmp0_;
114 g_return_if_fail (self != NULL);
115 _tmp0_ = _vala_code_node_ref0 (value);
116 _vala_code_node_unref0 (self->priv->_value_type);
117 self->priv->_value_type = _tmp0_;
118 if (value != NULL) {
119 ValaDataType* _tmp1_;
120 _tmp1_ = self->priv->_value_type;
121 vala_code_node_set_parent_node ((ValaCodeNode*) _tmp1_, (ValaCodeNode*) self);
122 }
123 }
124
125 gboolean
vala_property_accessor_get_readable(ValaPropertyAccessor * self)126 vala_property_accessor_get_readable (ValaPropertyAccessor* self)
127 {
128 gboolean result;
129 g_return_val_if_fail (self != NULL, FALSE);
130 result = self->priv->_readable;
131 return result;
132 }
133
134 static void
vala_property_accessor_set_readable(ValaPropertyAccessor * self,gboolean value)135 vala_property_accessor_set_readable (ValaPropertyAccessor* self,
136 gboolean value)
137 {
138 g_return_if_fail (self != NULL);
139 self->priv->_readable = value;
140 }
141
142 gboolean
vala_property_accessor_get_writable(ValaPropertyAccessor * self)143 vala_property_accessor_get_writable (ValaPropertyAccessor* self)
144 {
145 gboolean result;
146 g_return_val_if_fail (self != NULL, FALSE);
147 result = self->priv->_writable;
148 return result;
149 }
150
151 static void
vala_property_accessor_set_writable(ValaPropertyAccessor * self,gboolean value)152 vala_property_accessor_set_writable (ValaPropertyAccessor* self,
153 gboolean value)
154 {
155 g_return_if_fail (self != NULL);
156 self->priv->_writable = value;
157 }
158
159 gboolean
vala_property_accessor_get_construction(ValaPropertyAccessor * self)160 vala_property_accessor_get_construction (ValaPropertyAccessor* self)
161 {
162 gboolean result;
163 g_return_val_if_fail (self != NULL, FALSE);
164 result = self->priv->_construction;
165 return result;
166 }
167
168 static void
vala_property_accessor_set_construction(ValaPropertyAccessor * self,gboolean value)169 vala_property_accessor_set_construction (ValaPropertyAccessor* self,
170 gboolean value)
171 {
172 g_return_if_fail (self != NULL);
173 self->priv->_construction = value;
174 }
175
176 gboolean
vala_property_accessor_get_automatic_body(ValaPropertyAccessor * self)177 vala_property_accessor_get_automatic_body (ValaPropertyAccessor* self)
178 {
179 gboolean result;
180 g_return_val_if_fail (self != NULL, FALSE);
181 result = self->priv->_automatic_body;
182 return result;
183 }
184
185 static void
vala_property_accessor_set_automatic_body(ValaPropertyAccessor * self,gboolean value)186 vala_property_accessor_set_automatic_body (ValaPropertyAccessor* self,
187 gboolean value)
188 {
189 g_return_if_fail (self != NULL);
190 self->priv->_automatic_body = value;
191 }
192
193 static gboolean
vala_property_accessor_real_get_has_result(ValaSubroutine * base)194 vala_property_accessor_real_get_has_result (ValaSubroutine* base)
195 {
196 gboolean result;
197 ValaPropertyAccessor* self;
198 gboolean _tmp0_;
199 self = (ValaPropertyAccessor*) base;
200 _tmp0_ = self->priv->_readable;
201 result = _tmp0_;
202 return result;
203 }
204
205 ValaParameter*
vala_property_accessor_get_value_parameter(ValaPropertyAccessor * self)206 vala_property_accessor_get_value_parameter (ValaPropertyAccessor* self)
207 {
208 ValaParameter* result;
209 ValaParameter* _tmp0_;
210 g_return_val_if_fail (self != NULL, NULL);
211 _tmp0_ = self->priv->_value_parameter;
212 result = _tmp0_;
213 return result;
214 }
215
216 static void
vala_property_accessor_set_value_parameter(ValaPropertyAccessor * self,ValaParameter * value)217 vala_property_accessor_set_value_parameter (ValaPropertyAccessor* self,
218 ValaParameter* value)
219 {
220 ValaParameter* _tmp0_;
221 g_return_if_fail (self != NULL);
222 _tmp0_ = _vala_code_node_ref0 (value);
223 _vala_code_node_unref0 (self->priv->_value_parameter);
224 self->priv->_value_parameter = _tmp0_;
225 }
226
227 /**
228 * Creates a new property accessor.
229 *
230 * @param readable true if get accessor, false otherwise
231 * @param writable true if set accessor, false otherwise
232 * @param construction true if construct accessor, false otherwise
233 * @param body accessor body
234 * @param source_reference reference to source code
235 * @return newly created property accessor
236 */
237 ValaPropertyAccessor*
vala_property_accessor_construct(GType object_type,gboolean readable,gboolean writable,gboolean construction,ValaDataType * value_type,ValaBlock * body,ValaSourceReference * source_reference,ValaComment * comment)238 vala_property_accessor_construct (GType object_type,
239 gboolean readable,
240 gboolean writable,
241 gboolean construction,
242 ValaDataType* value_type,
243 ValaBlock* body,
244 ValaSourceReference* source_reference,
245 ValaComment* comment)
246 {
247 ValaPropertyAccessor* self = NULL;
248 self = (ValaPropertyAccessor*) vala_subroutine_construct (object_type, NULL, source_reference, comment);
249 vala_property_accessor_set_readable (self, readable);
250 vala_property_accessor_set_writable (self, writable);
251 vala_property_accessor_set_construction (self, construction);
252 vala_property_accessor_set_value_type (self, value_type);
253 vala_subroutine_set_body ((ValaSubroutine*) self, body);
254 vala_symbol_set_access ((ValaSymbol*) self, VALA_SYMBOL_ACCESSIBILITY_PUBLIC);
255 return self;
256 }
257
258 ValaPropertyAccessor*
vala_property_accessor_new(gboolean readable,gboolean writable,gboolean construction,ValaDataType * value_type,ValaBlock * body,ValaSourceReference * source_reference,ValaComment * comment)259 vala_property_accessor_new (gboolean readable,
260 gboolean writable,
261 gboolean construction,
262 ValaDataType* value_type,
263 ValaBlock* body,
264 ValaSourceReference* source_reference,
265 ValaComment* comment)
266 {
267 return vala_property_accessor_construct (VALA_TYPE_PROPERTY_ACCESSOR, readable, writable, construction, value_type, body, source_reference, comment);
268 }
269
270 static void
vala_property_accessor_real_accept(ValaCodeNode * base,ValaCodeVisitor * visitor)271 vala_property_accessor_real_accept (ValaCodeNode* base,
272 ValaCodeVisitor* visitor)
273 {
274 ValaPropertyAccessor * self;
275 self = (ValaPropertyAccessor*) base;
276 g_return_if_fail (visitor != NULL);
277 vala_code_visitor_visit_property_accessor (visitor, self);
278 }
279
280 static void
vala_property_accessor_real_accept_children(ValaCodeNode * base,ValaCodeVisitor * visitor)281 vala_property_accessor_real_accept_children (ValaCodeNode* base,
282 ValaCodeVisitor* visitor)
283 {
284 ValaPropertyAccessor * self;
285 ValaDataType* _tmp0_;
286 ValaDataType* _tmp1_;
287 ValaLocalVariable* _tmp2_;
288 ValaLocalVariable* _tmp3_;
289 ValaBlock* _tmp6_;
290 ValaBlock* _tmp7_;
291 self = (ValaPropertyAccessor*) base;
292 g_return_if_fail (visitor != NULL);
293 _tmp0_ = vala_property_accessor_get_value_type (self);
294 _tmp1_ = _tmp0_;
295 vala_code_node_accept ((ValaCodeNode*) _tmp1_, visitor);
296 _tmp2_ = vala_subroutine_get_result_var ((ValaSubroutine*) self);
297 _tmp3_ = _tmp2_;
298 if (_tmp3_ != NULL) {
299 ValaLocalVariable* _tmp4_;
300 ValaLocalVariable* _tmp5_;
301 _tmp4_ = vala_subroutine_get_result_var ((ValaSubroutine*) self);
302 _tmp5_ = _tmp4_;
303 vala_code_node_accept ((ValaCodeNode*) _tmp5_, visitor);
304 }
305 _tmp6_ = vala_subroutine_get_body ((ValaSubroutine*) self);
306 _tmp7_ = _tmp6_;
307 if (_tmp7_ != NULL) {
308 ValaBlock* _tmp8_;
309 ValaBlock* _tmp9_;
310 _tmp8_ = vala_subroutine_get_body ((ValaSubroutine*) self);
311 _tmp9_ = _tmp8_;
312 vala_code_node_accept ((ValaCodeNode*) _tmp9_, visitor);
313 }
314 }
315
316 /**
317 * Get the method representing this property accessor
318 * @return null if the accessor is neither readable nor writable
319 */
320 ValaMethod*
vala_property_accessor_get_method(ValaPropertyAccessor * self)321 vala_property_accessor_get_method (ValaPropertyAccessor* self)
322 {
323 ValaMethod* m = NULL;
324 gboolean _tmp0_;
325 ValaMethod* _tmp32_;
326 ValaMethod* result = NULL;
327 g_return_val_if_fail (self != NULL, NULL);
328 m = NULL;
329 _tmp0_ = self->priv->_readable;
330 if (_tmp0_) {
331 ValaProperty* _tmp1_;
332 ValaProperty* _tmp2_;
333 const gchar* _tmp3_;
334 const gchar* _tmp4_;
335 gchar* _tmp5_;
336 gchar* _tmp6_;
337 ValaDataType* _tmp7_;
338 ValaDataType* _tmp8_;
339 ValaSourceReference* _tmp9_;
340 ValaSourceReference* _tmp10_;
341 ValaComment* _tmp11_;
342 ValaComment* _tmp12_;
343 ValaMethod* _tmp13_;
344 _tmp1_ = vala_property_accessor_get_prop (self);
345 _tmp2_ = _tmp1_;
346 _tmp3_ = vala_symbol_get_name ((ValaSymbol*) _tmp2_);
347 _tmp4_ = _tmp3_;
348 _tmp5_ = g_strdup_printf ("get_%s", _tmp4_);
349 _tmp6_ = _tmp5_;
350 _tmp7_ = vala_property_accessor_get_value_type (self);
351 _tmp8_ = _tmp7_;
352 _tmp9_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
353 _tmp10_ = _tmp9_;
354 _tmp11_ = vala_symbol_get_comment ((ValaSymbol*) self);
355 _tmp12_ = _tmp11_;
356 _tmp13_ = vala_method_new (_tmp6_, _tmp8_, _tmp10_, _tmp12_);
357 _vala_code_node_unref0 (m);
358 m = _tmp13_;
359 _g_free0 (_tmp6_);
360 } else {
361 gboolean _tmp14_;
362 _tmp14_ = self->priv->_writable;
363 if (_tmp14_) {
364 ValaProperty* _tmp15_;
365 ValaProperty* _tmp16_;
366 const gchar* _tmp17_;
367 const gchar* _tmp18_;
368 gchar* _tmp19_;
369 gchar* _tmp20_;
370 ValaVoidType* _tmp21_;
371 ValaVoidType* _tmp22_;
372 ValaSourceReference* _tmp23_;
373 ValaSourceReference* _tmp24_;
374 ValaComment* _tmp25_;
375 ValaComment* _tmp26_;
376 ValaMethod* _tmp27_;
377 ValaMethod* _tmp28_;
378 ValaParameter* _tmp29_;
379 ValaParameter* _tmp30_;
380 ValaParameter* _tmp31_;
381 _tmp15_ = vala_property_accessor_get_prop (self);
382 _tmp16_ = _tmp15_;
383 _tmp17_ = vala_symbol_get_name ((ValaSymbol*) _tmp16_);
384 _tmp18_ = _tmp17_;
385 _tmp19_ = g_strdup_printf ("set_%s", _tmp18_);
386 _tmp20_ = _tmp19_;
387 _tmp21_ = vala_void_type_new (NULL);
388 _tmp22_ = _tmp21_;
389 _tmp23_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
390 _tmp24_ = _tmp23_;
391 _tmp25_ = vala_symbol_get_comment ((ValaSymbol*) self);
392 _tmp26_ = _tmp25_;
393 _tmp27_ = vala_method_new (_tmp20_, (ValaDataType*) _tmp22_, _tmp24_, _tmp26_);
394 _vala_code_node_unref0 (m);
395 m = _tmp27_;
396 _vala_code_node_unref0 (_tmp22_);
397 _g_free0 (_tmp20_);
398 _tmp28_ = m;
399 _tmp29_ = self->priv->_value_parameter;
400 _tmp30_ = vala_parameter_copy (_tmp29_);
401 _tmp31_ = _tmp30_;
402 vala_callable_add_parameter ((ValaCallable*) _tmp28_, _tmp31_);
403 _vala_code_node_unref0 (_tmp31_);
404 }
405 }
406 _tmp32_ = m;
407 if (_tmp32_ != NULL) {
408 ValaMethod* _tmp33_;
409 ValaProperty* _tmp34_;
410 ValaProperty* _tmp35_;
411 ValaScope* _tmp36_;
412 ValaScope* _tmp37_;
413 ValaMethod* _tmp38_;
414 ValaSymbolAccessibility _tmp39_;
415 ValaSymbolAccessibility _tmp40_;
416 ValaMethod* _tmp41_;
417 ValaProperty* _tmp42_;
418 ValaProperty* _tmp43_;
419 ValaMemberBinding _tmp44_;
420 ValaMemberBinding _tmp45_;
421 ValaMethod* _tmp46_;
422 ValaProperty* _tmp47_;
423 ValaProperty* _tmp48_;
424 gboolean _tmp49_;
425 gboolean _tmp50_;
426 ValaMethod* _tmp51_;
427 ValaProperty* _tmp52_;
428 ValaProperty* _tmp53_;
429 gboolean _tmp54_;
430 gboolean _tmp55_;
431 ValaMethod* _tmp56_;
432 ValaProperty* _tmp57_;
433 ValaProperty* _tmp58_;
434 ValaParameter* _tmp59_;
435 ValaParameter* _tmp60_;
436 ValaMethod* _tmp61_;
437 ValaProperty* _tmp62_;
438 ValaProperty* _tmp63_;
439 _tmp33_ = m;
440 _tmp34_ = vala_property_accessor_get_prop (self);
441 _tmp35_ = _tmp34_;
442 _tmp36_ = vala_symbol_get_owner ((ValaSymbol*) _tmp35_);
443 _tmp37_ = _tmp36_;
444 vala_symbol_set_owner ((ValaSymbol*) _tmp33_, _tmp37_);
445 _tmp38_ = m;
446 _tmp39_ = vala_symbol_get_access ((ValaSymbol*) self);
447 _tmp40_ = _tmp39_;
448 vala_symbol_set_access ((ValaSymbol*) _tmp38_, _tmp40_);
449 _tmp41_ = m;
450 _tmp42_ = vala_property_accessor_get_prop (self);
451 _tmp43_ = _tmp42_;
452 _tmp44_ = vala_property_get_binding (_tmp43_);
453 _tmp45_ = _tmp44_;
454 vala_method_set_binding (_tmp41_, _tmp45_);
455 _tmp46_ = m;
456 _tmp47_ = vala_property_accessor_get_prop (self);
457 _tmp48_ = _tmp47_;
458 _tmp49_ = vala_property_get_is_abstract (_tmp48_);
459 _tmp50_ = _tmp49_;
460 vala_method_set_is_abstract (_tmp46_, _tmp50_);
461 _tmp51_ = m;
462 _tmp52_ = vala_property_accessor_get_prop (self);
463 _tmp53_ = _tmp52_;
464 _tmp54_ = vala_property_get_is_virtual (_tmp53_);
465 _tmp55_ = _tmp54_;
466 vala_method_set_is_virtual (_tmp51_, _tmp55_);
467 _tmp56_ = m;
468 _tmp57_ = vala_property_accessor_get_prop (self);
469 _tmp58_ = _tmp57_;
470 _tmp59_ = vala_property_get_this_parameter (_tmp58_);
471 _tmp60_ = _tmp59_;
472 vala_method_set_this_parameter (_tmp56_, _tmp60_);
473 _tmp61_ = m;
474 _tmp62_ = vala_property_accessor_get_prop (self);
475 _tmp63_ = _tmp62_;
476 vala_code_node_copy_attribute_bool ((ValaCodeNode*) _tmp61_, (ValaCodeNode*) _tmp63_, "GIR", "visible");
477 }
478 result = m;
479 return result;
480 }
481
482 static gpointer
_vala_iterable_ref0(gpointer self)483 _vala_iterable_ref0 (gpointer self)
484 {
485 return self ? vala_iterable_ref (self) : NULL;
486 }
487
488 static gboolean
vala_property_accessor_real_check(ValaCodeNode * base,ValaCodeContext * context)489 vala_property_accessor_real_check (ValaCodeNode* base,
490 ValaCodeContext* context)
491 {
492 ValaPropertyAccessor * self;
493 gboolean _tmp0_;
494 gboolean _tmp1_;
495 ValaDataType* _tmp4_;
496 ValaDataType* _tmp5_;
497 ValaSymbol* old_symbol = NULL;
498 ValaSemanticAnalyzer* _tmp6_;
499 ValaSemanticAnalyzer* _tmp7_;
500 ValaSymbol* _tmp8_;
501 ValaSymbol* _tmp9_;
502 ValaSymbol* _tmp10_;
503 ValaSemanticAnalyzer* _tmp11_;
504 ValaSemanticAnalyzer* _tmp12_;
505 gboolean _tmp13_ = FALSE;
506 gboolean _tmp14_;
507 gboolean _tmp31_ = FALSE;
508 gboolean _tmp32_ = FALSE;
509 ValaProfile _tmp33_;
510 ValaProfile _tmp34_;
511 ValaProperty* _tmp101_;
512 ValaProperty* _tmp102_;
513 ValaSourceFileType _tmp103_;
514 ValaSourceFileType _tmp104_;
515 gboolean _tmp160_ = FALSE;
516 gboolean _tmp161_ = FALSE;
517 gboolean _tmp162_ = FALSE;
518 ValaProperty* _tmp163_;
519 ValaProperty* _tmp164_;
520 gboolean _tmp165_;
521 gboolean _tmp166_;
522 gboolean _tmp185_ = FALSE;
523 ValaProfile _tmp186_;
524 ValaProfile _tmp187_;
525 gboolean _tmp214_ = FALSE;
526 ValaBlock* _tmp215_;
527 ValaBlock* _tmp216_;
528 ValaBlock* _tmp229_;
529 ValaBlock* _tmp230_;
530 gboolean _tmp244_ = FALSE;
531 ValaBlock* _tmp245_;
532 ValaBlock* _tmp246_;
533 ValaSemanticAnalyzer* _tmp276_;
534 ValaSemanticAnalyzer* _tmp277_;
535 ValaSymbol* _tmp278_;
536 gboolean _tmp279_;
537 gboolean _tmp280_;
538 gboolean result = FALSE;
539 self = (ValaPropertyAccessor*) base;
540 g_return_val_if_fail (context != NULL, FALSE);
541 _tmp0_ = vala_code_node_get_checked ((ValaCodeNode*) self);
542 _tmp1_ = _tmp0_;
543 if (_tmp1_) {
544 gboolean _tmp2_;
545 gboolean _tmp3_;
546 _tmp2_ = vala_code_node_get_error ((ValaCodeNode*) self);
547 _tmp3_ = _tmp2_;
548 result = !_tmp3_;
549 return result;
550 }
551 vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
552 _tmp4_ = vala_property_accessor_get_value_type (self);
553 _tmp5_ = _tmp4_;
554 if (!vala_code_node_check ((ValaCodeNode*) _tmp5_, context)) {
555 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
556 result = FALSE;
557 return result;
558 }
559 _tmp6_ = vala_code_context_get_analyzer (context);
560 _tmp7_ = _tmp6_;
561 _tmp8_ = vala_semantic_analyzer_get_current_symbol (_tmp7_);
562 _tmp9_ = _tmp8_;
563 _tmp10_ = _vala_code_node_ref0 (_tmp9_);
564 old_symbol = _tmp10_;
565 _tmp11_ = vala_code_context_get_analyzer (context);
566 _tmp12_ = _tmp11_;
567 vala_semantic_analyzer_set_current_symbol (_tmp12_, (ValaSymbol*) self);
568 _tmp14_ = self->priv->_writable;
569 if (_tmp14_) {
570 _tmp13_ = TRUE;
571 } else {
572 gboolean _tmp15_;
573 _tmp15_ = self->priv->_construction;
574 _tmp13_ = _tmp15_;
575 }
576 if (_tmp13_) {
577 ValaDataType* _tmp16_;
578 ValaDataType* _tmp17_;
579 ValaSourceReference* _tmp18_;
580 ValaSourceReference* _tmp19_;
581 ValaParameter* _tmp20_;
582 ValaParameter* _tmp21_;
583 ValaParameter* _tmp22_;
584 ValaProperty* _tmp23_;
585 ValaProperty* _tmp24_;
586 ValaParameter* _tmp25_;
587 ValaProperty* _tmp26_;
588 ValaProperty* _tmp27_;
589 ValaParameter* _tmp28_;
590 ValaProperty* _tmp29_;
591 ValaProperty* _tmp30_;
592 _tmp16_ = vala_property_accessor_get_value_type (self);
593 _tmp17_ = _tmp16_;
594 _tmp18_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
595 _tmp19_ = _tmp18_;
596 _tmp20_ = vala_parameter_new ("value", _tmp17_, _tmp19_);
597 _tmp21_ = _tmp20_;
598 vala_property_accessor_set_value_parameter (self, _tmp21_);
599 _vala_code_node_unref0 (_tmp21_);
600 _tmp22_ = self->priv->_value_parameter;
601 _tmp23_ = vala_property_accessor_get_prop (self);
602 _tmp24_ = _tmp23_;
603 vala_code_node_copy_attribute_bool ((ValaCodeNode*) _tmp22_, (ValaCodeNode*) _tmp24_, "CCode", "array_length");
604 _tmp25_ = self->priv->_value_parameter;
605 _tmp26_ = vala_property_accessor_get_prop (self);
606 _tmp27_ = _tmp26_;
607 vala_code_node_copy_attribute_bool ((ValaCodeNode*) _tmp25_, (ValaCodeNode*) _tmp27_, "CCode", "array_null_terminated");
608 _tmp28_ = self->priv->_value_parameter;
609 _tmp29_ = vala_property_accessor_get_prop (self);
610 _tmp30_ = _tmp29_;
611 vala_code_node_copy_attribute_bool ((ValaCodeNode*) _tmp28_, (ValaCodeNode*) _tmp30_, "CCode", "delegate_target");
612 }
613 _tmp33_ = vala_code_context_get_profile (context);
614 _tmp34_ = _tmp33_;
615 if (_tmp34_ == VALA_PROFILE_GOBJECT) {
616 gboolean _tmp35_;
617 _tmp35_ = self->priv->_readable;
618 _tmp32_ = _tmp35_;
619 } else {
620 _tmp32_ = FALSE;
621 }
622 if (_tmp32_) {
623 ValaProperty* _tmp36_;
624 ValaProperty* _tmp37_;
625 ValaSymbol* _tmp38_;
626 ValaSymbol* _tmp39_;
627 ValaSemanticAnalyzer* _tmp40_;
628 ValaSemanticAnalyzer* _tmp41_;
629 ValaClass* _tmp42_;
630 _tmp36_ = vala_property_accessor_get_prop (self);
631 _tmp37_ = _tmp36_;
632 _tmp38_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp37_);
633 _tmp39_ = _tmp38_;
634 _tmp40_ = vala_code_context_get_analyzer (context);
635 _tmp41_ = _tmp40_;
636 _tmp42_ = _tmp41_->object_type;
637 _tmp31_ = vala_typesymbol_is_subtype_of (G_TYPE_CHECK_INSTANCE_CAST (_tmp39_, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol), (ValaTypeSymbol*) _tmp42_);
638 } else {
639 _tmp31_ = FALSE;
640 }
641 if (_tmp31_) {
642 ValaProperty* _tmp43_;
643 ValaProperty* _tmp44_;
644 ValaAttribute* _tmp45_;
645 _tmp43_ = vala_property_accessor_get_prop (self);
646 _tmp44_ = _tmp43_;
647 _tmp45_ = vala_code_node_get_attribute ((ValaCodeNode*) _tmp44_, "NoAccessorMethod");
648 if (_tmp45_ != NULL) {
649 ValaDataType* _tmp46_;
650 ValaDataType* _tmp47_;
651 _tmp46_ = vala_property_accessor_get_value_type (self);
652 _tmp47_ = _tmp46_;
653 if (vala_data_type_is_real_struct_type (_tmp47_)) {
654 gboolean _tmp48_ = FALSE;
655 ValaSourceReference* _tmp49_;
656 ValaSourceReference* _tmp50_;
657 _tmp49_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
658 _tmp50_ = _tmp49_;
659 if (_tmp50_ == NULL) {
660 _tmp48_ = TRUE;
661 } else {
662 ValaSourceReference* _tmp51_;
663 ValaSourceReference* _tmp52_;
664 ValaSourceFile* _tmp53_;
665 ValaSourceFile* _tmp54_;
666 _tmp51_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
667 _tmp52_ = _tmp51_;
668 _tmp53_ = vala_source_reference_get_file (_tmp52_);
669 _tmp54_ = _tmp53_;
670 _tmp48_ = _tmp54_ == NULL;
671 }
672 if (_tmp48_) {
673 } else {
674 gboolean _tmp55_ = FALSE;
675 ValaDataType* _tmp56_;
676 ValaDataType* _tmp57_;
677 gboolean _tmp58_;
678 gboolean _tmp59_;
679 _tmp56_ = vala_property_accessor_get_value_type (self);
680 _tmp57_ = _tmp56_;
681 _tmp58_ = vala_data_type_get_value_owned (_tmp57_);
682 _tmp59_ = _tmp58_;
683 if (!_tmp59_) {
684 ValaSourceReference* _tmp60_;
685 ValaSourceReference* _tmp61_;
686 ValaSourceFile* _tmp62_;
687 ValaSourceFile* _tmp63_;
688 ValaSourceFileType _tmp64_;
689 ValaSourceFileType _tmp65_;
690 _tmp60_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
691 _tmp61_ = _tmp60_;
692 _tmp62_ = vala_source_reference_get_file (_tmp61_);
693 _tmp63_ = _tmp62_;
694 _tmp64_ = vala_source_file_get_file_type (_tmp63_);
695 _tmp65_ = _tmp64_;
696 _tmp55_ = _tmp65_ == VALA_SOURCE_FILE_TYPE_SOURCE;
697 } else {
698 _tmp55_ = FALSE;
699 }
700 if (_tmp55_) {
701 ValaSourceReference* _tmp66_;
702 ValaSourceReference* _tmp67_;
703 ValaProperty* _tmp68_;
704 ValaProperty* _tmp69_;
705 gchar* _tmp70_;
706 gchar* _tmp71_;
707 gchar* _tmp72_;
708 gchar* _tmp73_;
709 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
710 _tmp66_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
711 _tmp67_ = _tmp66_;
712 _tmp68_ = vala_property_accessor_get_prop (self);
713 _tmp69_ = _tmp68_;
714 _tmp70_ = vala_symbol_get_full_name ((ValaSymbol*) _tmp69_);
715 _tmp71_ = _tmp70_;
716 _tmp72_ = g_strdup_printf ("unowned return value for getter of property `%s' not supported without" \
717 " accessor", _tmp71_);
718 _tmp73_ = _tmp72_;
719 vala_report_error (_tmp67_, _tmp73_);
720 _g_free0 (_tmp73_);
721 _g_free0 (_tmp71_);
722 }
723 }
724 } else {
725 gboolean _tmp74_ = FALSE;
726 ValaDataType* _tmp75_;
727 ValaDataType* _tmp76_;
728 gboolean _tmp77_;
729 gboolean _tmp78_;
730 _tmp75_ = vala_property_accessor_get_value_type (self);
731 _tmp76_ = _tmp75_;
732 _tmp77_ = vala_data_type_get_value_owned (_tmp76_);
733 _tmp78_ = _tmp77_;
734 if (_tmp78_) {
735 gboolean _tmp79_ = FALSE;
736 ValaSourceReference* _tmp80_;
737 ValaSourceReference* _tmp81_;
738 _tmp80_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
739 _tmp81_ = _tmp80_;
740 if (_tmp81_ == NULL) {
741 _tmp79_ = TRUE;
742 } else {
743 ValaSourceReference* _tmp82_;
744 ValaSourceReference* _tmp83_;
745 ValaSourceFile* _tmp84_;
746 ValaSourceFile* _tmp85_;
747 _tmp82_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
748 _tmp83_ = _tmp82_;
749 _tmp84_ = vala_source_reference_get_file (_tmp83_);
750 _tmp85_ = _tmp84_;
751 _tmp79_ = _tmp85_ == NULL;
752 }
753 _tmp74_ = _tmp79_;
754 } else {
755 _tmp74_ = FALSE;
756 }
757 if (_tmp74_) {
758 gboolean _tmp86_ = FALSE;
759 gboolean _tmp87_ = FALSE;
760 ValaDataType* _tmp88_;
761 ValaDataType* _tmp89_;
762 _tmp88_ = vala_property_accessor_get_value_type (self);
763 _tmp89_ = _tmp88_;
764 if (VALA_IS_DELEGATE_TYPE (_tmp89_)) {
765 _tmp87_ = TRUE;
766 } else {
767 ValaDataType* _tmp90_;
768 ValaDataType* _tmp91_;
769 _tmp90_ = vala_property_accessor_get_value_type (self);
770 _tmp91_ = _tmp90_;
771 _tmp87_ = VALA_IS_POINTER_TYPE (_tmp91_);
772 }
773 if (_tmp87_) {
774 _tmp86_ = TRUE;
775 } else {
776 gboolean _tmp92_ = FALSE;
777 ValaDataType* _tmp93_;
778 ValaDataType* _tmp94_;
779 _tmp93_ = vala_property_accessor_get_value_type (self);
780 _tmp94_ = _tmp93_;
781 if (VALA_IS_VALUE_TYPE (_tmp94_)) {
782 ValaDataType* _tmp95_;
783 ValaDataType* _tmp96_;
784 gboolean _tmp97_;
785 gboolean _tmp98_;
786 _tmp95_ = vala_property_accessor_get_value_type (self);
787 _tmp96_ = _tmp95_;
788 _tmp97_ = vala_data_type_get_nullable (_tmp96_);
789 _tmp98_ = _tmp97_;
790 _tmp92_ = !_tmp98_;
791 } else {
792 _tmp92_ = FALSE;
793 }
794 _tmp86_ = _tmp92_;
795 }
796 if (_tmp86_) {
797 ValaDataType* _tmp99_;
798 ValaDataType* _tmp100_;
799 _tmp99_ = vala_property_accessor_get_value_type (self);
800 _tmp100_ = _tmp99_;
801 vala_data_type_set_value_owned (_tmp100_, FALSE);
802 }
803 }
804 }
805 }
806 }
807 _tmp101_ = vala_property_accessor_get_prop (self);
808 _tmp102_ = _tmp101_;
809 _tmp103_ = vala_symbol_get_source_type ((ValaSymbol*) _tmp102_);
810 _tmp104_ = _tmp103_;
811 if (_tmp104_ == VALA_SOURCE_FILE_TYPE_SOURCE) {
812 gboolean _tmp105_ = FALSE;
813 gboolean _tmp106_ = FALSE;
814 ValaBlock* _tmp107_;
815 ValaBlock* _tmp108_;
816 _tmp107_ = vala_subroutine_get_body ((ValaSubroutine*) self);
817 _tmp108_ = _tmp107_;
818 if (_tmp108_ == NULL) {
819 ValaProperty* _tmp109_;
820 ValaProperty* _tmp110_;
821 gboolean _tmp111_;
822 gboolean _tmp112_;
823 _tmp109_ = vala_property_accessor_get_prop (self);
824 _tmp110_ = _tmp109_;
825 _tmp111_ = vala_property_get_interface_only (_tmp110_);
826 _tmp112_ = _tmp111_;
827 _tmp106_ = !_tmp112_;
828 } else {
829 _tmp106_ = FALSE;
830 }
831 if (_tmp106_) {
832 ValaProperty* _tmp113_;
833 ValaProperty* _tmp114_;
834 gboolean _tmp115_;
835 gboolean _tmp116_;
836 _tmp113_ = vala_property_accessor_get_prop (self);
837 _tmp114_ = _tmp113_;
838 _tmp115_ = vala_property_get_is_abstract (_tmp114_);
839 _tmp116_ = _tmp115_;
840 _tmp105_ = !_tmp116_;
841 } else {
842 _tmp105_ = FALSE;
843 }
844 if (_tmp105_) {
845 ValaSourceReference* _tmp117_;
846 ValaSourceReference* _tmp118_;
847 ValaBlock* _tmp119_;
848 ValaBlock* _tmp120_;
849 ValaMemberAccess* ma = NULL;
850 ValaProperty* _tmp121_;
851 ValaProperty* _tmp122_;
852 const gchar* _tmp123_;
853 const gchar* _tmp124_;
854 gchar* _tmp125_;
855 gchar* _tmp126_;
856 ValaSourceReference* _tmp127_;
857 ValaSourceReference* _tmp128_;
858 ValaMemberAccess* _tmp129_;
859 ValaMemberAccess* _tmp130_;
860 gboolean _tmp131_;
861 vala_property_accessor_set_automatic_body (self, TRUE);
862 _tmp117_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
863 _tmp118_ = _tmp117_;
864 _tmp119_ = vala_block_new (_tmp118_);
865 _tmp120_ = _tmp119_;
866 vala_subroutine_set_body ((ValaSubroutine*) self, _tmp120_);
867 _vala_code_node_unref0 (_tmp120_);
868 _tmp121_ = vala_property_accessor_get_prop (self);
869 _tmp122_ = _tmp121_;
870 _tmp123_ = vala_symbol_get_name ((ValaSymbol*) _tmp122_);
871 _tmp124_ = _tmp123_;
872 _tmp125_ = g_strdup_printf ("_%s", _tmp124_);
873 _tmp126_ = _tmp125_;
874 _tmp127_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
875 _tmp128_ = _tmp127_;
876 _tmp129_ = vala_member_access_new_simple (_tmp126_, _tmp128_);
877 _tmp130_ = _tmp129_;
878 _g_free0 (_tmp126_);
879 ma = _tmp130_;
880 _tmp131_ = self->priv->_readable;
881 if (_tmp131_) {
882 ValaBlock* _tmp132_;
883 ValaBlock* _tmp133_;
884 ValaMemberAccess* _tmp134_;
885 ValaSourceReference* _tmp135_;
886 ValaSourceReference* _tmp136_;
887 ValaReturnStatement* _tmp137_;
888 ValaReturnStatement* _tmp138_;
889 _tmp132_ = vala_subroutine_get_body ((ValaSubroutine*) self);
890 _tmp133_ = _tmp132_;
891 _tmp134_ = ma;
892 _tmp135_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
893 _tmp136_ = _tmp135_;
894 _tmp137_ = vala_return_statement_new ((ValaExpression*) _tmp134_, _tmp136_);
895 _tmp138_ = _tmp137_;
896 vala_block_add_statement (_tmp133_, (ValaStatement*) _tmp138_);
897 _vala_code_node_unref0 (_tmp138_);
898 } else {
899 ValaExpression* value = NULL;
900 ValaSourceReference* _tmp139_;
901 ValaSourceReference* _tmp140_;
902 ValaMemberAccess* _tmp141_;
903 ValaDataType* _tmp142_;
904 ValaDataType* _tmp143_;
905 gboolean _tmp144_;
906 gboolean _tmp145_;
907 ValaAssignment* assignment = NULL;
908 ValaMemberAccess* _tmp150_;
909 ValaExpression* _tmp151_;
910 ValaSourceReference* _tmp152_;
911 ValaSourceReference* _tmp153_;
912 ValaAssignment* _tmp154_;
913 ValaBlock* _tmp155_;
914 ValaBlock* _tmp156_;
915 ValaAssignment* _tmp157_;
916 ValaExpressionStatement* _tmp158_;
917 ValaExpressionStatement* _tmp159_;
918 _tmp139_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
919 _tmp140_ = _tmp139_;
920 _tmp141_ = vala_member_access_new_simple ("value", _tmp140_);
921 value = (ValaExpression*) _tmp141_;
922 _tmp142_ = vala_property_accessor_get_value_type (self);
923 _tmp143_ = _tmp142_;
924 _tmp144_ = vala_data_type_get_value_owned (_tmp143_);
925 _tmp145_ = _tmp144_;
926 if (_tmp145_) {
927 ValaExpression* _tmp146_;
928 ValaSourceReference* _tmp147_;
929 ValaSourceReference* _tmp148_;
930 ValaReferenceTransferExpression* _tmp149_;
931 _tmp146_ = value;
932 _tmp147_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
933 _tmp148_ = _tmp147_;
934 _tmp149_ = vala_reference_transfer_expression_new (_tmp146_, _tmp148_);
935 _vala_code_node_unref0 (value);
936 value = (ValaExpression*) _tmp149_;
937 }
938 _tmp150_ = ma;
939 _tmp151_ = value;
940 _tmp152_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
941 _tmp153_ = _tmp152_;
942 _tmp154_ = vala_assignment_new ((ValaExpression*) _tmp150_, _tmp151_, VALA_ASSIGNMENT_OPERATOR_SIMPLE, _tmp153_);
943 assignment = _tmp154_;
944 _tmp155_ = vala_subroutine_get_body ((ValaSubroutine*) self);
945 _tmp156_ = _tmp155_;
946 _tmp157_ = assignment;
947 _tmp158_ = vala_expression_statement_new ((ValaExpression*) _tmp157_, NULL);
948 _tmp159_ = _tmp158_;
949 vala_block_add_statement (_tmp156_, (ValaStatement*) _tmp159_);
950 _vala_code_node_unref0 (_tmp159_);
951 _vala_code_node_unref0 (assignment);
952 _vala_code_node_unref0 (value);
953 }
954 _vala_code_node_unref0 (ma);
955 }
956 }
957 _tmp163_ = vala_property_accessor_get_prop (self);
958 _tmp164_ = _tmp163_;
959 _tmp165_ = vala_property_get_is_abstract (_tmp164_);
960 _tmp166_ = _tmp165_;
961 if (_tmp166_) {
962 _tmp162_ = TRUE;
963 } else {
964 ValaProperty* _tmp167_;
965 ValaProperty* _tmp168_;
966 gboolean _tmp169_;
967 gboolean _tmp170_;
968 _tmp167_ = vala_property_accessor_get_prop (self);
969 _tmp168_ = _tmp167_;
970 _tmp169_ = vala_property_get_is_virtual (_tmp168_);
971 _tmp170_ = _tmp169_;
972 _tmp162_ = _tmp170_;
973 }
974 if (_tmp162_) {
975 _tmp161_ = TRUE;
976 } else {
977 ValaProperty* _tmp171_;
978 ValaProperty* _tmp172_;
979 gboolean _tmp173_;
980 gboolean _tmp174_;
981 _tmp171_ = vala_property_accessor_get_prop (self);
982 _tmp172_ = _tmp171_;
983 _tmp173_ = vala_property_get_overrides (_tmp172_);
984 _tmp174_ = _tmp173_;
985 _tmp161_ = _tmp174_;
986 }
987 if (_tmp161_) {
988 ValaSymbolAccessibility _tmp175_;
989 ValaSymbolAccessibility _tmp176_;
990 _tmp175_ = vala_symbol_get_access ((ValaSymbol*) self);
991 _tmp176_ = _tmp175_;
992 _tmp160_ = _tmp176_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE;
993 } else {
994 _tmp160_ = FALSE;
995 }
996 if (_tmp160_) {
997 ValaSourceReference* _tmp177_;
998 ValaSourceReference* _tmp178_;
999 ValaProperty* _tmp179_;
1000 ValaProperty* _tmp180_;
1001 gchar* _tmp181_;
1002 gchar* _tmp182_;
1003 gchar* _tmp183_;
1004 gchar* _tmp184_;
1005 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1006 _tmp177_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1007 _tmp178_ = _tmp177_;
1008 _tmp179_ = vala_property_accessor_get_prop (self);
1009 _tmp180_ = _tmp179_;
1010 _tmp181_ = vala_symbol_get_full_name ((ValaSymbol*) _tmp180_);
1011 _tmp182_ = _tmp181_;
1012 _tmp183_ = g_strdup_printf ("Property `%s' with private accessor cannot be marked as abstract, virt" \
1013 "ual or override", _tmp182_);
1014 _tmp184_ = _tmp183_;
1015 vala_report_error (_tmp178_, _tmp184_);
1016 _g_free0 (_tmp184_);
1017 _g_free0 (_tmp182_);
1018 result = FALSE;
1019 _vala_code_node_unref0 (old_symbol);
1020 return result;
1021 }
1022 _tmp186_ = vala_code_context_get_profile (context);
1023 _tmp187_ = _tmp186_;
1024 if (_tmp187_ == VALA_PROFILE_POSIX) {
1025 gboolean _tmp188_;
1026 _tmp188_ = self->priv->_construction;
1027 _tmp185_ = _tmp188_;
1028 } else {
1029 _tmp185_ = FALSE;
1030 }
1031 if (_tmp185_) {
1032 ValaSourceReference* _tmp189_;
1033 ValaSourceReference* _tmp190_;
1034 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1035 _tmp189_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1036 _tmp190_ = _tmp189_;
1037 vala_report_error (_tmp190_, "`construct' is not supported in POSIX profile");
1038 result = FALSE;
1039 _vala_code_node_unref0 (old_symbol);
1040 return result;
1041 } else {
1042 gboolean _tmp191_ = FALSE;
1043 gboolean _tmp192_;
1044 _tmp192_ = self->priv->_construction;
1045 if (_tmp192_) {
1046 ValaProperty* _tmp193_;
1047 ValaProperty* _tmp194_;
1048 ValaSymbol* _tmp195_;
1049 ValaSymbol* _tmp196_;
1050 ValaSemanticAnalyzer* _tmp197_;
1051 ValaSemanticAnalyzer* _tmp198_;
1052 ValaClass* _tmp199_;
1053 _tmp193_ = vala_property_accessor_get_prop (self);
1054 _tmp194_ = _tmp193_;
1055 _tmp195_ = vala_symbol_get_parent_symbol ((ValaSymbol*) _tmp194_);
1056 _tmp196_ = _tmp195_;
1057 _tmp197_ = vala_code_context_get_analyzer (context);
1058 _tmp198_ = _tmp197_;
1059 _tmp199_ = _tmp198_->object_type;
1060 _tmp191_ = !vala_typesymbol_is_subtype_of (G_TYPE_CHECK_INSTANCE_CAST (_tmp196_, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol), (ValaTypeSymbol*) _tmp199_);
1061 } else {
1062 _tmp191_ = FALSE;
1063 }
1064 if (_tmp191_) {
1065 ValaSourceReference* _tmp200_;
1066 ValaSourceReference* _tmp201_;
1067 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1068 _tmp200_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1069 _tmp201_ = _tmp200_;
1070 vala_report_error (_tmp201_, "construct properties require `GLib.Object'");
1071 result = FALSE;
1072 _vala_code_node_unref0 (old_symbol);
1073 return result;
1074 } else {
1075 gboolean _tmp202_ = FALSE;
1076 gboolean _tmp203_;
1077 _tmp203_ = self->priv->_construction;
1078 if (_tmp203_) {
1079 ValaSemanticAnalyzer* _tmp204_;
1080 ValaSemanticAnalyzer* _tmp205_;
1081 ValaProperty* _tmp206_;
1082 ValaProperty* _tmp207_;
1083 _tmp204_ = vala_code_context_get_analyzer (context);
1084 _tmp205_ = _tmp204_;
1085 _tmp206_ = vala_property_accessor_get_prop (self);
1086 _tmp207_ = _tmp206_;
1087 _tmp202_ = !vala_semantic_analyzer_is_gobject_property (_tmp205_, _tmp207_);
1088 } else {
1089 _tmp202_ = FALSE;
1090 }
1091 if (_tmp202_) {
1092 gboolean _tmp208_;
1093 gboolean _tmp209_;
1094 _tmp208_ = vala_symbol_get_external_package ((ValaSymbol*) self);
1095 _tmp209_ = _tmp208_;
1096 if (_tmp209_) {
1097 ValaSourceReference* _tmp210_;
1098 ValaSourceReference* _tmp211_;
1099 _tmp210_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1100 _tmp211_ = _tmp210_;
1101 vala_report_warning (_tmp211_, "construct properties not supported for specified property type");
1102 } else {
1103 ValaSourceReference* _tmp212_;
1104 ValaSourceReference* _tmp213_;
1105 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1106 _tmp212_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1107 _tmp213_ = _tmp212_;
1108 vala_report_error (_tmp213_, "construct properties not supported for specified property type");
1109 result = FALSE;
1110 _vala_code_node_unref0 (old_symbol);
1111 return result;
1112 }
1113 }
1114 }
1115 }
1116 _tmp215_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1117 _tmp216_ = _tmp215_;
1118 if (_tmp216_ != NULL) {
1119 ValaProperty* _tmp217_;
1120 ValaProperty* _tmp218_;
1121 gboolean _tmp219_;
1122 gboolean _tmp220_;
1123 _tmp217_ = vala_property_accessor_get_prop (self);
1124 _tmp218_ = _tmp217_;
1125 _tmp219_ = vala_property_get_is_abstract (_tmp218_);
1126 _tmp220_ = _tmp219_;
1127 _tmp214_ = _tmp220_;
1128 } else {
1129 _tmp214_ = FALSE;
1130 }
1131 if (_tmp214_) {
1132 ValaSourceReference* _tmp221_;
1133 ValaSourceReference* _tmp222_;
1134 ValaProperty* _tmp223_;
1135 ValaProperty* _tmp224_;
1136 gchar* _tmp225_;
1137 gchar* _tmp226_;
1138 gchar* _tmp227_;
1139 gchar* _tmp228_;
1140 vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1141 _tmp221_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
1142 _tmp222_ = _tmp221_;
1143 _tmp223_ = vala_property_accessor_get_prop (self);
1144 _tmp224_ = _tmp223_;
1145 _tmp225_ = vala_symbol_get_full_name ((ValaSymbol*) _tmp224_);
1146 _tmp226_ = _tmp225_;
1147 _tmp227_ = g_strdup_printf ("Accessor of abstract property `%s' cannot have body", _tmp226_);
1148 _tmp228_ = _tmp227_;
1149 vala_report_error (_tmp222_, _tmp228_);
1150 _g_free0 (_tmp228_);
1151 _g_free0 (_tmp226_);
1152 result = FALSE;
1153 _vala_code_node_unref0 (old_symbol);
1154 return result;
1155 }
1156 _tmp229_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1157 _tmp230_ = _tmp229_;
1158 if (_tmp230_ != NULL) {
1159 gboolean _tmp231_ = FALSE;
1160 gboolean _tmp232_;
1161 ValaBlock* _tmp242_;
1162 ValaBlock* _tmp243_;
1163 _tmp232_ = self->priv->_writable;
1164 if (_tmp232_) {
1165 _tmp231_ = TRUE;
1166 } else {
1167 gboolean _tmp233_;
1168 _tmp233_ = self->priv->_construction;
1169 _tmp231_ = _tmp233_;
1170 }
1171 if (_tmp231_) {
1172 ValaBlock* _tmp234_;
1173 ValaBlock* _tmp235_;
1174 ValaScope* _tmp236_;
1175 ValaScope* _tmp237_;
1176 ValaParameter* _tmp238_;
1177 const gchar* _tmp239_;
1178 const gchar* _tmp240_;
1179 ValaParameter* _tmp241_;
1180 _tmp234_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1181 _tmp235_ = _tmp234_;
1182 _tmp236_ = vala_symbol_get_scope ((ValaSymbol*) _tmp235_);
1183 _tmp237_ = _tmp236_;
1184 _tmp238_ = self->priv->_value_parameter;
1185 _tmp239_ = vala_symbol_get_name ((ValaSymbol*) _tmp238_);
1186 _tmp240_ = _tmp239_;
1187 _tmp241_ = self->priv->_value_parameter;
1188 vala_scope_add (_tmp237_, _tmp240_, (ValaSymbol*) _tmp241_);
1189 }
1190 _tmp242_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1191 _tmp243_ = _tmp242_;
1192 vala_code_node_check ((ValaCodeNode*) _tmp243_, context);
1193 }
1194 _tmp245_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1195 _tmp246_ = _tmp245_;
1196 if (_tmp246_ != NULL) {
1197 ValaBlock* _tmp247_;
1198 ValaBlock* _tmp248_;
1199 gboolean _tmp249_;
1200 gboolean _tmp250_;
1201 _tmp247_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1202 _tmp248_ = _tmp247_;
1203 _tmp249_ = vala_code_node_get_error ((ValaCodeNode*) _tmp248_);
1204 _tmp250_ = _tmp249_;
1205 _tmp244_ = !_tmp250_;
1206 } else {
1207 _tmp244_ = FALSE;
1208 }
1209 if (_tmp244_) {
1210 ValaArrayList* error_types = NULL;
1211 GEqualFunc _tmp251_;
1212 ValaArrayList* _tmp252_;
1213 ValaBlock* _tmp253_;
1214 ValaBlock* _tmp254_;
1215 ValaArrayList* _tmp255_;
1216 _tmp251_ = g_direct_equal;
1217 _tmp252_ = vala_array_list_new (VALA_TYPE_DATA_TYPE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp251_);
1218 error_types = _tmp252_;
1219 _tmp253_ = vala_subroutine_get_body ((ValaSubroutine*) self);
1220 _tmp254_ = _tmp253_;
1221 _tmp255_ = error_types;
1222 vala_code_node_get_error_types ((ValaCodeNode*) _tmp254_, (ValaCollection*) _tmp255_, NULL);
1223 {
1224 ValaArrayList* _body_error_type_list = NULL;
1225 ValaArrayList* _tmp256_;
1226 ValaArrayList* _tmp257_;
1227 gint _body_error_type_size = 0;
1228 ValaArrayList* _tmp258_;
1229 gint _tmp259_;
1230 gint _tmp260_;
1231 gint _body_error_type_index = 0;
1232 _tmp256_ = error_types;
1233 _tmp257_ = _vala_iterable_ref0 (_tmp256_);
1234 _body_error_type_list = _tmp257_;
1235 _tmp258_ = _body_error_type_list;
1236 _tmp259_ = vala_collection_get_size ((ValaCollection*) _tmp258_);
1237 _tmp260_ = _tmp259_;
1238 _body_error_type_size = _tmp260_;
1239 _body_error_type_index = -1;
1240 while (TRUE) {
1241 gint _tmp261_;
1242 gint _tmp262_;
1243 ValaDataType* body_error_type = NULL;
1244 ValaArrayList* _tmp263_;
1245 gpointer _tmp264_;
1246 ValaDataType* _tmp265_;
1247 gboolean _tmp266_;
1248 gboolean _tmp267_;
1249 _body_error_type_index = _body_error_type_index + 1;
1250 _tmp261_ = _body_error_type_index;
1251 _tmp262_ = _body_error_type_size;
1252 if (!(_tmp261_ < _tmp262_)) {
1253 break;
1254 }
1255 _tmp263_ = _body_error_type_list;
1256 _tmp264_ = vala_list_get ((ValaList*) _tmp263_, _body_error_type_index);
1257 body_error_type = (ValaDataType*) _tmp264_;
1258 _tmp265_ = body_error_type;
1259 _tmp266_ = vala_error_type_get_dynamic_error (G_TYPE_CHECK_INSTANCE_CAST (_tmp265_, VALA_TYPE_ERROR_TYPE, ValaErrorType));
1260 _tmp267_ = _tmp266_;
1261 if (!_tmp267_) {
1262 ValaDataType* _tmp268_;
1263 ValaSourceReference* _tmp269_;
1264 ValaSourceReference* _tmp270_;
1265 ValaDataType* _tmp271_;
1266 gchar* _tmp272_;
1267 gchar* _tmp273_;
1268 gchar* _tmp274_;
1269 gchar* _tmp275_;
1270 _tmp268_ = body_error_type;
1271 _tmp269_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp268_);
1272 _tmp270_ = _tmp269_;
1273 _tmp271_ = body_error_type;
1274 _tmp272_ = vala_code_node_to_string ((ValaCodeNode*) _tmp271_);
1275 _tmp273_ = _tmp272_;
1276 _tmp274_ = g_strdup_printf ("unhandled error `%s'", _tmp273_);
1277 _tmp275_ = _tmp274_;
1278 vala_report_warning (_tmp270_, _tmp275_);
1279 _g_free0 (_tmp275_);
1280 _g_free0 (_tmp273_);
1281 }
1282 _vala_code_node_unref0 (body_error_type);
1283 }
1284 _vala_iterable_unref0 (_body_error_type_list);
1285 }
1286 _vala_iterable_unref0 (error_types);
1287 }
1288 _tmp276_ = vala_code_context_get_analyzer (context);
1289 _tmp277_ = _tmp276_;
1290 _tmp278_ = old_symbol;
1291 vala_semantic_analyzer_set_current_symbol (_tmp277_, _tmp278_);
1292 _tmp279_ = vala_code_node_get_error ((ValaCodeNode*) self);
1293 _tmp280_ = _tmp279_;
1294 result = !_tmp280_;
1295 _vala_code_node_unref0 (old_symbol);
1296 return result;
1297 }
1298
1299 static void
vala_property_accessor_real_replace_type(ValaCodeNode * base,ValaDataType * old_type,ValaDataType * new_type)1300 vala_property_accessor_real_replace_type (ValaCodeNode* base,
1301 ValaDataType* old_type,
1302 ValaDataType* new_type)
1303 {
1304 ValaPropertyAccessor * self;
1305 ValaDataType* _tmp0_;
1306 ValaDataType* _tmp1_;
1307 self = (ValaPropertyAccessor*) base;
1308 g_return_if_fail (old_type != NULL);
1309 g_return_if_fail (new_type != NULL);
1310 _tmp0_ = vala_property_accessor_get_value_type (self);
1311 _tmp1_ = _tmp0_;
1312 if (_tmp1_ == old_type) {
1313 vala_property_accessor_set_value_type (self, new_type);
1314 }
1315 }
1316
1317 static void
vala_property_accessor_class_init(ValaPropertyAccessorClass * klass,gpointer klass_data)1318 vala_property_accessor_class_init (ValaPropertyAccessorClass * klass,
1319 gpointer klass_data)
1320 {
1321 vala_property_accessor_parent_class = g_type_class_peek_parent (klass);
1322 ((ValaCodeNodeClass *) klass)->finalize = vala_property_accessor_finalize;
1323 g_type_class_adjust_private_offset (klass, &ValaPropertyAccessor_private_offset);
1324 ((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_property_accessor_real_accept;
1325 ((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_property_accessor_real_accept_children;
1326 ((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_property_accessor_real_check;
1327 ((ValaCodeNodeClass *) klass)->replace_type = (void (*) (ValaCodeNode*, ValaDataType*, ValaDataType*)) vala_property_accessor_real_replace_type;
1328 VALA_SUBROUTINE_CLASS (klass)->get_has_result = vala_property_accessor_real_get_has_result;
1329 }
1330
1331 static void
vala_property_accessor_instance_init(ValaPropertyAccessor * self,gpointer klass)1332 vala_property_accessor_instance_init (ValaPropertyAccessor * self,
1333 gpointer klass)
1334 {
1335 self->priv = vala_property_accessor_get_instance_private (self);
1336 }
1337
1338 static void
vala_property_accessor_finalize(ValaCodeNode * obj)1339 vala_property_accessor_finalize (ValaCodeNode * obj)
1340 {
1341 ValaPropertyAccessor * self;
1342 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_PROPERTY_ACCESSOR, ValaPropertyAccessor);
1343 _vala_code_node_unref0 (self->priv->_value_parameter);
1344 _vala_code_node_unref0 (self->priv->_value_type);
1345 VALA_CODE_NODE_CLASS (vala_property_accessor_parent_class)->finalize (obj);
1346 }
1347
1348 /**
1349 * Represents a get or set accessor of a property in the source code.
1350 */
1351 static GType
vala_property_accessor_get_type_once(void)1352 vala_property_accessor_get_type_once (void)
1353 {
1354 static const GTypeInfo g_define_type_info = { sizeof (ValaPropertyAccessorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_property_accessor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaPropertyAccessor), 0, (GInstanceInitFunc) vala_property_accessor_instance_init, NULL };
1355 GType vala_property_accessor_type_id;
1356 vala_property_accessor_type_id = g_type_register_static (VALA_TYPE_SUBROUTINE, "ValaPropertyAccessor", &g_define_type_info, 0);
1357 ValaPropertyAccessor_private_offset = g_type_add_instance_private (vala_property_accessor_type_id, sizeof (ValaPropertyAccessorPrivate));
1358 return vala_property_accessor_type_id;
1359 }
1360
1361 GType
vala_property_accessor_get_type(void)1362 vala_property_accessor_get_type (void)
1363 {
1364 static volatile gsize vala_property_accessor_type_id__volatile = 0;
1365 if (g_once_init_enter (&vala_property_accessor_type_id__volatile)) {
1366 GType vala_property_accessor_type_id;
1367 vala_property_accessor_type_id = vala_property_accessor_get_type_once ();
1368 g_once_init_leave (&vala_property_accessor_type_id__volatile, vala_property_accessor_type_id);
1369 }
1370 return vala_property_accessor_type_id__volatile;
1371 }
1372
1373