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

/*
 * Some of the code below is taken from Anjuta and is licensed under the
 * terms of the GPL v2. The original copyright is preserved.
 *
 * Copyright (C) 2008-2010 Abderrahim Kitouni
 * 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 2 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 <vala.h>
#include <stdlib.h>
#include <string.h>
#include <valagee.h>


#define IDE_TYPE_VALA_COMPLETION (ide_vala_completion_get_type ())
#define IDE_VALA_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_COMPLETION, IdeValaCompletion))
#define IDE_VALA_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_COMPLETION, IdeValaCompletionClass))
#define IDE_IS_VALA_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_COMPLETION))
#define IDE_IS_VALA_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_COMPLETION))
#define IDE_VALA_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_COMPLETION, IdeValaCompletionClass))

typedef struct _IdeValaCompletion IdeValaCompletion;
typedef struct _IdeValaCompletionClass IdeValaCompletionClass;
typedef struct _IdeValaCompletionPrivate IdeValaCompletionPrivate;
#define _vala_code_context_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_context_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))
#define __g_list_free__vala_code_node_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__vala_code_node_unref0_ (var), NULL)))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _vala_iterator_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterator_unref (var), NULL)))
#define _vala_map_unref0(var) ((var == NULL) ? NULL : (var = (vala_map_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _IdeValaCompletion {
	GObject parent_instance;
	IdeValaCompletionPrivate * priv;
};

struct _IdeValaCompletionClass {
	GObjectClass parent_class;
};

struct _IdeValaCompletionPrivate {
	ValaCodeContext* context;
	ValaSourceLocation location;
	gchar* current_text;
	ValaBlock* nearest;
};


static gpointer ide_vala_completion_parent_class = NULL;
static GRegex* ide_vala_completion_member_access;
static GRegex* ide_vala_completion_member_access = NULL;
static GRegex* ide_vala_completion_member_access_split;
static GRegex* ide_vala_completion_member_access_split = NULL;
static GRegex* ide_vala_completion_function_call;
static GRegex* ide_vala_completion_function_call = NULL;
static GType ide_vala_completion_type_id = 0;

GType ide_vala_completion_get_type (void) G_GNUC_CONST;
GType ide_vala_completion_register_type (GTypeModule * module);
#define IDE_VALA_COMPLETION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IDE_TYPE_VALA_COMPLETION, IdeValaCompletionPrivate))
enum  {
	IDE_VALA_COMPLETION_DUMMY_PROPERTY
};
IdeValaCompletion* ide_vala_completion_new (ValaCodeContext* context, ValaSourceLocation* location, const gchar* current_text, ValaBlock* nearest);
IdeValaCompletion* ide_vala_completion_construct (GType object_type, ValaCodeContext* context, ValaSourceLocation* location, const gchar* current_text, ValaBlock* nearest);
GList* ide_vala_completion_run (IdeValaCompletion* self, ValaSourceLocation* start_pos);
static GList* ide_vala_completion_lookup_symbol (IdeValaCompletion* self, ValaExpression* inner, const gchar* name, gboolean prefix_match, ValaBlock* block);
static ValaExpression* ide_vala_completion_construct_member_access (IdeValaCompletion* self, gchar** names, int names_length1);
static void _vala_code_node_unref0_ (gpointer var);
static void _g_list_free__vala_code_node_unref0_ (GList* self);
static GList* ide_vala_completion_symbol_lookup_inherited (IdeValaCompletion* self, ValaSymbol* sym, const gchar* name, gboolean prefix_match, gboolean invocation);
static void ide_vala_completion_finalize (GObject* 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 _vala_code_context_ref0 (gpointer self) {
	return self ? vala_code_context_ref (self) : NULL;
}


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


IdeValaCompletion* ide_vala_completion_construct (GType object_type, ValaCodeContext* context, ValaSourceLocation* location, const gchar* current_text, ValaBlock* nearest) {
	IdeValaCompletion * self = NULL;
	ValaCodeContext* _tmp0_ = NULL;
	ValaCodeContext* _tmp1_ = NULL;
	ValaSourceLocation _tmp2_ = {0};
	const gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	ValaBlock* _tmp5_ = NULL;
	ValaBlock* _tmp6_ = NULL;
	g_return_val_if_fail (context != NULL, NULL);
	g_return_val_if_fail (location != NULL, NULL);
	g_return_val_if_fail (current_text != NULL, NULL);
	self = (IdeValaCompletion*) g_object_new (object_type, NULL);
	_tmp0_ = context;
	_tmp1_ = _vala_code_context_ref0 (_tmp0_);
	_vala_code_context_unref0 (self->priv->context);
	self->priv->context = _tmp1_;
	_tmp2_ = *location;
	self->priv->location = _tmp2_;
	_tmp3_ = current_text;
	_tmp4_ = g_strdup (_tmp3_);
	_g_free0 (self->priv->current_text);
	self->priv->current_text = _tmp4_;
	_tmp5_ = nearest;
	_tmp6_ = _vala_code_node_ref0 (_tmp5_);
	_vala_code_node_unref0 (self->priv->nearest);
	self->priv->nearest = _tmp6_;
	return self;
}


IdeValaCompletion* ide_vala_completion_new (ValaCodeContext* context, ValaSourceLocation* location, const gchar* current_text, ValaBlock* nearest) {
	return ide_vala_completion_construct (IDE_TYPE_VALA_COMPLETION, context, location, current_text, nearest);
}


static void _vala_code_node_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL));
}


static void _g_list_free__vala_code_node_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _vala_code_node_unref0_, NULL);
	g_list_free (self);
}


GList* ide_vala_completion_run (IdeValaCompletion* self, ValaSourceLocation* start_pos) {
	GList* result = NULL;
	GMatchInfo* match_info = NULL;
	GRegex* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	GMatchInfo* _tmp2_ = NULL;
	gboolean _tmp3_ = FALSE;
	ValaSourceLocation _tmp10_ = {0};
	gint _tmp11_ = 0;
	ValaSourceLocation _tmp12_ = {0};
	gint _tmp13_ = 0;
	GMatchInfo* _tmp14_ = NULL;
	gchar* _tmp15_ = NULL;
	gchar* _tmp16_ = NULL;
	gint _tmp17_ = 0;
	gint _tmp18_ = 0;
	gchar** names = NULL;
	GRegex* _tmp19_ = NULL;
	GMatchInfo* _tmp20_ = NULL;
	gchar* _tmp21_ = NULL;
	gchar* _tmp22_ = NULL;
	gchar** _tmp23_ = NULL;
	gchar** _tmp24_ = NULL;
	gchar** _tmp25_ = NULL;
	gint _tmp25__length1 = 0;
	gint names_length1 = 0;
	gint _names_size_ = 0;
	GList* syms = NULL;
	gchar** _tmp26_ = NULL;
	gint _tmp26__length1 = 0;
	ValaExpression* _tmp27_ = NULL;
	ValaExpression* _tmp28_ = NULL;
	GMatchInfo* _tmp29_ = NULL;
	gchar* _tmp30_ = NULL;
	gchar* _tmp31_ = NULL;
	ValaBlock* _tmp32_ = NULL;
	GList* _tmp33_ = NULL;
	GList* _tmp34_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (start_pos != NULL, NULL);
	_tmp0_ = ide_vala_completion_member_access;
	_tmp1_ = self->priv->current_text;
	_tmp3_ = g_regex_match (_tmp0_, _tmp1_, 0, &_tmp2_);
	_g_match_info_unref0 (match_info);
	match_info = _tmp2_;
	if (!_tmp3_) {
		result = NULL;
		_g_match_info_unref0 (match_info);
		return result;
	} else {
		GMatchInfo* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		gint _tmp7_ = 0;
		gint _tmp8_ = 0;
		gboolean _tmp9_ = FALSE;
		_tmp4_ = match_info;
		_tmp5_ = g_match_info_fetch (_tmp4_, 0);
		_tmp6_ = _tmp5_;
		_tmp7_ = strlen (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_ < 2;
		_g_free0 (_tmp6_);
		if (_tmp9_) {
			result = NULL;
			_g_match_info_unref0 (match_info);
			return result;
		}
	}
	_tmp10_ = self->priv->location;
	_tmp11_ = _tmp10_.line;
	(*start_pos).line = _tmp11_;
	_tmp12_ = self->priv->location;
	_tmp13_ = _tmp12_.column;
	_tmp14_ = match_info;
	_tmp15_ = g_match_info_fetch (_tmp14_, 2);
	_tmp16_ = _tmp15_;
	_tmp17_ = strlen (_tmp16_);
	_tmp18_ = _tmp17_;
	(*start_pos).column = _tmp13_ - ((gint) _tmp18_);
	_g_free0 (_tmp16_);
	_tmp19_ = ide_vala_completion_member_access_split;
	_tmp20_ = match_info;
	_tmp21_ = g_match_info_fetch (_tmp20_, 1);
	_tmp22_ = _tmp21_;
	_tmp24_ = _tmp23_ = g_regex_split (_tmp19_, _tmp22_, 0);
	_tmp25_ = _tmp24_;
	_tmp25__length1 = _vala_array_length (_tmp23_);
	_g_free0 (_tmp22_);
	names = _tmp25_;
	names_length1 = _tmp25__length1;
	_names_size_ = names_length1;
	_tmp26_ = names;
	_tmp26__length1 = names_length1;
	_tmp27_ = ide_vala_completion_construct_member_access (self, _tmp26_, _tmp26__length1);
	_tmp28_ = _tmp27_;
	_tmp29_ = match_info;
	_tmp30_ = g_match_info_fetch (_tmp29_, 2);
	_tmp31_ = _tmp30_;
	_tmp32_ = self->priv->nearest;
	_tmp33_ = ide_vala_completion_lookup_symbol (self, _tmp28_, _tmp31_, TRUE, _tmp32_);
	_tmp34_ = _tmp33_;
	_g_free0 (_tmp31_);
	_vala_code_node_unref0 (_tmp28_);
	syms = _tmp34_;
	result = syms;
	names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL);
	_g_match_info_unref0 (match_info);
	return result;
}


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


static GList* ide_vala_completion_lookup_symbol (IdeValaCompletion* self, ValaExpression* inner, const gchar* name, gboolean prefix_match, ValaBlock* block) {
	GList* result = NULL;
	GList* matching_symbols = NULL;
	ValaBlock* _tmp0_ = NULL;
	ValaExpression* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	matching_symbols = NULL;
	_tmp0_ = block;
	if (_tmp0_ == NULL) {
		result = matching_symbols;
		return result;
	}
	_tmp1_ = inner;
	if (_tmp1_ == NULL) {
		{
			ValaSymbol* sym = NULL;
			ValaBlock* _tmp2_ = NULL;
			ValaSymbol* _tmp3_ = NULL;
			_tmp2_ = block;
			_tmp3_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, VALA_TYPE_SYMBOL, ValaSymbol));
			sym = _tmp3_;
			{
				gboolean _tmp4_ = FALSE;
				_tmp4_ = TRUE;
				while (TRUE) {
					ValaSymbol* _tmp9_ = NULL;
					ValaSymbol* _tmp10_ = NULL;
					const gchar* _tmp11_ = NULL;
					gboolean _tmp12_ = FALSE;
					GList* _tmp13_ = NULL;
					if (!_tmp4_) {
						ValaSymbol* _tmp5_ = NULL;
						ValaSymbol* _tmp6_ = NULL;
						ValaSymbol* _tmp7_ = NULL;
						ValaSymbol* _tmp8_ = NULL;
						_tmp5_ = sym;
						_tmp6_ = vala_symbol_get_parent_symbol (_tmp5_);
						_tmp7_ = _tmp6_;
						_tmp8_ = _vala_code_node_ref0 (_tmp7_);
						_vala_code_node_unref0 (sym);
						sym = _tmp8_;
					}
					_tmp4_ = FALSE;
					_tmp9_ = sym;
					if (!(_tmp9_ != NULL)) {
						break;
					}
					_tmp10_ = sym;
					_tmp11_ = name;
					_tmp12_ = prefix_match;
					_tmp13_ = ide_vala_completion_symbol_lookup_inherited (self, _tmp10_, _tmp11_, _tmp12_, FALSE);
					matching_symbols = g_list_concat (matching_symbols, _tmp13_);
				}
			}
			_vala_code_node_unref0 (sym);
		}
		{
			ValaList* _ns_list = NULL;
			ValaBlock* _tmp14_ = NULL;
			ValaSourceReference* _tmp15_ = NULL;
			ValaSourceReference* _tmp16_ = NULL;
			ValaSourceFile* _tmp17_ = NULL;
			ValaSourceFile* _tmp18_ = NULL;
			ValaList* _tmp19_ = NULL;
			ValaList* _tmp20_ = NULL;
			ValaList* _tmp21_ = NULL;
			gint _ns_size = 0;
			ValaList* _tmp22_ = NULL;
			gint _tmp23_ = 0;
			gint _tmp24_ = 0;
			gint _ns_index = 0;
			_tmp14_ = block;
			_tmp15_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = vala_source_reference_get_file (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = vala_source_file_get_current_using_directives (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = _vala_iterable_ref0 (_tmp20_);
			_ns_list = _tmp21_;
			_tmp22_ = _ns_list;
			_tmp23_ = vala_collection_get_size ((ValaCollection*) _tmp22_);
			_tmp24_ = _tmp23_;
			_ns_size = _tmp24_;
			_ns_index = -1;
			while (TRUE) {
				gint _tmp25_ = 0;
				gint _tmp26_ = 0;
				gint _tmp27_ = 0;
				ValaUsingDirective* ns = NULL;
				ValaList* _tmp28_ = NULL;
				gint _tmp29_ = 0;
				gpointer _tmp30_ = NULL;
				ValaUsingDirective* _tmp31_ = NULL;
				ValaSymbol* _tmp32_ = NULL;
				ValaSymbol* _tmp33_ = NULL;
				const gchar* _tmp34_ = NULL;
				gboolean _tmp35_ = FALSE;
				GList* _tmp36_ = NULL;
				_tmp25_ = _ns_index;
				_ns_index = _tmp25_ + 1;
				_tmp26_ = _ns_index;
				_tmp27_ = _ns_size;
				if (!(_tmp26_ < _tmp27_)) {
					break;
				}
				_tmp28_ = _ns_list;
				_tmp29_ = _ns_index;
				_tmp30_ = vala_list_get (_tmp28_, _tmp29_);
				ns = (ValaUsingDirective*) _tmp30_;
				_tmp31_ = ns;
				_tmp32_ = vala_using_directive_get_namespace_symbol (_tmp31_);
				_tmp33_ = _tmp32_;
				_tmp34_ = name;
				_tmp35_ = prefix_match;
				_tmp36_ = ide_vala_completion_symbol_lookup_inherited (self, _tmp33_, _tmp34_, _tmp35_, FALSE);
				matching_symbols = g_list_concat (matching_symbols, _tmp36_);
				_vala_code_node_unref0 (ns);
			}
			_vala_iterable_unref0 (_ns_list);
		}
	} else {
		ValaExpression* _tmp37_ = NULL;
		ValaSymbol* _tmp38_ = NULL;
		ValaSymbol* _tmp39_ = NULL;
		_tmp37_ = inner;
		_tmp38_ = vala_expression_get_symbol_reference (_tmp37_);
		_tmp39_ = _tmp38_;
		if (_tmp39_ != NULL) {
			ValaExpression* _tmp40_ = NULL;
			ValaSymbol* _tmp41_ = NULL;
			ValaSymbol* _tmp42_ = NULL;
			const gchar* _tmp43_ = NULL;
			gboolean _tmp44_ = FALSE;
			GList* _tmp45_ = NULL;
			_tmp40_ = inner;
			_tmp41_ = vala_expression_get_symbol_reference (_tmp40_);
			_tmp42_ = _tmp41_;
			_tmp43_ = name;
			_tmp44_ = prefix_match;
			_tmp45_ = ide_vala_completion_symbol_lookup_inherited (self, _tmp42_, _tmp43_, _tmp44_, FALSE);
			matching_symbols = g_list_concat (matching_symbols, _tmp45_);
		} else {
			ValaExpression* _tmp46_ = NULL;
			_tmp46_ = inner;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp46_, VALA_TYPE_MEMBER_ACCESS)) {
				ValaMemberAccess* inner_ma = NULL;
				ValaExpression* _tmp47_ = NULL;
				ValaMemberAccess* _tmp48_ = NULL;
				GList* matching = NULL;
				ValaMemberAccess* _tmp49_ = NULL;
				ValaExpression* _tmp50_ = NULL;
				ValaExpression* _tmp51_ = NULL;
				ValaMemberAccess* _tmp52_ = NULL;
				const gchar* _tmp53_ = NULL;
				const gchar* _tmp54_ = NULL;
				ValaBlock* _tmp55_ = NULL;
				GList* _tmp56_ = NULL;
				GList* _tmp57_ = NULL;
				_tmp47_ = inner;
				_tmp48_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp47_, VALA_TYPE_MEMBER_ACCESS, ValaMemberAccess));
				inner_ma = _tmp48_;
				_tmp49_ = inner_ma;
				_tmp50_ = vala_member_access_get_inner (_tmp49_);
				_tmp51_ = _tmp50_;
				_tmp52_ = inner_ma;
				_tmp53_ = vala_member_access_get_member_name (_tmp52_);
				_tmp54_ = _tmp53_;
				_tmp55_ = block;
				_tmp56_ = ide_vala_completion_lookup_symbol (self, _tmp51_, _tmp54_, FALSE, _tmp55_);
				matching = _tmp56_;
				_tmp57_ = matching;
				if (_tmp57_ != NULL) {
					GList* _tmp58_ = NULL;
					gconstpointer _tmp59_ = NULL;
					const gchar* _tmp60_ = NULL;
					gboolean _tmp61_ = FALSE;
					GList* _tmp62_ = NULL;
					_tmp58_ = matching;
					_tmp59_ = _tmp58_->data;
					_tmp60_ = name;
					_tmp61_ = prefix_match;
					_tmp62_ = ide_vala_completion_symbol_lookup_inherited (self, (ValaSymbol*) _tmp59_, _tmp60_, _tmp61_, FALSE);
					matching_symbols = g_list_concat (matching_symbols, _tmp62_);
				}
				__g_list_free__vala_code_node_unref0_0 (matching);
				_vala_code_node_unref0 (inner_ma);
			} else {
				ValaExpression* _tmp63_ = NULL;
				_tmp63_ = inner;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp63_, VALA_TYPE_METHOD_CALL)) {
					ValaMethodCall* inner_inv = NULL;
					ValaExpression* _tmp64_ = NULL;
					ValaMethodCall* _tmp65_ = NULL;
					ValaMemberAccess* inner_ma = NULL;
					ValaMethodCall* _tmp66_ = NULL;
					ValaExpression* _tmp67_ = NULL;
					ValaExpression* _tmp68_ = NULL;
					ValaMemberAccess* _tmp69_ = NULL;
					ValaMemberAccess* _tmp70_ = NULL;
					_tmp64_ = inner;
					_tmp65_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp64_, VALA_TYPE_METHOD_CALL, ValaMethodCall));
					inner_inv = _tmp65_;
					_tmp66_ = inner_inv;
					_tmp67_ = vala_method_call_get_call (_tmp66_);
					_tmp68_ = _tmp67_;
					_tmp69_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp68_, VALA_TYPE_MEMBER_ACCESS) ? ((ValaMemberAccess*) _tmp68_) : NULL);
					inner_ma = _tmp69_;
					_tmp70_ = inner_ma;
					if (_tmp70_ != NULL) {
						GList* matching = NULL;
						ValaMemberAccess* _tmp71_ = NULL;
						ValaExpression* _tmp72_ = NULL;
						ValaExpression* _tmp73_ = NULL;
						ValaMemberAccess* _tmp74_ = NULL;
						const gchar* _tmp75_ = NULL;
						const gchar* _tmp76_ = NULL;
						ValaBlock* _tmp77_ = NULL;
						GList* _tmp78_ = NULL;
						GList* _tmp79_ = NULL;
						_tmp71_ = inner_ma;
						_tmp72_ = vala_member_access_get_inner (_tmp71_);
						_tmp73_ = _tmp72_;
						_tmp74_ = inner_ma;
						_tmp75_ = vala_member_access_get_member_name (_tmp74_);
						_tmp76_ = _tmp75_;
						_tmp77_ = block;
						_tmp78_ = ide_vala_completion_lookup_symbol (self, _tmp73_, _tmp76_, FALSE, _tmp77_);
						matching = _tmp78_;
						_tmp79_ = matching;
						if (_tmp79_ != NULL) {
							GList* _tmp80_ = NULL;
							gconstpointer _tmp81_ = NULL;
							const gchar* _tmp82_ = NULL;
							gboolean _tmp83_ = FALSE;
							GList* _tmp84_ = NULL;
							_tmp80_ = matching;
							_tmp81_ = _tmp80_->data;
							_tmp82_ = name;
							_tmp83_ = prefix_match;
							_tmp84_ = ide_vala_completion_symbol_lookup_inherited (self, (ValaSymbol*) _tmp81_, _tmp82_, _tmp83_, TRUE);
							matching_symbols = g_list_concat (matching_symbols, _tmp84_);
						}
						__g_list_free__vala_code_node_unref0_0 (matching);
					}
					_vala_code_node_unref0 (inner_ma);
					_vala_code_node_unref0 (inner_inv);
				}
			}
		}
	}
	result = matching_symbols;
	return result;
}


static GList* ide_vala_completion_symbol_lookup_inherited (IdeValaCompletion* self, ValaSymbol* sym, const gchar* name, gboolean prefix_match, gboolean invocation) {
	GList* result = NULL;
	GList* _result_ = NULL;
	ValaSymbol* _tmp0_ = NULL;
	ValaMap* symbol_table = NULL;
	ValaSymbol* _tmp1_ = NULL;
	ValaScope* _tmp2_ = NULL;
	ValaScope* _tmp3_ = NULL;
	ValaMap* _tmp4_ = NULL;
	ValaMap* _tmp5_ = NULL;
	gboolean _tmp26_ = FALSE;
	gboolean _tmp27_ = FALSE;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_result_ = NULL;
	_tmp0_ = sym;
	if (_tmp0_ == NULL) {
		result = _result_;
		return result;
	}
	_tmp1_ = sym;
	_tmp2_ = vala_symbol_get_scope (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = vala_scope_get_symbol_table (_tmp3_);
	symbol_table = _tmp4_;
	_tmp5_ = symbol_table;
	if (_tmp5_ != NULL) {
		{
			ValaIterator* _key_it = NULL;
			ValaMap* _tmp6_ = NULL;
			ValaSet* _tmp7_ = NULL;
			ValaSet* _tmp8_ = NULL;
			ValaIterator* _tmp9_ = NULL;
			ValaIterator* _tmp10_ = NULL;
			_tmp6_ = symbol_table;
			_tmp7_ = vala_map_get_keys (_tmp6_);
			_tmp8_ = _tmp7_;
			_tmp9_ = vala_iterable_iterator ((ValaIterable*) _tmp8_);
			_tmp10_ = _tmp9_;
			_vala_iterable_unref0 (_tmp8_);
			_key_it = _tmp10_;
			while (TRUE) {
				ValaIterator* _tmp11_ = NULL;
				gboolean _tmp12_ = FALSE;
				gchar* key = NULL;
				ValaIterator* _tmp13_ = NULL;
				gpointer _tmp14_ = NULL;
				gboolean _tmp15_ = FALSE;
				gboolean _tmp16_ = FALSE;
				gboolean _tmp17_ = FALSE;
				_tmp11_ = _key_it;
				_tmp12_ = vala_iterator_next (_tmp11_);
				if (!_tmp12_) {
					break;
				}
				_tmp13_ = _key_it;
				_tmp14_ = vala_iterator_get (_tmp13_);
				key = (gchar*) _tmp14_;
				_tmp17_ = prefix_match;
				if (_tmp17_) {
					const gchar* _tmp18_ = NULL;
					const gchar* _tmp19_ = NULL;
					gboolean _tmp20_ = FALSE;
					_tmp18_ = key;
					_tmp19_ = name;
					_tmp20_ = g_str_has_prefix (_tmp18_, _tmp19_);
					_tmp16_ = _tmp20_;
				} else {
					_tmp16_ = FALSE;
				}
				if (_tmp16_) {
					_tmp15_ = TRUE;
				} else {
					const gchar* _tmp21_ = NULL;
					const gchar* _tmp22_ = NULL;
					_tmp21_ = key;
					_tmp22_ = name;
					_tmp15_ = g_strcmp0 (_tmp21_, _tmp22_) == 0;
				}
				if (_tmp15_) {
					ValaMap* _tmp23_ = NULL;
					const gchar* _tmp24_ = NULL;
					gpointer _tmp25_ = NULL;
					_tmp23_ = symbol_table;
					_tmp24_ = key;
					_tmp25_ = vala_map_get (_tmp23_, _tmp24_);
					_result_ = g_list_append (_result_, (ValaSymbol*) _tmp25_);
				}
				_g_free0 (key);
			}
			_vala_iterator_unref0 (_key_it);
		}
	}
	_tmp27_ = invocation;
	if (_tmp27_) {
		ValaSymbol* _tmp28_ = NULL;
		_tmp28_ = sym;
		_tmp26_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp28_, VALA_TYPE_METHOD);
	} else {
		_tmp26_ = FALSE;
	}
	if (_tmp26_) {
		ValaMethod* func = NULL;
		ValaSymbol* _tmp29_ = NULL;
		ValaMethod* _tmp30_ = NULL;
		ValaMethod* _tmp31_ = NULL;
		ValaDataType* _tmp32_ = NULL;
		ValaDataType* _tmp33_ = NULL;
		ValaTypeSymbol* _tmp34_ = NULL;
		ValaTypeSymbol* _tmp35_ = NULL;
		const gchar* _tmp36_ = NULL;
		gboolean _tmp37_ = FALSE;
		GList* _tmp38_ = NULL;
		_tmp29_ = sym;
		_tmp30_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp29_, VALA_TYPE_METHOD, ValaMethod));
		func = _tmp30_;
		_tmp31_ = func;
		_tmp32_ = vala_method_get_return_type (_tmp31_);
		_tmp33_ = _tmp32_;
		_tmp34_ = vala_data_type_get_data_type (_tmp33_);
		_tmp35_ = _tmp34_;
		_tmp36_ = name;
		_tmp37_ = prefix_match;
		_tmp38_ = ide_vala_completion_symbol_lookup_inherited (self, (ValaSymbol*) _tmp35_, _tmp36_, _tmp37_, FALSE);
		_result_ = g_list_concat (_result_, _tmp38_);
		_vala_code_node_unref0 (func);
	} else {
		ValaSymbol* _tmp39_ = NULL;
		_tmp39_ = sym;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp39_, VALA_TYPE_CLASS)) {
			ValaClass* cl = NULL;
			ValaSymbol* _tmp40_ = NULL;
			ValaClass* _tmp41_ = NULL;
			_tmp40_ = sym;
			_tmp41_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp40_, VALA_TYPE_CLASS, ValaClass));
			cl = _tmp41_;
			{
				ValaList* _base_type_list = NULL;
				ValaClass* _tmp42_ = NULL;
				ValaList* _tmp43_ = NULL;
				gint _base_type_size = 0;
				ValaList* _tmp44_ = NULL;
				gint _tmp45_ = 0;
				gint _tmp46_ = 0;
				gint _base_type_index = 0;
				_tmp42_ = cl;
				_tmp43_ = vala_class_get_base_types (_tmp42_);
				_base_type_list = _tmp43_;
				_tmp44_ = _base_type_list;
				_tmp45_ = vala_collection_get_size ((ValaCollection*) _tmp44_);
				_tmp46_ = _tmp45_;
				_base_type_size = _tmp46_;
				_base_type_index = -1;
				while (TRUE) {
					gint _tmp47_ = 0;
					gint _tmp48_ = 0;
					gint _tmp49_ = 0;
					ValaDataType* base_type = NULL;
					ValaList* _tmp50_ = NULL;
					gint _tmp51_ = 0;
					gpointer _tmp52_ = NULL;
					ValaDataType* _tmp53_ = NULL;
					ValaTypeSymbol* _tmp54_ = NULL;
					ValaTypeSymbol* _tmp55_ = NULL;
					const gchar* _tmp56_ = NULL;
					gboolean _tmp57_ = FALSE;
					GList* _tmp58_ = NULL;
					_tmp47_ = _base_type_index;
					_base_type_index = _tmp47_ + 1;
					_tmp48_ = _base_type_index;
					_tmp49_ = _base_type_size;
					if (!(_tmp48_ < _tmp49_)) {
						break;
					}
					_tmp50_ = _base_type_list;
					_tmp51_ = _base_type_index;
					_tmp52_ = vala_list_get (_tmp50_, _tmp51_);
					base_type = (ValaDataType*) _tmp52_;
					_tmp53_ = base_type;
					_tmp54_ = vala_data_type_get_data_type (_tmp53_);
					_tmp55_ = _tmp54_;
					_tmp56_ = name;
					_tmp57_ = prefix_match;
					_tmp58_ = ide_vala_completion_symbol_lookup_inherited (self, (ValaSymbol*) _tmp55_, _tmp56_, _tmp57_, FALSE);
					_result_ = g_list_concat (_result_, _tmp58_);
					_vala_code_node_unref0 (base_type);
				}
				_vala_iterable_unref0 (_base_type_list);
			}
			_vala_code_node_unref0 (cl);
		} else {
			ValaSymbol* _tmp59_ = NULL;
			_tmp59_ = sym;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp59_, VALA_TYPE_STRUCT)) {
				ValaStruct* st = NULL;
				ValaSymbol* _tmp60_ = NULL;
				ValaStruct* _tmp61_ = NULL;
				ValaStruct* _tmp62_ = NULL;
				ValaDataType* _tmp63_ = NULL;
				ValaDataType* _tmp64_ = NULL;
				ValaTypeSymbol* _tmp65_ = NULL;
				ValaTypeSymbol* _tmp66_ = NULL;
				const gchar* _tmp67_ = NULL;
				gboolean _tmp68_ = FALSE;
				GList* _tmp69_ = NULL;
				_tmp60_ = sym;
				_tmp61_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp60_, VALA_TYPE_STRUCT, ValaStruct));
				st = _tmp61_;
				_tmp62_ = st;
				_tmp63_ = vala_struct_get_base_type (_tmp62_);
				_tmp64_ = _tmp63_;
				_tmp65_ = vala_data_type_get_data_type (_tmp64_);
				_tmp66_ = _tmp65_;
				_tmp67_ = name;
				_tmp68_ = prefix_match;
				_tmp69_ = ide_vala_completion_symbol_lookup_inherited (self, (ValaSymbol*) _tmp66_, _tmp67_, _tmp68_, FALSE);
				_result_ = g_list_concat (_result_, _tmp69_);
				_vala_code_node_unref0 (st);
			} else {
				ValaSymbol* _tmp70_ = NULL;
				_tmp70_ = sym;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp70_, VALA_TYPE_INTERFACE)) {
					ValaInterface* iface = NULL;
					ValaSymbol* _tmp71_ = NULL;
					ValaInterface* _tmp72_ = NULL;
					_tmp71_ = sym;
					_tmp72_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp71_, VALA_TYPE_INTERFACE, ValaInterface));
					iface = _tmp72_;
					{
						ValaList* _prerequisite_list = NULL;
						ValaInterface* _tmp73_ = NULL;
						ValaList* _tmp74_ = NULL;
						gint _prerequisite_size = 0;
						ValaList* _tmp75_ = NULL;
						gint _tmp76_ = 0;
						gint _tmp77_ = 0;
						gint _prerequisite_index = 0;
						_tmp73_ = iface;
						_tmp74_ = vala_interface_get_prerequisites (_tmp73_);
						_prerequisite_list = _tmp74_;
						_tmp75_ = _prerequisite_list;
						_tmp76_ = vala_collection_get_size ((ValaCollection*) _tmp75_);
						_tmp77_ = _tmp76_;
						_prerequisite_size = _tmp77_;
						_prerequisite_index = -1;
						while (TRUE) {
							gint _tmp78_ = 0;
							gint _tmp79_ = 0;
							gint _tmp80_ = 0;
							ValaDataType* prerequisite = NULL;
							ValaList* _tmp81_ = NULL;
							gint _tmp82_ = 0;
							gpointer _tmp83_ = NULL;
							ValaDataType* _tmp84_ = NULL;
							ValaTypeSymbol* _tmp85_ = NULL;
							ValaTypeSymbol* _tmp86_ = NULL;
							const gchar* _tmp87_ = NULL;
							gboolean _tmp88_ = FALSE;
							GList* _tmp89_ = NULL;
							_tmp78_ = _prerequisite_index;
							_prerequisite_index = _tmp78_ + 1;
							_tmp79_ = _prerequisite_index;
							_tmp80_ = _prerequisite_size;
							if (!(_tmp79_ < _tmp80_)) {
								break;
							}
							_tmp81_ = _prerequisite_list;
							_tmp82_ = _prerequisite_index;
							_tmp83_ = vala_list_get (_tmp81_, _tmp82_);
							prerequisite = (ValaDataType*) _tmp83_;
							_tmp84_ = prerequisite;
							_tmp85_ = vala_data_type_get_data_type (_tmp84_);
							_tmp86_ = _tmp85_;
							_tmp87_ = name;
							_tmp88_ = prefix_match;
							_tmp89_ = ide_vala_completion_symbol_lookup_inherited (self, (ValaSymbol*) _tmp86_, _tmp87_, _tmp88_, FALSE);
							_result_ = g_list_concat (_result_, _tmp89_);
							_vala_code_node_unref0 (prerequisite);
						}
						_vala_iterable_unref0 (_prerequisite_list);
					}
					_vala_code_node_unref0 (iface);
				} else {
					ValaSymbol* _tmp90_ = NULL;
					_tmp90_ = sym;
					if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp90_, VALA_TYPE_LOCAL_VARIABLE)) {
						ValaLocalVariable* variable = NULL;
						ValaSymbol* _tmp91_ = NULL;
						ValaLocalVariable* _tmp92_ = NULL;
						ValaLocalVariable* _tmp93_ = NULL;
						ValaDataType* _tmp94_ = NULL;
						ValaDataType* _tmp95_ = NULL;
						ValaTypeSymbol* _tmp96_ = NULL;
						ValaTypeSymbol* _tmp97_ = NULL;
						const gchar* _tmp98_ = NULL;
						gboolean _tmp99_ = FALSE;
						GList* _tmp100_ = NULL;
						_tmp91_ = sym;
						_tmp92_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp91_, VALA_TYPE_LOCAL_VARIABLE, ValaLocalVariable));
						variable = _tmp92_;
						_tmp93_ = variable;
						_tmp94_ = vala_variable_get_variable_type ((ValaVariable*) _tmp93_);
						_tmp95_ = _tmp94_;
						_tmp96_ = vala_data_type_get_data_type (_tmp95_);
						_tmp97_ = _tmp96_;
						_tmp98_ = name;
						_tmp99_ = prefix_match;
						_tmp100_ = ide_vala_completion_symbol_lookup_inherited (self, (ValaSymbol*) _tmp97_, _tmp98_, _tmp99_, FALSE);
						_result_ = g_list_concat (_result_, _tmp100_);
						_vala_code_node_unref0 (variable);
					} else {
						ValaSymbol* _tmp101_ = NULL;
						_tmp101_ = sym;
						if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp101_, VALA_TYPE_FIELD)) {
							ValaField* field = NULL;
							ValaSymbol* _tmp102_ = NULL;
							ValaField* _tmp103_ = NULL;
							ValaField* _tmp104_ = NULL;
							ValaDataType* _tmp105_ = NULL;
							ValaDataType* _tmp106_ = NULL;
							ValaTypeSymbol* _tmp107_ = NULL;
							ValaTypeSymbol* _tmp108_ = NULL;
							const gchar* _tmp109_ = NULL;
							gboolean _tmp110_ = FALSE;
							GList* _tmp111_ = NULL;
							_tmp102_ = sym;
							_tmp103_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp102_, VALA_TYPE_FIELD, ValaField));
							field = _tmp103_;
							_tmp104_ = field;
							_tmp105_ = vala_variable_get_variable_type ((ValaVariable*) _tmp104_);
							_tmp106_ = _tmp105_;
							_tmp107_ = vala_data_type_get_data_type (_tmp106_);
							_tmp108_ = _tmp107_;
							_tmp109_ = name;
							_tmp110_ = prefix_match;
							_tmp111_ = ide_vala_completion_symbol_lookup_inherited (self, (ValaSymbol*) _tmp108_, _tmp109_, _tmp110_, FALSE);
							_result_ = g_list_concat (_result_, _tmp111_);
							_vala_code_node_unref0 (field);
						} else {
							ValaSymbol* _tmp112_ = NULL;
							_tmp112_ = sym;
							if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp112_, VALA_TYPE_PROPERTY)) {
								ValaProperty* prop = NULL;
								ValaSymbol* _tmp113_ = NULL;
								ValaProperty* _tmp114_ = NULL;
								ValaProperty* _tmp115_ = NULL;
								ValaDataType* _tmp116_ = NULL;
								ValaDataType* _tmp117_ = NULL;
								ValaTypeSymbol* _tmp118_ = NULL;
								ValaTypeSymbol* _tmp119_ = NULL;
								const gchar* _tmp120_ = NULL;
								gboolean _tmp121_ = FALSE;
								GList* _tmp122_ = NULL;
								_tmp113_ = sym;
								_tmp114_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp113_, VALA_TYPE_PROPERTY, ValaProperty));
								prop = _tmp114_;
								_tmp115_ = prop;
								_tmp116_ = vala_property_get_property_type (_tmp115_);
								_tmp117_ = _tmp116_;
								_tmp118_ = vala_data_type_get_data_type (_tmp117_);
								_tmp119_ = _tmp118_;
								_tmp120_ = name;
								_tmp121_ = prefix_match;
								_tmp122_ = ide_vala_completion_symbol_lookup_inherited (self, (ValaSymbol*) _tmp119_, _tmp120_, _tmp121_, FALSE);
								_result_ = g_list_concat (_result_, _tmp122_);
								_vala_code_node_unref0 (prop);
							} else {
								ValaSymbol* _tmp123_ = NULL;
								_tmp123_ = sym;
								if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp123_, VALA_TYPE_PARAMETER)) {
									ValaParameter* fp = NULL;
									ValaSymbol* _tmp124_ = NULL;
									ValaParameter* _tmp125_ = NULL;
									ValaParameter* _tmp126_ = NULL;
									ValaDataType* _tmp127_ = NULL;
									ValaDataType* _tmp128_ = NULL;
									ValaTypeSymbol* _tmp129_ = NULL;
									ValaTypeSymbol* _tmp130_ = NULL;
									const gchar* _tmp131_ = NULL;
									gboolean _tmp132_ = FALSE;
									GList* _tmp133_ = NULL;
									_tmp124_ = sym;
									_tmp125_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp124_, VALA_TYPE_PARAMETER, ValaParameter));
									fp = _tmp125_;
									_tmp126_ = fp;
									_tmp127_ = vala_variable_get_variable_type ((ValaVariable*) _tmp126_);
									_tmp128_ = _tmp127_;
									_tmp129_ = vala_data_type_get_data_type (_tmp128_);
									_tmp130_ = _tmp129_;
									_tmp131_ = name;
									_tmp132_ = prefix_match;
									_tmp133_ = ide_vala_completion_symbol_lookup_inherited (self, (ValaSymbol*) _tmp130_, _tmp131_, _tmp132_, FALSE);
									_result_ = g_list_concat (_result_, _tmp133_);
									_vala_code_node_unref0 (fp);
								}
							}
						}
					}
				}
			}
		}
	}
	result = _result_;
	_vala_map_unref0 (symbol_table);
	return result;
}


static gchar* string_chug (const gchar* self) {
	gchar* result = NULL;
	gchar* _result_ = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	g_strchug (_tmp1_);
	result = _result_;
	return result;
}


static ValaExpression* ide_vala_completion_construct_member_access (IdeValaCompletion* self, gchar** names, int names_length1) {
	ValaExpression* result = NULL;
	ValaExpression* expr = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	expr = NULL;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gchar** _tmp2_ = NULL;
				gint _tmp2__length1 = 0;
				gint _tmp3_ = 0;
				const gchar* _tmp4_ = NULL;
				gchar** _tmp5_ = NULL;
				gint _tmp5__length1 = 0;
				gint _tmp6_ = 0;
				const gchar* _tmp7_ = NULL;
				if (!_tmp0_) {
					gint _tmp1_ = 0;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = names;
				_tmp2__length1 = names_length1;
				_tmp3_ = i;
				_tmp4_ = _tmp2_[_tmp3_];
				if (!(_tmp4_ != NULL)) {
					break;
				}
				_tmp5_ = names;
				_tmp5__length1 = names_length1;
				_tmp6_ = i;
				_tmp7_ = _tmp5_[_tmp6_];
				if (g_strcmp0 (_tmp7_, "") != 0) {
					ValaExpression* _tmp8_ = NULL;
					gchar** _tmp9_ = NULL;
					gint _tmp9__length1 = 0;
					gint _tmp10_ = 0;
					const gchar* _tmp11_ = NULL;
					ValaMemberAccess* _tmp12_ = NULL;
					gboolean _tmp13_ = FALSE;
					gchar** _tmp14_ = NULL;
					gint _tmp14__length1 = 0;
					gint _tmp15_ = 0;
					const gchar* _tmp16_ = NULL;
					_tmp8_ = expr;
					_tmp9_ = names;
					_tmp9__length1 = names_length1;
					_tmp10_ = i;
					_tmp11_ = _tmp9_[_tmp10_];
					_tmp12_ = vala_member_access_new (_tmp8_, _tmp11_, NULL);
					_vala_code_node_unref0 (expr);
					expr = (ValaExpression*) _tmp12_;
					_tmp14_ = names;
					_tmp14__length1 = names_length1;
					_tmp15_ = i;
					_tmp16_ = _tmp14_[_tmp15_ + 1];
					if (_tmp16_ != NULL) {
						gchar** _tmp17_ = NULL;
						gint _tmp17__length1 = 0;
						gint _tmp18_ = 0;
						const gchar* _tmp19_ = NULL;
						gchar* _tmp20_ = NULL;
						gchar* _tmp21_ = NULL;
						gboolean _tmp22_ = FALSE;
						_tmp17_ = names;
						_tmp17__length1 = names_length1;
						_tmp18_ = i;
						_tmp19_ = _tmp17_[_tmp18_ + 1];
						_tmp20_ = string_chug (_tmp19_);
						_tmp21_ = _tmp20_;
						_tmp22_ = g_str_has_prefix (_tmp21_, "(");
						_tmp13_ = _tmp22_;
						_g_free0 (_tmp21_);
					} else {
						_tmp13_ = FALSE;
					}
					if (_tmp13_) {
						ValaExpression* _tmp23_ = NULL;
						ValaMethodCall* _tmp24_ = NULL;
						gint _tmp25_ = 0;
						_tmp23_ = expr;
						_tmp24_ = vala_method_call_new (_tmp23_, NULL);
						_vala_code_node_unref0 (expr);
						expr = (ValaExpression*) _tmp24_;
						_tmp25_ = i;
						i = _tmp25_ + 1;
					}
				}
			}
		}
	}
	result = expr;
	return result;
}


static void ide_vala_completion_class_init (IdeValaCompletionClass * klass) {
	GError * _inner_error_ = NULL;
	ide_vala_completion_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (IdeValaCompletionPrivate));
	G_OBJECT_CLASS (klass)->finalize = ide_vala_completion_finalize;
	{
		GRegex* _tmp0_ = NULL;
		GRegex* _tmp1_ = NULL;
		GRegex* _tmp2_ = NULL;
		GRegex* _tmp3_ = NULL;
		GRegex* _tmp4_ = NULL;
		GRegex* _tmp5_ = NULL;
		GRegex* _tmp6_ = NULL;
		GRegex* _tmp7_ = NULL;
		GRegex* _tmp8_ = NULL;
		_tmp1_ = g_regex_new ("((?:\\w+(?:\\s*\\([^()]*\\))?\\.)*)(\\w*)$", 0, 0, &_inner_error_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch1_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		_g_regex_unref0 (ide_vala_completion_member_access);
		ide_vala_completion_member_access = _tmp2_;
		_tmp4_ = g_regex_new ("(\\s*\\([^()]*\\))?\\.", 0, 0, &_inner_error_);
		_tmp3_ = _tmp4_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_regex_unref0 (_tmp0_);
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch1_g_regex_error;
			}
			_g_regex_unref0 (_tmp0_);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
		}
		_tmp5_ = _tmp3_;
		_tmp3_ = NULL;
		_g_regex_unref0 (ide_vala_completion_member_access_split);
		ide_vala_completion_member_access_split = _tmp5_;
		_tmp7_ = g_regex_new ("(new )?((?:\\w+(?:\\s*\\([^()]*\\))?\\.)*)(\\w+)\\s*\\(([^(,)]+,)*([^(" \
",)]*)$", 0, 0, &_inner_error_);
		_tmp6_ = _tmp7_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_regex_unref0 (_tmp3_);
			_g_regex_unref0 (_tmp0_);
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch1_g_regex_error;
			}
			_g_regex_unref0 (_tmp3_);
			_g_regex_unref0 (_tmp0_);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
		}
		_tmp8_ = _tmp6_;
		_tmp6_ = NULL;
		_g_regex_unref0 (ide_vala_completion_function_call);
		ide_vala_completion_function_call = _tmp8_;
		_g_regex_unref0 (_tmp6_);
		_g_regex_unref0 (_tmp3_);
		_g_regex_unref0 (_tmp0_);
	}
	goto __finally1;
	__catch1_g_regex_error:
	{
		GError* err = NULL;
		GError* _tmp9_ = NULL;
		const gchar* _tmp10_ = NULL;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp9_ = err;
		_tmp10_ = _tmp9_->message;
		g_critical ("ide-vala-completion.vala:45: Regular expressions failed to compile : %" \
"s", _tmp10_);
		_g_error_free0 (err);
	}
	__finally1:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
	}
}


static void ide_vala_completion_instance_init (IdeValaCompletion * self) {
	self->priv = IDE_VALA_COMPLETION_GET_PRIVATE (self);
}


static void ide_vala_completion_finalize (GObject* obj) {
	IdeValaCompletion * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, IDE_TYPE_VALA_COMPLETION, IdeValaCompletion);
	_vala_code_context_unref0 (self->priv->context);
	_g_free0 (self->priv->current_text);
	_vala_code_node_unref0 (self->priv->nearest);
	G_OBJECT_CLASS (ide_vala_completion_parent_class)->finalize (obj);
}


GType ide_vala_completion_get_type (void) {
	return ide_vala_completion_type_id;
}


GType ide_vala_completion_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (IdeValaCompletionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ide_vala_completion_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IdeValaCompletion), 0, (GInstanceInitFunc) ide_vala_completion_instance_init, NULL };
	ide_vala_completion_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "IdeValaCompletion", &g_define_type_info, 0);
	return ide_vala_completion_type_id;
}


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



