File: valadestructor.c

package info (click to toggle)
vala 0.42.5-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 41,584 kB
  • sloc: ansic: 557,663; sh: 4,808; xml: 3,135; makefile: 2,864; yacc: 1,218; lex: 374; perl: 106
file content (301 lines) | stat: -rw-r--r-- 9,045 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
/* valadestructor.c generated by valac, the Vala compiler
 * generated from valadestructor.vala, do not modify */

/* valadestructor.vala
 *
 * Copyright (C) 2006-2010  Jürg Billeter
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
 */


#include <glib.h>
#include <glib-object.h>
#include "vala.h"

#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))

struct _ValaDestructorPrivate {
	ValaParameter* _this_parameter;
	ValaMemberBinding _binding;
};


static gint ValaDestructor_private_offset;
static gpointer vala_destructor_parent_class = NULL;

static void vala_destructor_real_accept (ValaCodeNode* base,
                                  ValaCodeVisitor* visitor);
static void vala_destructor_real_accept_children (ValaCodeNode* base,
                                           ValaCodeVisitor* visitor);
static gboolean vala_destructor_real_check (ValaCodeNode* base,
                                     ValaCodeContext* context);
static void vala_destructor_finalize (ValaCodeNode * obj);


static inline gpointer
vala_destructor_get_instance_private (ValaDestructor* self)
{
	return G_STRUCT_MEMBER_P (self, ValaDestructor_private_offset);
}


/**
 * Creates a new destructor.
 *
 * @param source_reference reference to source code
 * @return                 newly created destructor
 */
ValaDestructor*
vala_destructor_construct (GType object_type,
                           ValaSourceReference* source_reference)
{
	ValaDestructor* self = NULL;
	self = (ValaDestructor*) vala_subroutine_construct (object_type, NULL, source_reference, NULL);
	return self;
}


ValaDestructor*
vala_destructor_new (ValaSourceReference* source_reference)
{
	return vala_destructor_construct (VALA_TYPE_DESTRUCTOR, source_reference);
}


static void
vala_destructor_real_accept (ValaCodeNode* base,
                             ValaCodeVisitor* visitor)
{
	ValaDestructor * self;
	self = (ValaDestructor*) base;
	g_return_if_fail (visitor != NULL);
	vala_code_visitor_visit_destructor (visitor, self);
}


static void
vala_destructor_real_accept_children (ValaCodeNode* base,
                                      ValaCodeVisitor* visitor)
{
	ValaDestructor * self;
	ValaBlock* _tmp0_;
	ValaBlock* _tmp1_;
	self = (ValaDestructor*) base;
	g_return_if_fail (visitor != NULL);
	_tmp0_ = vala_subroutine_get_body ((ValaSubroutine*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != NULL) {
		ValaBlock* _tmp2_;
		ValaBlock* _tmp3_;
		_tmp2_ = vala_subroutine_get_body ((ValaSubroutine*) self);
		_tmp3_ = _tmp2_;
		vala_code_node_accept ((ValaCodeNode*) _tmp3_, visitor);
	}
}


static gboolean
vala_destructor_real_check (ValaCodeNode* base,
                            ValaCodeContext* context)
{
	ValaDestructor * self;
	gboolean result = FALSE;
	gboolean _tmp0_;
	gboolean _tmp1_;
	ValaSemanticAnalyzer* _tmp4_;
	ValaSemanticAnalyzer* _tmp5_;
	ValaSymbol* _tmp6_;
	ValaSymbol* _tmp7_;
	ValaScope* _tmp8_;
	ValaScope* _tmp9_;
	ValaSemanticAnalyzer* _tmp10_;
	ValaSemanticAnalyzer* _tmp11_;
	ValaBlock* _tmp12_;
	ValaBlock* _tmp13_;
	ValaSemanticAnalyzer* _tmp16_;
	ValaSemanticAnalyzer* _tmp17_;
	ValaSemanticAnalyzer* _tmp18_;
	ValaSemanticAnalyzer* _tmp19_;
	ValaSymbol* _tmp20_;
	ValaSymbol* _tmp21_;
	ValaSymbol* _tmp22_;
	ValaSymbol* _tmp23_;
	gboolean _tmp24_;
	gboolean _tmp25_;
	self = (ValaDestructor*) base;
	g_return_val_if_fail (context != NULL, FALSE);
	_tmp0_ = vala_code_node_get_checked ((ValaCodeNode*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		gboolean _tmp2_;
		gboolean _tmp3_;
		_tmp2_ = vala_code_node_get_error ((ValaCodeNode*) self);
		_tmp3_ = _tmp2_;
		result = !_tmp3_;
		return result;
	}
	vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
	_tmp4_ = vala_code_context_get_analyzer (context);
	_tmp5_ = _tmp4_;
	_tmp6_ = vala_semantic_analyzer_get_current_symbol (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = vala_symbol_get_scope (_tmp7_);
	_tmp9_ = _tmp8_;
	vala_symbol_set_owner ((ValaSymbol*) self, _tmp9_);
	_tmp10_ = vala_code_context_get_analyzer (context);
	_tmp11_ = _tmp10_;
	vala_semantic_analyzer_set_current_symbol (_tmp11_, (ValaSymbol*) self);
	_tmp12_ = vala_subroutine_get_body ((ValaSubroutine*) self);
	_tmp13_ = _tmp12_;
	if (_tmp13_ != NULL) {
		ValaBlock* _tmp14_;
		ValaBlock* _tmp15_;
		_tmp14_ = vala_subroutine_get_body ((ValaSubroutine*) self);
		_tmp15_ = _tmp14_;
		vala_code_node_check ((ValaCodeNode*) _tmp15_, context);
	}
	_tmp16_ = vala_code_context_get_analyzer (context);
	_tmp17_ = _tmp16_;
	_tmp18_ = vala_code_context_get_analyzer (context);
	_tmp19_ = _tmp18_;
	_tmp20_ = vala_semantic_analyzer_get_current_symbol (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = vala_symbol_get_parent_symbol (_tmp21_);
	_tmp23_ = _tmp22_;
	vala_semantic_analyzer_set_current_symbol (_tmp17_, _tmp23_);
	_tmp24_ = vala_code_node_get_error ((ValaCodeNode*) self);
	_tmp25_ = _tmp24_;
	result = !_tmp25_;
	return result;
}


ValaParameter*
vala_destructor_get_this_parameter (ValaDestructor* self)
{
	ValaParameter* result;
	ValaParameter* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_this_parameter;
	result = _tmp0_;
	return result;
}


static gpointer
_vala_code_node_ref0 (gpointer self)
{
	return self ? vala_code_node_ref (self) : NULL;
}


void
vala_destructor_set_this_parameter (ValaDestructor* self,
                                    ValaParameter* value)
{
	ValaParameter* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _vala_code_node_ref0 (value);
	_vala_code_node_unref0 (self->priv->_this_parameter);
	self->priv->_this_parameter = _tmp0_;
}


ValaMemberBinding
vala_destructor_get_binding (ValaDestructor* self)
{
	ValaMemberBinding result;
	ValaMemberBinding _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_binding;
	result = _tmp0_;
	return result;
}


void
vala_destructor_set_binding (ValaDestructor* self,
                             ValaMemberBinding value)
{
	g_return_if_fail (self != NULL);
	self->priv->_binding = value;
}


static gboolean
vala_destructor_real_get_has_result (ValaSubroutine* base)
{
	gboolean result;
	ValaDestructor* self;
	self = (ValaDestructor*) base;
	result = FALSE;
	return result;
}


static void
vala_destructor_class_init (ValaDestructorClass * klass)
{
	vala_destructor_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeNodeClass *) klass)->finalize = vala_destructor_finalize;
	g_type_class_adjust_private_offset (klass, &ValaDestructor_private_offset);
	((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_destructor_real_accept;
	((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_destructor_real_accept_children;
	((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_destructor_real_check;
	VALA_SUBROUTINE_CLASS (klass)->get_has_result = vala_destructor_real_get_has_result;
}


static void
vala_destructor_instance_init (ValaDestructor * self)
{
	self->priv = vala_destructor_get_instance_private (self);
	self->priv->_binding = VALA_MEMBER_BINDING_INSTANCE;
}


static void
vala_destructor_finalize (ValaCodeNode * obj)
{
	ValaDestructor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_DESTRUCTOR, ValaDestructor);
	_vala_code_node_unref0 (self->priv->_this_parameter);
	VALA_CODE_NODE_CLASS (vala_destructor_parent_class)->finalize (obj);
}


/**
 * Represents a class or instance destructor.
 */
GType
vala_destructor_get_type (void)
{
	static volatile gsize vala_destructor_type_id__volatile = 0;
	if (g_once_init_enter (&vala_destructor_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValaDestructorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_destructor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaDestructor), 0, (GInstanceInitFunc) vala_destructor_instance_init, NULL };
		GType vala_destructor_type_id;
		vala_destructor_type_id = g_type_register_static (VALA_TYPE_SUBROUTINE, "ValaDestructor", &g_define_type_info, 0);
		ValaDestructor_private_offset = g_type_add_instance_private (vala_destructor_type_id, sizeof (ValaDestructorPrivate));
		g_once_init_leave (&vala_destructor_type_id__volatile, vala_destructor_type_id);
	}
	return vala_destructor_type_id__volatile;
}