/* sourcefile.c generated by valac 0.12.1.1-323029-dirty, the Vala compiler
 * generated from sourcefile.vala, do not modify */

/* sourcefile.vala
 *
 * Copyright (C) 2009  Andrea Del Signore
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 * Author:
 * 	Andrea Del Signore <sejerpz@tin.it>
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <valagee.h>
#include <gio/gio.h>
#include <gobject/gvaluecollector.h>


#define AFRODITE_TYPE_SOURCE_FILE (afrodite_source_file_get_type ())
#define AFRODITE_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_SOURCE_FILE, AfroditeSourceFile))
#define AFRODITE_SOURCE_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_SOURCE_FILE, AfroditeSourceFileClass))
#define AFRODITE_IS_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_SOURCE_FILE))
#define AFRODITE_IS_SOURCE_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_SOURCE_FILE))
#define AFRODITE_SOURCE_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_SOURCE_FILE, AfroditeSourceFileClass))

typedef struct _AfroditeSourceFile AfroditeSourceFile;
typedef struct _AfroditeSourceFileClass AfroditeSourceFileClass;
typedef struct _AfroditeSourceFilePrivate AfroditeSourceFilePrivate;

#define AFRODITE_TYPE_DATA_TYPE (afrodite_data_type_get_type ())
#define AFRODITE_DATA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_DATA_TYPE, AfroditeDataType))
#define AFRODITE_DATA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_DATA_TYPE, AfroditeDataTypeClass))
#define AFRODITE_IS_DATA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_DATA_TYPE))
#define AFRODITE_IS_DATA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_DATA_TYPE))
#define AFRODITE_DATA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_DATA_TYPE, AfroditeDataTypeClass))

typedef struct _AfroditeDataType AfroditeDataType;
typedef struct _AfroditeDataTypeClass AfroditeDataTypeClass;

#define AFRODITE_TYPE_SYMBOL (afrodite_symbol_get_type ())
#define AFRODITE_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_SYMBOL, AfroditeSymbol))
#define AFRODITE_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_SYMBOL, AfroditeSymbolClass))
#define AFRODITE_IS_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_SYMBOL))
#define AFRODITE_IS_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_SYMBOL))
#define AFRODITE_SYMBOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_SYMBOL, AfroditeSymbolClass))

typedef struct _AfroditeSymbol AfroditeSymbol;
typedef struct _AfroditeSymbolClass AfroditeSymbolClass;

#define AFRODITE_TYPE_CODE_DOM (afrodite_code_dom_get_type ())
#define AFRODITE_CODE_DOM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_CODE_DOM, AfroditeCodeDom))
#define AFRODITE_CODE_DOM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_CODE_DOM, AfroditeCodeDomClass))
#define AFRODITE_IS_CODE_DOM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_CODE_DOM))
#define AFRODITE_IS_CODE_DOM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_CODE_DOM))
#define AFRODITE_CODE_DOM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_CODE_DOM, AfroditeCodeDomClass))

typedef struct _AfroditeCodeDom AfroditeCodeDom;
typedef struct _AfroditeCodeDomClass AfroditeCodeDomClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _afrodite_data_type_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_data_type_unref (var), NULL)))
typedef struct _AfroditeCodeDomPrivate AfroditeCodeDomPrivate;

#define AFRODITE_TYPE_SOURCE_REFERENCE (afrodite_source_reference_get_type ())
#define AFRODITE_SOURCE_REFERENCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_SOURCE_REFERENCE, AfroditeSourceReference))
#define AFRODITE_SOURCE_REFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_SOURCE_REFERENCE, AfroditeSourceReferenceClass))
#define AFRODITE_IS_SOURCE_REFERENCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_SOURCE_REFERENCE))
#define AFRODITE_IS_SOURCE_REFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_SOURCE_REFERENCE))
#define AFRODITE_SOURCE_REFERENCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_SOURCE_REFERENCE, AfroditeSourceReferenceClass))

typedef struct _AfroditeSourceReference AfroditeSourceReference;
typedef struct _AfroditeSourceReferenceClass AfroditeSourceReferenceClass;
#define _afrodite_source_reference_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_source_reference_unref (var), NULL)))
typedef struct _AfroditeParamSpecSourceFile AfroditeParamSpecSourceFile;

struct _AfroditeSourceFile {
	GTypeInstance parent_instance;
	volatile int ref_count;
	AfroditeSourceFilePrivate * priv;
	GTimeVal last_modification_time;
};

struct _AfroditeSourceFileClass {
	GTypeClass parent_class;
	void (*finalize) (AfroditeSourceFile *self);
};

struct _AfroditeSourceFilePrivate {
	gchar* _filename;
	ValaList* _using_directives;
	ValaList* _symbols;
	AfroditeCodeDom* _codedom;
};

struct _AfroditeCodeDom {
	GTypeInstance parent_instance;
	volatile int ref_count;
	AfroditeCodeDomPrivate * priv;
	ValaHashMap* symbols;
	ValaList* unresolved_symbols;
};

struct _AfroditeCodeDomClass {
	GTypeClass parent_class;
	void (*finalize) (AfroditeCodeDom *self);
};

struct _AfroditeParamSpecSourceFile {
	GParamSpec parent_instance;
};


static gpointer afrodite_source_file_parent_class = NULL;

gpointer afrodite_source_file_ref (gpointer instance);
void afrodite_source_file_unref (gpointer instance);
GParamSpec* afrodite_param_spec_source_file (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_source_file (GValue* value, gpointer v_object);
void afrodite_value_take_source_file (GValue* value, gpointer v_object);
gpointer afrodite_value_get_source_file (const GValue* value);
GType afrodite_source_file_get_type (void) G_GNUC_CONST;
gpointer afrodite_data_type_ref (gpointer instance);
void afrodite_data_type_unref (gpointer instance);
GParamSpec* afrodite_param_spec_data_type (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_data_type (GValue* value, gpointer v_object);
void afrodite_value_take_data_type (GValue* value, gpointer v_object);
gpointer afrodite_value_get_data_type (const GValue* value);
GType afrodite_data_type_get_type (void) G_GNUC_CONST;
GType afrodite_symbol_get_type (void) G_GNUC_CONST;
gpointer afrodite_code_dom_ref (gpointer instance);
void afrodite_code_dom_unref (gpointer instance);
GParamSpec* afrodite_param_spec_code_dom (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_code_dom (GValue* value, gpointer v_object);
void afrodite_value_take_code_dom (GValue* value, gpointer v_object);
gpointer afrodite_value_get_code_dom (const GValue* value);
GType afrodite_code_dom_get_type (void) G_GNUC_CONST;
#define AFRODITE_SOURCE_FILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), AFRODITE_TYPE_SOURCE_FILE, AfroditeSourceFilePrivate))
enum  {
	AFRODITE_SOURCE_FILE_DUMMY_PROPERTY
};
void afrodite_utils_trace (const gchar* format, ...);
const gchar* afrodite_source_file_get_filename (AfroditeSourceFile* self);
ValaList* afrodite_source_file_get_symbols (AfroditeSourceFile* self);
void afrodite_source_file_remove_symbol (AfroditeSourceFile* self, AfroditeSymbol* symbol);
AfroditeSourceFile* afrodite_source_file_new (const gchar* filename);
AfroditeSourceFile* afrodite_source_file_construct (GType object_type, const gchar* filename);
void afrodite_source_file_set_filename (AfroditeSourceFile* self, const gchar* value);
gboolean afrodite_source_file_update_last_modification_time (AfroditeSourceFile* self);
AfroditeDataType* afrodite_source_file_add_using_directive (AfroditeSourceFile* self, const gchar* name);
AfroditeDataType* afrodite_source_file_lookup_using_directive (AfroditeSourceFile* self, const gchar* name);
ValaList* afrodite_source_file_get_using_directives (AfroditeSourceFile* self);
void afrodite_source_file_set_using_directives (AfroditeSourceFile* self, ValaList* value);
AfroditeDataType* afrodite_data_type_new (const gchar* type_name, const gchar* name);
AfroditeDataType* afrodite_data_type_construct (GType object_type, const gchar* type_name, const gchar* name);
const gchar* afrodite_data_type_get_type_name (AfroditeDataType* self);
void afrodite_source_file_remove_using_directive (AfroditeSourceFile* self, const gchar* name);
void afrodite_source_file_add_symbol (AfroditeSourceFile* self, AfroditeSymbol* symbol);
void afrodite_source_file_set_symbols (AfroditeSourceFile* self, ValaList* value);
AfroditeCodeDom* afrodite_source_file_get_codedom (AfroditeSourceFile* self);
gchar* afrodite_symbol_get_fully_qualified_name (AfroditeSymbol* self);
gpointer afrodite_source_reference_ref (gpointer instance);
void afrodite_source_reference_unref (gpointer instance);
GParamSpec* afrodite_param_spec_source_reference (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_source_reference (GValue* value, gpointer v_object);
void afrodite_value_take_source_reference (GValue* value, gpointer v_object);
gpointer afrodite_value_get_source_reference (const GValue* value);
GType afrodite_source_reference_get_type (void) G_GNUC_CONST;
AfroditeSourceReference* afrodite_symbol_lookup_source_reference_sourcefile (AfroditeSymbol* self, AfroditeSourceFile* source);
void afrodite_symbol_remove_source_reference (AfroditeSymbol* self, AfroditeSourceReference* reference);
gboolean afrodite_symbol_get_has_source_references (AfroditeSymbol* self);
void afrodite_source_file_remove_symbol_from_codedom (AfroditeSourceFile* self, AfroditeSymbol* symbol);
AfroditeSymbol* afrodite_symbol_get_parent (AfroditeSymbol* self);
gboolean afrodite_symbol_get_is_generic_type_argument (AfroditeSymbol* self);
void afrodite_symbol_remove_generic_type_argument (AfroditeSymbol* self, AfroditeSymbol* sym);
gboolean afrodite_symbol_get_has_children (AfroditeSymbol* self);
void afrodite_symbol_remove_child (AfroditeSymbol* self, AfroditeSymbol* child);
AfroditeSymbol* afrodite_symbol_get_generic_parent (AfroditeSymbol* self);
gboolean afrodite_symbol_get_has_specialized_symbols (AfroditeSymbol* self);
void afrodite_symbol_remove_specialized_symbol (AfroditeSymbol* self, AfroditeSymbol* item);
void afrodite_source_file_set_codedom (AfroditeSourceFile* self, AfroditeCodeDom* value);
gboolean afrodite_source_file_get_has_using_directives (AfroditeSourceFile* self);
gboolean afrodite_source_file_get_has_symbols (AfroditeSourceFile* self);
static void afrodite_source_file_finalize (AfroditeSourceFile* obj);


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


AfroditeSourceFile* afrodite_source_file_construct (GType object_type, const gchar* filename) {
	AfroditeSourceFile* self = NULL;
	g_return_val_if_fail (filename != NULL, NULL);
	self = (AfroditeSourceFile*) g_type_create_instance (object_type);
	afrodite_source_file_set_filename (self, filename);
	return self;
}


AfroditeSourceFile* afrodite_source_file_new (const gchar* filename) {
	return afrodite_source_file_construct (AFRODITE_TYPE_SOURCE_FILE, filename);
}


gboolean afrodite_source_file_update_last_modification_time (AfroditeSourceFile* self) {
	gboolean result = FALSE;
	GTimeVal new_value = {0};
	gboolean _result_;
	GFile* _tmp0_ = NULL;
	GFile* _tmp1_;
	GFileInfo* _tmp2_ = NULL;
	GFileInfo* _tmp3_;
	GFileInfo* info;
	GTimeVal _tmp4_ = {0};
	gboolean _tmp5_ = FALSE;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	_result_ = TRUE;
	_tmp0_ = g_file_new_for_path (self->priv->_filename);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_file_query_info (_tmp1_, G_FILE_ATTRIBUTE_TIME_MODIFIED "," G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC, G_FILE_QUERY_INFO_NONE, NULL, &_inner_error_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	info = _tmp3_;
	if (_inner_error_ != NULL) {
		goto __catch0_g_error;
	}
	g_file_info_get_modification_time (info, &_tmp4_);
	new_value = _tmp4_;
	if (self->last_modification_time.tv_sec == new_value.tv_sec) {
		_tmp5_ = self->last_modification_time.tv_usec == new_value.tv_usec;
	} else {
		_tmp5_ = FALSE;
	}
	_result_ = !_tmp5_;
	self->last_modification_time = new_value;
	_g_object_unref0 (info);
	goto __finally0;
	__catch0_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		g_critical ("sourcefile.vala:64: error while updating last modification time: %s", err->message);
		_g_error_free0 (err);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return FALSE;
	}
	result = _result_;
	return result;
}


AfroditeDataType* afrodite_source_file_add_using_directive (AfroditeSourceFile* self, const gchar* name) {
	AfroditeDataType* result = NULL;
	AfroditeDataType* _tmp0_ = NULL;
	AfroditeDataType* u;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = afrodite_source_file_lookup_using_directive (self, name);
	u = _tmp0_;
	if (u == NULL) {
		AfroditeDataType* _tmp3_ = NULL;
		if (self->priv->_using_directives == NULL) {
			ValaArrayList* _tmp1_ = NULL;
			ValaArrayList* _tmp2_;
			_tmp1_ = vala_array_list_new (AFRODITE_TYPE_DATA_TYPE, (GBoxedCopyFunc) afrodite_data_type_ref, afrodite_data_type_unref, g_direct_equal);
			_tmp2_ = _tmp1_;
			afrodite_source_file_set_using_directives (self, (ValaList*) _tmp2_);
			_vala_iterable_unref0 (_tmp2_);
		}
		_tmp3_ = afrodite_data_type_new (name, "UsingDirective");
		_afrodite_data_type_unref0 (u);
		u = _tmp3_;
		vala_collection_add ((ValaCollection*) self->priv->_using_directives, u);
	}
	result = u;
	return result;
}


static gpointer _vala_iterable_ref0 (gpointer self) {
	return self ? vala_iterable_ref (self) : NULL;
}


AfroditeDataType* afrodite_source_file_lookup_using_directive (AfroditeSourceFile* self, const gchar* name) {
	AfroditeDataType* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	if (self->priv->_using_directives != NULL) {
		{
			ValaList* _tmp0_;
			ValaList* _u_list;
			gint _tmp1_;
			gint _u_size;
			gint _u_index;
			_tmp0_ = _vala_iterable_ref0 (self->priv->_using_directives);
			_u_list = _tmp0_;
			_tmp1_ = vala_collection_get_size ((ValaCollection*) _u_list);
			_u_size = _tmp1_;
			_u_index = -1;
			while (TRUE) {
				gpointer _tmp2_ = NULL;
				AfroditeDataType* u;
				const gchar* _tmp3_ = NULL;
				_u_index = _u_index + 1;
				if (!(_u_index < _u_size)) {
					break;
				}
				_tmp2_ = vala_list_get (_u_list, _u_index);
				u = (AfroditeDataType*) _tmp2_;
				_tmp3_ = afrodite_data_type_get_type_name (u);
				if (g_strcmp0 (_tmp3_, name) == 0) {
					result = u;
					_vala_iterable_unref0 (_u_list);
					return result;
				}
				_afrodite_data_type_unref0 (u);
			}
			_vala_iterable_unref0 (_u_list);
		}
	}
	result = NULL;
	return result;
}


void afrodite_source_file_remove_using_directive (AfroditeSourceFile* self, const gchar* name) {
	AfroditeDataType* _tmp0_ = NULL;
	AfroditeDataType* u;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = afrodite_source_file_lookup_using_directive (self, name);
	u = _tmp0_;
	if (u != NULL) {
		gint _tmp1_;
		vala_collection_remove ((ValaCollection*) self->priv->_using_directives, u);
		_tmp1_ = vala_collection_get_size ((ValaCollection*) self->priv->_using_directives);
		if (_tmp1_ == 0) {
			afrodite_source_file_set_using_directives (self, NULL);
		}
	}
	_afrodite_data_type_unref0 (u);
}


void afrodite_source_file_add_symbol (AfroditeSourceFile* self, AfroditeSymbol* symbol) {
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (symbol != NULL);
	if (self->priv->_symbols == NULL) {
		ValaArrayList* _tmp0_ = NULL;
		ValaArrayList* _tmp1_;
		_tmp0_ = vala_array_list_new (AFRODITE_TYPE_SYMBOL, NULL, NULL, g_direct_equal);
		_tmp1_ = _tmp0_;
		afrodite_source_file_set_symbols (self, (ValaList*) _tmp1_);
		_vala_iterable_unref0 (_tmp1_);
	}
	vala_collection_add ((ValaCollection*) self->priv->_symbols, symbol);
	_tmp2_ = afrodite_symbol_get_fully_qualified_name (symbol);
	_tmp3_ = _tmp2_;
	vala_map_set ((ValaMap*) self->priv->_codedom->symbols, _tmp3_, symbol);
	_g_free0 (_tmp3_);
	vala_collection_add ((ValaCollection*) self->priv->_codedom->unresolved_symbols, symbol);
}


void afrodite_source_file_remove_symbol (AfroditeSourceFile* self, AfroditeSymbol* symbol) {
	AfroditeSourceReference* _tmp0_ = NULL;
	AfroditeSourceReference* sr;
	gint _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (symbol != NULL);
	_tmp0_ = afrodite_symbol_lookup_source_reference_sourcefile (symbol, self);
	sr = _tmp0_;
	g_assert (sr != NULL);
	afrodite_symbol_remove_source_reference (symbol, sr);
	_tmp1_ = vala_collection_get_size ((ValaCollection*) self->priv->_symbols);
	if (_tmp1_ == 0) {
		afrodite_source_file_set_symbols (self, NULL);
	}
	_tmp2_ = afrodite_symbol_get_has_source_references (symbol);
	if (!_tmp2_) {
		AfroditeSymbol* _tmp3_ = NULL;
		gboolean _tmp9_ = FALSE;
		AfroditeSymbol* _tmp10_ = NULL;
		if (self->priv->_codedom != NULL) {
			afrodite_source_file_remove_symbol_from_codedom (self, symbol);
		}
		_tmp3_ = afrodite_symbol_get_parent (symbol);
		if (_tmp3_ != NULL) {
			gboolean _tmp4_;
			_tmp4_ = afrodite_symbol_get_is_generic_type_argument (symbol);
			if (_tmp4_) {
				AfroditeSymbol* _tmp5_ = NULL;
				_tmp5_ = afrodite_symbol_get_parent (symbol);
				afrodite_symbol_remove_generic_type_argument (_tmp5_, symbol);
			} else {
				AfroditeSymbol* _tmp6_ = NULL;
				gboolean _tmp7_;
				_tmp6_ = afrodite_symbol_get_parent (symbol);
				_tmp7_ = afrodite_symbol_get_has_children (_tmp6_);
				if (_tmp7_) {
					AfroditeSymbol* _tmp8_ = NULL;
					_tmp8_ = afrodite_symbol_get_parent (symbol);
					afrodite_symbol_remove_child (_tmp8_, symbol);
				}
			}
		}
		_tmp10_ = afrodite_symbol_get_generic_parent (symbol);
		if (_tmp10_ != NULL) {
			AfroditeSymbol* _tmp11_ = NULL;
			gboolean _tmp12_;
			_tmp11_ = afrodite_symbol_get_generic_parent (symbol);
			_tmp12_ = afrodite_symbol_get_has_specialized_symbols (_tmp11_);
			_tmp9_ = _tmp12_;
		} else {
			_tmp9_ = FALSE;
		}
		if (_tmp9_) {
			AfroditeSymbol* _tmp13_ = NULL;
			_tmp13_ = afrodite_symbol_get_generic_parent (symbol);
			afrodite_symbol_remove_specialized_symbol (_tmp13_, symbol);
		}
	}
	_afrodite_source_reference_unref0 (sr);
}


void afrodite_source_file_remove_symbol_from_codedom (AfroditeSourceFile* self, AfroditeSymbol* symbol) {
	gboolean _tmp0_ = FALSE;
	gboolean _tmp3_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (symbol != NULL);
	if (self->priv->_codedom != NULL) {
		_tmp0_ = self->priv->_codedom->symbols != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar* _tmp1_ = NULL;
		gchar* _tmp2_;
		_tmp1_ = afrodite_symbol_get_fully_qualified_name (symbol);
		_tmp2_ = _tmp1_;
		vala_map_remove ((ValaMap*) self->priv->_codedom->symbols, _tmp2_);
		_g_free0 (_tmp2_);
	}
	if (self->priv->_codedom != NULL) {
		_tmp3_ = self->priv->_codedom->unresolved_symbols != NULL;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		vala_collection_remove ((ValaCollection*) self->priv->_codedom->unresolved_symbols, symbol);
	}
}


ValaList* afrodite_source_file_get_using_directives (AfroditeSourceFile* self) {
	ValaList* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_using_directives;
	return result;
}


void afrodite_source_file_set_using_directives (AfroditeSourceFile* self, ValaList* value) {
	ValaList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _vala_iterable_ref0 (value);
	_vala_iterable_unref0 (self->priv->_using_directives);
	self->priv->_using_directives = _tmp0_;
}


ValaList* afrodite_source_file_get_symbols (AfroditeSourceFile* self) {
	ValaList* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_symbols;
	return result;
}


void afrodite_source_file_set_symbols (AfroditeSourceFile* self, ValaList* value) {
	ValaList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _vala_iterable_ref0 (value);
	_vala_iterable_unref0 (self->priv->_symbols);
	self->priv->_symbols = _tmp0_;
}


AfroditeCodeDom* afrodite_source_file_get_codedom (AfroditeSourceFile* self) {
	AfroditeCodeDom* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_codedom;
	return result;
}


void afrodite_source_file_set_codedom (AfroditeSourceFile* self, AfroditeCodeDom* value) {
	g_return_if_fail (self != NULL);
	self->priv->_codedom = value;
}


const gchar* afrodite_source_file_get_filename (AfroditeSourceFile* self) {
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_filename;
	return result;
}


void afrodite_source_file_set_filename (AfroditeSourceFile* self, const gchar* value) {
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_filename);
	self->priv->_filename = _tmp0_;
	afrodite_source_file_update_last_modification_time (self);
}


gboolean afrodite_source_file_get_has_using_directives (AfroditeSourceFile* self) {
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_using_directives != NULL;
	return result;
}


gboolean afrodite_source_file_get_has_symbols (AfroditeSourceFile* self) {
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_symbols != NULL;
	return result;
}


static void afrodite_value_source_file_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void afrodite_value_source_file_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		afrodite_source_file_unref (value->data[0].v_pointer);
	}
}


static void afrodite_value_source_file_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = afrodite_source_file_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer afrodite_value_source_file_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* afrodite_value_source_file_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		AfroditeSourceFile* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = afrodite_source_file_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* afrodite_value_source_file_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	AfroditeSourceFile** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = afrodite_source_file_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* afrodite_param_spec_source_file (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	AfroditeParamSpecSourceFile* spec;
	g_return_val_if_fail (g_type_is_a (object_type, AFRODITE_TYPE_SOURCE_FILE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer afrodite_value_get_source_file (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SOURCE_FILE), NULL);
	return value->data[0].v_pointer;
}


void afrodite_value_set_source_file (GValue* value, gpointer v_object) {
	AfroditeSourceFile* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SOURCE_FILE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_SOURCE_FILE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		afrodite_source_file_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		afrodite_source_file_unref (old);
	}
}


void afrodite_value_take_source_file (GValue* value, gpointer v_object) {
	AfroditeSourceFile* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SOURCE_FILE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_SOURCE_FILE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		afrodite_source_file_unref (old);
	}
}


static void afrodite_source_file_class_init (AfroditeSourceFileClass * klass) {
	afrodite_source_file_parent_class = g_type_class_peek_parent (klass);
	AFRODITE_SOURCE_FILE_CLASS (klass)->finalize = afrodite_source_file_finalize;
	g_type_class_add_private (klass, sizeof (AfroditeSourceFilePrivate));
}


static void afrodite_source_file_instance_init (AfroditeSourceFile * self) {
	self->priv = AFRODITE_SOURCE_FILE_GET_PRIVATE (self);
	self->ref_count = 1;
}


static void afrodite_source_file_finalize (AfroditeSourceFile* obj) {
	AfroditeSourceFile * self;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp5_ = NULL;
	self = AFRODITE_SOURCE_FILE (obj);
	_tmp0_ = afrodite_source_file_get_filename (self);
	afrodite_utils_trace ("sourcefile.vala:71: SourceFile destroying: %s", _tmp0_);
	while (TRUE) {
		gboolean _tmp1_ = FALSE;
		gpointer _tmp3_ = NULL;
		AfroditeSymbol* _tmp4_;
		AfroditeSymbol* symbol;
		if (self->priv->_symbols != NULL) {
			gint _tmp2_;
			_tmp2_ = vala_collection_get_size ((ValaCollection*) self->priv->_symbols);
			_tmp1_ = _tmp2_ > 0;
		} else {
			_tmp1_ = FALSE;
		}
		if (!_tmp1_) {
			break;
		}
		_tmp3_ = vala_list_get (self->priv->_symbols, 0);
		_tmp4_ = _g_object_ref0 ((AfroditeSymbol*) _tmp3_);
		symbol = _tmp4_;
		afrodite_source_file_remove_symbol (self, symbol);
		_g_object_unref0 (symbol);
	}
	_tmp5_ = afrodite_source_file_get_filename (self);
	afrodite_utils_trace ("sourcefile.vala:76: SourceFile destroyed: %s", _tmp5_);
	_g_free0 (self->priv->_filename);
	_vala_iterable_unref0 (self->priv->_using_directives);
	_vala_iterable_unref0 (self->priv->_symbols);
}


GType afrodite_source_file_get_type (void) {
	static volatile gsize afrodite_source_file_type_id__volatile = 0;
	if (g_once_init_enter (&afrodite_source_file_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { afrodite_value_source_file_init, afrodite_value_source_file_free_value, afrodite_value_source_file_copy_value, afrodite_value_source_file_peek_pointer, "p", afrodite_value_source_file_collect_value, "p", afrodite_value_source_file_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (AfroditeSourceFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) afrodite_source_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AfroditeSourceFile), 0, (GInstanceInitFunc) afrodite_source_file_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType afrodite_source_file_type_id;
		afrodite_source_file_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AfroditeSourceFile", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&afrodite_source_file_type_id__volatile, afrodite_source_file_type_id);
	}
	return afrodite_source_file_type_id__volatile;
}


gpointer afrodite_source_file_ref (gpointer instance) {
	AfroditeSourceFile* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void afrodite_source_file_unref (gpointer instance) {
	AfroditeSourceFile* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		AFRODITE_SOURCE_FILE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



