1 /* valaunaryexpression.c generated by valac, the Vala compiler
2  * generated from valaunaryexpression.vala, do not modify */
3 
4 /* valaunaryexpression.vala
5  *
6  * Copyright (C) 2006-2011  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 <stdlib.h>
28 #include <string.h>
29 #include <glib.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 
36 struct _ValaUnaryExpressionPrivate {
37 	ValaUnaryOperator _operator;
38 	ValaExpression* _inner;
39 };
40 
41 static gint ValaUnaryExpression_private_offset;
42 static gpointer vala_unary_expression_parent_class = NULL;
43 
44 static void vala_unary_expression_real_accept (ValaCodeNode* base,
45                                         ValaCodeVisitor* visitor);
46 static void vala_unary_expression_real_accept_children (ValaCodeNode* base,
47                                                  ValaCodeVisitor* visitor);
48 static void vala_unary_expression_real_replace_expression (ValaCodeNode* base,
49                                                     ValaExpression* old_node,
50                                                     ValaExpression* new_node);
51 static gchar* vala_unary_expression_real_to_string (ValaCodeNode* base);
52 static gboolean vala_unary_expression_real_is_constant (ValaExpression* base);
53 static gboolean vala_unary_expression_real_is_pure (ValaExpression* base);
54 static gboolean vala_unary_expression_real_is_accessible (ValaExpression* base,
55                                                    ValaSymbol* sym);
56 static gboolean vala_unary_expression_is_numeric_type (ValaUnaryExpression* self,
57                                                 ValaDataType* type);
58 static gboolean vala_unary_expression_is_integer_type (ValaUnaryExpression* self,
59                                                 ValaDataType* type);
60 static ValaMemberAccess* vala_unary_expression_find_member_access (ValaUnaryExpression* self,
61                                                             ValaExpression* expr);
62 static void vala_unary_expression_real_get_error_types (ValaCodeNode* base,
63                                                  ValaCollection* collection,
64                                                  ValaSourceReference* source_reference);
65 static gboolean vala_unary_expression_real_check (ValaCodeNode* base,
66                                            ValaCodeContext* context);
67 static void vala_unary_expression_real_emit (ValaCodeNode* base,
68                                       ValaCodeGenerator* codegen);
69 static void vala_unary_expression_real_get_defined_variables (ValaCodeNode* base,
70                                                        ValaCollection* collection);
71 static void vala_unary_expression_real_get_used_variables (ValaCodeNode* base,
72                                                     ValaCollection* collection);
73 static void vala_unary_expression_finalize (ValaCodeNode * obj);
74 static GType vala_unary_expression_get_type_once (void);
75 
76 static inline gpointer
vala_unary_expression_get_instance_private(ValaUnaryExpression * self)77 vala_unary_expression_get_instance_private (ValaUnaryExpression* self)
78 {
79 	return G_STRUCT_MEMBER_P (self, ValaUnaryExpression_private_offset);
80 }
81 
82 ValaUnaryOperator
vala_unary_expression_get_operator(ValaUnaryExpression * self)83 vala_unary_expression_get_operator (ValaUnaryExpression* self)
84 {
85 	ValaUnaryOperator result;
86 	ValaUnaryOperator _tmp0_;
87 	g_return_val_if_fail (self != NULL, 0);
88 	_tmp0_ = self->priv->_operator;
89 	result = _tmp0_;
90 	return result;
91 }
92 
93 void
vala_unary_expression_set_operator(ValaUnaryExpression * self,ValaUnaryOperator value)94 vala_unary_expression_set_operator (ValaUnaryExpression* self,
95                                     ValaUnaryOperator value)
96 {
97 	g_return_if_fail (self != NULL);
98 	self->priv->_operator = value;
99 }
100 
101 ValaExpression*
vala_unary_expression_get_inner(ValaUnaryExpression * self)102 vala_unary_expression_get_inner (ValaUnaryExpression* self)
103 {
104 	ValaExpression* result;
105 	ValaExpression* _tmp0_;
106 	g_return_val_if_fail (self != NULL, NULL);
107 	_tmp0_ = self->priv->_inner;
108 	result = _tmp0_;
109 	return result;
110 }
111 
112 static gpointer
_vala_code_node_ref0(gpointer self)113 _vala_code_node_ref0 (gpointer self)
114 {
115 	return self ? vala_code_node_ref (self) : NULL;
116 }
117 
118 void
vala_unary_expression_set_inner(ValaUnaryExpression * self,ValaExpression * value)119 vala_unary_expression_set_inner (ValaUnaryExpression* self,
120                                  ValaExpression* value)
121 {
122 	ValaExpression* _tmp0_;
123 	ValaExpression* _tmp1_;
124 	g_return_if_fail (self != NULL);
125 	_tmp0_ = _vala_code_node_ref0 (value);
126 	_vala_code_node_unref0 (self->priv->_inner);
127 	self->priv->_inner = _tmp0_;
128 	_tmp1_ = self->priv->_inner;
129 	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp1_, (ValaCodeNode*) self);
130 }
131 
132 /**
133  * Creates a new unary expression.
134  *
135  * @param op     unary operator
136  * @param _inner operand
137  * @param source reference to source code
138  * @return       newly created binary expression
139  */
140 ValaUnaryExpression*
vala_unary_expression_construct(GType object_type,ValaUnaryOperator op,ValaExpression * _inner,ValaSourceReference * source)141 vala_unary_expression_construct (GType object_type,
142                                  ValaUnaryOperator op,
143                                  ValaExpression* _inner,
144                                  ValaSourceReference* source)
145 {
146 	ValaUnaryExpression* self = NULL;
147 	g_return_val_if_fail (_inner != NULL, NULL);
148 	self = (ValaUnaryExpression*) vala_expression_construct (object_type);
149 	vala_unary_expression_set_operator (self, op);
150 	vala_unary_expression_set_inner (self, _inner);
151 	vala_code_node_set_source_reference ((ValaCodeNode*) self, source);
152 	return self;
153 }
154 
155 ValaUnaryExpression*
vala_unary_expression_new(ValaUnaryOperator op,ValaExpression * _inner,ValaSourceReference * source)156 vala_unary_expression_new (ValaUnaryOperator op,
157                            ValaExpression* _inner,
158                            ValaSourceReference* source)
159 {
160 	return vala_unary_expression_construct (VALA_TYPE_UNARY_EXPRESSION, op, _inner, source);
161 }
162 
163 static void
vala_unary_expression_real_accept(ValaCodeNode * base,ValaCodeVisitor * visitor)164 vala_unary_expression_real_accept (ValaCodeNode* base,
165                                    ValaCodeVisitor* visitor)
166 {
167 	ValaUnaryExpression * self;
168 	self = (ValaUnaryExpression*) base;
169 	g_return_if_fail (visitor != NULL);
170 	vala_code_visitor_visit_unary_expression (visitor, self);
171 	vala_code_visitor_visit_expression (visitor, (ValaExpression*) self);
172 }
173 
174 static void
vala_unary_expression_real_accept_children(ValaCodeNode * base,ValaCodeVisitor * visitor)175 vala_unary_expression_real_accept_children (ValaCodeNode* base,
176                                             ValaCodeVisitor* visitor)
177 {
178 	ValaUnaryExpression * self;
179 	ValaExpression* _tmp0_;
180 	ValaExpression* _tmp1_;
181 	self = (ValaUnaryExpression*) base;
182 	g_return_if_fail (visitor != NULL);
183 	_tmp0_ = vala_unary_expression_get_inner (self);
184 	_tmp1_ = _tmp0_;
185 	vala_code_node_accept ((ValaCodeNode*) _tmp1_, visitor);
186 }
187 
188 static void
vala_unary_expression_real_replace_expression(ValaCodeNode * base,ValaExpression * old_node,ValaExpression * new_node)189 vala_unary_expression_real_replace_expression (ValaCodeNode* base,
190                                                ValaExpression* old_node,
191                                                ValaExpression* new_node)
192 {
193 	ValaUnaryExpression * self;
194 	ValaExpression* _tmp0_;
195 	ValaExpression* _tmp1_;
196 	self = (ValaUnaryExpression*) base;
197 	g_return_if_fail (old_node != NULL);
198 	g_return_if_fail (new_node != NULL);
199 	_tmp0_ = vala_unary_expression_get_inner (self);
200 	_tmp1_ = _tmp0_;
201 	if (_tmp1_ == old_node) {
202 		vala_unary_expression_set_inner (self, new_node);
203 	}
204 }
205 
206 static gchar*
vala_unary_expression_real_to_string(ValaCodeNode * base)207 vala_unary_expression_real_to_string (ValaCodeNode* base)
208 {
209 	ValaUnaryExpression * self;
210 	ValaUnaryOperator _tmp0_;
211 	const gchar* _tmp1_;
212 	ValaExpression* _tmp2_;
213 	gchar* _tmp3_;
214 	gchar* _tmp4_;
215 	gchar* _tmp5_;
216 	gchar* _tmp6_;
217 	gchar* result = NULL;
218 	self = (ValaUnaryExpression*) base;
219 	_tmp0_ = self->priv->_operator;
220 	_tmp1_ = vala_unary_operator_to_string (_tmp0_);
221 	_tmp2_ = self->priv->_inner;
222 	_tmp3_ = vala_code_node_to_string ((ValaCodeNode*) _tmp2_);
223 	_tmp4_ = _tmp3_;
224 	_tmp5_ = g_strconcat (_tmp1_, _tmp4_, NULL);
225 	_tmp6_ = _tmp5_;
226 	_g_free0 (_tmp4_);
227 	result = _tmp6_;
228 	return result;
229 }
230 
231 static gboolean
vala_unary_expression_real_is_constant(ValaExpression * base)232 vala_unary_expression_real_is_constant (ValaExpression* base)
233 {
234 	ValaUnaryExpression * self;
235 	gboolean _tmp0_ = FALSE;
236 	ValaUnaryOperator _tmp1_;
237 	gboolean _tmp3_ = FALSE;
238 	ValaUnaryOperator _tmp4_;
239 	ValaExpression* _tmp15_;
240 	ValaExpression* _tmp16_;
241 	gboolean result = FALSE;
242 	self = (ValaUnaryExpression*) base;
243 	_tmp1_ = self->priv->_operator;
244 	if (_tmp1_ == VALA_UNARY_OPERATOR_INCREMENT) {
245 		_tmp0_ = TRUE;
246 	} else {
247 		ValaUnaryOperator _tmp2_;
248 		_tmp2_ = self->priv->_operator;
249 		_tmp0_ = _tmp2_ == VALA_UNARY_OPERATOR_DECREMENT;
250 	}
251 	if (_tmp0_) {
252 		result = FALSE;
253 		return result;
254 	}
255 	_tmp4_ = self->priv->_operator;
256 	if (_tmp4_ == VALA_UNARY_OPERATOR_REF) {
257 		_tmp3_ = TRUE;
258 	} else {
259 		ValaUnaryOperator _tmp5_;
260 		_tmp5_ = self->priv->_operator;
261 		_tmp3_ = _tmp5_ == VALA_UNARY_OPERATOR_OUT;
262 	}
263 	if (_tmp3_) {
264 		ValaField* field = NULL;
265 		ValaExpression* _tmp6_;
266 		ValaExpression* _tmp7_;
267 		ValaSymbol* _tmp8_;
268 		ValaSymbol* _tmp9_;
269 		gboolean _tmp10_ = FALSE;
270 		ValaField* _tmp11_;
271 		_tmp6_ = vala_unary_expression_get_inner (self);
272 		_tmp7_ = _tmp6_;
273 		_tmp8_ = vala_expression_get_symbol_reference (_tmp7_);
274 		_tmp9_ = _tmp8_;
275 		field = VALA_IS_FIELD (_tmp9_) ? ((ValaField*) _tmp9_) : NULL;
276 		_tmp11_ = field;
277 		if (_tmp11_ != NULL) {
278 			ValaField* _tmp12_;
279 			ValaMemberBinding _tmp13_;
280 			ValaMemberBinding _tmp14_;
281 			_tmp12_ = field;
282 			_tmp13_ = vala_field_get_binding (_tmp12_);
283 			_tmp14_ = _tmp13_;
284 			_tmp10_ = _tmp14_ == VALA_MEMBER_BINDING_STATIC;
285 		} else {
286 			_tmp10_ = FALSE;
287 		}
288 		if (_tmp10_) {
289 			result = TRUE;
290 			return result;
291 		} else {
292 			result = FALSE;
293 			return result;
294 		}
295 	}
296 	_tmp15_ = vala_unary_expression_get_inner (self);
297 	_tmp16_ = _tmp15_;
298 	result = vala_expression_is_constant (_tmp16_);
299 	return result;
300 }
301 
302 static gboolean
vala_unary_expression_real_is_pure(ValaExpression * base)303 vala_unary_expression_real_is_pure (ValaExpression* base)
304 {
305 	ValaUnaryExpression * self;
306 	gboolean _tmp0_ = FALSE;
307 	ValaUnaryOperator _tmp1_;
308 	ValaExpression* _tmp3_;
309 	ValaExpression* _tmp4_;
310 	gboolean result = FALSE;
311 	self = (ValaUnaryExpression*) base;
312 	_tmp1_ = self->priv->_operator;
313 	if (_tmp1_ == VALA_UNARY_OPERATOR_INCREMENT) {
314 		_tmp0_ = TRUE;
315 	} else {
316 		ValaUnaryOperator _tmp2_;
317 		_tmp2_ = self->priv->_operator;
318 		_tmp0_ = _tmp2_ == VALA_UNARY_OPERATOR_DECREMENT;
319 	}
320 	if (_tmp0_) {
321 		result = FALSE;
322 		return result;
323 	}
324 	_tmp3_ = vala_unary_expression_get_inner (self);
325 	_tmp4_ = _tmp3_;
326 	result = vala_expression_is_pure (_tmp4_);
327 	return result;
328 }
329 
330 static gboolean
vala_unary_expression_real_is_accessible(ValaExpression * base,ValaSymbol * sym)331 vala_unary_expression_real_is_accessible (ValaExpression* base,
332                                           ValaSymbol* sym)
333 {
334 	ValaUnaryExpression * self;
335 	ValaExpression* _tmp0_;
336 	ValaExpression* _tmp1_;
337 	gboolean result = FALSE;
338 	self = (ValaUnaryExpression*) base;
339 	g_return_val_if_fail (sym != NULL, FALSE);
340 	_tmp0_ = vala_unary_expression_get_inner (self);
341 	_tmp1_ = _tmp0_;
342 	result = vala_expression_is_accessible (_tmp1_, sym);
343 	return result;
344 }
345 
346 static gboolean
vala_unary_expression_is_numeric_type(ValaUnaryExpression * self,ValaDataType * type)347 vala_unary_expression_is_numeric_type (ValaUnaryExpression* self,
348                                        ValaDataType* type)
349 {
350 	ValaStruct* st = NULL;
351 	ValaTypeSymbol* _tmp0_;
352 	ValaTypeSymbol* _tmp1_;
353 	gboolean _tmp2_ = FALSE;
354 	gboolean _tmp3_;
355 	gboolean _tmp4_;
356 	gboolean _tmp6_ = FALSE;
357 	ValaStruct* _tmp7_;
358 	gboolean result = FALSE;
359 	g_return_val_if_fail (self != NULL, FALSE);
360 	g_return_val_if_fail (type != NULL, FALSE);
361 	_tmp0_ = vala_data_type_get_type_symbol (type);
362 	_tmp1_ = _tmp0_;
363 	st = VALA_IS_STRUCT (_tmp1_) ? ((ValaStruct*) _tmp1_) : NULL;
364 	_tmp3_ = vala_data_type_get_nullable (type);
365 	_tmp4_ = _tmp3_;
366 	if (_tmp4_) {
367 		_tmp2_ = TRUE;
368 	} else {
369 		ValaStruct* _tmp5_;
370 		_tmp5_ = st;
371 		_tmp2_ = _tmp5_ == NULL;
372 	}
373 	if (_tmp2_) {
374 		result = FALSE;
375 		return result;
376 	}
377 	_tmp7_ = st;
378 	if (vala_struct_is_integer_type (_tmp7_)) {
379 		_tmp6_ = TRUE;
380 	} else {
381 		ValaStruct* _tmp8_;
382 		_tmp8_ = st;
383 		_tmp6_ = vala_struct_is_floating_type (_tmp8_);
384 	}
385 	result = _tmp6_;
386 	return result;
387 }
388 
389 static gboolean
vala_unary_expression_is_integer_type(ValaUnaryExpression * self,ValaDataType * type)390 vala_unary_expression_is_integer_type (ValaUnaryExpression* self,
391                                        ValaDataType* type)
392 {
393 	ValaStruct* st = NULL;
394 	ValaTypeSymbol* _tmp0_;
395 	ValaTypeSymbol* _tmp1_;
396 	gboolean _tmp2_ = FALSE;
397 	gboolean _tmp3_;
398 	gboolean _tmp4_;
399 	ValaStruct* _tmp6_;
400 	gboolean result = FALSE;
401 	g_return_val_if_fail (self != NULL, FALSE);
402 	g_return_val_if_fail (type != NULL, FALSE);
403 	_tmp0_ = vala_data_type_get_type_symbol (type);
404 	_tmp1_ = _tmp0_;
405 	st = VALA_IS_STRUCT (_tmp1_) ? ((ValaStruct*) _tmp1_) : NULL;
406 	_tmp3_ = vala_data_type_get_nullable (type);
407 	_tmp4_ = _tmp3_;
408 	if (_tmp4_) {
409 		_tmp2_ = TRUE;
410 	} else {
411 		ValaStruct* _tmp5_;
412 		_tmp5_ = st;
413 		_tmp2_ = _tmp5_ == NULL;
414 	}
415 	if (_tmp2_) {
416 		result = FALSE;
417 		return result;
418 	}
419 	_tmp6_ = st;
420 	result = vala_struct_is_integer_type (_tmp6_);
421 	return result;
422 }
423 
424 static ValaMemberAccess*
vala_unary_expression_find_member_access(ValaUnaryExpression * self,ValaExpression * expr)425 vala_unary_expression_find_member_access (ValaUnaryExpression* self,
426                                           ValaExpression* expr)
427 {
428 	ValaMemberAccess* result = NULL;
429 	g_return_val_if_fail (self != NULL, NULL);
430 	g_return_val_if_fail (expr != NULL, NULL);
431 	if (VALA_IS_MEMBER_ACCESS (expr)) {
432 		ValaMemberAccess* _tmp0_;
433 		_tmp0_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (expr, VALA_TYPE_MEMBER_ACCESS, ValaMemberAccess));
434 		result = _tmp0_;
435 		return result;
436 	}
437 	result = NULL;
438 	return result;
439 }
440 
441 static void
vala_unary_expression_real_get_error_types(ValaCodeNode * base,ValaCollection * collection,ValaSourceReference * source_reference)442 vala_unary_expression_real_get_error_types (ValaCodeNode* base,
443                                             ValaCollection* collection,
444                                             ValaSourceReference* source_reference)
445 {
446 	ValaUnaryExpression * self;
447 	ValaExpression* _tmp0_;
448 	ValaExpression* _tmp1_;
449 	self = (ValaUnaryExpression*) base;
450 	g_return_if_fail (collection != NULL);
451 	_tmp0_ = vala_unary_expression_get_inner (self);
452 	_tmp1_ = _tmp0_;
453 	vala_code_node_get_error_types ((ValaCodeNode*) _tmp1_, collection, source_reference);
454 }
455 
456 static gboolean
vala_unary_expression_real_check(ValaCodeNode * base,ValaCodeContext * context)457 vala_unary_expression_real_check (ValaCodeNode* base,
458                                   ValaCodeContext* context)
459 {
460 	ValaUnaryExpression * self;
461 	gboolean _tmp0_;
462 	gboolean _tmp1_;
463 	gboolean _tmp4_ = FALSE;
464 	ValaUnaryOperator _tmp5_;
465 	ValaExpression* _tmp18_;
466 	ValaExpression* _tmp19_;
467 	gboolean _tmp28_ = FALSE;
468 	ValaExpression* _tmp29_;
469 	ValaExpression* _tmp30_;
470 	ValaDataType* _tmp31_;
471 	ValaDataType* _tmp32_;
472 	ValaUnaryOperator _tmp49_;
473 	ValaDataType* _tmp175_;
474 	ValaDataType* _tmp176_;
475 	gboolean _tmp177_;
476 	gboolean _tmp178_;
477 	gboolean result = FALSE;
478 	self = (ValaUnaryExpression*) base;
479 	g_return_val_if_fail (context != NULL, FALSE);
480 	_tmp0_ = vala_code_node_get_checked ((ValaCodeNode*) self);
481 	_tmp1_ = _tmp0_;
482 	if (_tmp1_) {
483 		gboolean _tmp2_;
484 		gboolean _tmp3_;
485 		_tmp2_ = vala_code_node_get_error ((ValaCodeNode*) self);
486 		_tmp3_ = _tmp2_;
487 		result = !_tmp3_;
488 		return result;
489 	}
490 	vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
491 	_tmp5_ = self->priv->_operator;
492 	if (_tmp5_ == VALA_UNARY_OPERATOR_REF) {
493 		_tmp4_ = TRUE;
494 	} else {
495 		ValaUnaryOperator _tmp6_;
496 		_tmp6_ = self->priv->_operator;
497 		_tmp4_ = _tmp6_ == VALA_UNARY_OPERATOR_OUT;
498 	}
499 	if (_tmp4_) {
500 		ValaExpression* _tmp7_;
501 		ValaExpression* _tmp8_;
502 		ValaExpression* _tmp9_;
503 		ValaExpression* _tmp10_;
504 		ValaDataType* _tmp11_;
505 		ValaDataType* _tmp12_;
506 		_tmp7_ = vala_unary_expression_get_inner (self);
507 		_tmp8_ = _tmp7_;
508 		vala_expression_set_lvalue (_tmp8_, TRUE);
509 		_tmp9_ = vala_unary_expression_get_inner (self);
510 		_tmp10_ = _tmp9_;
511 		_tmp11_ = vala_expression_get_target_type ((ValaExpression*) self);
512 		_tmp12_ = _tmp11_;
513 		vala_expression_set_target_type (_tmp10_, _tmp12_);
514 	} else {
515 		gboolean _tmp13_ = FALSE;
516 		ValaUnaryOperator _tmp14_;
517 		_tmp14_ = self->priv->_operator;
518 		if (_tmp14_ == VALA_UNARY_OPERATOR_INCREMENT) {
519 			_tmp13_ = TRUE;
520 		} else {
521 			ValaUnaryOperator _tmp15_;
522 			_tmp15_ = self->priv->_operator;
523 			_tmp13_ = _tmp15_ == VALA_UNARY_OPERATOR_DECREMENT;
524 		}
525 		if (_tmp13_) {
526 			ValaExpression* _tmp16_;
527 			ValaExpression* _tmp17_;
528 			_tmp16_ = vala_unary_expression_get_inner (self);
529 			_tmp17_ = _tmp16_;
530 			vala_expression_set_lvalue (_tmp17_, TRUE);
531 		}
532 	}
533 	_tmp18_ = vala_unary_expression_get_inner (self);
534 	_tmp19_ = _tmp18_;
535 	if (!vala_code_node_check ((ValaCodeNode*) _tmp19_, context)) {
536 		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
537 		result = FALSE;
538 		return result;
539 	} else {
540 		ValaExpression* _tmp20_;
541 		ValaExpression* _tmp21_;
542 		ValaDataType* _tmp22_;
543 		ValaDataType* _tmp23_;
544 		_tmp20_ = vala_unary_expression_get_inner (self);
545 		_tmp21_ = _tmp20_;
546 		_tmp22_ = vala_expression_get_value_type (_tmp21_);
547 		_tmp23_ = _tmp22_;
548 		if (_tmp23_ == NULL) {
549 			ValaExpression* _tmp24_;
550 			ValaExpression* _tmp25_;
551 			ValaSourceReference* _tmp26_;
552 			ValaSourceReference* _tmp27_;
553 			vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
554 			_tmp24_ = vala_unary_expression_get_inner (self);
555 			_tmp25_ = _tmp24_;
556 			_tmp26_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp25_);
557 			_tmp27_ = _tmp26_;
558 			vala_report_error (_tmp27_, "Invalid inner operand");
559 			result = FALSE;
560 			return result;
561 		}
562 	}
563 	_tmp29_ = vala_unary_expression_get_inner (self);
564 	_tmp30_ = _tmp29_;
565 	_tmp31_ = vala_expression_get_value_type (_tmp30_);
566 	_tmp32_ = _tmp31_;
567 	if (VALA_IS_FIELD_PROTOTYPE (_tmp32_)) {
568 		_tmp28_ = TRUE;
569 	} else {
570 		ValaExpression* _tmp33_;
571 		ValaExpression* _tmp34_;
572 		ValaDataType* _tmp35_;
573 		ValaDataType* _tmp36_;
574 		_tmp33_ = vala_unary_expression_get_inner (self);
575 		_tmp34_ = _tmp33_;
576 		_tmp35_ = vala_expression_get_value_type (_tmp34_);
577 		_tmp36_ = _tmp35_;
578 		_tmp28_ = VALA_IS_PROPERTY_PROTOTYPE (_tmp36_);
579 	}
580 	if (_tmp28_) {
581 		ValaExpression* _tmp37_;
582 		ValaExpression* _tmp38_;
583 		ValaSourceReference* _tmp39_;
584 		ValaSourceReference* _tmp40_;
585 		ValaExpression* _tmp41_;
586 		ValaExpression* _tmp42_;
587 		ValaSymbol* _tmp43_;
588 		ValaSymbol* _tmp44_;
589 		gchar* _tmp45_;
590 		gchar* _tmp46_;
591 		gchar* _tmp47_;
592 		gchar* _tmp48_;
593 		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
594 		_tmp37_ = vala_unary_expression_get_inner (self);
595 		_tmp38_ = _tmp37_;
596 		_tmp39_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp38_);
597 		_tmp40_ = _tmp39_;
598 		_tmp41_ = vala_unary_expression_get_inner (self);
599 		_tmp42_ = _tmp41_;
600 		_tmp43_ = vala_expression_get_symbol_reference (_tmp42_);
601 		_tmp44_ = _tmp43_;
602 		_tmp45_ = vala_symbol_get_full_name (_tmp44_);
603 		_tmp46_ = _tmp45_;
604 		_tmp47_ = g_strdup_printf ("Access to instance member `%s' denied", _tmp46_);
605 		_tmp48_ = _tmp47_;
606 		vala_report_error (_tmp40_, _tmp48_);
607 		_g_free0 (_tmp48_);
608 		_g_free0 (_tmp46_);
609 		result = FALSE;
610 		return result;
611 	}
612 	_tmp49_ = self->priv->_operator;
613 	switch (_tmp49_) {
614 		case VALA_UNARY_OPERATOR_PLUS:
615 		case VALA_UNARY_OPERATOR_MINUS:
616 		{
617 			ValaExpression* _tmp50_;
618 			ValaExpression* _tmp51_;
619 			ValaDataType* _tmp52_;
620 			ValaDataType* _tmp53_;
621 			ValaExpression* _tmp64_;
622 			ValaExpression* _tmp65_;
623 			ValaDataType* _tmp66_;
624 			ValaDataType* _tmp67_;
625 			_tmp50_ = vala_unary_expression_get_inner (self);
626 			_tmp51_ = _tmp50_;
627 			_tmp52_ = vala_expression_get_value_type (_tmp51_);
628 			_tmp53_ = _tmp52_;
629 			if (!vala_unary_expression_is_numeric_type (self, _tmp53_)) {
630 				ValaSourceReference* _tmp54_;
631 				ValaSourceReference* _tmp55_;
632 				ValaExpression* _tmp56_;
633 				ValaExpression* _tmp57_;
634 				ValaDataType* _tmp58_;
635 				ValaDataType* _tmp59_;
636 				gchar* _tmp60_;
637 				gchar* _tmp61_;
638 				gchar* _tmp62_;
639 				gchar* _tmp63_;
640 				vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
641 				_tmp54_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
642 				_tmp55_ = _tmp54_;
643 				_tmp56_ = vala_unary_expression_get_inner (self);
644 				_tmp57_ = _tmp56_;
645 				_tmp58_ = vala_expression_get_value_type (_tmp57_);
646 				_tmp59_ = _tmp58_;
647 				_tmp60_ = vala_code_node_to_string ((ValaCodeNode*) _tmp59_);
648 				_tmp61_ = _tmp60_;
649 				_tmp62_ = g_strdup_printf ("Operator not supported for `%s'", _tmp61_);
650 				_tmp63_ = _tmp62_;
651 				vala_report_error (_tmp55_, _tmp63_);
652 				_g_free0 (_tmp63_);
653 				_g_free0 (_tmp61_);
654 				result = FALSE;
655 				return result;
656 			}
657 			_tmp64_ = vala_unary_expression_get_inner (self);
658 			_tmp65_ = _tmp64_;
659 			_tmp66_ = vala_expression_get_value_type (_tmp65_);
660 			_tmp67_ = _tmp66_;
661 			vala_expression_set_value_type ((ValaExpression*) self, _tmp67_);
662 			break;
663 		}
664 		case VALA_UNARY_OPERATOR_LOGICAL_NEGATION:
665 		{
666 			gboolean _tmp68_ = FALSE;
667 			ValaExpression* _tmp69_;
668 			ValaExpression* _tmp70_;
669 			ValaDataType* _tmp71_;
670 			ValaDataType* _tmp72_;
671 			gboolean _tmp73_;
672 			gboolean _tmp74_;
673 			ValaExpression* _tmp92_;
674 			ValaExpression* _tmp93_;
675 			ValaDataType* _tmp94_;
676 			ValaDataType* _tmp95_;
677 			_tmp69_ = vala_unary_expression_get_inner (self);
678 			_tmp70_ = _tmp69_;
679 			_tmp71_ = vala_expression_get_value_type (_tmp70_);
680 			_tmp72_ = _tmp71_;
681 			_tmp73_ = vala_data_type_get_nullable (_tmp72_);
682 			_tmp74_ = _tmp73_;
683 			if (_tmp74_) {
684 				_tmp68_ = TRUE;
685 			} else {
686 				ValaExpression* _tmp75_;
687 				ValaExpression* _tmp76_;
688 				ValaDataType* _tmp77_;
689 				ValaDataType* _tmp78_;
690 				ValaSemanticAnalyzer* _tmp79_;
691 				ValaSemanticAnalyzer* _tmp80_;
692 				ValaDataType* _tmp81_;
693 				_tmp75_ = vala_unary_expression_get_inner (self);
694 				_tmp76_ = _tmp75_;
695 				_tmp77_ = vala_expression_get_value_type (_tmp76_);
696 				_tmp78_ = _tmp77_;
697 				_tmp79_ = vala_code_context_get_analyzer (context);
698 				_tmp80_ = _tmp79_;
699 				_tmp81_ = _tmp80_->bool_type;
700 				_tmp68_ = !vala_data_type_compatible (_tmp78_, _tmp81_);
701 			}
702 			if (_tmp68_) {
703 				ValaSourceReference* _tmp82_;
704 				ValaSourceReference* _tmp83_;
705 				ValaExpression* _tmp84_;
706 				ValaExpression* _tmp85_;
707 				ValaDataType* _tmp86_;
708 				ValaDataType* _tmp87_;
709 				gchar* _tmp88_;
710 				gchar* _tmp89_;
711 				gchar* _tmp90_;
712 				gchar* _tmp91_;
713 				vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
714 				_tmp82_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
715 				_tmp83_ = _tmp82_;
716 				_tmp84_ = vala_unary_expression_get_inner (self);
717 				_tmp85_ = _tmp84_;
718 				_tmp86_ = vala_expression_get_value_type (_tmp85_);
719 				_tmp87_ = _tmp86_;
720 				_tmp88_ = vala_code_node_to_string ((ValaCodeNode*) _tmp87_);
721 				_tmp89_ = _tmp88_;
722 				_tmp90_ = g_strdup_printf ("Operator not supported for `%s'", _tmp89_);
723 				_tmp91_ = _tmp90_;
724 				vala_report_error (_tmp83_, _tmp91_);
725 				_g_free0 (_tmp91_);
726 				_g_free0 (_tmp89_);
727 				result = FALSE;
728 				return result;
729 			}
730 			_tmp92_ = vala_unary_expression_get_inner (self);
731 			_tmp93_ = _tmp92_;
732 			_tmp94_ = vala_expression_get_value_type (_tmp93_);
733 			_tmp95_ = _tmp94_;
734 			vala_expression_set_value_type ((ValaExpression*) self, _tmp95_);
735 			break;
736 		}
737 		case VALA_UNARY_OPERATOR_BITWISE_COMPLEMENT:
738 		{
739 			gboolean _tmp96_ = FALSE;
740 			ValaExpression* _tmp97_;
741 			ValaExpression* _tmp98_;
742 			ValaDataType* _tmp99_;
743 			ValaDataType* _tmp100_;
744 			ValaExpression* _tmp115_;
745 			ValaExpression* _tmp116_;
746 			ValaDataType* _tmp117_;
747 			ValaDataType* _tmp118_;
748 			_tmp97_ = vala_unary_expression_get_inner (self);
749 			_tmp98_ = _tmp97_;
750 			_tmp99_ = vala_expression_get_value_type (_tmp98_);
751 			_tmp100_ = _tmp99_;
752 			if (!vala_unary_expression_is_integer_type (self, _tmp100_)) {
753 				ValaExpression* _tmp101_;
754 				ValaExpression* _tmp102_;
755 				ValaDataType* _tmp103_;
756 				ValaDataType* _tmp104_;
757 				_tmp101_ = vala_unary_expression_get_inner (self);
758 				_tmp102_ = _tmp101_;
759 				_tmp103_ = vala_expression_get_value_type (_tmp102_);
760 				_tmp104_ = _tmp103_;
761 				_tmp96_ = !VALA_IS_ENUM_VALUE_TYPE (_tmp104_);
762 			} else {
763 				_tmp96_ = FALSE;
764 			}
765 			if (_tmp96_) {
766 				ValaSourceReference* _tmp105_;
767 				ValaSourceReference* _tmp106_;
768 				ValaExpression* _tmp107_;
769 				ValaExpression* _tmp108_;
770 				ValaDataType* _tmp109_;
771 				ValaDataType* _tmp110_;
772 				gchar* _tmp111_;
773 				gchar* _tmp112_;
774 				gchar* _tmp113_;
775 				gchar* _tmp114_;
776 				vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
777 				_tmp105_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
778 				_tmp106_ = _tmp105_;
779 				_tmp107_ = vala_unary_expression_get_inner (self);
780 				_tmp108_ = _tmp107_;
781 				_tmp109_ = vala_expression_get_value_type (_tmp108_);
782 				_tmp110_ = _tmp109_;
783 				_tmp111_ = vala_code_node_to_string ((ValaCodeNode*) _tmp110_);
784 				_tmp112_ = _tmp111_;
785 				_tmp113_ = g_strdup_printf ("Operator not supported for `%s'", _tmp112_);
786 				_tmp114_ = _tmp113_;
787 				vala_report_error (_tmp106_, _tmp114_);
788 				_g_free0 (_tmp114_);
789 				_g_free0 (_tmp112_);
790 				result = FALSE;
791 				return result;
792 			}
793 			_tmp115_ = vala_unary_expression_get_inner (self);
794 			_tmp116_ = _tmp115_;
795 			_tmp117_ = vala_expression_get_value_type (_tmp116_);
796 			_tmp118_ = _tmp117_;
797 			vala_expression_set_value_type ((ValaExpression*) self, _tmp118_);
798 			break;
799 		}
800 		case VALA_UNARY_OPERATOR_INCREMENT:
801 		case VALA_UNARY_OPERATOR_DECREMENT:
802 		{
803 			ValaExpression* _tmp119_;
804 			ValaExpression* _tmp120_;
805 			ValaDataType* _tmp121_;
806 			ValaDataType* _tmp122_;
807 			ValaMemberAccess* ma = NULL;
808 			ValaExpression* _tmp133_;
809 			ValaExpression* _tmp134_;
810 			ValaMemberAccess* _tmp135_;
811 			ValaMemberAccess* _tmp136_;
812 			ValaExpression* _tmp139_;
813 			ValaExpression* _tmp140_;
814 			ValaDataType* _tmp141_;
815 			ValaDataType* _tmp142_;
816 			_tmp119_ = vala_unary_expression_get_inner (self);
817 			_tmp120_ = _tmp119_;
818 			_tmp121_ = vala_expression_get_value_type (_tmp120_);
819 			_tmp122_ = _tmp121_;
820 			if (!vala_unary_expression_is_integer_type (self, _tmp122_)) {
821 				ValaSourceReference* _tmp123_;
822 				ValaSourceReference* _tmp124_;
823 				ValaExpression* _tmp125_;
824 				ValaExpression* _tmp126_;
825 				ValaDataType* _tmp127_;
826 				ValaDataType* _tmp128_;
827 				gchar* _tmp129_;
828 				gchar* _tmp130_;
829 				gchar* _tmp131_;
830 				gchar* _tmp132_;
831 				vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
832 				_tmp123_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
833 				_tmp124_ = _tmp123_;
834 				_tmp125_ = vala_unary_expression_get_inner (self);
835 				_tmp126_ = _tmp125_;
836 				_tmp127_ = vala_expression_get_value_type (_tmp126_);
837 				_tmp128_ = _tmp127_;
838 				_tmp129_ = vala_code_node_to_string ((ValaCodeNode*) _tmp128_);
839 				_tmp130_ = _tmp129_;
840 				_tmp131_ = g_strdup_printf ("Operator not supported for `%s'", _tmp130_);
841 				_tmp132_ = _tmp131_;
842 				vala_report_error (_tmp124_, _tmp132_);
843 				_g_free0 (_tmp132_);
844 				_g_free0 (_tmp130_);
845 				result = FALSE;
846 				return result;
847 			}
848 			_tmp133_ = vala_unary_expression_get_inner (self);
849 			_tmp134_ = _tmp133_;
850 			_tmp135_ = vala_unary_expression_find_member_access (self, _tmp134_);
851 			ma = _tmp135_;
852 			_tmp136_ = ma;
853 			if (_tmp136_ == NULL) {
854 				ValaSourceReference* _tmp137_;
855 				ValaSourceReference* _tmp138_;
856 				vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
857 				_tmp137_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
858 				_tmp138_ = _tmp137_;
859 				vala_report_error (_tmp138_, "Prefix operators not supported for this expression");
860 				result = FALSE;
861 				_vala_code_node_unref0 (ma);
862 				return result;
863 			}
864 			_tmp139_ = vala_unary_expression_get_inner (self);
865 			_tmp140_ = _tmp139_;
866 			_tmp141_ = vala_expression_get_value_type (_tmp140_);
867 			_tmp142_ = _tmp141_;
868 			vala_expression_set_value_type ((ValaExpression*) self, _tmp142_);
869 			_vala_code_node_unref0 (ma);
870 			break;
871 		}
872 		case VALA_UNARY_OPERATOR_REF:
873 		case VALA_UNARY_OPERATOR_OUT:
874 		{
875 			ValaElementAccess* ea = NULL;
876 			ValaExpression* _tmp143_;
877 			ValaExpression* _tmp144_;
878 			gboolean _tmp145_ = FALSE;
879 			gboolean _tmp146_ = FALSE;
880 			gboolean _tmp147_ = FALSE;
881 			ValaExpression* _tmp148_;
882 			ValaExpression* _tmp149_;
883 			ValaSymbol* _tmp150_;
884 			ValaSymbol* _tmp151_;
885 			_tmp143_ = vala_unary_expression_get_inner (self);
886 			_tmp144_ = _tmp143_;
887 			ea = VALA_IS_ELEMENT_ACCESS (_tmp144_) ? ((ValaElementAccess*) _tmp144_) : NULL;
888 			_tmp148_ = vala_unary_expression_get_inner (self);
889 			_tmp149_ = _tmp148_;
890 			_tmp150_ = vala_expression_get_symbol_reference (_tmp149_);
891 			_tmp151_ = _tmp150_;
892 			if (VALA_IS_FIELD (_tmp151_)) {
893 				_tmp147_ = TRUE;
894 			} else {
895 				ValaExpression* _tmp152_;
896 				ValaExpression* _tmp153_;
897 				ValaSymbol* _tmp154_;
898 				ValaSymbol* _tmp155_;
899 				_tmp152_ = vala_unary_expression_get_inner (self);
900 				_tmp153_ = _tmp152_;
901 				_tmp154_ = vala_expression_get_symbol_reference (_tmp153_);
902 				_tmp155_ = _tmp154_;
903 				_tmp147_ = VALA_IS_PARAMETER (_tmp155_);
904 			}
905 			if (_tmp147_) {
906 				_tmp146_ = TRUE;
907 			} else {
908 				ValaExpression* _tmp156_;
909 				ValaExpression* _tmp157_;
910 				ValaSymbol* _tmp158_;
911 				ValaSymbol* _tmp159_;
912 				_tmp156_ = vala_unary_expression_get_inner (self);
913 				_tmp157_ = _tmp156_;
914 				_tmp158_ = vala_expression_get_symbol_reference (_tmp157_);
915 				_tmp159_ = _tmp158_;
916 				_tmp146_ = VALA_IS_LOCAL_VARIABLE (_tmp159_);
917 			}
918 			if (_tmp146_) {
919 				_tmp145_ = TRUE;
920 			} else {
921 				gboolean _tmp160_ = FALSE;
922 				ValaElementAccess* _tmp161_;
923 				_tmp161_ = ea;
924 				if (_tmp161_ != NULL) {
925 					ValaElementAccess* _tmp162_;
926 					ValaExpression* _tmp163_;
927 					ValaExpression* _tmp164_;
928 					ValaDataType* _tmp165_;
929 					ValaDataType* _tmp166_;
930 					_tmp162_ = ea;
931 					_tmp163_ = vala_element_access_get_container (_tmp162_);
932 					_tmp164_ = _tmp163_;
933 					_tmp165_ = vala_expression_get_value_type (_tmp164_);
934 					_tmp166_ = _tmp165_;
935 					_tmp160_ = VALA_IS_ARRAY_TYPE (_tmp166_);
936 				} else {
937 					_tmp160_ = FALSE;
938 				}
939 				_tmp145_ = _tmp160_;
940 			}
941 			if (_tmp145_) {
942 				ValaExpression* _tmp167_;
943 				ValaExpression* _tmp168_;
944 				ValaDataType* _tmp169_;
945 				ValaDataType* _tmp170_;
946 				vala_expression_set_lvalue ((ValaExpression*) self, TRUE);
947 				_tmp167_ = vala_unary_expression_get_inner (self);
948 				_tmp168_ = _tmp167_;
949 				_tmp169_ = vala_expression_get_value_type (_tmp168_);
950 				_tmp170_ = _tmp169_;
951 				vala_expression_set_value_type ((ValaExpression*) self, _tmp170_);
952 			} else {
953 				ValaSourceReference* _tmp171_;
954 				ValaSourceReference* _tmp172_;
955 				vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
956 				_tmp171_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
957 				_tmp172_ = _tmp171_;
958 				vala_report_error (_tmp172_, "ref and out method arguments can only be used with fields, parameters," \
959 " local variables, and array element access");
960 				result = FALSE;
961 				return result;
962 			}
963 			break;
964 		}
965 		default:
966 		{
967 			ValaSourceReference* _tmp173_;
968 			ValaSourceReference* _tmp174_;
969 			vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
970 			_tmp173_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
971 			_tmp174_ = _tmp173_;
972 			vala_report_error (_tmp174_, "internal error: unsupported unary operator");
973 			result = FALSE;
974 			return result;
975 		}
976 	}
977 	_tmp175_ = vala_expression_get_value_type ((ValaExpression*) self);
978 	_tmp176_ = _tmp175_;
979 	vala_code_node_check ((ValaCodeNode*) _tmp176_, context);
980 	_tmp177_ = vala_code_node_get_error ((ValaCodeNode*) self);
981 	_tmp178_ = _tmp177_;
982 	result = !_tmp178_;
983 	return result;
984 }
985 
986 static void
vala_unary_expression_real_emit(ValaCodeNode * base,ValaCodeGenerator * codegen)987 vala_unary_expression_real_emit (ValaCodeNode* base,
988                                  ValaCodeGenerator* codegen)
989 {
990 	ValaUnaryExpression * self;
991 	ValaExpression* _tmp0_;
992 	ValaExpression* _tmp1_;
993 	self = (ValaUnaryExpression*) base;
994 	g_return_if_fail (codegen != NULL);
995 	_tmp0_ = vala_unary_expression_get_inner (self);
996 	_tmp1_ = _tmp0_;
997 	vala_code_node_emit ((ValaCodeNode*) _tmp1_, codegen);
998 	vala_code_visitor_visit_unary_expression ((ValaCodeVisitor*) codegen, self);
999 	vala_code_visitor_visit_expression ((ValaCodeVisitor*) codegen, (ValaExpression*) self);
1000 }
1001 
1002 static void
vala_unary_expression_real_get_defined_variables(ValaCodeNode * base,ValaCollection * collection)1003 vala_unary_expression_real_get_defined_variables (ValaCodeNode* base,
1004                                                   ValaCollection* collection)
1005 {
1006 	ValaUnaryExpression * self;
1007 	ValaExpression* _tmp0_;
1008 	ValaExpression* _tmp1_;
1009 	gboolean _tmp2_ = FALSE;
1010 	ValaUnaryOperator _tmp3_;
1011 	self = (ValaUnaryExpression*) base;
1012 	g_return_if_fail (collection != NULL);
1013 	_tmp0_ = vala_unary_expression_get_inner (self);
1014 	_tmp1_ = _tmp0_;
1015 	vala_code_node_get_defined_variables ((ValaCodeNode*) _tmp1_, collection);
1016 	_tmp3_ = self->priv->_operator;
1017 	if (_tmp3_ == VALA_UNARY_OPERATOR_OUT) {
1018 		_tmp2_ = TRUE;
1019 	} else {
1020 		ValaUnaryOperator _tmp4_;
1021 		_tmp4_ = self->priv->_operator;
1022 		_tmp2_ = _tmp4_ == VALA_UNARY_OPERATOR_REF;
1023 	}
1024 	if (_tmp2_) {
1025 		ValaLocalVariable* local = NULL;
1026 		ValaExpression* _tmp5_;
1027 		ValaExpression* _tmp6_;
1028 		ValaSymbol* _tmp7_;
1029 		ValaSymbol* _tmp8_;
1030 		ValaParameter* param = NULL;
1031 		ValaExpression* _tmp9_;
1032 		ValaExpression* _tmp10_;
1033 		ValaSymbol* _tmp11_;
1034 		ValaSymbol* _tmp12_;
1035 		ValaLocalVariable* _tmp13_;
1036 		gboolean _tmp15_ = FALSE;
1037 		ValaParameter* _tmp16_;
1038 		_tmp5_ = vala_unary_expression_get_inner (self);
1039 		_tmp6_ = _tmp5_;
1040 		_tmp7_ = vala_expression_get_symbol_reference (_tmp6_);
1041 		_tmp8_ = _tmp7_;
1042 		local = VALA_IS_LOCAL_VARIABLE (_tmp8_) ? ((ValaLocalVariable*) _tmp8_) : NULL;
1043 		_tmp9_ = vala_unary_expression_get_inner (self);
1044 		_tmp10_ = _tmp9_;
1045 		_tmp11_ = vala_expression_get_symbol_reference (_tmp10_);
1046 		_tmp12_ = _tmp11_;
1047 		param = VALA_IS_PARAMETER (_tmp12_) ? ((ValaParameter*) _tmp12_) : NULL;
1048 		_tmp13_ = local;
1049 		if (_tmp13_ != NULL) {
1050 			ValaLocalVariable* _tmp14_;
1051 			_tmp14_ = local;
1052 			vala_collection_add (collection, (ValaVariable*) _tmp14_);
1053 		}
1054 		_tmp16_ = param;
1055 		if (_tmp16_ != NULL) {
1056 			ValaParameter* _tmp17_;
1057 			ValaParameterDirection _tmp18_;
1058 			ValaParameterDirection _tmp19_;
1059 			_tmp17_ = param;
1060 			_tmp18_ = vala_parameter_get_direction (_tmp17_);
1061 			_tmp19_ = _tmp18_;
1062 			_tmp15_ = _tmp19_ == VALA_PARAMETER_DIRECTION_OUT;
1063 		} else {
1064 			_tmp15_ = FALSE;
1065 		}
1066 		if (_tmp15_) {
1067 			ValaParameter* _tmp20_;
1068 			_tmp20_ = param;
1069 			vala_collection_add (collection, (ValaVariable*) _tmp20_);
1070 		}
1071 	}
1072 }
1073 
1074 static void
vala_unary_expression_real_get_used_variables(ValaCodeNode * base,ValaCollection * collection)1075 vala_unary_expression_real_get_used_variables (ValaCodeNode* base,
1076                                                ValaCollection* collection)
1077 {
1078 	ValaUnaryExpression * self;
1079 	ValaUnaryOperator _tmp0_;
1080 	self = (ValaUnaryExpression*) base;
1081 	g_return_if_fail (collection != NULL);
1082 	_tmp0_ = self->priv->_operator;
1083 	if (_tmp0_ != VALA_UNARY_OPERATOR_OUT) {
1084 		ValaExpression* _tmp1_;
1085 		ValaExpression* _tmp2_;
1086 		_tmp1_ = vala_unary_expression_get_inner (self);
1087 		_tmp2_ = _tmp1_;
1088 		vala_code_node_get_used_variables ((ValaCodeNode*) _tmp2_, collection);
1089 	}
1090 }
1091 
1092 static void
vala_unary_expression_class_init(ValaUnaryExpressionClass * klass,gpointer klass_data)1093 vala_unary_expression_class_init (ValaUnaryExpressionClass * klass,
1094                                   gpointer klass_data)
1095 {
1096 	vala_unary_expression_parent_class = g_type_class_peek_parent (klass);
1097 	((ValaCodeNodeClass *) klass)->finalize = vala_unary_expression_finalize;
1098 	g_type_class_adjust_private_offset (klass, &ValaUnaryExpression_private_offset);
1099 	((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_unary_expression_real_accept;
1100 	((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_unary_expression_real_accept_children;
1101 	((ValaCodeNodeClass *) klass)->replace_expression = (void (*) (ValaCodeNode*, ValaExpression*, ValaExpression*)) vala_unary_expression_real_replace_expression;
1102 	((ValaCodeNodeClass *) klass)->to_string = (gchar* (*) (ValaCodeNode*)) vala_unary_expression_real_to_string;
1103 	((ValaExpressionClass *) klass)->is_constant = (gboolean (*) (ValaExpression*)) vala_unary_expression_real_is_constant;
1104 	((ValaExpressionClass *) klass)->is_pure = (gboolean (*) (ValaExpression*)) vala_unary_expression_real_is_pure;
1105 	((ValaExpressionClass *) klass)->is_accessible = (gboolean (*) (ValaExpression*, ValaSymbol*)) vala_unary_expression_real_is_accessible;
1106 	((ValaCodeNodeClass *) klass)->get_error_types = (void (*) (ValaCodeNode*, ValaCollection*, ValaSourceReference*)) vala_unary_expression_real_get_error_types;
1107 	((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_unary_expression_real_check;
1108 	((ValaCodeNodeClass *) klass)->emit = (void (*) (ValaCodeNode*, ValaCodeGenerator*)) vala_unary_expression_real_emit;
1109 	((ValaCodeNodeClass *) klass)->get_defined_variables = (void (*) (ValaCodeNode*, ValaCollection*)) vala_unary_expression_real_get_defined_variables;
1110 	((ValaCodeNodeClass *) klass)->get_used_variables = (void (*) (ValaCodeNode*, ValaCollection*)) vala_unary_expression_real_get_used_variables;
1111 }
1112 
1113 static void
vala_unary_expression_instance_init(ValaUnaryExpression * self,gpointer klass)1114 vala_unary_expression_instance_init (ValaUnaryExpression * self,
1115                                      gpointer klass)
1116 {
1117 	self->priv = vala_unary_expression_get_instance_private (self);
1118 }
1119 
1120 static void
vala_unary_expression_finalize(ValaCodeNode * obj)1121 vala_unary_expression_finalize (ValaCodeNode * obj)
1122 {
1123 	ValaUnaryExpression * self;
1124 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_UNARY_EXPRESSION, ValaUnaryExpression);
1125 	_vala_code_node_unref0 (self->priv->_inner);
1126 	VALA_CODE_NODE_CLASS (vala_unary_expression_parent_class)->finalize (obj);
1127 }
1128 
1129 /**
1130  * Represents an expression with one operand in the source code.
1131  *
1132  * Supports +, -, !, ~, ref, out.
1133  */
1134 static GType
vala_unary_expression_get_type_once(void)1135 vala_unary_expression_get_type_once (void)
1136 {
1137 	static const GTypeInfo g_define_type_info = { sizeof (ValaUnaryExpressionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_unary_expression_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaUnaryExpression), 0, (GInstanceInitFunc) vala_unary_expression_instance_init, NULL };
1138 	GType vala_unary_expression_type_id;
1139 	vala_unary_expression_type_id = g_type_register_static (VALA_TYPE_EXPRESSION, "ValaUnaryExpression", &g_define_type_info, 0);
1140 	ValaUnaryExpression_private_offset = g_type_add_instance_private (vala_unary_expression_type_id, sizeof (ValaUnaryExpressionPrivate));
1141 	return vala_unary_expression_type_id;
1142 }
1143 
1144 GType
vala_unary_expression_get_type(void)1145 vala_unary_expression_get_type (void)
1146 {
1147 	static volatile gsize vala_unary_expression_type_id__volatile = 0;
1148 	if (g_once_init_enter (&vala_unary_expression_type_id__volatile)) {
1149 		GType vala_unary_expression_type_id;
1150 		vala_unary_expression_type_id = vala_unary_expression_get_type_once ();
1151 		g_once_init_leave (&vala_unary_expression_type_id__volatile, vala_unary_expression_type_id);
1152 	}
1153 	return vala_unary_expression_type_id__volatile;
1154 }
1155 
1156 const gchar*
vala_unary_operator_to_string(ValaUnaryOperator self)1157 vala_unary_operator_to_string (ValaUnaryOperator self)
1158 {
1159 	const gchar* result = NULL;
1160 	switch (self) {
1161 		case VALA_UNARY_OPERATOR_PLUS:
1162 		{
1163 			result = "+";
1164 			return result;
1165 		}
1166 		case VALA_UNARY_OPERATOR_MINUS:
1167 		{
1168 			result = "-";
1169 			return result;
1170 		}
1171 		case VALA_UNARY_OPERATOR_LOGICAL_NEGATION:
1172 		{
1173 			result = "!";
1174 			return result;
1175 		}
1176 		case VALA_UNARY_OPERATOR_BITWISE_COMPLEMENT:
1177 		{
1178 			result = "~";
1179 			return result;
1180 		}
1181 		case VALA_UNARY_OPERATOR_INCREMENT:
1182 		{
1183 			result = "++";
1184 			return result;
1185 		}
1186 		case VALA_UNARY_OPERATOR_DECREMENT:
1187 		{
1188 			result = "--";
1189 			return result;
1190 		}
1191 		case VALA_UNARY_OPERATOR_REF:
1192 		{
1193 			result = "ref ";
1194 			return result;
1195 		}
1196 		case VALA_UNARY_OPERATOR_OUT:
1197 		{
1198 			result = "out ";
1199 			return result;
1200 		}
1201 		default:
1202 		{
1203 			g_assert_not_reached ();
1204 		}
1205 	}
1206 }
1207 
1208 static GType
vala_unary_operator_get_type_once(void)1209 vala_unary_operator_get_type_once (void)
1210 {
1211 	static const GEnumValue values[] = {{VALA_UNARY_OPERATOR_NONE, "VALA_UNARY_OPERATOR_NONE", "none"}, {VALA_UNARY_OPERATOR_PLUS, "VALA_UNARY_OPERATOR_PLUS", "plus"}, {VALA_UNARY_OPERATOR_MINUS, "VALA_UNARY_OPERATOR_MINUS", "minus"}, {VALA_UNARY_OPERATOR_LOGICAL_NEGATION, "VALA_UNARY_OPERATOR_LOGICAL_NEGATION", "logical-negation"}, {VALA_UNARY_OPERATOR_BITWISE_COMPLEMENT, "VALA_UNARY_OPERATOR_BITWISE_COMPLEMENT", "bitwise-complement"}, {VALA_UNARY_OPERATOR_INCREMENT, "VALA_UNARY_OPERATOR_INCREMENT", "increment"}, {VALA_UNARY_OPERATOR_DECREMENT, "VALA_UNARY_OPERATOR_DECREMENT", "decrement"}, {VALA_UNARY_OPERATOR_REF, "VALA_UNARY_OPERATOR_REF", "ref"}, {VALA_UNARY_OPERATOR_OUT, "VALA_UNARY_OPERATOR_OUT", "out"}, {0, NULL, NULL}};
1212 	GType vala_unary_operator_type_id;
1213 	vala_unary_operator_type_id = g_enum_register_static ("ValaUnaryOperator", values);
1214 	return vala_unary_operator_type_id;
1215 }
1216 
1217 GType
vala_unary_operator_get_type(void)1218 vala_unary_operator_get_type (void)
1219 {
1220 	static volatile gsize vala_unary_operator_type_id__volatile = 0;
1221 	if (g_once_init_enter (&vala_unary_operator_type_id__volatile)) {
1222 		GType vala_unary_operator_type_id;
1223 		vala_unary_operator_type_id = vala_unary_operator_get_type_once ();
1224 		g_once_init_leave (&vala_unary_operator_type_id__volatile, vala_unary_operator_type_id);
1225 	}
1226 	return vala_unary_operator_type_id__volatile;
1227 }
1228 
1229