/* valaenum.c generated by valac, the Vala compiler
 * generated from valaenum.vala, do not modify */

/* valaenum.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 "vala.h"
#include <valagee.h>
#include <glib-object.h>
#include <glib.h>
#include <string.h>
#include <stdlib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _vala_source_file_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_file_unref (var), NULL)))

struct _ValaEnumPrivate {
	ValaList* values;
	ValaList* methods;
	ValaList* constants;
	gboolean* _is_flags;
};

static gint ValaEnum_private_offset;
static gpointer vala_enum_parent_class = NULL;

static gboolean* _bool_dup (gboolean* self);
static void vala_enum_real_add_method (ValaSymbol* base,
                                ValaMethod* m);
static void vala_enum_real_add_constant (ValaSymbol* base,
                                  ValaConstant* c);
static void vala_enum_real_accept (ValaCodeNode* base,
                            ValaCodeVisitor* visitor);
static void vala_enum_real_accept_children (ValaCodeNode* base,
                                     ValaCodeVisitor* visitor);
static gboolean vala_enum_real_is_reference_type (ValaTypeSymbol* base);
static gboolean vala_enum_real_check (ValaCodeNode* base,
                               ValaCodeContext* context);
static void vala_enum_finalize (ValaCodeNode * obj);
static GType vala_enum_get_type_once (void);

static inline gpointer
vala_enum_get_instance_private (ValaEnum* self)
{
	return G_STRUCT_MEMBER_P (self, ValaEnum_private_offset);
}

static gboolean*
_bool_dup (gboolean* self)
{
	gboolean* dup;
	dup = g_new0 (gboolean, 1);
	memcpy (dup, self, sizeof (gboolean));
	return dup;
}

static gpointer
__bool_dup0 (gpointer self)
{
	return self ? _bool_dup (self) : NULL;
}

gboolean
vala_enum_get_is_flags (ValaEnum* self)
{
	gboolean result;
	gboolean* _tmp0_;
	gboolean* _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_is_flags;
	if (_tmp0_ == NULL) {
		gboolean _tmp1_;
		gboolean* _tmp2_;
		_tmp1_ = vala_code_node_has_attribute ((ValaCodeNode*) self, "Flags");
		_tmp2_ = __bool_dup0 (&_tmp1_);
		_g_free0 (self->priv->_is_flags);
		self->priv->_is_flags = _tmp2_;
	}
	_tmp3_ = self->priv->_is_flags;
	result = *_tmp3_;
	return result;
}

/**
 * Creates a new enum.
 *
 * @param name             type name
 * @param source_reference reference to source code
 * @return                 newly created enum
 */
ValaEnum*
vala_enum_construct (GType object_type,
                     const gchar* name,
                     ValaSourceReference* source_reference,
                     ValaComment* comment)
{
	ValaEnum* self = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	self = (ValaEnum*) vala_typesymbol_construct (object_type, name, source_reference, comment);
	return self;
}

ValaEnum*
vala_enum_new (const gchar* name,
               ValaSourceReference* source_reference,
               ValaComment* comment)
{
	return vala_enum_construct (VALA_TYPE_ENUM, name, source_reference, comment);
}

/**
 * Appends the specified enum value to the list of values.
 *
 * @param value an enum value
 */
void
vala_enum_add_value (ValaEnum* self,
                     ValaEnumValue* value)
{
	ValaList* _tmp0_;
	ValaScope* _tmp1_;
	ValaScope* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (value != NULL);
	vala_symbol_set_access ((ValaSymbol*) value, VALA_SYMBOL_ACCESSIBILITY_PUBLIC);
	_tmp0_ = self->priv->values;
	vala_collection_add ((ValaCollection*) _tmp0_, value);
	_tmp1_ = vala_symbol_get_scope ((ValaSymbol*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = vala_symbol_get_name ((ValaSymbol*) value);
	_tmp4_ = _tmp3_;
	vala_scope_add (_tmp2_, _tmp4_, (ValaSymbol*) value);
}

/**
 * Adds the specified method as a member to this enum.
 *
 * @param m a method
 */
static void
vala_enum_real_add_method (ValaSymbol* base,
                           ValaMethod* m)
{
	ValaEnum * self;
	ValaMemberBinding _tmp2_;
	ValaMemberBinding _tmp3_;
	gboolean _tmp18_ = FALSE;
	ValaDataType* _tmp19_;
	ValaDataType* _tmp20_;
	ValaList* _tmp34_;
	ValaScope* _tmp35_;
	ValaScope* _tmp36_;
	const gchar* _tmp37_;
	const gchar* _tmp38_;
	self = (ValaEnum*) base;
	g_return_if_fail (m != NULL);
	if (VALA_IS_CREATION_METHOD (m)) {
		ValaSourceReference* _tmp0_;
		ValaSourceReference* _tmp1_;
		_tmp0_ = vala_code_node_get_source_reference ((ValaCodeNode*) m);
		_tmp1_ = _tmp0_;
		vala_report_error (_tmp1_, "construction methods may only be declared within classes and structs");
		vala_code_node_set_error ((ValaCodeNode*) m, TRUE);
		return;
	}
	_tmp2_ = vala_method_get_binding (m);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == VALA_MEMBER_BINDING_INSTANCE) {
		ValaEnumValueType* _tmp4_;
		ValaEnumValueType* _tmp5_;
		ValaSourceReference* _tmp6_;
		ValaSourceReference* _tmp7_;
		ValaParameter* _tmp8_;
		ValaParameter* _tmp9_;
		ValaScope* _tmp10_;
		ValaScope* _tmp11_;
		ValaParameter* _tmp12_;
		ValaParameter* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		ValaParameter* _tmp16_;
		ValaParameter* _tmp17_;
		_tmp4_ = vala_enum_value_type_new (self, NULL);
		_tmp5_ = _tmp4_;
		_tmp6_ = vala_code_node_get_source_reference ((ValaCodeNode*) m);
		_tmp7_ = _tmp6_;
		_tmp8_ = vala_parameter_new ("this", (ValaDataType*) _tmp5_, _tmp7_);
		_tmp9_ = _tmp8_;
		vala_method_set_this_parameter (m, _tmp9_);
		_vala_code_node_unref0 (_tmp9_);
		_vala_code_node_unref0 (_tmp5_);
		_tmp10_ = vala_symbol_get_scope ((ValaSymbol*) m);
		_tmp11_ = _tmp10_;
		_tmp12_ = vala_method_get_this_parameter (m);
		_tmp13_ = _tmp12_;
		_tmp14_ = vala_symbol_get_name ((ValaSymbol*) _tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = vala_method_get_this_parameter (m);
		_tmp17_ = _tmp16_;
		vala_scope_add (_tmp11_, _tmp15_, (ValaSymbol*) _tmp17_);
	}
	_tmp19_ = vala_callable_get_return_type ((ValaCallable*) m);
	_tmp20_ = _tmp19_;
	if (!VALA_IS_VOID_TYPE (_tmp20_)) {
		ValaList* _tmp21_;
		gint _tmp22_;
		gint _tmp23_;
		_tmp21_ = vala_method_get_postconditions (m);
		_tmp22_ = vala_collection_get_size ((ValaCollection*) _tmp21_);
		_tmp23_ = _tmp22_;
		_tmp18_ = _tmp23_ > 0;
	} else {
		_tmp18_ = FALSE;
	}
	if (_tmp18_) {
		ValaDataType* _tmp24_;
		ValaDataType* _tmp25_;
		ValaDataType* _tmp26_;
		ValaDataType* _tmp27_;
		ValaSourceReference* _tmp28_;
		ValaSourceReference* _tmp29_;
		ValaLocalVariable* _tmp30_;
		ValaLocalVariable* _tmp31_;
		ValaLocalVariable* _tmp32_;
		ValaLocalVariable* _tmp33_;
		_tmp24_ = vala_callable_get_return_type ((ValaCallable*) m);
		_tmp25_ = _tmp24_;
		_tmp26_ = vala_data_type_copy (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = vala_code_node_get_source_reference ((ValaCodeNode*) m);
		_tmp29_ = _tmp28_;
		_tmp30_ = vala_local_variable_new (_tmp27_, "result", NULL, _tmp29_);
		_tmp31_ = _tmp30_;
		vala_subroutine_set_result_var ((ValaSubroutine*) m, _tmp31_);
		_vala_code_node_unref0 (_tmp31_);
		_vala_code_node_unref0 (_tmp27_);
		_tmp32_ = vala_subroutine_get_result_var ((ValaSubroutine*) m);
		_tmp33_ = _tmp32_;
		vala_local_variable_set_is_result (_tmp33_, TRUE);
	}
	_tmp34_ = self->priv->methods;
	vala_collection_add ((ValaCollection*) _tmp34_, m);
	_tmp35_ = vala_symbol_get_scope ((ValaSymbol*) self);
	_tmp36_ = _tmp35_;
	_tmp37_ = vala_symbol_get_name ((ValaSymbol*) m);
	_tmp38_ = _tmp37_;
	vala_scope_add (_tmp36_, _tmp38_, (ValaSymbol*) m);
}

/**
 * Adds the specified constant as a member to this enum.
 *
 * @param c a constant
 */
static void
vala_enum_real_add_constant (ValaSymbol* base,
                             ValaConstant* c)
{
	ValaEnum * self;
	ValaList* _tmp0_;
	ValaScope* _tmp1_;
	ValaScope* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	self = (ValaEnum*) base;
	g_return_if_fail (c != NULL);
	_tmp0_ = self->priv->constants;
	vala_collection_add ((ValaCollection*) _tmp0_, c);
	_tmp1_ = vala_symbol_get_scope ((ValaSymbol*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = vala_symbol_get_name ((ValaSymbol*) c);
	_tmp4_ = _tmp3_;
	vala_scope_add (_tmp2_, _tmp4_, (ValaSymbol*) c);
}

/**
 * Returns the list of enum values.
 *
 * @return list of enum values
 */
ValaList*
vala_enum_get_values (ValaEnum* self)
{
	ValaList* _tmp0_;
	ValaList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->values;
	result = _tmp0_;
	return result;
}

/**
 * Returns the list of methods.
 *
 * @return list of methods
 */
ValaList*
vala_enum_get_methods (ValaEnum* self)
{
	ValaList* _tmp0_;
	ValaList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->methods;
	result = _tmp0_;
	return result;
}

/**
 * Returns the list of constants.
 *
 * @return list of constants
 */
ValaList*
vala_enum_get_constants (ValaEnum* self)
{
	ValaList* _tmp0_;
	ValaList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->constants;
	result = _tmp0_;
	return result;
}

static void
vala_enum_real_accept (ValaCodeNode* base,
                       ValaCodeVisitor* visitor)
{
	ValaEnum * self;
	self = (ValaEnum*) base;
	g_return_if_fail (visitor != NULL);
	vala_code_visitor_visit_enum (visitor, self);
}

static void
vala_enum_real_accept_children (ValaCodeNode* base,
                                ValaCodeVisitor* visitor)
{
	ValaEnum * self;
	self = (ValaEnum*) base;
	g_return_if_fail (visitor != NULL);
	{
		ValaList* _value_list = NULL;
		ValaList* _tmp0_;
		gint _value_size = 0;
		ValaList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _value_index = 0;
		_tmp0_ = self->priv->values;
		_value_list = _tmp0_;
		_tmp1_ = _value_list;
		_tmp2_ = vala_collection_get_size ((ValaCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_value_size = _tmp3_;
		_value_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			ValaEnumValue* value = NULL;
			ValaList* _tmp6_;
			gpointer _tmp7_;
			ValaEnumValue* _tmp8_;
			_value_index = _value_index + 1;
			_tmp4_ = _value_index;
			_tmp5_ = _value_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _value_list;
			_tmp7_ = vala_list_get (_tmp6_, _value_index);
			value = (ValaEnumValue*) _tmp7_;
			_tmp8_ = value;
			vala_code_node_accept ((ValaCodeNode*) _tmp8_, visitor);
			_vala_code_node_unref0 (value);
		}
	}
	{
		ValaList* _m_list = NULL;
		ValaList* _tmp9_;
		gint _m_size = 0;
		ValaList* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		gint _m_index = 0;
		_tmp9_ = self->priv->methods;
		_m_list = _tmp9_;
		_tmp10_ = _m_list;
		_tmp11_ = vala_collection_get_size ((ValaCollection*) _tmp10_);
		_tmp12_ = _tmp11_;
		_m_size = _tmp12_;
		_m_index = -1;
		while (TRUE) {
			gint _tmp13_;
			gint _tmp14_;
			ValaMethod* m = NULL;
			ValaList* _tmp15_;
			gpointer _tmp16_;
			ValaMethod* _tmp17_;
			_m_index = _m_index + 1;
			_tmp13_ = _m_index;
			_tmp14_ = _m_size;
			if (!(_tmp13_ < _tmp14_)) {
				break;
			}
			_tmp15_ = _m_list;
			_tmp16_ = vala_list_get (_tmp15_, _m_index);
			m = (ValaMethod*) _tmp16_;
			_tmp17_ = m;
			vala_code_node_accept ((ValaCodeNode*) _tmp17_, visitor);
			_vala_code_node_unref0 (m);
		}
	}
	{
		ValaList* _c_list = NULL;
		ValaList* _tmp18_;
		gint _c_size = 0;
		ValaList* _tmp19_;
		gint _tmp20_;
		gint _tmp21_;
		gint _c_index = 0;
		_tmp18_ = self->priv->constants;
		_c_list = _tmp18_;
		_tmp19_ = _c_list;
		_tmp20_ = vala_collection_get_size ((ValaCollection*) _tmp19_);
		_tmp21_ = _tmp20_;
		_c_size = _tmp21_;
		_c_index = -1;
		while (TRUE) {
			gint _tmp22_;
			gint _tmp23_;
			ValaConstant* c = NULL;
			ValaList* _tmp24_;
			gpointer _tmp25_;
			ValaConstant* _tmp26_;
			_c_index = _c_index + 1;
			_tmp22_ = _c_index;
			_tmp23_ = _c_size;
			if (!(_tmp22_ < _tmp23_)) {
				break;
			}
			_tmp24_ = _c_list;
			_tmp25_ = vala_list_get (_tmp24_, _c_index);
			c = (ValaConstant*) _tmp25_;
			_tmp26_ = c;
			vala_code_node_accept ((ValaCodeNode*) _tmp26_, visitor);
			_vala_code_node_unref0 (c);
		}
	}
}

static gboolean
vala_enum_real_is_reference_type (ValaTypeSymbol* base)
{
	ValaEnum * self;
	gboolean result;
	self = (ValaEnum*) base;
	result = FALSE;
	return result;
}

static gpointer
_vala_source_file_ref0 (gpointer self)
{
	return self ? vala_source_file_ref (self) : NULL;
}

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

static gboolean
vala_enum_real_check (ValaCodeNode* base,
                      ValaCodeContext* context)
{
	ValaEnum * self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	ValaSourceFile* old_source_file = NULL;
	ValaSemanticAnalyzer* _tmp4_;
	ValaSemanticAnalyzer* _tmp5_;
	ValaSourceFile* _tmp6_;
	ValaSourceFile* _tmp7_;
	ValaSourceFile* _tmp8_;
	ValaSymbol* old_symbol = NULL;
	ValaSemanticAnalyzer* _tmp9_;
	ValaSemanticAnalyzer* _tmp10_;
	ValaSymbol* _tmp11_;
	ValaSymbol* _tmp12_;
	ValaSymbol* _tmp13_;
	ValaSourceReference* _tmp14_;
	ValaSourceReference* _tmp15_;
	ValaSemanticAnalyzer* _tmp22_;
	ValaSemanticAnalyzer* _tmp23_;
	ValaList* _tmp24_;
	gint _tmp25_;
	gint _tmp26_;
	ValaSemanticAnalyzer* _tmp58_;
	ValaSemanticAnalyzer* _tmp59_;
	ValaSourceFile* _tmp60_;
	ValaSemanticAnalyzer* _tmp61_;
	ValaSemanticAnalyzer* _tmp62_;
	ValaSymbol* _tmp63_;
	gboolean _tmp64_;
	gboolean _tmp65_;
	gboolean result;
	self = (ValaEnum*) 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_source_file (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _vala_source_file_ref0 (_tmp7_);
	old_source_file = _tmp8_;
	_tmp9_ = vala_code_context_get_analyzer (context);
	_tmp10_ = _tmp9_;
	_tmp11_ = vala_semantic_analyzer_get_current_symbol (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = _vala_code_node_ref0 (_tmp12_);
	old_symbol = _tmp13_;
	_tmp14_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp15_ = _tmp14_;
	if (_tmp15_ != NULL) {
		ValaSemanticAnalyzer* _tmp16_;
		ValaSemanticAnalyzer* _tmp17_;
		ValaSourceReference* _tmp18_;
		ValaSourceReference* _tmp19_;
		ValaSourceFile* _tmp20_;
		ValaSourceFile* _tmp21_;
		_tmp16_ = vala_code_context_get_analyzer (context);
		_tmp17_ = _tmp16_;
		_tmp18_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
		_tmp19_ = _tmp18_;
		_tmp20_ = vala_source_reference_get_file (_tmp19_);
		_tmp21_ = _tmp20_;
		vala_semantic_analyzer_set_current_source_file (_tmp17_, _tmp21_);
	}
	_tmp22_ = vala_code_context_get_analyzer (context);
	_tmp23_ = _tmp22_;
	vala_semantic_analyzer_set_current_symbol (_tmp23_, (ValaSymbol*) self);
	_tmp24_ = self->priv->values;
	_tmp25_ = vala_collection_get_size ((ValaCollection*) _tmp24_);
	_tmp26_ = _tmp25_;
	if (_tmp26_ <= 0) {
		ValaSourceReference* _tmp27_;
		ValaSourceReference* _tmp28_;
		gchar* _tmp29_;
		gchar* _tmp30_;
		_tmp27_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
		_tmp28_ = _tmp27_;
		_tmp29_ = vala_symbol_get_full_name ((ValaSymbol*) self);
		_tmp30_ = _tmp29_;
		vala_report_error (_tmp28_, "Enum `%s' requires at least one value", _tmp30_);
		_g_free0 (_tmp30_);
		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
		result = FALSE;
		_vala_code_node_unref0 (old_symbol);
		_vala_source_file_unref0 (old_source_file);
		return result;
	}
	{
		ValaList* _value_list = NULL;
		ValaList* _tmp31_;
		gint _value_size = 0;
		ValaList* _tmp32_;
		gint _tmp33_;
		gint _tmp34_;
		gint _value_index = 0;
		_tmp31_ = self->priv->values;
		_value_list = _tmp31_;
		_tmp32_ = _value_list;
		_tmp33_ = vala_collection_get_size ((ValaCollection*) _tmp32_);
		_tmp34_ = _tmp33_;
		_value_size = _tmp34_;
		_value_index = -1;
		while (TRUE) {
			gint _tmp35_;
			gint _tmp36_;
			ValaEnumValue* value = NULL;
			ValaList* _tmp37_;
			gpointer _tmp38_;
			ValaEnumValue* _tmp39_;
			_value_index = _value_index + 1;
			_tmp35_ = _value_index;
			_tmp36_ = _value_size;
			if (!(_tmp35_ < _tmp36_)) {
				break;
			}
			_tmp37_ = _value_list;
			_tmp38_ = vala_list_get (_tmp37_, _value_index);
			value = (ValaEnumValue*) _tmp38_;
			_tmp39_ = value;
			vala_code_node_check ((ValaCodeNode*) _tmp39_, context);
			_vala_code_node_unref0 (value);
		}
	}
	{
		ValaList* _m_list = NULL;
		ValaList* _tmp40_;
		gint _m_size = 0;
		ValaList* _tmp41_;
		gint _tmp42_;
		gint _tmp43_;
		gint _m_index = 0;
		_tmp40_ = self->priv->methods;
		_m_list = _tmp40_;
		_tmp41_ = _m_list;
		_tmp42_ = vala_collection_get_size ((ValaCollection*) _tmp41_);
		_tmp43_ = _tmp42_;
		_m_size = _tmp43_;
		_m_index = -1;
		while (TRUE) {
			gint _tmp44_;
			gint _tmp45_;
			ValaMethod* m = NULL;
			ValaList* _tmp46_;
			gpointer _tmp47_;
			ValaMethod* _tmp48_;
			_m_index = _m_index + 1;
			_tmp44_ = _m_index;
			_tmp45_ = _m_size;
			if (!(_tmp44_ < _tmp45_)) {
				break;
			}
			_tmp46_ = _m_list;
			_tmp47_ = vala_list_get (_tmp46_, _m_index);
			m = (ValaMethod*) _tmp47_;
			_tmp48_ = m;
			vala_code_node_check ((ValaCodeNode*) _tmp48_, context);
			_vala_code_node_unref0 (m);
		}
	}
	{
		ValaList* _c_list = NULL;
		ValaList* _tmp49_;
		gint _c_size = 0;
		ValaList* _tmp50_;
		gint _tmp51_;
		gint _tmp52_;
		gint _c_index = 0;
		_tmp49_ = self->priv->constants;
		_c_list = _tmp49_;
		_tmp50_ = _c_list;
		_tmp51_ = vala_collection_get_size ((ValaCollection*) _tmp50_);
		_tmp52_ = _tmp51_;
		_c_size = _tmp52_;
		_c_index = -1;
		while (TRUE) {
			gint _tmp53_;
			gint _tmp54_;
			ValaConstant* c = NULL;
			ValaList* _tmp55_;
			gpointer _tmp56_;
			ValaConstant* _tmp57_;
			_c_index = _c_index + 1;
			_tmp53_ = _c_index;
			_tmp54_ = _c_size;
			if (!(_tmp53_ < _tmp54_)) {
				break;
			}
			_tmp55_ = _c_list;
			_tmp56_ = vala_list_get (_tmp55_, _c_index);
			c = (ValaConstant*) _tmp56_;
			_tmp57_ = c;
			vala_code_node_check ((ValaCodeNode*) _tmp57_, context);
			_vala_code_node_unref0 (c);
		}
	}
	_tmp58_ = vala_code_context_get_analyzer (context);
	_tmp59_ = _tmp58_;
	_tmp60_ = old_source_file;
	vala_semantic_analyzer_set_current_source_file (_tmp59_, _tmp60_);
	_tmp61_ = vala_code_context_get_analyzer (context);
	_tmp62_ = _tmp61_;
	_tmp63_ = old_symbol;
	vala_semantic_analyzer_set_current_symbol (_tmp62_, _tmp63_);
	_tmp64_ = vala_code_node_get_error ((ValaCodeNode*) self);
	_tmp65_ = _tmp64_;
	result = !_tmp65_;
	_vala_code_node_unref0 (old_symbol);
	_vala_source_file_unref0 (old_source_file);
	return result;
}

static void
vala_enum_class_init (ValaEnumClass * klass,
                      gpointer klass_data)
{
	vala_enum_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeNodeClass *) klass)->finalize = vala_enum_finalize;
	g_type_class_adjust_private_offset (klass, &ValaEnum_private_offset);
	((ValaSymbolClass *) klass)->add_method = (void (*) (ValaSymbol*, ValaMethod*)) vala_enum_real_add_method;
	((ValaSymbolClass *) klass)->add_constant = (void (*) (ValaSymbol*, ValaConstant*)) vala_enum_real_add_constant;
	((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_enum_real_accept;
	((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_enum_real_accept_children;
	((ValaTypeSymbolClass *) klass)->is_reference_type = (gboolean (*) (ValaTypeSymbol*)) vala_enum_real_is_reference_type;
	((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_enum_real_check;
}

static void
vala_enum_instance_init (ValaEnum * self,
                         gpointer klass)
{
	GEqualFunc _tmp0_;
	ValaArrayList* _tmp1_;
	GEqualFunc _tmp2_;
	ValaArrayList* _tmp3_;
	GEqualFunc _tmp4_;
	ValaArrayList* _tmp5_;
	self->priv = vala_enum_get_instance_private (self);
	_tmp0_ = g_direct_equal;
	_tmp1_ = vala_array_list_new (VALA_TYPE_ENUM_VALUE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp0_);
	self->priv->values = (ValaList*) _tmp1_;
	_tmp2_ = g_direct_equal;
	_tmp3_ = vala_array_list_new (VALA_TYPE_METHOD, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp2_);
	self->priv->methods = (ValaList*) _tmp3_;
	_tmp4_ = g_direct_equal;
	_tmp5_ = vala_array_list_new (VALA_TYPE_CONSTANT, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp4_);
	self->priv->constants = (ValaList*) _tmp5_;
}

static void
vala_enum_finalize (ValaCodeNode * obj)
{
	ValaEnum * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_ENUM, ValaEnum);
	_vala_iterable_unref0 (self->priv->values);
	_vala_iterable_unref0 (self->priv->methods);
	_vala_iterable_unref0 (self->priv->constants);
	_g_free0 (self->priv->_is_flags);
	VALA_CODE_NODE_CLASS (vala_enum_parent_class)->finalize (obj);
}

/**
 * Represents an enum declaration in the source code.
 */
static GType
vala_enum_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValaEnumClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_enum_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaEnum), 0, (GInstanceInitFunc) vala_enum_instance_init, NULL };
	GType vala_enum_type_id;
	vala_enum_type_id = g_type_register_static (VALA_TYPE_TYPESYMBOL, "ValaEnum", &g_define_type_info, 0);
	ValaEnum_private_offset = g_type_add_instance_private (vala_enum_type_id, sizeof (ValaEnumPrivate));
	return vala_enum_type_id;
}

GType
vala_enum_get_type (void)
{
	static volatile gsize vala_enum_type_id__once = 0;
	if (g_once_init_enter (&vala_enum_type_id__once)) {
		GType vala_enum_type_id;
		vala_enum_type_id = vala_enum_get_type_once ();
		g_once_init_leave (&vala_enum_type_id__once, vala_enum_type_id);
	}
	return vala_enum_type_id__once;
}

