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

/* symbolresolver.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 <gobject/gvaluecollector.h>


#define AFRODITE_TYPE_SYMBOL_RESOLVER (afrodite_symbol_resolver_get_type ())
#define AFRODITE_SYMBOL_RESOLVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_SYMBOL_RESOLVER, AfroditeSymbolResolver))
#define AFRODITE_SYMBOL_RESOLVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_SYMBOL_RESOLVER, AfroditeSymbolResolverClass))
#define AFRODITE_IS_SYMBOL_RESOLVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_SYMBOL_RESOLVER))
#define AFRODITE_IS_SYMBOL_RESOLVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_SYMBOL_RESOLVER))
#define AFRODITE_SYMBOL_RESOLVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_SYMBOL_RESOLVER, AfroditeSymbolResolverClass))

typedef struct _AfroditeSymbolResolver AfroditeSymbolResolver;
typedef struct _AfroditeSymbolResolverClass AfroditeSymbolResolverClass;
typedef struct _AfroditeSymbolResolverPrivate AfroditeSymbolResolverPrivate;

#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 _afrodite_code_dom_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_code_dom_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#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;

#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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _afrodite_data_type_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_data_type_unref (var), NULL)))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _afrodite_source_file_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_source_file_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)))

#define AFRODITE_TYPE_VOID_TYPE (afrodite_void_type_get_type ())
#define AFRODITE_VOID_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_VOID_TYPE, AfroditeVoidType))
#define AFRODITE_VOID_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_VOID_TYPE, AfroditeVoidTypeClass))
#define AFRODITE_IS_VOID_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_VOID_TYPE))
#define AFRODITE_IS_VOID_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_VOID_TYPE))
#define AFRODITE_VOID_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_VOID_TYPE, AfroditeVoidTypeClass))

typedef struct _AfroditeVoidType AfroditeVoidType;
typedef struct _AfroditeVoidTypeClass AfroditeVoidTypeClass;

#define AFRODITE_TYPE_MEMBER_TYPE (afrodite_member_type_get_type ())
typedef struct _AfroditeParamSpecSymbolResolver AfroditeParamSpecSymbolResolver;

struct _AfroditeSymbolResolver {
	GTypeInstance parent_instance;
	volatile int ref_count;
	AfroditeSymbolResolverPrivate * priv;
};

struct _AfroditeSymbolResolverClass {
	GTypeClass parent_class;
	void (*finalize) (AfroditeSymbolResolver *self);
};

struct _AfroditeSymbolResolverPrivate {
	AfroditeCodeDom* _codedom;
	gchar* _vala_symbol_fqn;
};

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);
};

typedef enum  {
	AFRODITE_MEMBER_TYPE_NONE,
	AFRODITE_MEMBER_TYPE_VOID,
	AFRODITE_MEMBER_TYPE_CONSTANT,
	AFRODITE_MEMBER_TYPE_ENUM,
	AFRODITE_MEMBER_TYPE_ENUM_VALUE,
	AFRODITE_MEMBER_TYPE_FIELD,
	AFRODITE_MEMBER_TYPE_PROPERTY,
	AFRODITE_MEMBER_TYPE_LOCAL_VARIABLE,
	AFRODITE_MEMBER_TYPE_SIGNAL,
	AFRODITE_MEMBER_TYPE_CREATION_METHOD,
	AFRODITE_MEMBER_TYPE_CONSTRUCTOR,
	AFRODITE_MEMBER_TYPE_DESTRUCTOR,
	AFRODITE_MEMBER_TYPE_METHOD,
	AFRODITE_MEMBER_TYPE_DELEGATE,
	AFRODITE_MEMBER_TYPE_PARAMETER,
	AFRODITE_MEMBER_TYPE_TYPE_PARAMETER,
	AFRODITE_MEMBER_TYPE_ERROR_DOMAIN,
	AFRODITE_MEMBER_TYPE_ERROR_CODE,
	AFRODITE_MEMBER_TYPE_NAMESPACE,
	AFRODITE_MEMBER_TYPE_STRUCT,
	AFRODITE_MEMBER_TYPE_CLASS,
	AFRODITE_MEMBER_TYPE_INTERFACE,
	AFRODITE_MEMBER_TYPE_SCOPED_CODE_NODE
} AfroditeMemberType;

struct _AfroditeParamSpecSymbolResolver {
	GParamSpec parent_instance;
};


static gpointer afrodite_symbol_resolver_parent_class = NULL;
extern AfroditeVoidType* afrodite_symbol_VOID;

gpointer afrodite_symbol_resolver_ref (gpointer instance);
void afrodite_symbol_resolver_unref (gpointer instance);
GParamSpec* afrodite_param_spec_symbol_resolver (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_symbol_resolver (GValue* value, gpointer v_object);
void afrodite_value_take_symbol_resolver (GValue* value, gpointer v_object);
gpointer afrodite_value_get_symbol_resolver (const GValue* value);
GType afrodite_symbol_resolver_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_SYMBOL_RESOLVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), AFRODITE_TYPE_SYMBOL_RESOLVER, AfroditeSymbolResolverPrivate))
enum  {
	AFRODITE_SYMBOL_RESOLVER_DUMMY_PROPERTY
};
void afrodite_symbol_resolver_resolve (AfroditeSymbolResolver* self, AfroditeCodeDom* codedom);
gboolean afrodite_code_dom_get_has_source_files (AfroditeCodeDom* self);
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;
ValaList* afrodite_code_dom_get_source_files (AfroditeCodeDom* self);
gboolean afrodite_source_file_get_has_using_directives (AfroditeSourceFile* self);
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;
ValaList* afrodite_source_file_get_using_directives (AfroditeSourceFile* self);
gboolean afrodite_data_type_get_unresolved (AfroditeDataType* self);
GType afrodite_symbol_get_type (void) G_GNUC_CONST;
AfroditeSymbol* afrodite_code_dom_lookup (AfroditeCodeDom* self, const gchar* fully_qualified_name);
const gchar* afrodite_data_type_get_type_name (AfroditeDataType* self);
void afrodite_data_type_set_symbol (AfroditeDataType* self, AfroditeSymbol* value);
const gchar* afrodite_source_file_get_filename (AfroditeSourceFile* self);
void afrodite_utils_trace (const gchar* format, ...);
static void afrodite_symbol_resolver_visit_symbols (AfroditeSymbolResolver* self, ValaList* symbols);
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;
ValaList* afrodite_symbol_get_source_references (AfroditeSymbol* self);
AfroditeDataType* afrodite_symbol_get_symbol_type (AfroditeSymbol* self);
gboolean afrodite_symbol_get_has_parameters (AfroditeSymbol* self);
ValaList* afrodite_symbol_get_parameters (AfroditeSymbol* self);
gboolean afrodite_symbol_get_has_local_variables (AfroditeSymbol* self);
ValaList* afrodite_symbol_get_local_variables (AfroditeSymbol* self);
gboolean afrodite_symbol_get_has_base_types (AfroditeSymbol* self);
ValaList* afrodite_symbol_get_base_types (AfroditeSymbol* self);
gchar* afrodite_symbol_get_fully_qualified_name (AfroditeSymbol* self);
AfroditeSourceFile* afrodite_source_reference_get_file (AfroditeSourceReference* self);
gint afrodite_source_reference_get_first_line (AfroditeSourceReference* self);
static AfroditeSymbol* afrodite_symbol_resolver_resolve_type (AfroditeSymbolResolver* self, AfroditeSymbol* symbol, AfroditeDataType* type);
static AfroditeSymbol* afrodite_symbol_resolver_resolve_type_name (AfroditeSymbolResolver* self, AfroditeSymbol* symbol, const gchar* type_name);
gboolean afrodite_data_type_get_has_generic_types (AfroditeDataType* self);
gboolean afrodite_symbol_get_has_generic_type_arguments (AfroditeSymbol* self);
ValaList* afrodite_data_type_get_generic_types (AfroditeDataType* self);
ValaList* afrodite_symbol_get_generic_type_arguments (AfroditeSymbol* self);
const gchar* afrodite_symbol_get_name (AfroditeSymbol* self);
static AfroditeSymbol* afrodite_symbol_resolver_specialize_generic_symbol (AfroditeSymbolResolver* self, AfroditeDataType* type, AfroditeSymbol* symbol);
GType afrodite_void_type_get_type (void) G_GNUC_CONST;
void afrodite_symbol_add_resolved_target (AfroditeSymbol* self, AfroditeSymbol* resolve_target);
static AfroditeSymbol* afrodite_symbol_resolver_resolve_type_name_part (AfroditeSymbolResolver* self, AfroditeSymbol* symbol, const gchar* type_name);
static gboolean afrodite_symbol_resolver_visit_symbol (AfroditeSymbolResolver* self, AfroditeSymbol* symbol);
AfroditeSymbol* afrodite_data_type_get_symbol (AfroditeDataType* self);
AfroditeSymbol* afrodite_code_dom_get_root (AfroditeCodeDom* self);
AfroditeSymbol* afrodite_symbol_get_parent (AfroditeSymbol* self);
GType afrodite_member_type_get_type (void) G_GNUC_CONST;
AfroditeMemberType afrodite_symbol_get_member_type (AfroditeSymbol* self);
gboolean afrodite_symbol_get_has_source_references (AfroditeSymbol* self);
const gchar* afrodite_data_type_get_name (AfroditeDataType* self);
AfroditeSymbol* afrodite_symbol_copy (AfroditeSymbol* self);
void afrodite_symbol_specialize_generic_symbol (AfroditeSymbol* self, ValaList* types);
gchar* afrodite_symbol_get_description (AfroditeSymbol* self);
void afrodite_symbol_add_specialized_symbol (AfroditeSymbol* self, AfroditeSymbol* item);
static void afrodite_symbol_resolver_resolve_symbol (AfroditeSymbolResolver* self, AfroditeSymbol* symbol, AfroditeDataType* type);
AfroditeDataType* afrodite_symbol_get_return_type (AfroditeSymbol* self);
void afrodite_data_type_set_type_name (AfroditeDataType* self, const gchar* value);
gboolean afrodite_data_type_get_is_iterator (AfroditeDataType* self);
AfroditeSymbolResolver* afrodite_symbol_resolver_new (void);
AfroditeSymbolResolver* afrodite_symbol_resolver_construct (GType object_type);
static void afrodite_symbol_resolver_finalize (AfroditeSymbolResolver* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


static gpointer _afrodite_code_dom_ref0 (gpointer self) {
	return self ? afrodite_code_dom_ref (self) : NULL;
}


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


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


void afrodite_symbol_resolver_resolve (AfroditeSymbolResolver* self, AfroditeCodeDom* codedom) {
	AfroditeCodeDom* _tmp0_;
	gboolean _tmp1_;
	gint _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (codedom != NULL);
	_g_free0 (self->priv->_vala_symbol_fqn);
	self->priv->_vala_symbol_fqn = NULL;
	_tmp0_ = _afrodite_code_dom_ref0 (codedom);
	_afrodite_code_dom_unref0 (self->priv->_codedom);
	self->priv->_codedom = _tmp0_;
	_tmp1_ = afrodite_code_dom_get_has_source_files (self->priv->_codedom);
	if (_tmp1_) {
		{
			ValaList* _tmp2_ = NULL;
			ValaList* _tmp3_;
			ValaList* _file_list;
			gint _tmp4_;
			gint _file_size;
			gint _file_index;
			_tmp2_ = afrodite_code_dom_get_source_files (self->priv->_codedom);
			_tmp3_ = _vala_iterable_ref0 (_tmp2_);
			_file_list = _tmp3_;
			_tmp4_ = vala_collection_get_size ((ValaCollection*) _file_list);
			_file_size = _tmp4_;
			_file_index = -1;
			while (TRUE) {
				gpointer _tmp5_ = NULL;
				AfroditeSourceFile* file;
				gboolean _tmp6_;
				_file_index = _file_index + 1;
				if (!(_file_index < _file_size)) {
					break;
				}
				_tmp5_ = vala_list_get (_file_list, _file_index);
				file = (AfroditeSourceFile*) _tmp5_;
				_tmp6_ = afrodite_source_file_get_has_using_directives (file);
				if (_tmp6_) {
					{
						ValaList* _tmp7_ = NULL;
						ValaList* _tmp8_;
						ValaList* _using_directive_list;
						gint _tmp9_;
						gint _using_directive_size;
						gint _using_directive_index;
						_tmp7_ = afrodite_source_file_get_using_directives (file);
						_tmp8_ = _vala_iterable_ref0 (_tmp7_);
						_using_directive_list = _tmp8_;
						_tmp9_ = vala_collection_get_size ((ValaCollection*) _using_directive_list);
						_using_directive_size = _tmp9_;
						_using_directive_index = -1;
						while (TRUE) {
							gpointer _tmp10_ = NULL;
							AfroditeDataType* using_directive;
							gboolean _tmp11_;
							_using_directive_index = _using_directive_index + 1;
							if (!(_using_directive_index < _using_directive_size)) {
								break;
							}
							_tmp10_ = vala_list_get (_using_directive_list, _using_directive_index);
							using_directive = (AfroditeDataType*) _tmp10_;
							_tmp11_ = afrodite_data_type_get_unresolved (using_directive);
							if (_tmp11_) {
								const gchar* _tmp12_ = NULL;
								AfroditeSymbol* _tmp13_ = NULL;
								AfroditeSymbol* _tmp14_;
								gboolean _tmp15_;
								_tmp12_ = afrodite_data_type_get_type_name (using_directive);
								_tmp13_ = afrodite_code_dom_lookup (self->priv->_codedom, _tmp12_);
								_tmp14_ = _tmp13_;
								afrodite_data_type_set_symbol (using_directive, _tmp14_);
								_g_object_unref0 (_tmp14_);
								_tmp15_ = afrodite_data_type_get_unresolved (using_directive);
								if (_tmp15_) {
									const gchar* _tmp16_ = NULL;
									const gchar* _tmp17_ = NULL;
									_tmp16_ = afrodite_source_file_get_filename (file);
									_tmp17_ = afrodite_data_type_get_type_name (using_directive);
									g_message ("symbolresolver.vala:54: file %s - can't resolve using directive: %s", _tmp16_, _tmp17_);
								}
							}
							_afrodite_data_type_unref0 (using_directive);
						}
						_vala_iterable_unref0 (_using_directive_list);
					}
				}
				_afrodite_source_file_unref0 (file);
			}
			_vala_iterable_unref0 (_file_list);
		}
	}
	_tmp18_ = vala_collection_get_size ((ValaCollection*) codedom->unresolved_symbols);
	if (_tmp18_ > 0) {
		gint _tmp19_;
		gint _tmp20_;
		gint _tmp21_ = 0;
		gint _tmp22_;
		gint count;
		_tmp19_ = vala_collection_get_size ((ValaCollection*) codedom->unresolved_symbols);
		afrodite_utils_trace ("symbolresolver.vala:62: (symbol resolver): symbols to resolve %d", _tmp19_);
		afrodite_symbol_resolver_visit_symbols (self, codedom->unresolved_symbols);
		_tmp20_ = vala_collection_get_size ((ValaCollection*) codedom->unresolved_symbols);
		afrodite_utils_trace ("symbolresolver.vala:64: (symbol resolver): unresolved symbol after res" \
"olve process %d", _tmp20_);
		_tmp22_ = vala_collection_get_size ((ValaCollection*) codedom->unresolved_symbols);
		if (_tmp22_ > 5) {
			_tmp21_ = 5;
		} else {
			gint _tmp23_;
			_tmp23_ = vala_collection_get_size ((ValaCollection*) codedom->unresolved_symbols);
			_tmp21_ = _tmp23_;
		}
		count = _tmp21_;
		if (count > 0) {
			afrodite_utils_trace ("symbolresolver.vala:68: (symbol resolver): dumping first %d", count);
			{
				gint i;
				i = 0;
				{
					gboolean _tmp24_;
					_tmp24_ = TRUE;
					while (TRUE) {
						gpointer _tmp25_ = NULL;
						AfroditeSymbol* _tmp26_;
						AfroditeSymbol* symbol;
						ValaList* _tmp27_ = NULL;
						gpointer _tmp28_ = NULL;
						AfroditeSourceReference* sr;
						gchar* cause;
						gboolean _tmp29_ = FALSE;
						AfroditeDataType* _tmp30_ = NULL;
						gchar* _tmp60_ = NULL;
						gchar* _tmp61_;
						AfroditeSourceFile* _tmp62_ = NULL;
						const gchar* _tmp63_ = NULL;
						gint _tmp64_;
						if (!_tmp24_) {
							i++;
						}
						_tmp24_ = FALSE;
						if (!(i < count)) {
							break;
						}
						_tmp25_ = vala_list_get (codedom->unresolved_symbols, i);
						_tmp26_ = _g_object_ref0 ((AfroditeSymbol*) _tmp25_);
						symbol = _tmp26_;
						_tmp27_ = afrodite_symbol_get_source_references (symbol);
						_tmp28_ = vala_list_get (_tmp27_, 0);
						sr = (AfroditeSourceReference*) _tmp28_;
						cause = NULL;
						_tmp30_ = afrodite_symbol_get_symbol_type (symbol);
						if (_tmp30_ != NULL) {
							AfroditeDataType* _tmp31_ = NULL;
							gboolean _tmp32_;
							_tmp31_ = afrodite_symbol_get_symbol_type (symbol);
							_tmp32_ = afrodite_data_type_get_unresolved (_tmp31_);
							_tmp29_ = _tmp32_;
						} else {
							_tmp29_ = FALSE;
						}
						if (_tmp29_) {
							AfroditeDataType* _tmp33_ = NULL;
							const gchar* _tmp34_ = NULL;
							gchar* _tmp35_ = NULL;
							_tmp33_ = afrodite_symbol_get_symbol_type (symbol);
							_tmp34_ = afrodite_data_type_get_type_name (_tmp33_);
							_tmp35_ = g_strdup_printf ("symbol_type: %s", _tmp34_);
							_g_free0 (cause);
							cause = _tmp35_;
						}
						if (cause == NULL) {
							gboolean _tmp36_;
							_tmp36_ = afrodite_symbol_get_has_parameters (symbol);
							if (_tmp36_) {
								{
									ValaList* _tmp37_ = NULL;
									ValaList* _tmp38_;
									ValaList* _type_list;
									gint _tmp39_;
									gint _type_size;
									gint _type_index;
									_tmp37_ = afrodite_symbol_get_parameters (symbol);
									_tmp38_ = _vala_iterable_ref0 (_tmp37_);
									_type_list = _tmp38_;
									_tmp39_ = vala_collection_get_size ((ValaCollection*) _type_list);
									_type_size = _tmp39_;
									_type_index = -1;
									while (TRUE) {
										gpointer _tmp40_ = NULL;
										AfroditeDataType* type;
										gboolean _tmp41_;
										_type_index = _type_index + 1;
										if (!(_type_index < _type_size)) {
											break;
										}
										_tmp40_ = vala_list_get (_type_list, _type_index);
										type = (AfroditeDataType*) _tmp40_;
										_tmp41_ = afrodite_data_type_get_unresolved (type);
										if (_tmp41_) {
											const gchar* _tmp42_ = NULL;
											gchar* _tmp43_ = NULL;
											_tmp42_ = afrodite_data_type_get_type_name (type);
											_tmp43_ = g_strdup_printf ("parameter: %s", _tmp42_);
											_g_free0 (cause);
											cause = _tmp43_;
											_afrodite_data_type_unref0 (type);
											break;
										}
										_afrodite_data_type_unref0 (type);
									}
									_vala_iterable_unref0 (_type_list);
								}
							}
						}
						if (cause == NULL) {
							gboolean _tmp44_;
							_tmp44_ = afrodite_symbol_get_has_local_variables (symbol);
							if (_tmp44_) {
								{
									ValaList* _tmp45_ = NULL;
									ValaList* _tmp46_;
									ValaList* _type_list;
									gint _tmp47_;
									gint _type_size;
									gint _type_index;
									_tmp45_ = afrodite_symbol_get_local_variables (symbol);
									_tmp46_ = _vala_iterable_ref0 (_tmp45_);
									_type_list = _tmp46_;
									_tmp47_ = vala_collection_get_size ((ValaCollection*) _type_list);
									_type_size = _tmp47_;
									_type_index = -1;
									while (TRUE) {
										gpointer _tmp48_ = NULL;
										AfroditeDataType* type;
										gboolean _tmp49_;
										_type_index = _type_index + 1;
										if (!(_type_index < _type_size)) {
											break;
										}
										_tmp48_ = vala_list_get (_type_list, _type_index);
										type = (AfroditeDataType*) _tmp48_;
										_tmp49_ = afrodite_data_type_get_unresolved (type);
										if (_tmp49_) {
											const gchar* _tmp50_ = NULL;
											gchar* _tmp51_ = NULL;
											_tmp50_ = afrodite_data_type_get_type_name (type);
											_tmp51_ = g_strdup_printf ("variable: %s", _tmp50_);
											_g_free0 (cause);
											cause = _tmp51_;
											_afrodite_data_type_unref0 (type);
											break;
										}
										_afrodite_data_type_unref0 (type);
									}
									_vala_iterable_unref0 (_type_list);
								}
							}
						}
						if (cause == NULL) {
							gboolean _tmp52_;
							_tmp52_ = afrodite_symbol_get_has_base_types (symbol);
							if (_tmp52_) {
								{
									ValaList* _tmp53_ = NULL;
									ValaList* _tmp54_;
									ValaList* _type_list;
									gint _tmp55_;
									gint _type_size;
									gint _type_index;
									_tmp53_ = afrodite_symbol_get_base_types (symbol);
									_tmp54_ = _vala_iterable_ref0 (_tmp53_);
									_type_list = _tmp54_;
									_tmp55_ = vala_collection_get_size ((ValaCollection*) _type_list);
									_type_size = _tmp55_;
									_type_index = -1;
									while (TRUE) {
										gpointer _tmp56_ = NULL;
										AfroditeDataType* type;
										gboolean _tmp57_;
										_type_index = _type_index + 1;
										if (!(_type_index < _type_size)) {
											break;
										}
										_tmp56_ = vala_list_get (_type_list, _type_index);
										type = (AfroditeDataType*) _tmp56_;
										_tmp57_ = afrodite_data_type_get_unresolved (type);
										if (_tmp57_) {
											const gchar* _tmp58_ = NULL;
											gchar* _tmp59_ = NULL;
											_tmp58_ = afrodite_data_type_get_type_name (type);
											_tmp59_ = g_strdup_printf ("base_type: %s", _tmp58_);
											_g_free0 (cause);
											cause = _tmp59_;
											_afrodite_data_type_unref0 (type);
											break;
										}
										_afrodite_data_type_unref0 (type);
									}
									_vala_iterable_unref0 (_type_list);
								}
							}
						}
						_tmp60_ = afrodite_symbol_get_fully_qualified_name (symbol);
						_tmp61_ = _tmp60_;
						_tmp62_ = afrodite_source_reference_get_file (sr);
						_tmp63_ = afrodite_source_file_get_filename (_tmp62_);
						_tmp64_ = afrodite_source_reference_get_first_line (sr);
						afrodite_utils_trace ("symbolresolver.vala:111: \tname: %s %s (%s, line %d)", _tmp61_, cause, _tmp63_, _tmp64_);
						_g_free0 (_tmp61_);
						_g_free0 (cause);
						_afrodite_source_reference_unref0 (sr);
						_g_object_unref0 (symbol);
					}
				}
			}
		}
	}
}


static gboolean string_contains (const gchar* self, const gchar* needle) {
	gboolean result = FALSE;
	gchar* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}


static AfroditeSymbol* afrodite_symbol_resolver_resolve_type (AfroditeSymbolResolver* self, AfroditeSymbol* symbol, AfroditeDataType* type) {
	AfroditeSymbol* result = NULL;
	const gchar* _tmp0_ = NULL;
	AfroditeSymbol* _tmp1_ = NULL;
	AfroditeSymbol* res;
	gboolean _tmp2_ = FALSE;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (symbol != NULL, NULL);
	g_return_val_if_fail (type != NULL, NULL);
	_tmp0_ = afrodite_data_type_get_type_name (type);
	_tmp1_ = afrodite_symbol_resolver_resolve_type_name (self, symbol, _tmp0_);
	res = _tmp1_;
	if (res == NULL) {
		const gchar* _tmp3_ = NULL;
		gboolean _tmp4_;
		_tmp3_ = afrodite_data_type_get_type_name (type);
		_tmp4_ = string_contains (_tmp3_, ".");
		_tmp2_ = _tmp4_;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		const gchar* _tmp5_ = NULL;
		gpointer _tmp6_ = NULL;
		AfroditeSymbol* _tmp7_;
		AfroditeSymbol* s;
		gboolean _tmp8_ = FALSE;
		_tmp5_ = afrodite_data_type_get_type_name (type);
		_tmp6_ = vala_map_get ((ValaMap*) self->priv->_codedom->symbols, _tmp5_);
		_tmp7_ = _g_object_ref0 ((AfroditeSymbol*) _tmp6_);
		s = _tmp7_;
		if (s != NULL) {
			_tmp8_ = s != symbol;
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			AfroditeSymbol* _tmp9_;
			_tmp9_ = _g_object_ref0 (s);
			_g_object_unref0 (res);
			res = _tmp9_;
		}
		_g_object_unref0 (s);
	}
	if (res != NULL) {
		gboolean _tmp10_;
		_tmp10_ = afrodite_data_type_get_has_generic_types (type);
		if (_tmp10_) {
			gboolean _tmp11_ = FALSE;
			gboolean _tmp12_;
			_tmp12_ = afrodite_symbol_get_has_generic_type_arguments (res);
			if (_tmp12_) {
				ValaList* _tmp13_ = NULL;
				gint _tmp14_;
				ValaList* _tmp15_ = NULL;
				gint _tmp16_;
				_tmp13_ = afrodite_data_type_get_generic_types (type);
				_tmp14_ = vala_collection_get_size ((ValaCollection*) _tmp13_);
				_tmp15_ = afrodite_symbol_get_generic_type_arguments (res);
				_tmp16_ = vala_collection_get_size ((ValaCollection*) _tmp15_);
				_tmp11_ = _tmp14_ == _tmp16_;
			} else {
				_tmp11_ = FALSE;
			}
			if (_tmp11_) {
				gboolean need_specialization;
				need_specialization = FALSE;
				{
					gint i;
					i = 0;
					{
						gboolean _tmp17_;
						_tmp17_ = TRUE;
						while (TRUE) {
							ValaList* _tmp18_ = NULL;
							gint _tmp19_;
							ValaList* _tmp20_ = NULL;
							gpointer _tmp21_ = NULL;
							AfroditeSymbol* _tmp22_;
							gchar* _tmp23_ = NULL;
							gchar* _tmp24_;
							gchar* _tmp25_;
							gchar* _tmp31_;
							gchar* name;
							ValaList* _tmp32_ = NULL;
							gpointer _tmp33_ = NULL;
							AfroditeDataType* _tmp34_;
							const gchar* _tmp35_ = NULL;
							gboolean _tmp36_;
							if (!_tmp17_) {
								i++;
							}
							_tmp17_ = FALSE;
							_tmp18_ = afrodite_data_type_get_generic_types (type);
							_tmp19_ = vala_collection_get_size ((ValaCollection*) _tmp18_);
							if (!(i < _tmp19_)) {
								break;
							}
							_tmp20_ = afrodite_symbol_get_generic_type_arguments (res);
							_tmp21_ = vala_list_get (_tmp20_, i);
							_tmp22_ = (AfroditeSymbol*) _tmp21_;
							_tmp23_ = afrodite_symbol_get_fully_qualified_name (_tmp22_);
							_tmp24_ = _tmp23_;
							_g_object_unref0 (_tmp22_);
							_tmp25_ = _tmp24_;
							if (_tmp25_ == NULL) {
								ValaList* _tmp26_ = NULL;
								gpointer _tmp27_ = NULL;
								AfroditeSymbol* _tmp28_;
								const gchar* _tmp29_ = NULL;
								gchar* _tmp30_;
								_tmp26_ = afrodite_symbol_get_generic_type_arguments (res);
								_tmp27_ = vala_list_get (_tmp26_, i);
								_tmp28_ = (AfroditeSymbol*) _tmp27_;
								_tmp29_ = afrodite_symbol_get_name (_tmp28_);
								_tmp30_ = g_strdup (_tmp29_);
								_g_free0 (_tmp25_);
								_tmp25_ = _tmp30_;
								_g_object_unref0 (_tmp28_);
							}
							_tmp31_ = g_strdup (_tmp25_);
							name = _tmp31_;
							_tmp32_ = afrodite_data_type_get_generic_types (type);
							_tmp33_ = vala_list_get (_tmp32_, i);
							_tmp34_ = (AfroditeDataType*) _tmp33_;
							_tmp35_ = afrodite_data_type_get_type_name (_tmp34_);
							_tmp36_ = g_strcmp0 (_tmp35_, name) != 0;
							_afrodite_data_type_unref0 (_tmp34_);
							if (_tmp36_) {
								need_specialization = TRUE;
								_g_free0 (name);
								_g_free0 (_tmp25_);
								break;
							}
							_g_free0 (name);
							_g_free0 (_tmp25_);
						}
					}
				}
				if (need_specialization) {
					AfroditeSymbol* _tmp37_ = NULL;
					_tmp37_ = afrodite_symbol_resolver_specialize_generic_symbol (self, type, res);
					_g_object_unref0 (res);
					res = _tmp37_;
				}
			} else {
				{
					ValaList* _tmp38_ = NULL;
					ValaList* _tmp39_;
					ValaList* _generic_type_list;
					gint _tmp40_;
					gint _generic_type_size;
					gint _generic_type_index;
					_tmp38_ = afrodite_data_type_get_generic_types (type);
					_tmp39_ = _vala_iterable_ref0 (_tmp38_);
					_generic_type_list = _tmp39_;
					_tmp40_ = vala_collection_get_size ((ValaCollection*) _generic_type_list);
					_generic_type_size = _tmp40_;
					_generic_type_index = -1;
					while (TRUE) {
						gpointer _tmp41_ = NULL;
						AfroditeDataType* generic_type;
						gboolean _tmp42_;
						_generic_type_index = _generic_type_index + 1;
						if (!(_generic_type_index < _generic_type_size)) {
							break;
						}
						_tmp41_ = vala_list_get (_generic_type_list, _generic_type_index);
						generic_type = (AfroditeDataType*) _tmp41_;
						_tmp42_ = afrodite_data_type_get_unresolved (generic_type);
						if (_tmp42_) {
							AfroditeSymbol* _tmp43_ = NULL;
							AfroditeSymbol* _tmp44_;
							_tmp43_ = afrodite_symbol_resolver_resolve_type (self, res, generic_type);
							_tmp44_ = _tmp43_;
							afrodite_data_type_set_symbol (generic_type, _tmp44_);
							_g_object_unref0 (_tmp44_);
						}
						_afrodite_data_type_unref0 (generic_type);
					}
					_vala_iterable_unref0 (_generic_type_list);
				}
			}
		}
		if (res != AFRODITE_SYMBOL (afrodite_symbol_VOID)) {
			afrodite_symbol_add_resolved_target (res, symbol);
		}
	}
	result = res;
	return result;
}


static AfroditeSymbol* afrodite_symbol_resolver_resolve_type_name (AfroditeSymbolResolver* self, AfroditeSymbol* symbol, const gchar* type_name) {
	AfroditeSymbol* result = NULL;
	AfroditeSymbol* _tmp0_;
	AfroditeSymbol* current;
	gboolean _tmp1_ = FALSE;
	AfroditeSymbol* _tmp23_ = NULL;
	AfroditeSymbol* _tmp24_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (symbol != NULL, NULL);
	g_return_val_if_fail (type_name != NULL, NULL);
	_tmp0_ = _g_object_ref0 (symbol);
	current = _tmp0_;
	if (g_strcmp0 (type_name, "void") == 0) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = g_strcmp0 (type_name, "...") == 0;
	}
	if (_tmp1_) {
		AfroditeSymbol* _tmp2_;
		_tmp2_ = _g_object_ref0 ((AfroditeSymbol*) afrodite_symbol_VOID);
		_g_object_unref0 (current);
		current = _tmp2_;
	} else {
		gpointer _tmp3_ = NULL;
		AfroditeSymbol* _tmp4_;
		gboolean _tmp5_ = FALSE;
		_tmp3_ = vala_map_get ((ValaMap*) self->priv->_codedom->symbols, type_name);
		_tmp4_ = _g_object_ref0 ((AfroditeSymbol*) _tmp3_);
		_g_object_unref0 (current);
		current = _tmp4_;
		if (current == NULL) {
			_tmp5_ = TRUE;
		} else {
			_tmp5_ = current == symbol;
		}
		if (_tmp5_) {
			gchar** _tmp6_;
			gchar** _tmp7_ = NULL;
			gchar** parts;
			gint parts_length1;
			gint _parts_size_;
			AfroditeSymbol* _tmp8_;
			_tmp7_ = _tmp6_ = g_strsplit (type_name, ".", 0);
			parts = _tmp7_;
			parts_length1 = _vala_array_length (_tmp6_);
			_parts_size_ = _vala_array_length (_tmp6_);
			_tmp8_ = _g_object_ref0 (symbol);
			_g_object_unref0 (current);
			current = _tmp8_;
			{
				gchar** part_collection;
				int part_collection_length1;
				int part_it;
				part_collection = parts;
				part_collection_length1 = parts_length1;
				for (part_it = 0; part_it < parts_length1; part_it = part_it + 1) {
					gchar* _tmp9_;
					gchar* part;
					_tmp9_ = g_strdup (part_collection[part_it]);
					part = _tmp9_;
					{
						AfroditeSymbol* _tmp10_ = NULL;
						_tmp10_ = afrodite_symbol_resolver_resolve_type_name_part (self, current, part);
						_g_object_unref0 (current);
						current = _tmp10_;
						if (current != NULL) {
							AfroditeDataType* _tmp11_ = NULL;
							_tmp11_ = afrodite_symbol_get_symbol_type (current);
							if (_tmp11_ != NULL) {
								AfroditeDataType* _tmp12_ = NULL;
								gboolean _tmp13_;
								AfroditeDataType* _tmp14_ = NULL;
								AfroditeSymbol* _tmp15_ = NULL;
								AfroditeSymbol* _tmp16_;
								_tmp12_ = afrodite_symbol_get_symbol_type (current);
								_tmp13_ = afrodite_data_type_get_unresolved (_tmp12_);
								if (_tmp13_) {
									afrodite_symbol_resolver_visit_symbol (self, current);
								}
								_tmp14_ = afrodite_symbol_get_symbol_type (current);
								_tmp15_ = afrodite_data_type_get_symbol (_tmp14_);
								_tmp16_ = _g_object_ref0 (_tmp15_);
								_g_object_unref0 (current);
								current = _tmp16_;
							}
						}
						if (current == NULL) {
							_g_free0 (part);
							break;
						}
						_g_free0 (part);
					}
				}
			}
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		}
		if (current != NULL) {
			AfroditeDataType* _tmp17_ = NULL;
			_tmp17_ = afrodite_symbol_get_symbol_type (current);
			if (_tmp17_ != NULL) {
				AfroditeDataType* _tmp18_ = NULL;
				gboolean _tmp19_;
				AfroditeDataType* _tmp20_ = NULL;
				AfroditeSymbol* _tmp21_ = NULL;
				AfroditeSymbol* _tmp22_;
				_tmp18_ = afrodite_symbol_get_symbol_type (current);
				_tmp19_ = afrodite_data_type_get_unresolved (_tmp18_);
				if (_tmp19_) {
					afrodite_symbol_resolver_visit_symbol (self, current);
				}
				_tmp20_ = afrodite_symbol_get_symbol_type (current);
				_tmp21_ = afrodite_data_type_get_symbol (_tmp20_);
				_tmp22_ = _g_object_ref0 (_tmp21_);
				_g_object_unref0 (current);
				current = _tmp22_;
			}
		}
	}
	if (current != symbol) {
		_tmp23_ = current;
	} else {
		_tmp23_ = NULL;
	}
	_tmp24_ = _g_object_ref0 (_tmp23_);
	result = _tmp24_;
	_g_object_unref0 (current);
	return result;
}


static gpointer _afrodite_source_file_ref0 (gpointer self) {
	return self ? afrodite_source_file_ref (self) : NULL;
}


static AfroditeSymbol* afrodite_symbol_resolver_resolve_type_name_part (AfroditeSymbolResolver* self, AfroditeSymbol* symbol, const gchar* type_name) {
	AfroditeSymbol* result = NULL;
	AfroditeSymbol* res;
	AfroditeSymbol* s;
	AfroditeSymbol* _tmp0_;
	AfroditeSymbol* curr_symbol;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (symbol != NULL, NULL);
	g_return_val_if_fail (type_name != NULL, NULL);
	res = NULL;
	s = NULL;
	_tmp0_ = _g_object_ref0 (symbol);
	curr_symbol = _tmp0_;
	while (TRUE) {
		gboolean _tmp1_ = FALSE;
		gboolean _tmp3_ = FALSE;
		const gchar* _tmp4_ = NULL;
		gboolean _tmp5_;
		AfroditeSymbol* _tmp15_ = NULL;
		AfroditeSymbol* _tmp16_;
		if (curr_symbol != NULL) {
			AfroditeSymbol* _tmp2_ = NULL;
			_tmp2_ = afrodite_code_dom_get_root (self->priv->_codedom);
			_tmp1_ = curr_symbol != _tmp2_;
		} else {
			_tmp1_ = FALSE;
		}
		if (!_tmp1_) {
			break;
		}
		_tmp4_ = afrodite_symbol_get_name (curr_symbol);
		_tmp5_ = g_str_has_prefix (_tmp4_, "!");
		if (_tmp5_ == FALSE) {
			gboolean _tmp6_;
			_tmp6_ = afrodite_symbol_get_has_generic_type_arguments (curr_symbol);
			_tmp3_ = _tmp6_;
		} else {
			_tmp3_ = FALSE;
		}
		if (_tmp3_) {
			{
				ValaList* _tmp7_ = NULL;
				ValaList* _tmp8_;
				ValaList* _arg_list;
				gint _tmp9_;
				gint _arg_size;
				gint _arg_index;
				_tmp7_ = afrodite_symbol_get_generic_type_arguments (curr_symbol);
				_tmp8_ = _vala_iterable_ref0 (_tmp7_);
				_arg_list = _tmp8_;
				_tmp9_ = vala_collection_get_size ((ValaCollection*) _arg_list);
				_arg_size = _tmp9_;
				_arg_index = -1;
				while (TRUE) {
					gpointer _tmp10_ = NULL;
					AfroditeSymbol* arg;
					gchar* _tmp11_ = NULL;
					gchar* _tmp12_;
					gboolean _tmp13_;
					_arg_index = _arg_index + 1;
					if (!(_arg_index < _arg_size)) {
						break;
					}
					_tmp10_ = vala_list_get (_arg_list, _arg_index);
					arg = (AfroditeSymbol*) _tmp10_;
					_tmp11_ = afrodite_symbol_get_fully_qualified_name (arg);
					_tmp12_ = _tmp11_;
					_tmp13_ = g_strcmp0 (type_name, _tmp12_) == 0;
					_g_free0 (_tmp12_);
					if (_tmp13_) {
						AfroditeSymbol* _tmp14_;
						_tmp14_ = _g_object_ref0 (arg);
						_g_object_unref0 (res);
						res = _tmp14_;
						_g_object_unref0 (arg);
						break;
					}
					_g_object_unref0 (arg);
				}
				_vala_iterable_unref0 (_arg_list);
			}
		}
		if (res != NULL) {
			break;
		}
		_tmp15_ = afrodite_symbol_get_parent (curr_symbol);
		_tmp16_ = _g_object_ref0 (_tmp15_);
		_g_object_unref0 (curr_symbol);
		curr_symbol = _tmp16_;
	}
	if (res == NULL) {
		AfroditeSymbol* _tmp17_;
		_tmp17_ = _g_object_ref0 (symbol);
		_g_object_unref0 (curr_symbol);
		curr_symbol = _tmp17_;
		while (TRUE) {
			gboolean _tmp18_ = FALSE;
			gboolean _tmp20_ = FALSE;
			gboolean _tmp21_ = FALSE;
			gboolean _tmp22_ = FALSE;
			AfroditeMemberType _tmp23_;
			AfroditeSymbol* _tmp35_ = NULL;
			AfroditeSymbol* _tmp36_;
			if (curr_symbol != NULL) {
				AfroditeSymbol* _tmp19_ = NULL;
				_tmp19_ = afrodite_code_dom_get_root (self->priv->_codedom);
				_tmp18_ = curr_symbol != _tmp19_;
			} else {
				_tmp18_ = FALSE;
			}
			if (!_tmp18_) {
				break;
			}
			_tmp23_ = afrodite_symbol_get_member_type (curr_symbol);
			if (_tmp23_ == AFRODITE_MEMBER_TYPE_CLASS) {
				_tmp22_ = TRUE;
			} else {
				AfroditeMemberType _tmp24_;
				_tmp24_ = afrodite_symbol_get_member_type (curr_symbol);
				_tmp22_ = _tmp24_ == AFRODITE_MEMBER_TYPE_NAMESPACE;
			}
			if (_tmp22_) {
				_tmp21_ = TRUE;
			} else {
				AfroditeMemberType _tmp25_;
				_tmp25_ = afrodite_symbol_get_member_type (curr_symbol);
				_tmp21_ = _tmp25_ == AFRODITE_MEMBER_TYPE_INTERFACE;
			}
			if (_tmp21_) {
				_tmp20_ = TRUE;
			} else {
				AfroditeMemberType _tmp26_;
				_tmp26_ = afrodite_symbol_get_member_type (curr_symbol);
				_tmp20_ = _tmp26_ == AFRODITE_MEMBER_TYPE_STRUCT;
			}
			if (_tmp20_) {
				gchar* _tmp27_ = NULL;
				gchar* _tmp28_;
				gchar* _tmp29_ = NULL;
				gchar* _tmp30_;
				gpointer _tmp31_ = NULL;
				AfroditeSymbol* _tmp32_;
				gboolean _tmp33_ = FALSE;
				_tmp27_ = afrodite_symbol_get_fully_qualified_name (curr_symbol);
				_tmp28_ = _tmp27_;
				_tmp29_ = g_strdup_printf ("%s.%s", _tmp28_, type_name);
				_tmp30_ = _tmp29_;
				_tmp31_ = vala_map_get ((ValaMap*) self->priv->_codedom->symbols, _tmp30_);
				_tmp32_ = _g_object_ref0 ((AfroditeSymbol*) _tmp31_);
				_g_object_unref0 (s);
				s = _tmp32_;
				_g_free0 (_tmp30_);
				_g_free0 (_tmp28_);
				if (s != NULL) {
					_tmp33_ = s != symbol;
				} else {
					_tmp33_ = FALSE;
				}
				if (_tmp33_) {
					AfroditeSymbol* _tmp34_;
					_tmp34_ = _g_object_ref0 (s);
					_g_object_unref0 (res);
					res = _tmp34_;
					break;
				}
			}
			_tmp35_ = afrodite_symbol_get_parent (curr_symbol);
			_tmp36_ = _g_object_ref0 (_tmp35_);
			_g_object_unref0 (curr_symbol);
			curr_symbol = _tmp36_;
		}
	}
	if (res == NULL) {
		gboolean has_glib_using;
		gboolean _tmp37_;
		has_glib_using = FALSE;
		_tmp37_ = afrodite_symbol_get_has_source_references (symbol);
		if (_tmp37_) {
			{
				ValaList* _tmp38_ = NULL;
				ValaList* _tmp39_;
				ValaList* _reference_list;
				gint _tmp40_;
				gint _reference_size;
				gint _reference_index;
				_tmp38_ = afrodite_symbol_get_source_references (symbol);
				_tmp39_ = _vala_iterable_ref0 (_tmp38_);
				_reference_list = _tmp39_;
				_tmp40_ = vala_collection_get_size ((ValaCollection*) _reference_list);
				_reference_size = _tmp40_;
				_reference_index = -1;
				while (TRUE) {
					gpointer _tmp41_ = NULL;
					AfroditeSourceReference* reference;
					AfroditeSourceFile* _tmp42_ = NULL;
					AfroditeSourceFile* _tmp43_;
					AfroditeSourceFile* file;
					gboolean _tmp44_;
					_reference_index = _reference_index + 1;
					if (!(_reference_index < _reference_size)) {
						break;
					}
					_tmp41_ = vala_list_get (_reference_list, _reference_index);
					reference = (AfroditeSourceReference*) _tmp41_;
					_tmp42_ = afrodite_source_reference_get_file (reference);
					_tmp43_ = _afrodite_source_file_ref0 (_tmp42_);
					file = _tmp43_;
					_tmp44_ = afrodite_source_file_get_has_using_directives (file);
					if (!_tmp44_) {
						_afrodite_source_file_unref0 (file);
						_afrodite_source_reference_unref0 (reference);
						continue;
					}
					{
						ValaList* _tmp45_ = NULL;
						ValaList* _tmp46_;
						ValaList* _using_directive_list;
						gint _tmp47_;
						gint _using_directive_size;
						gint _using_directive_index;
						_tmp45_ = afrodite_source_file_get_using_directives (file);
						_tmp46_ = _vala_iterable_ref0 (_tmp45_);
						_using_directive_list = _tmp46_;
						_tmp47_ = vala_collection_get_size ((ValaCollection*) _using_directive_list);
						_using_directive_size = _tmp47_;
						_using_directive_index = -1;
						while (TRUE) {
							gpointer _tmp48_ = NULL;
							AfroditeDataType* using_directive;
							gboolean _tmp49_;
							const gchar* _tmp50_ = NULL;
							const gchar* _tmp51_ = NULL;
							gchar* _tmp52_ = NULL;
							gchar* _tmp53_;
							gpointer _tmp54_ = NULL;
							AfroditeSymbol* _tmp55_;
							gboolean _tmp56_ = FALSE;
							_using_directive_index = _using_directive_index + 1;
							if (!(_using_directive_index < _using_directive_size)) {
								break;
							}
							_tmp48_ = vala_list_get (_using_directive_list, _using_directive_index);
							using_directive = (AfroditeDataType*) _tmp48_;
							_tmp49_ = afrodite_data_type_get_unresolved (using_directive);
							if (_tmp49_) {
								_afrodite_data_type_unref0 (using_directive);
								continue;
							}
							_tmp50_ = afrodite_data_type_get_name (using_directive);
							if (g_strcmp0 (_tmp50_, "GLib") == 0) {
								has_glib_using = TRUE;
							}
							_tmp51_ = afrodite_data_type_get_type_name (using_directive);
							_tmp52_ = g_strdup_printf ("%s.%s", _tmp51_, type_name);
							_tmp53_ = _tmp52_;
							_tmp54_ = vala_map_get ((ValaMap*) self->priv->_codedom->symbols, _tmp53_);
							_tmp55_ = _g_object_ref0 ((AfroditeSymbol*) _tmp54_);
							_g_object_unref0 (s);
							s = _tmp55_;
							_g_free0 (_tmp53_);
							if (s != NULL) {
								_tmp56_ = s != symbol;
							} else {
								_tmp56_ = FALSE;
							}
							if (_tmp56_) {
								AfroditeSymbol* _tmp57_;
								_tmp57_ = _g_object_ref0 (s);
								_g_object_unref0 (res);
								res = _tmp57_;
								_afrodite_data_type_unref0 (using_directive);
								break;
							}
							_afrodite_data_type_unref0 (using_directive);
						}
						_vala_iterable_unref0 (_using_directive_list);
					}
					if (res != NULL) {
						_afrodite_source_file_unref0 (file);
						_afrodite_source_reference_unref0 (reference);
						break;
					}
					_afrodite_source_file_unref0 (file);
					_afrodite_source_reference_unref0 (reference);
				}
				_vala_iterable_unref0 (_reference_list);
			}
		}
		if (res == NULL) {
			if (!has_glib_using) {
				gchar* _tmp58_ = NULL;
				gchar* _tmp59_;
				gpointer _tmp60_ = NULL;
				AfroditeSymbol* _tmp61_;
				gboolean _tmp62_ = FALSE;
				_tmp58_ = g_strdup_printf ("GLib.%s", type_name);
				_tmp59_ = _tmp58_;
				_tmp60_ = vala_map_get ((ValaMap*) self->priv->_codedom->symbols, _tmp59_);
				_tmp61_ = _g_object_ref0 ((AfroditeSymbol*) _tmp60_);
				_g_object_unref0 (s);
				s = _tmp61_;
				_g_free0 (_tmp59_);
				if (s != NULL) {
					_tmp62_ = s != symbol;
				} else {
					_tmp62_ = FALSE;
				}
				if (_tmp62_) {
					AfroditeSymbol* _tmp63_;
					_tmp63_ = _g_object_ref0 (s);
					_g_object_unref0 (res);
					res = _tmp63_;
				}
			}
		}
	}
	result = res;
	_g_object_unref0 (curr_symbol);
	_g_object_unref0 (s);
	return result;
}


static AfroditeSymbol* afrodite_symbol_resolver_specialize_generic_symbol (AfroditeSymbolResolver* self, AfroditeDataType* type, AfroditeSymbol* symbol) {
	AfroditeSymbol* result = NULL;
	AfroditeSymbol* _tmp0_ = NULL;
	AfroditeSymbol* c;
	ValaList* _tmp1_ = NULL;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (type != NULL, NULL);
	g_return_val_if_fail (symbol != NULL, NULL);
	_tmp0_ = afrodite_symbol_copy (symbol);
	c = _tmp0_;
	afrodite_symbol_resolver_visit_symbol (self, c);
	_tmp1_ = afrodite_data_type_get_generic_types (type);
	afrodite_symbol_specialize_generic_symbol (c, _tmp1_);
	afrodite_symbol_resolver_visit_symbol (self, c);
	_tmp2_ = afrodite_symbol_get_has_base_types (c);
	if (_tmp2_) {
		{
			ValaList* _tmp3_ = NULL;
			ValaList* _tmp4_;
			ValaList* _item_list;
			gint _tmp5_;
			gint _item_size;
			gint _item_index;
			_tmp3_ = afrodite_symbol_get_base_types (c);
			_tmp4_ = _vala_iterable_ref0 (_tmp3_);
			_item_list = _tmp4_;
			_tmp5_ = vala_collection_get_size ((ValaCollection*) _item_list);
			_item_size = _tmp5_;
			_item_index = -1;
			while (TRUE) {
				gpointer _tmp6_ = NULL;
				AfroditeDataType* item;
				gboolean _tmp7_;
				_item_index = _item_index + 1;
				if (!(_item_index < _item_size)) {
					break;
				}
				_tmp6_ = vala_list_get (_item_list, _item_index);
				item = (AfroditeDataType*) _tmp6_;
				_tmp7_ = afrodite_data_type_get_unresolved (item);
				if (!_tmp7_) {
					AfroditeSymbol* _tmp8_ = NULL;
					gboolean _tmp9_;
					_tmp8_ = afrodite_data_type_get_symbol (item);
					_tmp9_ = afrodite_symbol_get_has_generic_type_arguments (_tmp8_);
					if (_tmp9_) {
						AfroditeSymbol* _tmp10_ = NULL;
						AfroditeSymbol* _tmp14_ = NULL;
						gchar* _tmp15_ = NULL;
						gchar* _tmp16_;
						gchar* _tmp17_ = NULL;
						gchar* _tmp18_;
						gboolean _tmp19_;
						AfroditeSymbol* _tmp23_ = NULL;
						AfroditeSymbol* _tmp24_ = NULL;
						AfroditeSymbol* _tmp25_;
						_tmp10_ = afrodite_data_type_get_symbol (item);
						if (_tmp10_ == symbol) {
							gchar* _tmp11_ = NULL;
							gchar* _tmp12_;
							const gchar* _tmp13_ = NULL;
							_tmp11_ = afrodite_symbol_get_description (symbol);
							_tmp12_ = _tmp11_;
							_tmp13_ = afrodite_data_type_get_type_name (item);
							g_critical ("symbolresolver.vala:313: Skipping same instance reference cycle: %s %s", _tmp12_, _tmp13_);
							_g_free0 (_tmp12_);
							_afrodite_data_type_unref0 (item);
							continue;
						}
						_tmp14_ = afrodite_data_type_get_symbol (item);
						_tmp15_ = afrodite_symbol_get_fully_qualified_name (_tmp14_);
						_tmp16_ = _tmp15_;
						_tmp17_ = afrodite_symbol_get_fully_qualified_name (symbol);
						_tmp18_ = _tmp17_;
						_tmp19_ = g_strcmp0 (_tmp16_, _tmp18_) == 0;
						_g_free0 (_tmp18_);
						_g_free0 (_tmp16_);
						if (_tmp19_) {
							AfroditeSymbol* _tmp20_ = NULL;
							gchar* _tmp21_ = NULL;
							gchar* _tmp22_;
							_tmp20_ = afrodite_data_type_get_symbol (item);
							_tmp21_ = afrodite_symbol_get_description (_tmp20_);
							_tmp22_ = _tmp21_;
							g_critical ("symbolresolver.vala:317: Skipping same name reference cycle: %s", _tmp22_);
							_g_free0 (_tmp22_);
							_afrodite_data_type_unref0 (item);
							continue;
						}
						_tmp23_ = afrodite_data_type_get_symbol (item);
						_tmp24_ = afrodite_symbol_resolver_specialize_generic_symbol (self, type, _tmp23_);
						_tmp25_ = _tmp24_;
						afrodite_data_type_set_symbol (item, _tmp25_);
						_g_object_unref0 (_tmp25_);
					}
				}
				_afrodite_data_type_unref0 (item);
			}
			_vala_iterable_unref0 (_item_list);
		}
	}
	afrodite_symbol_add_specialized_symbol (symbol, c);
	result = c;
	return result;
}


static gpointer _afrodite_data_type_ref0 (gpointer self) {
	return self ? afrodite_data_type_ref (self) : NULL;
}


static void afrodite_symbol_resolver_resolve_symbol (AfroditeSymbolResolver* self, AfroditeSymbol* symbol, AfroditeDataType* type) {
	AfroditeSymbol* _tmp0_ = NULL;
	AfroditeSymbol* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (symbol != NULL);
	g_return_if_fail (type != NULL);
	_tmp0_ = afrodite_symbol_resolver_resolve_type (self, symbol, type);
	_tmp1_ = _tmp0_;
	afrodite_data_type_set_symbol (type, _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = afrodite_data_type_get_unresolved (type);
	if (!_tmp2_) {
		AfroditeSymbol* _tmp3_ = NULL;
		AfroditeDataType* _tmp4_ = NULL;
		_tmp3_ = afrodite_data_type_get_symbol (type);
		_tmp4_ = afrodite_symbol_get_return_type (_tmp3_);
		if (_tmp4_ != NULL) {
			AfroditeSymbol* _tmp5_ = NULL;
			AfroditeDataType* _tmp6_ = NULL;
			AfroditeDataType* _tmp7_;
			AfroditeDataType* dt;
			const gchar* _tmp8_ = NULL;
			gboolean _tmp9_;
			_tmp5_ = afrodite_data_type_get_symbol (type);
			_tmp6_ = afrodite_symbol_get_return_type (_tmp5_);
			_tmp7_ = _afrodite_data_type_ref0 (_tmp6_);
			dt = _tmp7_;
			_tmp8_ = afrodite_data_type_get_type_name (dt);
			afrodite_data_type_set_type_name (type, _tmp8_);
			_tmp9_ = afrodite_data_type_get_is_iterator (type);
			if (_tmp9_) {
				gboolean _tmp10_ = FALSE;
				gboolean _tmp11_;
				_tmp11_ = afrodite_data_type_get_has_generic_types (dt);
				if (_tmp11_) {
					ValaList* _tmp12_ = NULL;
					gint _tmp13_;
					_tmp12_ = afrodite_data_type_get_generic_types (dt);
					_tmp13_ = vala_collection_get_size ((ValaCollection*) _tmp12_);
					_tmp10_ = _tmp13_ == 1;
				} else {
					_tmp10_ = FALSE;
				}
				if (_tmp10_) {
					ValaList* _tmp14_ = NULL;
					gpointer _tmp15_ = NULL;
					AfroditeDataType* _tmp16_;
					const gchar* _tmp17_ = NULL;
					ValaList* _tmp18_ = NULL;
					gpointer _tmp19_ = NULL;
					AfroditeDataType* _tmp20_;
					AfroditeSymbol* _tmp21_ = NULL;
					_tmp14_ = afrodite_data_type_get_generic_types (dt);
					_tmp15_ = vala_list_get (_tmp14_, 0);
					_tmp16_ = (AfroditeDataType*) _tmp15_;
					_tmp17_ = afrodite_data_type_get_type_name (_tmp16_);
					afrodite_data_type_set_type_name (type, _tmp17_);
					_afrodite_data_type_unref0 (_tmp16_);
					_tmp18_ = afrodite_data_type_get_generic_types (dt);
					_tmp19_ = vala_list_get (_tmp18_, 0);
					_tmp20_ = (AfroditeDataType*) _tmp19_;
					_tmp21_ = afrodite_data_type_get_symbol (_tmp20_);
					afrodite_data_type_set_symbol (type, _tmp21_);
					_afrodite_data_type_unref0 (_tmp20_);
				}
			}
			_afrodite_data_type_unref0 (dt);
		}
	}
}


static gboolean afrodite_symbol_resolver_visit_symbol (AfroditeSymbolResolver* self, AfroditeSymbol* symbol) {
	gboolean result = FALSE;
	gboolean resolved;
	gboolean _tmp0_;
	AfroditeDataType* _tmp9_ = NULL;
	gboolean _tmp18_;
	gboolean _tmp27_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (symbol != NULL, FALSE);
	resolved = TRUE;
	_tmp0_ = afrodite_symbol_get_has_base_types (symbol);
	if (_tmp0_) {
		{
			ValaList* _tmp1_ = NULL;
			ValaList* _tmp2_;
			ValaList* _type_list;
			gint _tmp3_;
			gint _type_size;
			gint _type_index;
			_tmp1_ = afrodite_symbol_get_base_types (symbol);
			_tmp2_ = _vala_iterable_ref0 (_tmp1_);
			_type_list = _tmp2_;
			_tmp3_ = vala_collection_get_size ((ValaCollection*) _type_list);
			_type_size = _tmp3_;
			_type_index = -1;
			while (TRUE) {
				gpointer _tmp4_ = NULL;
				AfroditeDataType* type;
				gboolean _tmp5_;
				_type_index = _type_index + 1;
				if (!(_type_index < _type_size)) {
					break;
				}
				_tmp4_ = vala_list_get (_type_list, _type_index);
				type = (AfroditeDataType*) _tmp4_;
				_tmp5_ = afrodite_data_type_get_unresolved (type);
				if (_tmp5_) {
					AfroditeSymbol* _tmp6_ = NULL;
					AfroditeSymbol* _tmp7_;
					gboolean _tmp8_;
					_tmp6_ = afrodite_symbol_resolver_resolve_type (self, symbol, type);
					_tmp7_ = _tmp6_;
					afrodite_data_type_set_symbol (type, _tmp7_);
					_g_object_unref0 (_tmp7_);
					_tmp8_ = afrodite_data_type_get_unresolved (type);
					resolved = resolved & (!_tmp8_);
				}
				_afrodite_data_type_unref0 (type);
			}
			_vala_iterable_unref0 (_type_list);
		}
	}
	_tmp9_ = afrodite_symbol_get_return_type (symbol);
	if (_tmp9_ != NULL) {
		AfroditeDataType* _tmp10_ = NULL;
		gboolean _tmp11_;
		_tmp10_ = afrodite_symbol_get_return_type (symbol);
		_tmp11_ = afrodite_data_type_get_unresolved (_tmp10_);
		if (_tmp11_) {
			AfroditeDataType* _tmp12_ = NULL;
			AfroditeDataType* _tmp13_ = NULL;
			AfroditeSymbol* _tmp14_ = NULL;
			AfroditeSymbol* _tmp15_;
			AfroditeDataType* _tmp16_ = NULL;
			gboolean _tmp17_;
			_tmp12_ = afrodite_symbol_get_return_type (symbol);
			_tmp13_ = afrodite_symbol_get_return_type (symbol);
			_tmp14_ = afrodite_symbol_resolver_resolve_type (self, symbol, _tmp13_);
			_tmp15_ = _tmp14_;
			afrodite_data_type_set_symbol (_tmp12_, _tmp15_);
			_g_object_unref0 (_tmp15_);
			_tmp16_ = afrodite_symbol_get_return_type (symbol);
			_tmp17_ = afrodite_data_type_get_unresolved (_tmp16_);
			resolved = resolved & (!_tmp17_);
		}
	}
	_tmp18_ = afrodite_symbol_get_has_parameters (symbol);
	if (_tmp18_) {
		{
			ValaList* _tmp19_ = NULL;
			ValaList* _tmp20_;
			ValaList* _type_list;
			gint _tmp21_;
			gint _type_size;
			gint _type_index;
			_tmp19_ = afrodite_symbol_get_parameters (symbol);
			_tmp20_ = _vala_iterable_ref0 (_tmp19_);
			_type_list = _tmp20_;
			_tmp21_ = vala_collection_get_size ((ValaCollection*) _type_list);
			_type_size = _tmp21_;
			_type_index = -1;
			while (TRUE) {
				gpointer _tmp22_ = NULL;
				AfroditeDataType* type;
				gboolean _tmp23_;
				_type_index = _type_index + 1;
				if (!(_type_index < _type_size)) {
					break;
				}
				_tmp22_ = vala_list_get (_type_list, _type_index);
				type = (AfroditeDataType*) _tmp22_;
				_tmp23_ = afrodite_data_type_get_unresolved (type);
				if (_tmp23_) {
					AfroditeSymbol* _tmp24_ = NULL;
					AfroditeSymbol* _tmp25_;
					gboolean _tmp26_;
					_tmp24_ = afrodite_symbol_resolver_resolve_type (self, symbol, type);
					_tmp25_ = _tmp24_;
					afrodite_data_type_set_symbol (type, _tmp25_);
					_g_object_unref0 (_tmp25_);
					_tmp26_ = afrodite_data_type_get_unresolved (type);
					resolved = resolved & (!_tmp26_);
				}
				_afrodite_data_type_unref0 (type);
			}
			_vala_iterable_unref0 (_type_list);
		}
	}
	_tmp27_ = afrodite_symbol_get_has_local_variables (symbol);
	if (_tmp27_) {
		{
			ValaList* _tmp28_ = NULL;
			ValaList* _tmp29_;
			ValaList* _type_list;
			gint _tmp30_;
			gint _type_size;
			gint _type_index;
			_tmp28_ = afrodite_symbol_get_local_variables (symbol);
			_tmp29_ = _vala_iterable_ref0 (_tmp28_);
			_type_list = _tmp29_;
			_tmp30_ = vala_collection_get_size ((ValaCollection*) _type_list);
			_type_size = _tmp30_;
			_type_index = -1;
			while (TRUE) {
				gpointer _tmp31_ = NULL;
				AfroditeDataType* type;
				gboolean _tmp32_;
				_type_index = _type_index + 1;
				if (!(_type_index < _type_size)) {
					break;
				}
				_tmp31_ = vala_list_get (_type_list, _type_index);
				type = (AfroditeDataType*) _tmp31_;
				_tmp32_ = afrodite_data_type_get_unresolved (type);
				if (_tmp32_) {
					gboolean _tmp33_;
					afrodite_symbol_resolver_resolve_symbol (self, symbol, type);
					_tmp33_ = afrodite_data_type_get_unresolved (type);
					resolved = resolved & (!_tmp33_);
				}
				_afrodite_data_type_unref0 (type);
			}
			_vala_iterable_unref0 (_type_list);
		}
	}
	result = resolved;
	return result;
}


static void afrodite_symbol_resolver_visit_symbols (AfroditeSymbolResolver* self, ValaList* symbols) {
	ValaArrayList* _tmp0_ = NULL;
	ValaList* resolved;
	g_return_if_fail (self != NULL);
	g_return_if_fail (symbols != NULL);
	_tmp0_ = vala_array_list_new (AFRODITE_TYPE_SYMBOL, NULL, NULL, g_direct_equal);
	resolved = (ValaList*) _tmp0_;
	{
		ValaList* _tmp1_;
		ValaList* _symbol_list;
		gint _tmp2_;
		gint _symbol_size;
		gint _symbol_index;
		_tmp1_ = _vala_iterable_ref0 (symbols);
		_symbol_list = _tmp1_;
		_tmp2_ = vala_collection_get_size ((ValaCollection*) _symbol_list);
		_symbol_size = _tmp2_;
		_symbol_index = -1;
		while (TRUE) {
			gpointer _tmp3_ = NULL;
			AfroditeSymbol* _tmp4_;
			AfroditeSymbol* symbol;
			gboolean _tmp5_;
			_symbol_index = _symbol_index + 1;
			if (!(_symbol_index < _symbol_size)) {
				break;
			}
			_tmp3_ = vala_list_get (_symbol_list, _symbol_index);
			_tmp4_ = _g_object_ref0 ((AfroditeSymbol*) _tmp3_);
			symbol = _tmp4_;
			_tmp5_ = afrodite_symbol_resolver_visit_symbol (self, symbol);
			if (_tmp5_) {
				vala_collection_add ((ValaCollection*) resolved, symbol);
			}
			_g_object_unref0 (symbol);
		}
		_vala_iterable_unref0 (_symbol_list);
	}
	{
		ValaList* _tmp6_;
		ValaList* _symbol_list;
		gint _tmp7_;
		gint _symbol_size;
		gint _symbol_index;
		_tmp6_ = _vala_iterable_ref0 (resolved);
		_symbol_list = _tmp6_;
		_tmp7_ = vala_collection_get_size ((ValaCollection*) _symbol_list);
		_symbol_size = _tmp7_;
		_symbol_index = -1;
		while (TRUE) {
			gpointer _tmp8_ = NULL;
			AfroditeSymbol* _tmp9_;
			AfroditeSymbol* symbol;
			_symbol_index = _symbol_index + 1;
			if (!(_symbol_index < _symbol_size)) {
				break;
			}
			_tmp8_ = vala_list_get (_symbol_list, _symbol_index);
			_tmp9_ = _g_object_ref0 ((AfroditeSymbol*) _tmp8_);
			symbol = _tmp9_;
			vala_collection_remove ((ValaCollection*) symbols, symbol);
			_g_object_unref0 (symbol);
		}
		_vala_iterable_unref0 (_symbol_list);
	}
	_vala_iterable_unref0 (resolved);
}


AfroditeSymbolResolver* afrodite_symbol_resolver_construct (GType object_type) {
	AfroditeSymbolResolver* self = NULL;
	self = (AfroditeSymbolResolver*) g_type_create_instance (object_type);
	return self;
}


AfroditeSymbolResolver* afrodite_symbol_resolver_new (void) {
	return afrodite_symbol_resolver_construct (AFRODITE_TYPE_SYMBOL_RESOLVER);
}


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


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


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


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


static gchar* afrodite_value_symbol_resolver_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		AfroditeSymbolResolver* 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_symbol_resolver_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* afrodite_value_symbol_resolver_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	AfroditeSymbolResolver** 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_symbol_resolver_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* afrodite_param_spec_symbol_resolver (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	AfroditeParamSpecSymbolResolver* spec;
	g_return_val_if_fail (g_type_is_a (object_type, AFRODITE_TYPE_SYMBOL_RESOLVER), 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_symbol_resolver (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SYMBOL_RESOLVER), NULL);
	return value->data[0].v_pointer;
}


void afrodite_value_set_symbol_resolver (GValue* value, gpointer v_object) {
	AfroditeSymbolResolver* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SYMBOL_RESOLVER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_SYMBOL_RESOLVER));
		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_symbol_resolver_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		afrodite_symbol_resolver_unref (old);
	}
}


void afrodite_value_take_symbol_resolver (GValue* value, gpointer v_object) {
	AfroditeSymbolResolver* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SYMBOL_RESOLVER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_SYMBOL_RESOLVER));
		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_symbol_resolver_unref (old);
	}
}


static void afrodite_symbol_resolver_class_init (AfroditeSymbolResolverClass * klass) {
	afrodite_symbol_resolver_parent_class = g_type_class_peek_parent (klass);
	AFRODITE_SYMBOL_RESOLVER_CLASS (klass)->finalize = afrodite_symbol_resolver_finalize;
	g_type_class_add_private (klass, sizeof (AfroditeSymbolResolverPrivate));
}


static void afrodite_symbol_resolver_instance_init (AfroditeSymbolResolver * self) {
	self->priv = AFRODITE_SYMBOL_RESOLVER_GET_PRIVATE (self);
	self->priv->_codedom = NULL;
	self->priv->_vala_symbol_fqn = NULL;
	self->ref_count = 1;
}


static void afrodite_symbol_resolver_finalize (AfroditeSymbolResolver* obj) {
	AfroditeSymbolResolver * self;
	self = AFRODITE_SYMBOL_RESOLVER (obj);
	_afrodite_code_dom_unref0 (self->priv->_codedom);
	_g_free0 (self->priv->_vala_symbol_fqn);
}


GType afrodite_symbol_resolver_get_type (void) {
	static volatile gsize afrodite_symbol_resolver_type_id__volatile = 0;
	if (g_once_init_enter (&afrodite_symbol_resolver_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { afrodite_value_symbol_resolver_init, afrodite_value_symbol_resolver_free_value, afrodite_value_symbol_resolver_copy_value, afrodite_value_symbol_resolver_peek_pointer, "p", afrodite_value_symbol_resolver_collect_value, "p", afrodite_value_symbol_resolver_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (AfroditeSymbolResolverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) afrodite_symbol_resolver_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AfroditeSymbolResolver), 0, (GInstanceInitFunc) afrodite_symbol_resolver_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_symbol_resolver_type_id;
		afrodite_symbol_resolver_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AfroditeSymbolResolver", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&afrodite_symbol_resolver_type_id__volatile, afrodite_symbol_resolver_type_id);
	}
	return afrodite_symbol_resolver_type_id__volatile;
}


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


void afrodite_symbol_resolver_unref (gpointer instance) {
	AfroditeSymbolResolver* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		AFRODITE_SYMBOL_RESOLVER_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



