/* ide-vala-symbol-resolver.c generated by valac 0.30.0, the Vala compiler
 * generated from ide-vala-symbol-resolver.vala, do not modify */

/* ide-vala-symbol-resolver.vala
 *
 * Copyright (C) 2015 Christian Hergert <christian@hergert.me>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <ide.h>
#include <gio/gio.h>
#include <vala.h>
#include <string.h>


#define IDE_TYPE_VALA_SYMBOL_RESOLVER (ide_vala_symbol_resolver_get_type ())
#define IDE_VALA_SYMBOL_RESOLVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_SYMBOL_RESOLVER, IdeValaSymbolResolver))
#define IDE_VALA_SYMBOL_RESOLVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_SYMBOL_RESOLVER, IdeValaSymbolResolverClass))
#define IDE_IS_VALA_SYMBOL_RESOLVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_SYMBOL_RESOLVER))
#define IDE_IS_VALA_SYMBOL_RESOLVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_SYMBOL_RESOLVER))
#define IDE_VALA_SYMBOL_RESOLVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_SYMBOL_RESOLVER, IdeValaSymbolResolverClass))

typedef struct _IdeValaSymbolResolver IdeValaSymbolResolver;
typedef struct _IdeValaSymbolResolverClass IdeValaSymbolResolverClass;
typedef struct _IdeValaSymbolResolverPrivate IdeValaSymbolResolverPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define IDE_TYPE_VALA_SERVICE (ide_vala_service_get_type ())
#define IDE_VALA_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_SERVICE, IdeValaService))
#define IDE_VALA_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_SERVICE, IdeValaServiceClass))
#define IDE_IS_VALA_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_SERVICE))
#define IDE_IS_VALA_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_SERVICE))
#define IDE_VALA_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_SERVICE, IdeValaServiceClass))

typedef struct _IdeValaService IdeValaService;
typedef struct _IdeValaServiceClass IdeValaServiceClass;

#define IDE_TYPE_VALA_INDEX (ide_vala_index_get_type ())
#define IDE_VALA_INDEX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_INDEX, IdeValaIndex))
#define IDE_VALA_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_INDEX, IdeValaIndexClass))
#define IDE_IS_VALA_INDEX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_INDEX))
#define IDE_IS_VALA_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_INDEX))
#define IDE_VALA_INDEX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_INDEX, IdeValaIndexClass))

typedef struct _IdeValaIndex IdeValaIndex;
typedef struct _IdeValaIndexClass IdeValaIndexClass;
typedef struct _IdeValaSymbolResolverGetSymbolTreeAsyncData IdeValaSymbolResolverGetSymbolTreeAsyncData;
#define _ide_source_location_unref0(var) ((var == NULL) ? NULL : (var = (ide_source_location_unref (var), NULL)))
#define _ide_symbol_unref0(var) ((var == NULL) ? NULL : (var = (ide_symbol_unref (var), NULL)))
#define _vala_source_reference_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_reference_unref (var), NULL)))
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
typedef struct _IdeValaSymbolResolverLookupSymbolAsyncData IdeValaSymbolResolverLookupSymbolAsyncData;

struct _IdeValaSymbolResolver {
	IdeObject parent_instance;
	IdeValaSymbolResolverPrivate * priv;
};

struct _IdeValaSymbolResolverClass {
	IdeObjectClass parent_class;
};

struct _IdeValaSymbolResolverGetSymbolTreeAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	IdeValaSymbolResolver* self;
	GFile* file;
	GCancellable* cancellable;
	IdeSymbolTree* result;
	IdeContext* context;
	IdeContext* _tmp0_;
	IdeContext* _tmp1_;
	IdeValaService* service;
	void* _tmp2_;
	IdeValaService* _tmp3_;
	IdeValaIndex* index;
	IdeValaIndex* _tmp4_;
	IdeValaIndex* _tmp5_;
	IdeValaIndex* _tmp6_;
	IdeSymbolTree* symbol_tree;
	GFile* _tmp7_;
	GCancellable* _tmp8_;
	IdeSymbolTree* _tmp9_;
	GError * _inner_error_;
};

struct _IdeValaSymbolResolverLookupSymbolAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	IdeValaSymbolResolver* self;
	IdeSourceLocation* location;
	GCancellable* cancellable;
	IdeSymbol* result;
	IdeContext* context;
	IdeContext* _tmp0_;
	IdeContext* _tmp1_;
	IdeValaService* service;
	IdeContext* _tmp2_;
	void* _tmp3_;
	IdeValaService* _tmp4_;
	IdeValaIndex* index;
	IdeValaService* _tmp5_;
	IdeValaIndex* _tmp6_;
	IdeValaIndex* _tmp7_;
	IdeValaIndex* _tmp8_;
	IdeFile* file;
	IdeSourceLocation* _tmp9_;
	IdeFile* _tmp10_;
	IdeFile* _tmp11_;
	gint line;
	IdeSourceLocation* _tmp12_;
	guint _tmp13_;
	gint column;
	IdeSourceLocation* _tmp14_;
	guint _tmp15_;
	ValaSymbol* symbol;
	IdeValaIndex* _tmp16_;
	IdeFile* _tmp17_;
	GFile* _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	ValaSymbol* _tmp21_;
	ValaSymbol* _tmp22_;
	IdeSymbolKind kind;
	ValaSymbol* _tmp23_;
	ValaSymbol* _tmp24_;
	ValaSymbol* _tmp25_;
	gboolean _tmp26_;
	ValaSymbol* _tmp27_;
	ValaSymbol* _tmp28_;
	ValaSymbol* _tmp29_;
	ValaSymbol* _tmp30_;
	ValaSymbol* _tmp31_;
	IdeSymbolFlags flags;
	ValaSymbol* _tmp32_;
	gboolean _tmp33_;
	IdeSymbolFlags _tmp34_;
	ValaMemberBinding* binding;
	ValaSymbol* _tmp35_;
	ValaMemberBinding* _tmp36_;
	gboolean _tmp37_;
	ValaMemberBinding* _tmp38_;
	ValaMemberBinding* _tmp39_;
	ValaMemberBinding _tmp40_;
	IdeSymbolFlags _tmp41_;
	ValaSymbol* _tmp42_;
	gboolean _tmp43_;
	gboolean _tmp44_;
	IdeSymbolFlags _tmp45_;
	ValaSourceReference* source_reference;
	ValaSymbol* _tmp46_;
	ValaSourceReference* _tmp47_;
	ValaSourceReference* _tmp48_;
	ValaSourceReference* _tmp49_;
	ValaSourceReference* _tmp50_;
	IdeSourceLocation* loc;
	IdeFile* _tmp51_;
	ValaSourceReference* _tmp52_;
	ValaSourceLocation _tmp53_;
	ValaSourceLocation _tmp54_;
	gint _tmp55_;
	ValaSourceReference* _tmp56_;
	ValaSourceLocation _tmp57_;
	ValaSourceLocation _tmp58_;
	gint _tmp59_;
	IdeSourceLocation* _tmp60_;
	ValaSymbol* _tmp61_;
	const gchar* _tmp62_;
	const gchar* _tmp63_;
	IdeSymbolKind _tmp64_;
	IdeSymbolFlags _tmp65_;
	IdeSourceLocation* _tmp66_;
	IdeSourceLocation* _tmp67_;
	IdeSourceLocation* _tmp68_;
	IdeSymbol* _tmp69_;
};


static gpointer ide_vala_symbol_resolver_parent_class = NULL;
static IdeSymbolResolverInterface* ide_vala_symbol_resolver_ide_symbol_resolver_parent_iface = NULL;
static GType ide_vala_symbol_resolver_type_id = 0;

GType ide_vala_symbol_resolver_get_type (void) G_GNUC_CONST;
GType ide_vala_symbol_resolver_register_type (GTypeModule * module);
enum  {
	IDE_VALA_SYMBOL_RESOLVER_DUMMY_PROPERTY
};
static void ide_vala_symbol_resolver_real_get_symbol_tree_async_data_free (gpointer _data);
static void ide_vala_symbol_resolver_real_get_symbol_tree_async (IdeSymbolResolver* base, GFile* file, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean ide_vala_symbol_resolver_real_get_symbol_tree_async_co (IdeValaSymbolResolverGetSymbolTreeAsyncData* _data_);
GType ide_vala_service_get_type (void) G_GNUC_CONST;
GType ide_vala_service_register_type (GTypeModule * module);
GType ide_vala_index_get_type (void) G_GNUC_CONST;
GType ide_vala_index_register_type (GTypeModule * module);
IdeValaIndex* ide_vala_service_get_index (IdeValaService* self);
void ide_vala_index_get_symbol_tree (IdeValaIndex* self, GFile* file, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
IdeSymbolTree* ide_vala_index_get_symbol_tree_finish (IdeValaIndex* self, GAsyncResult* _res_, GError** error);
static void ide_vala_symbol_resolver_get_symbol_tree_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void ide_vala_symbol_resolver_real_lookup_symbol_async_data_free (gpointer _data);
static void ide_vala_symbol_resolver_real_lookup_symbol_async (IdeSymbolResolver* base, IdeSourceLocation* location, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean ide_vala_symbol_resolver_real_lookup_symbol_async_co (IdeValaSymbolResolverLookupSymbolAsyncData* _data_);
void ide_vala_index_find_symbol_at (IdeValaIndex* self, GFile* file, gint line, gint column, GAsyncReadyCallback _callback_, gpointer _user_data_);
ValaSymbol* ide_vala_index_find_symbol_at_finish (IdeValaIndex* self, GAsyncResult* _res_);
static void ide_vala_symbol_resolver_lookup_symbol_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static ValaMemberBinding* ide_vala_symbol_resolver_get_member_binding (IdeValaSymbolResolver* self, ValaSymbol* sym);
static gboolean _vala_member_binding_equal (const ValaMemberBinding* s1, const ValaMemberBinding* s2);
static ValaMemberBinding* _vala_member_binding_dup (ValaMemberBinding* self);
IdeValaSymbolResolver* ide_vala_symbol_resolver_new (void);
IdeValaSymbolResolver* ide_vala_symbol_resolver_construct (GType object_type);


static void ide_vala_symbol_resolver_real_get_symbol_tree_async_data_free (gpointer _data) {
	IdeValaSymbolResolverGetSymbolTreeAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (IdeValaSymbolResolverGetSymbolTreeAsyncData, _data_);
}


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


static void ide_vala_symbol_resolver_real_get_symbol_tree_async (IdeSymbolResolver* base, GFile* file, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	IdeValaSymbolResolver * self;
	IdeValaSymbolResolverGetSymbolTreeAsyncData* _data_;
	IdeValaSymbolResolver* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	GFile* _tmp2_ = NULL;
	GCancellable* _tmp3_ = NULL;
	GCancellable* _tmp4_ = NULL;
	self = (IdeValaSymbolResolver*) base;
	_data_ = g_slice_new0 (IdeValaSymbolResolverGetSymbolTreeAsyncData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, ide_vala_symbol_resolver_real_get_symbol_tree_async);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, ide_vala_symbol_resolver_real_get_symbol_tree_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = file;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp2_;
	_tmp3_ = cancellable;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp4_;
	ide_vala_symbol_resolver_real_get_symbol_tree_async_co (_data_);
}


static IdeSymbolTree* ide_vala_symbol_resolver_real_get_symbol_tree_finish (IdeSymbolResolver* base, GAsyncResult* _res_, GError** error) {
	IdeSymbolTree* result;
	IdeValaSymbolResolverGetSymbolTreeAsyncData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void ide_vala_symbol_resolver_get_symbol_tree_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	IdeValaSymbolResolverGetSymbolTreeAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	ide_vala_symbol_resolver_real_get_symbol_tree_async_co (_data_);
}


static gboolean ide_vala_symbol_resolver_real_get_symbol_tree_async_co (IdeValaSymbolResolverGetSymbolTreeAsyncData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = ide_object_get_context ((IdeObject*) _data_->self);
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _g_object_ref0 (_data_->_tmp0_);
	_data_->context = _data_->_tmp1_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = ide_context_get_service_typed (_data_->context, IDE_TYPE_VALA_SERVICE);
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp2_, IDE_TYPE_VALA_SERVICE, IdeValaService));
	_data_->service = _data_->_tmp3_;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = ide_vala_service_get_index (_data_->service);
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = _g_object_ref0 (_data_->_tmp5_);
	_data_->index = _data_->_tmp6_;
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = _data_->file;
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = _data_->cancellable;
	_data_->_state_ = 1;
	ide_vala_index_get_symbol_tree (_data_->index, _data_->_tmp7_, _data_->_tmp8_, ide_vala_symbol_resolver_get_symbol_tree_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = ide_vala_index_get_symbol_tree_finish (_data_->index, _data_->_res_, &_data_->_inner_error_);
	_data_->symbol_tree = _data_->_tmp9_;
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->index);
		_g_object_unref0 (_data_->service);
		_g_object_unref0 (_data_->context);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->symbol_tree;
	_g_object_unref0 (_data_->index);
	_g_object_unref0 (_data_->service);
	_g_object_unref0 (_data_->context);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	_g_object_unref0 (_data_->symbol_tree);
	_g_object_unref0 (_data_->index);
	_g_object_unref0 (_data_->service);
	_g_object_unref0 (_data_->context);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void ide_vala_symbol_resolver_real_lookup_symbol_async_data_free (gpointer _data) {
	IdeValaSymbolResolverLookupSymbolAsyncData* _data_;
	_data_ = _data;
	_ide_source_location_unref0 (_data_->location);
	_g_object_unref0 (_data_->cancellable);
	_ide_symbol_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (IdeValaSymbolResolverLookupSymbolAsyncData, _data_);
}


static gpointer _ide_source_location_ref0 (gpointer self) {
	return self ? ide_source_location_ref (self) : NULL;
}


static void ide_vala_symbol_resolver_real_lookup_symbol_async (IdeSymbolResolver* base, IdeSourceLocation* location, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	IdeValaSymbolResolver * self;
	IdeValaSymbolResolverLookupSymbolAsyncData* _data_;
	IdeValaSymbolResolver* _tmp0_ = NULL;
	IdeSourceLocation* _tmp1_ = NULL;
	IdeSourceLocation* _tmp2_ = NULL;
	GCancellable* _tmp3_ = NULL;
	GCancellable* _tmp4_ = NULL;
	self = (IdeValaSymbolResolver*) base;
	_data_ = g_slice_new0 (IdeValaSymbolResolverLookupSymbolAsyncData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, ide_vala_symbol_resolver_real_lookup_symbol_async);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, ide_vala_symbol_resolver_real_lookup_symbol_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = location;
	_tmp2_ = _ide_source_location_ref0 (_tmp1_);
	_ide_source_location_unref0 (_data_->location);
	_data_->location = _tmp2_;
	_tmp3_ = cancellable;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp4_;
	ide_vala_symbol_resolver_real_lookup_symbol_async_co (_data_);
}


static IdeSymbol* ide_vala_symbol_resolver_real_lookup_symbol_finish (IdeSymbolResolver* base, GAsyncResult* _res_, GError** error) {
	IdeSymbol* result;
	IdeValaSymbolResolverLookupSymbolAsyncData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void ide_vala_symbol_resolver_lookup_symbol_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	IdeValaSymbolResolverLookupSymbolAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	ide_vala_symbol_resolver_real_lookup_symbol_async_co (_data_);
}


static gboolean _vala_member_binding_equal (const ValaMemberBinding* s1, const ValaMemberBinding* s2) {
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}


static gpointer _vala_source_reference_ref0 (gpointer self) {
	return self ? vala_source_reference_ref (self) : NULL;
}


static gboolean ide_vala_symbol_resolver_real_lookup_symbol_async_co (IdeValaSymbolResolverLookupSymbolAsyncData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = ide_object_get_context ((IdeObject*) _data_->self);
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _g_object_ref0 (_data_->_tmp0_);
	_data_->context = _data_->_tmp1_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->context;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = ide_context_get_service_typed (_data_->_tmp2_, IDE_TYPE_VALA_SERVICE);
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, IDE_TYPE_VALA_SERVICE, IdeValaService));
	_data_->service = _data_->_tmp4_;
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = _data_->service;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = ide_vala_service_get_index (_data_->_tmp5_);
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = _g_object_ref0 (_data_->_tmp7_);
	_data_->index = _data_->_tmp8_;
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = _data_->location;
	_data_->_tmp10_ = NULL;
	_data_->_tmp10_ = ide_source_location_get_file (_data_->_tmp9_);
	_data_->_tmp11_ = NULL;
	_data_->_tmp11_ = _g_object_ref0 (_data_->_tmp10_);
	_data_->file = _data_->_tmp11_;
	_data_->_tmp12_ = NULL;
	_data_->_tmp12_ = _data_->location;
	_data_->_tmp13_ = 0U;
	_data_->_tmp13_ = ide_source_location_get_line (_data_->_tmp12_);
	_data_->line = ((gint) _data_->_tmp13_) + 1;
	_data_->_tmp14_ = NULL;
	_data_->_tmp14_ = _data_->location;
	_data_->_tmp15_ = 0U;
	_data_->_tmp15_ = ide_source_location_get_line_offset (_data_->_tmp14_);
	_data_->column = ((gint) _data_->_tmp15_) + 1;
	_data_->_tmp16_ = NULL;
	_data_->_tmp16_ = _data_->index;
	_data_->_tmp17_ = NULL;
	_data_->_tmp17_ = _data_->file;
	_data_->_tmp18_ = NULL;
	_data_->_tmp18_ = ide_file_get_file (_data_->_tmp17_);
	_data_->_tmp19_ = 0;
	_data_->_tmp19_ = _data_->line;
	_data_->_tmp20_ = 0;
	_data_->_tmp20_ = _data_->column;
	_data_->_state_ = 1;
	ide_vala_index_find_symbol_at (_data_->_tmp16_, _data_->_tmp18_, _data_->_tmp19_, _data_->_tmp20_, ide_vala_symbol_resolver_lookup_symbol_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp21_ = NULL;
	_data_->_tmp21_ = ide_vala_index_find_symbol_at_finish (_data_->_tmp16_, _data_->_res_);
	_data_->symbol = _data_->_tmp21_;
	_data_->_tmp22_ = NULL;
	_data_->_tmp22_ = _data_->symbol;
	if (_data_->_tmp22_ != NULL) {
		_data_->kind = IDE_SYMBOL_NONE;
		_data_->_tmp23_ = NULL;
		_data_->_tmp23_ = _data_->symbol;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp23_, VALA_TYPE_CLASS)) {
			_data_->kind = IDE_SYMBOL_CLASS;
		} else {
			_data_->_tmp24_ = NULL;
			_data_->_tmp24_ = _data_->symbol;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp24_, VALA_TYPE_SUBROUTINE)) {
				_data_->_tmp25_ = NULL;
				_data_->_tmp25_ = _data_->symbol;
				_data_->_tmp26_ = FALSE;
				_data_->_tmp26_ = vala_symbol_is_instance_member (_data_->_tmp25_);
				if (_data_->_tmp26_) {
					_data_->kind = IDE_SYMBOL_METHOD;
				} else {
					_data_->kind = IDE_SYMBOL_FUNCTION;
				}
			} else {
				_data_->_tmp27_ = NULL;
				_data_->_tmp27_ = _data_->symbol;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp27_, VALA_TYPE_STRUCT)) {
					_data_->kind = IDE_SYMBOL_STRUCT;
				} else {
					_data_->_tmp28_ = NULL;
					_data_->_tmp28_ = _data_->symbol;
					if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp28_, VALA_TYPE_FIELD)) {
						_data_->kind = IDE_SYMBOL_FIELD;
					} else {
						_data_->_tmp29_ = NULL;
						_data_->_tmp29_ = _data_->symbol;
						if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp29_, VALA_TYPE_ENUM)) {
							_data_->kind = IDE_SYMBOL_ENUM;
						} else {
							_data_->_tmp30_ = NULL;
							_data_->_tmp30_ = _data_->symbol;
							if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp30_, VALA_TYPE_ENUM_VALUE)) {
								_data_->kind = IDE_SYMBOL_ENUM_VALUE;
							} else {
								_data_->_tmp31_ = NULL;
								_data_->_tmp31_ = _data_->symbol;
								if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp31_, VALA_TYPE_VARIABLE)) {
									_data_->kind = IDE_SYMBOL_VARIABLE;
								}
							}
						}
					}
				}
			}
		}
		_data_->flags = IDE_SYMBOL_FLAGS_NONE;
		_data_->_tmp32_ = NULL;
		_data_->_tmp32_ = _data_->symbol;
		_data_->_tmp33_ = FALSE;
		_data_->_tmp33_ = vala_symbol_is_instance_member (_data_->_tmp32_);
		if (_data_->_tmp33_) {
			_data_->_tmp34_ = 0;
			_data_->_tmp34_ = _data_->flags;
			_data_->flags = _data_->_tmp34_ | IDE_SYMBOL_FLAGS_IS_MEMBER;
		}
		_data_->_tmp35_ = NULL;
		_data_->_tmp35_ = _data_->symbol;
		_data_->_tmp36_ = NULL;
		_data_->_tmp36_ = ide_vala_symbol_resolver_get_member_binding (_data_->self, _data_->_tmp35_);
		_data_->binding = _data_->_tmp36_;
		_data_->_tmp38_ = NULL;
		_data_->_tmp38_ = _data_->binding;
		if (_data_->_tmp38_ != NULL) {
			_data_->_tmp39_ = NULL;
			_data_->_tmp39_ = _data_->binding;
			_data_->_tmp40_ = 0;
			_data_->_tmp40_ = VALA_MEMBER_BINDING_STATIC;
			_data_->_tmp37_ = _vala_member_binding_equal (_data_->_tmp39_, &_data_->_tmp40_) == TRUE;
		} else {
			_data_->_tmp37_ = FALSE;
		}
		if (_data_->_tmp37_) {
			_data_->_tmp41_ = 0;
			_data_->_tmp41_ = _data_->flags;
			_data_->flags = _data_->_tmp41_ | IDE_SYMBOL_FLAGS_IS_STATIC;
		}
		_data_->_tmp42_ = NULL;
		_data_->_tmp42_ = _data_->symbol;
		_data_->_tmp43_ = FALSE;
		_data_->_tmp43_ = vala_symbol_get_deprecated (_data_->_tmp42_);
		_data_->_tmp44_ = FALSE;
		_data_->_tmp44_ = _data_->_tmp43_;
		if (_data_->_tmp44_) {
			_data_->_tmp45_ = 0;
			_data_->_tmp45_ = _data_->flags;
			_data_->flags = _data_->_tmp45_ | IDE_SYMBOL_FLAGS_IS_DEPRECATED;
		}
		_data_->_tmp46_ = NULL;
		_data_->_tmp46_ = _data_->symbol;
		_data_->_tmp47_ = NULL;
		_data_->_tmp47_ = vala_code_node_get_source_reference ((ValaCodeNode*) _data_->_tmp46_);
		_data_->_tmp48_ = NULL;
		_data_->_tmp48_ = _data_->_tmp47_;
		_data_->_tmp49_ = NULL;
		_data_->_tmp49_ = _vala_source_reference_ref0 (_data_->_tmp48_);
		_data_->source_reference = _data_->_tmp49_;
		_data_->_tmp50_ = NULL;
		_data_->_tmp50_ = _data_->source_reference;
		if (_data_->_tmp50_ != NULL) {
			_data_->_tmp51_ = NULL;
			_data_->_tmp51_ = _data_->file;
			_data_->_tmp52_ = NULL;
			_data_->_tmp52_ = _data_->source_reference;
			memset (&_data_->_tmp53_, 0, sizeof (ValaSourceLocation));
			vala_source_reference_get_begin (_data_->_tmp52_, &_data_->_tmp53_);
			memset (&_data_->_tmp54_, 0, sizeof (ValaSourceLocation));
			_data_->_tmp54_ = _data_->_tmp53_;
			_data_->_tmp55_ = 0;
			_data_->_tmp55_ = _data_->_tmp54_.line;
			_data_->_tmp56_ = NULL;
			_data_->_tmp56_ = _data_->source_reference;
			memset (&_data_->_tmp57_, 0, sizeof (ValaSourceLocation));
			vala_source_reference_get_begin (_data_->_tmp56_, &_data_->_tmp57_);
			memset (&_data_->_tmp58_, 0, sizeof (ValaSourceLocation));
			_data_->_tmp58_ = _data_->_tmp57_;
			_data_->_tmp59_ = 0;
			_data_->_tmp59_ = _data_->_tmp58_.column;
			_data_->_tmp60_ = NULL;
			_data_->_tmp60_ = ide_source_location_new (_data_->_tmp51_, (guint) (_data_->_tmp55_ - 1), (guint) (_data_->_tmp59_ - 1), (guint) 0);
			_data_->loc = _data_->_tmp60_;
			_data_->_tmp61_ = NULL;
			_data_->_tmp61_ = _data_->symbol;
			_data_->_tmp62_ = NULL;
			_data_->_tmp62_ = vala_symbol_get_name (_data_->_tmp61_);
			_data_->_tmp63_ = NULL;
			_data_->_tmp63_ = _data_->_tmp62_;
			_data_->_tmp64_ = 0;
			_data_->_tmp64_ = _data_->kind;
			_data_->_tmp65_ = 0;
			_data_->_tmp65_ = _data_->flags;
			_data_->_tmp66_ = NULL;
			_data_->_tmp66_ = _data_->loc;
			_data_->_tmp67_ = NULL;
			_data_->_tmp67_ = _data_->loc;
			_data_->_tmp68_ = NULL;
			_data_->_tmp68_ = _data_->loc;
			_data_->_tmp69_ = NULL;
			_data_->_tmp69_ = ide_symbol_new (_data_->_tmp63_, _data_->_tmp64_, _data_->_tmp65_, _data_->_tmp66_, _data_->_tmp67_, _data_->_tmp68_);
			_data_->result = _data_->_tmp69_;
			_ide_source_location_unref0 (_data_->loc);
			_vala_source_reference_unref0 (_data_->source_reference);
			_g_free0 (_data_->binding);
			_vala_code_node_unref0 (_data_->symbol);
			_g_object_unref0 (_data_->file);
			_g_object_unref0 (_data_->index);
			_g_object_unref0 (_data_->service);
			_g_object_unref0 (_data_->context);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_vala_source_reference_unref0 (_data_->source_reference);
		_g_free0 (_data_->binding);
	}
	_data_->result = NULL;
	_vala_code_node_unref0 (_data_->symbol);
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->index);
	_g_object_unref0 (_data_->service);
	_g_object_unref0 (_data_->context);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	_vala_code_node_unref0 (_data_->symbol);
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->index);
	_g_object_unref0 (_data_->service);
	_g_object_unref0 (_data_->context);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


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


static gpointer __vala_member_binding_dup0 (gpointer self) {
	return self ? _vala_member_binding_dup (self) : NULL;
}


static ValaMemberBinding* ide_vala_symbol_resolver_get_member_binding (IdeValaSymbolResolver* self, ValaSymbol* sym) {
	ValaMemberBinding* result = NULL;
	ValaSymbol* _tmp0_ = NULL;
	ValaSymbol* _tmp5_ = NULL;
	ValaSymbol* _tmp10_ = NULL;
	ValaSymbol* _tmp15_ = NULL;
	ValaSymbol* _tmp20_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (sym != NULL, NULL);
	_tmp0_ = sym;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, VALA_TYPE_CONSTRUCTOR)) {
		ValaSymbol* _tmp1_ = NULL;
		ValaMemberBinding _tmp2_ = 0;
		ValaMemberBinding _tmp3_ = 0;
		ValaMemberBinding* _tmp4_ = NULL;
		_tmp1_ = sym;
		_tmp2_ = vala_constructor_get_binding (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VALA_TYPE_CONSTRUCTOR, ValaConstructor));
		_tmp3_ = _tmp2_;
		_tmp4_ = __vala_member_binding_dup0 (&_tmp3_);
		result = _tmp4_;
		return result;
	}
	_tmp5_ = sym;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, VALA_TYPE_DESTRUCTOR)) {
		ValaSymbol* _tmp6_ = NULL;
		ValaMemberBinding _tmp7_ = 0;
		ValaMemberBinding _tmp8_ = 0;
		ValaMemberBinding* _tmp9_ = NULL;
		_tmp6_ = sym;
		_tmp7_ = vala_destructor_get_binding (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, VALA_TYPE_DESTRUCTOR, ValaDestructor));
		_tmp8_ = _tmp7_;
		_tmp9_ = __vala_member_binding_dup0 (&_tmp8_);
		result = _tmp9_;
		return result;
	}
	_tmp10_ = sym;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, VALA_TYPE_FIELD)) {
		ValaSymbol* _tmp11_ = NULL;
		ValaMemberBinding _tmp12_ = 0;
		ValaMemberBinding _tmp13_ = 0;
		ValaMemberBinding* _tmp14_ = NULL;
		_tmp11_ = sym;
		_tmp12_ = vala_field_get_binding (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, VALA_TYPE_FIELD, ValaField));
		_tmp13_ = _tmp12_;
		_tmp14_ = __vala_member_binding_dup0 (&_tmp13_);
		result = _tmp14_;
		return result;
	}
	_tmp15_ = sym;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp15_, VALA_TYPE_METHOD)) {
		ValaSymbol* _tmp16_ = NULL;
		ValaMemberBinding _tmp17_ = 0;
		ValaMemberBinding _tmp18_ = 0;
		ValaMemberBinding* _tmp19_ = NULL;
		_tmp16_ = sym;
		_tmp17_ = vala_method_get_binding (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, VALA_TYPE_METHOD, ValaMethod));
		_tmp18_ = _tmp17_;
		_tmp19_ = __vala_member_binding_dup0 (&_tmp18_);
		result = _tmp19_;
		return result;
	}
	_tmp20_ = sym;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp20_, VALA_TYPE_PROPERTY)) {
		ValaSymbol* _tmp21_ = NULL;
		ValaMemberBinding _tmp22_ = 0;
		ValaMemberBinding _tmp23_ = 0;
		ValaMemberBinding* _tmp24_ = NULL;
		_tmp21_ = sym;
		_tmp22_ = vala_property_get_binding (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, VALA_TYPE_PROPERTY, ValaProperty));
		_tmp23_ = _tmp22_;
		_tmp24_ = __vala_member_binding_dup0 (&_tmp23_);
		result = _tmp24_;
		return result;
	}
	result = NULL;
	return result;
}


IdeValaSymbolResolver* ide_vala_symbol_resolver_construct (GType object_type) {
	IdeValaSymbolResolver * self = NULL;
	self = (IdeValaSymbolResolver*) g_object_new (object_type, NULL);
	return self;
}


IdeValaSymbolResolver* ide_vala_symbol_resolver_new (void) {
	return ide_vala_symbol_resolver_construct (IDE_TYPE_VALA_SYMBOL_RESOLVER);
}


static void ide_vala_symbol_resolver_class_init (IdeValaSymbolResolverClass * klass) {
	ide_vala_symbol_resolver_parent_class = g_type_class_peek_parent (klass);
}


static void ide_vala_symbol_resolver_ide_symbol_resolver_interface_init (IdeSymbolResolverInterface * iface) {
	ide_vala_symbol_resolver_ide_symbol_resolver_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_symbol_tree_async = (IdeSymbolTree* (*)(IdeSymbolResolver*, GFile*, GCancellable*, GError**)) ide_vala_symbol_resolver_real_get_symbol_tree_async;
	iface->get_symbol_tree_finish = ide_vala_symbol_resolver_real_get_symbol_tree_finish;
	iface->lookup_symbol_async = (IdeSymbol* (*)(IdeSymbolResolver*, IdeSourceLocation*, GCancellable*, GError**)) ide_vala_symbol_resolver_real_lookup_symbol_async;
	iface->lookup_symbol_finish = ide_vala_symbol_resolver_real_lookup_symbol_finish;
	iface->set_context = (void (*)(IdeSymbolResolver*, IdeContext*)) ide_object_set_context;
	iface->set_context = (void (*) (IdeSymbolResolver *, IdeContext*)) ide_object_set_context;
}


static void ide_vala_symbol_resolver_instance_init (IdeValaSymbolResolver * self) {
}


GType ide_vala_symbol_resolver_get_type (void) {
	return ide_vala_symbol_resolver_type_id;
}


GType ide_vala_symbol_resolver_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (IdeValaSymbolResolverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ide_vala_symbol_resolver_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IdeValaSymbolResolver), 0, (GInstanceInitFunc) ide_vala_symbol_resolver_instance_init, NULL };
	static const GInterfaceInfo ide_symbol_resolver_info = { (GInterfaceInitFunc) ide_vala_symbol_resolver_ide_symbol_resolver_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	ide_vala_symbol_resolver_type_id = g_type_module_register_type (module, ide_object_get_type (), "IdeValaSymbolResolver", &g_define_type_info, 0);
	g_type_module_add_interface (module, ide_vala_symbol_resolver_type_id, ide_symbol_resolver_get_type (), &ide_symbol_resolver_info);
	return ide_vala_symbol_resolver_type_id;
}



