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

/*
 * Copyright (C) 2008-2010 Abderrahim Kitouni
 *
 * 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 <libanjuta/interfaces/libanjuta-interfaces.h>
#include <libanjuta/libanjuta.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <vala.h>
#include <valagee.h>


#define TYPE_VALA_PROVIDER (vala_provider_get_type ())
#define VALA_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VALA_PROVIDER, ValaProvider))
#define VALA_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VALA_PROVIDER, ValaProviderClass))
#define IS_VALA_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VALA_PROVIDER))
#define IS_VALA_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VALA_PROVIDER))
#define VALA_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VALA_PROVIDER, ValaProviderClass))

typedef struct _ValaProvider ValaProvider;
typedef struct _ValaProviderClass ValaProviderClass;
typedef struct _ValaProviderPrivate ValaProviderPrivate;

#define TYPE_VALA_PLUGIN (vala_plugin_get_type ())
#define VALA_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VALA_PLUGIN, ValaPlugin))
#define VALA_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VALA_PLUGIN, ValaPluginClass))
#define IS_VALA_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VALA_PLUGIN))
#define IS_VALA_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VALA_PLUGIN))
#define VALA_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VALA_PLUGIN, ValaPluginClass))

typedef struct _ValaPlugin ValaPlugin;
typedef struct _ValaPluginClass ValaPluginClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ValaPluginPrivate ValaPluginPrivate;
#define _g_match_info_free0(var) ((var == NULL) ? NULL : (var = (g_match_info_free (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_list_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_free0_ (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 _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), 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 _ValaProvider {
	GObject parent_instance;
	ValaProviderPrivate * priv;
};

struct _ValaProviderClass {
	GObjectClass parent_class;
};

struct _ValaProviderPrivate {
	IAnjutaIterable* start_pos;
	ValaPlugin* plugin;
};

struct _ValaPlugin {
	AnjutaPlugin parent_instance;
	ValaPluginPrivate * priv;
	IAnjutaEditor* current_editor;
	GSettings* settings;
};

struct _ValaPluginClass {
	AnjutaPluginClass parent_class;
};


static gpointer vala_provider_parent_class = NULL;
static GRegex* vala_provider_member_access;
static GRegex* vala_provider_member_access = NULL;
static GRegex* vala_provider_member_access_split;
static GRegex* vala_provider_member_access_split = NULL;
static GRegex* vala_provider_function_call;
static GRegex* vala_provider_function_call = NULL;
static IAnjutaProviderIface* vala_provider_ianjuta_provider_parent_iface = NULL;
static GType vala_provider_type_id = 0;

GType vala_provider_get_type (void) G_GNUC_CONST;
GType vala_provider_register_type (GTypeModule * module);
GType vala_plugin_get_type (void) G_GNUC_CONST;
GType vala_plugin_register_type (GTypeModule * module);
#define VALA_PROVIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_VALA_PROVIDER, ValaProviderPrivate))
enum  {
	VALA_PROVIDER_DUMMY_PROPERTY
};
#define VALA_PROVIDER_PREF_AUTOCOMPLETE_ENABLE "completion-enable"
#define VALA_PROVIDER_PREF_SPACE_AFTER_FUNC "completion-space-after-func"
#define VALA_PROVIDER_PREF_BRACE_AFTER_FUNC "completion-brace-after-func"
#define VALA_PROVIDER_PREF_CALLTIP_ENABLE "calltip-enable"
ValaProvider* vala_provider_new (ValaPlugin* plugin);
ValaProvider* vala_provider_construct (GType object_type, ValaPlugin* plugin);
static const gchar* vala_provider_real_get_name (IAnjutaProvider* base, GError** error);
static void vala_provider_real_populate (IAnjutaProvider* base, IAnjutaIterable* iter, GError** error);
GList* vala_plugin_lookup_symbol (ValaPlugin* self, ValaExpression* inner, const gchar* name, gboolean prefix_match, ValaBlock* block);
static ValaExpression* vala_provider_construct_member_access (ValaProvider* self, gchar** names, int names_length1);
ValaSymbol* vala_plugin_get_current_context (ValaPlugin* self, IAnjutaEditor* editor, IAnjutaIterable* position);
static void _g_free0_ (gpointer var);
static void _g_list_free__g_free0_ (GList* self);
static void _vala_code_node_unref0_ (gpointer var);
static void _g_list_free__vala_code_node_unref0_ (GList* self);
static IAnjutaEditorAssistProposal* _ianjuta_editor_assist_proposal_dup (IAnjutaEditorAssistProposal* self);
static IAnjutaIterable* vala_provider_real_get_start_iter (IAnjutaProvider* base, GError** error);
static void vala_provider_real_activate (IAnjutaProvider* base, IAnjutaIterable* iter, void* data, GError** error);
void vala_provider_show_call_tip (ValaProvider* self, IAnjutaEditorTip* editor);
static void vala_provider_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);


ValaProvider* vala_provider_construct (GType object_type, ValaPlugin* plugin) {
	ValaProvider * self = NULL;
	ValaPlugin* _tmp0_ = NULL;
	g_return_val_if_fail (plugin != NULL, NULL);
	self = (ValaProvider*) g_object_new (object_type, NULL);
	_tmp0_ = plugin;
	self->priv->plugin = _tmp0_;
	return self;
}


ValaProvider* vala_provider_new (ValaPlugin* plugin) {
	return vala_provider_construct (TYPE_VALA_PROVIDER, plugin);
}


static const gchar* vala_provider_real_get_name (IAnjutaProvider* base, GError** error) {
	ValaProvider * self;
	const gchar* result = NULL;
	self = (ValaProvider*) base;
	result = "Vala";
	return result;
}


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


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


static void _g_free0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_free (var), NULL));
}


static void _g_list_free__g_free0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_free0_, NULL);
	g_list_free (self);
}


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


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


static gpointer __ianjuta_editor_assist_proposal_dup0 (gpointer self) {
	return self ? _ianjuta_editor_assist_proposal_dup (self) : NULL;
}


static void vala_provider_real_populate (IAnjutaProvider* base, IAnjutaIterable* iter, GError** error) {
	ValaProvider * self;
	ValaPlugin* _tmp0_ = NULL;
	GSettings* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	IAnjutaEditorAssist* editor = NULL;
	ValaPlugin* _tmp3_ = NULL;
	IAnjutaEditor* _tmp4_ = NULL;
	IAnjutaEditorAssist* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	IAnjutaEditorAssist* _tmp7_ = NULL;
	gint _tmp8_ = 0;
	IAnjutaIterable* line_start = NULL;
	IAnjutaEditorAssist* _tmp9_ = NULL;
	IAnjutaIterable* _tmp10_ = NULL;
	gchar* current_text = NULL;
	IAnjutaEditorAssist* _tmp11_ = NULL;
	IAnjutaIterable* _tmp12_ = NULL;
	IAnjutaIterable* _tmp13_ = NULL;
	gchar* _tmp14_ = NULL;
	GMatchInfo* match_info = NULL;
	GRegex* _tmp15_ = NULL;
	const gchar* _tmp16_ = NULL;
	GMatchInfo* _tmp17_ = NULL;
	gboolean _tmp18_ = FALSE;
	GMatchInfo* _tmp19_ = NULL;
	gchar* _tmp20_ = NULL;
	gchar* _tmp21_ = NULL;
	gint _tmp22_ = 0;
	gint _tmp23_ = 0;
	gboolean _tmp24_ = FALSE;
	IAnjutaIterable* _tmp25_ = NULL;
	IAnjutaIterable* _tmp26_ = NULL;
	IAnjutaIterable* _tmp27_ = NULL;
	IAnjutaIterable* _tmp28_ = NULL;
	gint _tmp29_ = 0;
	IAnjutaIterable* _tmp30_ = NULL;
	gint _tmp31_ = 0;
	IAnjutaIterable* _tmp32_ = NULL;
	GMatchInfo* _tmp33_ = NULL;
	gchar* _tmp34_ = NULL;
	gchar* _tmp35_ = NULL;
	gint _tmp36_ = 0;
	gint _tmp37_ = 0;
	gchar** names = NULL;
	GRegex* _tmp38_ = NULL;
	GMatchInfo* _tmp39_ = NULL;
	gchar* _tmp40_ = NULL;
	gchar* _tmp41_ = NULL;
	gchar** _tmp42_ = NULL;
	gchar** _tmp43_ = NULL;
	gchar** _tmp44_ = NULL;
	gint _tmp44__length1 = 0;
	gint names_length1 = 0;
	gint _names_size_ = 0;
	GList* syms = NULL;
	ValaPlugin* _tmp45_ = NULL;
	gchar** _tmp46_ = NULL;
	gint _tmp46__length1 = 0;
	ValaExpression* _tmp47_ = NULL;
	ValaExpression* _tmp48_ = NULL;
	GMatchInfo* _tmp49_ = NULL;
	gchar* _tmp50_ = NULL;
	gchar* _tmp51_ = NULL;
	ValaPlugin* _tmp52_ = NULL;
	IAnjutaEditorAssist* _tmp53_ = NULL;
	ValaSymbol* _tmp54_ = NULL;
	ValaBlock* _tmp55_ = NULL;
	ValaBlock* _tmp56_ = NULL;
	GList* _tmp57_ = NULL;
	GList* _tmp58_ = NULL;
	GList* proposals = NULL;
	GList* _tmp59_ = NULL;
	IAnjutaEditorAssist* _tmp78_ = NULL;
	GList* _tmp79_ = NULL;
	GError * _inner_error_ = NULL;
	self = (ValaProvider*) base;
	g_return_if_fail (iter != NULL);
	_tmp0_ = self->priv->plugin;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = g_settings_get_boolean (_tmp1_, VALA_PROVIDER_PREF_AUTOCOMPLETE_ENABLE);
	if (!_tmp2_) {
		return;
	}
	_tmp3_ = self->priv->plugin;
	_tmp4_ = _tmp3_->current_editor;
	_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, ianjuta_editor_assist_get_type ()) ? ((IAnjutaEditorAssist*) _tmp4_) : NULL);
	editor = _tmp5_;
	_tmp7_ = editor;
	_tmp8_ = ianjuta_editor_get_lineno ((IAnjutaEditor*) _tmp7_, &_inner_error_);
	_tmp6_ = _tmp8_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (editor);
		return;
	}
	_tmp9_ = editor;
	_tmp10_ = ianjuta_editor_get_line_begin_position ((IAnjutaEditor*) _tmp9_, _tmp6_, &_inner_error_);
	line_start = _tmp10_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (editor);
		return;
	}
	_tmp11_ = editor;
	_tmp12_ = line_start;
	_tmp13_ = iter;
	_tmp14_ = ianjuta_editor_get_text ((IAnjutaEditor*) _tmp11_, _tmp12_, _tmp13_, &_inner_error_);
	current_text = _tmp14_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (line_start);
		_g_object_unref0 (editor);
		return;
	}
	_tmp15_ = vala_provider_member_access;
	_tmp16_ = current_text;
	_tmp18_ = g_regex_match (_tmp15_, _tmp16_, 0, &_tmp17_);
	_g_match_info_free0 (match_info);
	match_info = _tmp17_;
	if (!_tmp18_) {
		_g_match_info_free0 (match_info);
		_g_free0 (current_text);
		_g_object_unref0 (line_start);
		_g_object_unref0 (editor);
		return;
	}
	_tmp19_ = match_info;
	_tmp20_ = g_match_info_fetch (_tmp19_, 0);
	_tmp21_ = _tmp20_;
	_tmp22_ = strlen (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = _tmp23_ < 2;
	_g_free0 (_tmp21_);
	if (_tmp24_) {
		_g_match_info_free0 (match_info);
		_g_free0 (current_text);
		_g_object_unref0 (line_start);
		_g_object_unref0 (editor);
		return;
	}
	_tmp26_ = iter;
	_tmp27_ = ianjuta_iterable_clone (_tmp26_, &_inner_error_);
	_tmp25_ = _tmp27_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_match_info_free0 (match_info);
		_g_free0 (current_text);
		_g_object_unref0 (line_start);
		_g_object_unref0 (editor);
		return;
	}
	_tmp28_ = _tmp25_;
	_tmp25_ = NULL;
	_g_object_unref0 (self->priv->start_pos);
	self->priv->start_pos = _tmp28_;
	_tmp30_ = iter;
	_tmp31_ = ianjuta_iterable_get_position (_tmp30_, &_inner_error_);
	_tmp29_ = _tmp31_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (_tmp25_);
		_g_match_info_free0 (match_info);
		_g_free0 (current_text);
		_g_object_unref0 (line_start);
		_g_object_unref0 (editor);
		return;
	}
	_tmp32_ = self->priv->start_pos;
	_tmp33_ = match_info;
	_tmp34_ = g_match_info_fetch (_tmp33_, 2);
	_tmp35_ = _tmp34_;
	_tmp36_ = strlen (_tmp35_);
	_tmp37_ = _tmp36_;
	ianjuta_iterable_set_position (_tmp32_, _tmp29_ - ((gint) _tmp37_), &_inner_error_);
	_g_free0 (_tmp35_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (_tmp25_);
		_g_match_info_free0 (match_info);
		_g_free0 (current_text);
		_g_object_unref0 (line_start);
		_g_object_unref0 (editor);
		return;
	}
	_tmp38_ = vala_provider_member_access_split;
	_tmp39_ = match_info;
	_tmp40_ = g_match_info_fetch (_tmp39_, 1);
	_tmp41_ = _tmp40_;
	_tmp43_ = _tmp42_ = g_regex_split (_tmp38_, _tmp41_, 0);
	_tmp44_ = _tmp43_;
	_tmp44__length1 = _vala_array_length (_tmp42_);
	_g_free0 (_tmp41_);
	names = _tmp44_;
	names_length1 = _tmp44__length1;
	_names_size_ = names_length1;
	_tmp45_ = self->priv->plugin;
	_tmp46_ = names;
	_tmp46__length1 = names_length1;
	_tmp47_ = vala_provider_construct_member_access (self, _tmp46_, _tmp46__length1);
	_tmp48_ = _tmp47_;
	_tmp49_ = match_info;
	_tmp50_ = g_match_info_fetch (_tmp49_, 2);
	_tmp51_ = _tmp50_;
	_tmp52_ = self->priv->plugin;
	_tmp53_ = editor;
	_tmp54_ = vala_plugin_get_current_context (_tmp52_, (IAnjutaEditor*) _tmp53_, NULL);
	_tmp55_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp54_, VALA_TYPE_BLOCK) ? ((ValaBlock*) _tmp54_) : NULL;
	if (_tmp55_ == NULL) {
		_vala_code_node_unref0 (_tmp54_);
	}
	_tmp56_ = _tmp55_;
	_tmp57_ = vala_plugin_lookup_symbol (_tmp45_, _tmp48_, _tmp51_, TRUE, _tmp56_);
	_tmp58_ = _tmp57_;
	_vala_code_node_unref0 (_tmp56_);
	_g_free0 (_tmp51_);
	_vala_code_node_unref0 (_tmp48_);
	syms = _tmp58_;
	proposals = NULL;
	_tmp59_ = syms;
	{
		GList* symbol_collection = NULL;
		GList* symbol_it = NULL;
		symbol_collection = _tmp59_;
		for (symbol_it = symbol_collection; symbol_it != NULL; symbol_it = symbol_it->next) {
			ValaSymbol* _tmp60_ = NULL;
			ValaSymbol* symbol = NULL;
			_tmp60_ = _vala_code_node_ref0 ((ValaSymbol*) symbol_it->data);
			symbol = _tmp60_;
			{
				gboolean _tmp61_ = FALSE;
				ValaSymbol* _tmp62_ = NULL;
				IAnjutaEditorAssistProposal prop = {0};
				ValaSymbol* _tmp72_ = NULL;
				ValaSymbol* _tmp73_ = NULL;
				const gchar* _tmp74_ = NULL;
				const gchar* _tmp75_ = NULL;
				IAnjutaEditorAssistProposal _tmp76_ = {0};
				IAnjutaEditorAssistProposal* _tmp77_ = NULL;
				_tmp62_ = symbol;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp62_, VALA_TYPE_LOCAL_VARIABLE)) {
					gint _tmp63_ = 0;
					IAnjutaEditorAssist* _tmp64_ = NULL;
					gint _tmp65_ = 0;
					ValaSymbol* _tmp66_ = NULL;
					ValaSourceReference* _tmp67_ = NULL;
					ValaSourceReference* _tmp68_ = NULL;
					ValaSourceLocation _tmp69_ = {0};
					ValaSourceLocation _tmp70_ = {0};
					gint _tmp71_ = 0;
					_tmp64_ = editor;
					_tmp65_ = ianjuta_editor_get_lineno ((IAnjutaEditor*) _tmp64_, &_inner_error_);
					_tmp63_ = _tmp65_;
					if (G_UNLIKELY (_inner_error_ != NULL)) {
						g_propagate_error (error, _inner_error_);
						_vala_code_node_unref0 (symbol);
						__g_list_free__g_free0_0 (proposals);
						__g_list_free__vala_code_node_unref0_0 (syms);
						names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL);
						_g_object_unref0 (_tmp25_);
						_g_match_info_free0 (match_info);
						_g_free0 (current_text);
						_g_object_unref0 (line_start);
						_g_object_unref0 (editor);
						return;
					}
					_tmp66_ = symbol;
					_tmp67_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp66_);
					_tmp68_ = _tmp67_;
					vala_source_reference_get_begin (_tmp68_, &_tmp69_);
					_tmp70_ = _tmp69_;
					_tmp71_ = _tmp70_.line;
					_tmp61_ = _tmp71_ > _tmp63_;
				} else {
					_tmp61_ = FALSE;
				}
				if (_tmp61_) {
					_vala_code_node_unref0 (symbol);
					continue;
				}
				memset (&prop, 0, sizeof (IAnjutaEditorAssistProposal));
				_tmp72_ = symbol;
				prop.data = _tmp72_;
				_tmp73_ = symbol;
				_tmp74_ = vala_symbol_get_name (_tmp73_);
				_tmp75_ = _tmp74_;
				prop.label = _tmp75_;
				_tmp76_ = prop;
				_tmp77_ = __ianjuta_editor_assist_proposal_dup0 (&_tmp76_);
				proposals = g_list_prepend (proposals, _tmp77_);
				_vala_code_node_unref0 (symbol);
			}
		}
	}
	proposals = g_list_reverse (proposals);
	_tmp78_ = editor;
	_tmp79_ = proposals;
	ianjuta_editor_assist_proposals (_tmp78_, (IAnjutaProvider*) self, _tmp79_, NULL, TRUE, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		__g_list_free__g_free0_0 (proposals);
		__g_list_free__vala_code_node_unref0_0 (syms);
		names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL);
		_g_object_unref0 (_tmp25_);
		_g_match_info_free0 (match_info);
		_g_free0 (current_text);
		_g_object_unref0 (line_start);
		_g_object_unref0 (editor);
		return;
	}
	__g_list_free__g_free0_0 (proposals);
	__g_list_free__vala_code_node_unref0_0 (syms);
	names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_tmp25_);
	_g_match_info_free0 (match_info);
	_g_free0 (current_text);
	_g_object_unref0 (line_start);
	_g_object_unref0 (editor);
}


static IAnjutaIterable* vala_provider_real_get_start_iter (IAnjutaProvider* base, GError** error) {
	ValaProvider * self;
	IAnjutaIterable* result = NULL;
	IAnjutaIterable* _tmp0_ = NULL;
	self = (ValaProvider*) base;
	_tmp0_ = self->priv->start_pos;
	result = _tmp0_;
	return result;
}


static void vala_provider_real_activate (IAnjutaProvider* base, IAnjutaIterable* iter, void* data, GError** error) {
	ValaProvider * self;
	ValaSymbol* sym = NULL;
	void* _tmp0_ = NULL;
	ValaSymbol* _tmp1_ = NULL;
	IAnjutaEditorAssist* editor = NULL;
	ValaPlugin* _tmp2_ = NULL;
	IAnjutaEditor* _tmp3_ = NULL;
	IAnjutaEditorAssist* _tmp4_ = NULL;
	gchar* assist = NULL;
	ValaSymbol* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	gchar* _tmp8_ = NULL;
	gboolean is_func = FALSE;
	gboolean calltip = FALSE;
	gboolean _tmp9_ = FALSE;
	ValaSymbol* _tmp10_ = NULL;
	gboolean _tmp16_ = FALSE;
	IAnjutaEditorAssist* _tmp30_ = NULL;
	IAnjutaEditorAssist* _tmp31_ = NULL;
	IAnjutaIterable* _tmp32_ = NULL;
	IAnjutaIterable* _tmp33_ = NULL;
	IAnjutaEditorAssist* _tmp34_ = NULL;
	IAnjutaIterable* _tmp35_ = NULL;
	const gchar* _tmp36_ = NULL;
	IAnjutaEditorAssist* _tmp37_ = NULL;
	gboolean _tmp38_ = FALSE;
	gboolean _tmp39_ = FALSE;
	GError * _inner_error_ = NULL;
	self = (ValaProvider*) base;
	g_return_if_fail (iter != NULL);
	_tmp0_ = data;
	_tmp1_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, VALA_TYPE_SYMBOL) ? ((ValaSymbol*) _tmp0_) : NULL);
	sym = _tmp1_;
	_tmp2_ = self->priv->plugin;
	_tmp3_ = _tmp2_->current_editor;
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, ianjuta_editor_assist_get_type ()) ? ((IAnjutaEditorAssist*) _tmp3_) : NULL);
	editor = _tmp4_;
	_tmp5_ = sym;
	_tmp6_ = vala_symbol_get_name (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strdup (_tmp7_);
	assist = _tmp8_;
	is_func = FALSE;
	calltip = FALSE;
	_tmp10_ = sym;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, VALA_TYPE_METHOD)) {
		_tmp9_ = TRUE;
	} else {
		ValaSymbol* _tmp11_ = NULL;
		_tmp11_ = sym;
		_tmp9_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, VALA_TYPE_SIGNAL);
	}
	if (_tmp9_) {
		is_func = TRUE;
	} else {
		ValaSymbol* _tmp12_ = NULL;
		_tmp12_ = sym;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, VALA_TYPE_VARIABLE)) {
			ValaSymbol* _tmp13_ = NULL;
			ValaDataType* _tmp14_ = NULL;
			ValaDataType* _tmp15_ = NULL;
			_tmp13_ = sym;
			_tmp14_ = vala_variable_get_variable_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, VALA_TYPE_VARIABLE, ValaVariable));
			_tmp15_ = _tmp14_;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp15_, VALA_TYPE_DELEGATE_TYPE)) {
				is_func = TRUE;
			}
		}
	}
	_tmp16_ = is_func;
	if (_tmp16_) {
		ValaPlugin* _tmp17_ = NULL;
		GSettings* _tmp18_ = NULL;
		gboolean _tmp19_ = FALSE;
		ValaPlugin* _tmp22_ = NULL;
		GSettings* _tmp23_ = NULL;
		gboolean _tmp24_ = FALSE;
		_tmp17_ = self->priv->plugin;
		_tmp18_ = _tmp17_->settings;
		_tmp19_ = g_settings_get_boolean (_tmp18_, VALA_PROVIDER_PREF_SPACE_AFTER_FUNC);
		if (_tmp19_) {
			const gchar* _tmp20_ = NULL;
			gchar* _tmp21_ = NULL;
			_tmp20_ = assist;
			_tmp21_ = g_strconcat (_tmp20_, " ", NULL);
			_g_free0 (assist);
			assist = _tmp21_;
		}
		_tmp22_ = self->priv->plugin;
		_tmp23_ = _tmp22_->settings;
		_tmp24_ = g_settings_get_boolean (_tmp23_, VALA_PROVIDER_PREF_BRACE_AFTER_FUNC);
		if (_tmp24_) {
			const gchar* _tmp25_ = NULL;
			gchar* _tmp26_ = NULL;
			ValaPlugin* _tmp27_ = NULL;
			GSettings* _tmp28_ = NULL;
			gboolean _tmp29_ = FALSE;
			_tmp25_ = assist;
			_tmp26_ = g_strconcat (_tmp25_, "(", NULL);
			_g_free0 (assist);
			assist = _tmp26_;
			_tmp27_ = self->priv->plugin;
			_tmp28_ = _tmp27_->settings;
			_tmp29_ = g_settings_get_boolean (_tmp28_, VALA_PROVIDER_PREF_CALLTIP_ENABLE);
			if (_tmp29_) {
				calltip = TRUE;
			}
		}
	}
	_tmp30_ = editor;
	ianjuta_document_begin_undo_action (G_TYPE_CHECK_INSTANCE_TYPE (_tmp30_, ianjuta_document_get_type ()) ? ((IAnjutaDocument*) _tmp30_) : NULL, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_free0 (assist);
		_g_object_unref0 (editor);
		_vala_code_node_unref0 (sym);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp31_ = editor;
	_tmp32_ = self->priv->start_pos;
	_tmp33_ = iter;
	ianjuta_editor_erase ((IAnjutaEditor*) _tmp31_, _tmp32_, _tmp33_, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_free0 (assist);
		_g_object_unref0 (editor);
		_vala_code_node_unref0 (sym);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp34_ = editor;
	_tmp35_ = self->priv->start_pos;
	_tmp36_ = assist;
	ianjuta_editor_insert ((IAnjutaEditor*) _tmp34_, _tmp35_, _tmp36_, -1, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_free0 (assist);
		_g_object_unref0 (editor);
		_vala_code_node_unref0 (sym);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp37_ = editor;
	ianjuta_document_end_undo_action (G_TYPE_CHECK_INSTANCE_TYPE (_tmp37_, ianjuta_document_get_type ()) ? ((IAnjutaDocument*) _tmp37_) : NULL, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_free0 (assist);
		_g_object_unref0 (editor);
		_vala_code_node_unref0 (sym);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp39_ = calltip;
	if (_tmp39_) {
		IAnjutaEditorAssist* _tmp40_ = NULL;
		_tmp40_ = editor;
		_tmp38_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp40_, ianjuta_editor_tip_get_type ());
	} else {
		_tmp38_ = FALSE;
	}
	if (_tmp38_) {
		IAnjutaEditorAssist* _tmp41_ = NULL;
		_tmp41_ = editor;
		vala_provider_show_call_tip (self, G_TYPE_CHECK_INSTANCE_CAST (_tmp41_, ianjuta_editor_tip_get_type (), IAnjutaEditorTip));
	}
	_g_free0 (assist);
	_g_object_unref0 (editor);
	_vala_code_node_unref0 (sym);
}


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


void vala_provider_show_call_tip (ValaProvider* self, IAnjutaEditorTip* editor) {
	IAnjutaIterable* current_position = NULL;
	IAnjutaEditorTip* _tmp0_ = NULL;
	IAnjutaIterable* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	IAnjutaEditorTip* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	IAnjutaIterable* line_start = NULL;
	IAnjutaEditorTip* _tmp5_ = NULL;
	IAnjutaIterable* _tmp6_ = NULL;
	gchar* to_complete = NULL;
	IAnjutaEditorTip* _tmp7_ = NULL;
	IAnjutaIterable* _tmp8_ = NULL;
	IAnjutaIterable* _tmp9_ = NULL;
	gchar* _tmp10_ = NULL;
	GList* tips = NULL;
	GMatchInfo* match_info = NULL;
	GRegex* _tmp11_ = NULL;
	const gchar* _tmp12_ = NULL;
	GMatchInfo* _tmp13_ = NULL;
	gboolean _tmp14_ = FALSE;
	gboolean creation_method = FALSE;
	GMatchInfo* _tmp15_ = NULL;
	gchar* _tmp16_ = NULL;
	gchar* _tmp17_ = NULL;
	gboolean _tmp18_ = FALSE;
	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;
	ValaPlugin* _tmp26_ = NULL;
	gchar** _tmp27_ = NULL;
	gint _tmp27__length1 = 0;
	ValaExpression* _tmp28_ = NULL;
	ValaExpression* _tmp29_ = NULL;
	GMatchInfo* _tmp30_ = NULL;
	gchar* _tmp31_ = NULL;
	gchar* _tmp32_ = NULL;
	ValaPlugin* _tmp33_ = NULL;
	IAnjutaEditorTip* _tmp34_ = NULL;
	ValaSymbol* _tmp35_ = NULL;
	ValaBlock* _tmp36_ = NULL;
	ValaBlock* _tmp37_ = NULL;
	GList* _tmp38_ = NULL;
	GList* _tmp39_ = NULL;
	GList* _tmp40_ = NULL;
	IAnjutaIterable* _tmp126_ = NULL;
	IAnjutaEditorTip* _tmp127_ = NULL;
	IAnjutaIterable* _tmp128_ = NULL;
	IAnjutaEditorTip* _tmp129_ = NULL;
	GList* _tmp130_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (editor != NULL);
	_tmp0_ = editor;
	_tmp1_ = ianjuta_editor_get_position ((IAnjutaEditor*) _tmp0_, &_inner_error_);
	current_position = _tmp1_;
	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_);
		return;
	}
	_tmp3_ = editor;
	_tmp4_ = ianjuta_editor_get_lineno ((IAnjutaEditor*) _tmp3_, &_inner_error_);
	_tmp2_ = _tmp4_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (current_position);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp5_ = editor;
	_tmp6_ = ianjuta_editor_get_line_begin_position ((IAnjutaEditor*) _tmp5_, _tmp2_, &_inner_error_);
	line_start = _tmp6_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (current_position);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp7_ = editor;
	_tmp8_ = line_start;
	_tmp9_ = current_position;
	_tmp10_ = ianjuta_editor_get_text ((IAnjutaEditor*) _tmp7_, _tmp8_, _tmp9_, &_inner_error_);
	to_complete = _tmp10_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (line_start);
		_g_object_unref0 (current_position);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	tips = NULL;
	_tmp11_ = vala_provider_function_call;
	_tmp12_ = to_complete;
	_tmp14_ = g_regex_match (_tmp11_, _tmp12_, 0, &_tmp13_);
	_g_match_info_free0 (match_info);
	match_info = _tmp13_;
	if (!_tmp14_) {
		_g_match_info_free0 (match_info);
		__g_list_free__g_free0_0 (tips);
		_g_free0 (to_complete);
		_g_object_unref0 (line_start);
		_g_object_unref0 (current_position);
		return;
	}
	_tmp15_ = match_info;
	_tmp16_ = g_match_info_fetch (_tmp15_, 1);
	_tmp17_ = _tmp16_;
	_tmp18_ = g_strcmp0 (_tmp17_, "") != 0;
	_g_free0 (_tmp17_);
	creation_method = _tmp18_;
	_tmp19_ = vala_provider_member_access_split;
	_tmp20_ = match_info;
	_tmp21_ = g_match_info_fetch (_tmp20_, 2);
	_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_ = self->priv->plugin;
	_tmp27_ = names;
	_tmp27__length1 = names_length1;
	_tmp28_ = vala_provider_construct_member_access (self, _tmp27_, _tmp27__length1);
	_tmp29_ = _tmp28_;
	_tmp30_ = match_info;
	_tmp31_ = g_match_info_fetch (_tmp30_, 3);
	_tmp32_ = _tmp31_;
	_tmp33_ = self->priv->plugin;
	_tmp34_ = editor;
	_tmp35_ = vala_plugin_get_current_context (_tmp33_, (IAnjutaEditor*) _tmp34_, NULL);
	_tmp36_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp35_, VALA_TYPE_BLOCK) ? ((ValaBlock*) _tmp35_) : NULL;
	if (_tmp36_ == NULL) {
		_vala_code_node_unref0 (_tmp35_);
	}
	_tmp37_ = _tmp36_;
	_tmp38_ = vala_plugin_lookup_symbol (_tmp26_, _tmp29_, _tmp32_, FALSE, _tmp37_);
	_tmp39_ = _tmp38_;
	_vala_code_node_unref0 (_tmp37_);
	_g_free0 (_tmp32_);
	_vala_code_node_unref0 (_tmp29_);
	syms = _tmp39_;
	_tmp40_ = syms;
	{
		GList* sym_collection = NULL;
		GList* sym_it = NULL;
		sym_collection = _tmp40_;
		for (sym_it = sym_collection; sym_it != NULL; sym_it = sym_it->next) {
			ValaSymbol* _tmp41_ = NULL;
			ValaSymbol* sym = NULL;
			_tmp41_ = _vala_code_node_ref0 ((ValaSymbol*) sym_it->data);
			sym = _tmp41_;
			{
				GString* calltip = NULL;
				GString* _tmp42_ = NULL;
				ValaList* parameters = NULL;
				ValaSymbol* _tmp43_ = NULL;
				GString* _tmp84_ = NULL;
				ValaSymbol* _tmp85_ = NULL;
				gchar* _tmp86_ = NULL;
				gchar* _tmp87_ = NULL;
				GString* _tmp88_ = NULL;
				gchar* prestring = NULL;
				GString* _tmp89_ = NULL;
				gssize _tmp90_ = 0L;
				gchar* _tmp91_ = NULL;
				gboolean first = FALSE;
				GString* _tmp122_ = NULL;
				GString* _tmp123_ = NULL;
				const gchar* _tmp124_ = NULL;
				gchar* _tmp125_ = NULL;
				_tmp42_ = g_string_new ("");
				calltip = _tmp42_;
				parameters = NULL;
				_tmp43_ = sym;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp43_, VALA_TYPE_METHOD)) {
					ValaSymbol* _tmp44_ = NULL;
					ValaList* _tmp45_ = NULL;
					GString* _tmp46_ = NULL;
					ValaSymbol* _tmp47_ = NULL;
					ValaDataType* _tmp48_ = NULL;
					ValaDataType* _tmp49_ = NULL;
					gchar* _tmp50_ = NULL;
					gchar* _tmp51_ = NULL;
					gchar* _tmp52_ = NULL;
					gchar* _tmp53_ = NULL;
					_tmp44_ = sym;
					_tmp45_ = vala_method_get_parameters (G_TYPE_CHECK_INSTANCE_CAST (_tmp44_, VALA_TYPE_METHOD, ValaMethod));
					_vala_iterable_unref0 (parameters);
					parameters = _tmp45_;
					_tmp46_ = calltip;
					_tmp47_ = sym;
					_tmp48_ = vala_method_get_return_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp47_, VALA_TYPE_METHOD, ValaMethod));
					_tmp49_ = _tmp48_;
					_tmp50_ = vala_data_type_to_qualified_string (_tmp49_, NULL);
					_tmp51_ = _tmp50_;
					_tmp52_ = g_strconcat (_tmp51_, " ", NULL);
					_tmp53_ = _tmp52_;
					g_string_append (_tmp46_, _tmp53_);
					_g_free0 (_tmp53_);
					_g_free0 (_tmp51_);
				} else {
					ValaSymbol* _tmp54_ = NULL;
					_tmp54_ = sym;
					if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp54_, VALA_TYPE_SIGNAL)) {
						ValaSymbol* _tmp55_ = NULL;
						ValaList* _tmp56_ = NULL;
						_tmp55_ = sym;
						_tmp56_ = vala_signal_get_parameters (G_TYPE_CHECK_INSTANCE_CAST (_tmp55_, VALA_TYPE_SIGNAL, ValaSignal));
						_vala_iterable_unref0 (parameters);
						parameters = _tmp56_;
					} else {
						gboolean _tmp57_ = FALSE;
						gboolean _tmp58_ = FALSE;
						_tmp58_ = creation_method;
						if (_tmp58_) {
							ValaSymbol* _tmp59_ = NULL;
							_tmp59_ = sym;
							_tmp57_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp59_, VALA_TYPE_CLASS);
						} else {
							_tmp57_ = FALSE;
						}
						if (_tmp57_) {
							ValaSymbol* _tmp60_ = NULL;
							ValaCreationMethod* _tmp61_ = NULL;
							ValaCreationMethod* _tmp62_ = NULL;
							ValaList* _tmp63_ = NULL;
							_tmp60_ = sym;
							_tmp61_ = vala_class_get_default_construction_method (G_TYPE_CHECK_INSTANCE_CAST (_tmp60_, VALA_TYPE_CLASS, ValaClass));
							_tmp62_ = _tmp61_;
							_tmp63_ = vala_method_get_parameters ((ValaMethod*) _tmp62_);
							_vala_iterable_unref0 (parameters);
							parameters = _tmp63_;
						} else {
							ValaSymbol* _tmp64_ = NULL;
							_tmp64_ = sym;
							if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp64_, VALA_TYPE_VARIABLE)) {
								ValaDataType* var_type = NULL;
								ValaSymbol* _tmp65_ = NULL;
								ValaDataType* _tmp66_ = NULL;
								ValaDataType* _tmp67_ = NULL;
								ValaDataType* _tmp68_ = NULL;
								ValaDataType* _tmp69_ = NULL;
								_tmp65_ = sym;
								_tmp66_ = vala_variable_get_variable_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp65_, VALA_TYPE_VARIABLE, ValaVariable));
								_tmp67_ = _tmp66_;
								_tmp68_ = _vala_code_node_ref0 (_tmp67_);
								var_type = _tmp68_;
								_tmp69_ = var_type;
								if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp69_, VALA_TYPE_DELEGATE_TYPE)) {
									ValaDelegate* delegate_sym = NULL;
									ValaDataType* _tmp70_ = NULL;
									ValaDelegate* _tmp71_ = NULL;
									ValaDelegate* _tmp72_ = NULL;
									ValaDelegate* _tmp73_ = NULL;
									ValaDelegate* _tmp74_ = NULL;
									ValaList* _tmp75_ = NULL;
									GString* _tmp76_ = NULL;
									ValaDelegate* _tmp77_ = NULL;
									ValaDataType* _tmp78_ = NULL;
									ValaDataType* _tmp79_ = NULL;
									gchar* _tmp80_ = NULL;
									gchar* _tmp81_ = NULL;
									gchar* _tmp82_ = NULL;
									gchar* _tmp83_ = NULL;
									_tmp70_ = var_type;
									_tmp71_ = vala_delegate_type_get_delegate_symbol (G_TYPE_CHECK_INSTANCE_CAST (_tmp70_, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType));
									_tmp72_ = _tmp71_;
									_tmp73_ = _vala_code_node_ref0 (_tmp72_);
									delegate_sym = _tmp73_;
									_tmp74_ = delegate_sym;
									_tmp75_ = vala_delegate_get_parameters (_tmp74_);
									_vala_iterable_unref0 (parameters);
									parameters = _tmp75_;
									_tmp76_ = calltip;
									_tmp77_ = delegate_sym;
									_tmp78_ = vala_delegate_get_return_type (_tmp77_);
									_tmp79_ = _tmp78_;
									_tmp80_ = vala_data_type_to_qualified_string (_tmp79_, NULL);
									_tmp81_ = _tmp80_;
									_tmp82_ = g_strconcat (_tmp81_, " ", NULL);
									_tmp83_ = _tmp82_;
									g_string_append (_tmp76_, _tmp83_);
									_g_free0 (_tmp83_);
									_g_free0 (_tmp81_);
									_vala_code_node_unref0 (delegate_sym);
								} else {
									_vala_code_node_unref0 (var_type);
									_vala_iterable_unref0 (parameters);
									_g_string_free0 (calltip);
									_vala_code_node_unref0 (sym);
									__g_list_free__vala_code_node_unref0_0 (syms);
									names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL);
									_g_match_info_free0 (match_info);
									__g_list_free__g_free0_0 (tips);
									_g_free0 (to_complete);
									_g_object_unref0 (line_start);
									_g_object_unref0 (current_position);
									return;
								}
								_vala_code_node_unref0 (var_type);
							} else {
								_vala_iterable_unref0 (parameters);
								_g_string_free0 (calltip);
								_vala_code_node_unref0 (sym);
								__g_list_free__vala_code_node_unref0_0 (syms);
								names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL);
								_g_match_info_free0 (match_info);
								__g_list_free__g_free0_0 (tips);
								_g_free0 (to_complete);
								_g_object_unref0 (line_start);
								_g_object_unref0 (current_position);
								return;
							}
						}
					}
				}
				_tmp84_ = calltip;
				_tmp85_ = sym;
				_tmp86_ = vala_symbol_get_full_name (_tmp85_);
				_tmp87_ = _tmp86_;
				g_string_append (_tmp84_, _tmp87_);
				_g_free0 (_tmp87_);
				_tmp88_ = calltip;
				g_string_append (_tmp88_, " (");
				_tmp89_ = calltip;
				_tmp90_ = _tmp89_->len;
				_tmp91_ = g_strnfill ((gsize) _tmp90_, ' ');
				prestring = _tmp91_;
				first = TRUE;
				{
					ValaList* _p_list = NULL;
					ValaList* _tmp92_ = NULL;
					ValaList* _tmp93_ = NULL;
					gint _p_size = 0;
					ValaList* _tmp94_ = NULL;
					gint _tmp95_ = 0;
					gint _tmp96_ = 0;
					gint _p_index = 0;
					_tmp92_ = parameters;
					_tmp93_ = _vala_iterable_ref0 (_tmp92_);
					_p_list = _tmp93_;
					_tmp94_ = _p_list;
					_tmp95_ = vala_collection_get_size ((ValaCollection*) _tmp94_);
					_tmp96_ = _tmp95_;
					_p_size = _tmp96_;
					_p_index = -1;
					while (TRUE) {
						gint _tmp97_ = 0;
						gint _tmp98_ = 0;
						gint _tmp99_ = 0;
						ValaParameter* p = NULL;
						ValaList* _tmp100_ = NULL;
						gint _tmp101_ = 0;
						gpointer _tmp102_ = NULL;
						gboolean _tmp103_ = FALSE;
						ValaParameter* _tmp107_ = NULL;
						gboolean _tmp108_ = FALSE;
						gboolean _tmp109_ = FALSE;
						_tmp97_ = _p_index;
						_p_index = _tmp97_ + 1;
						_tmp98_ = _p_index;
						_tmp99_ = _p_size;
						if (!(_tmp98_ < _tmp99_)) {
							break;
						}
						_tmp100_ = _p_list;
						_tmp101_ = _p_index;
						_tmp102_ = vala_list_get (_tmp100_, _tmp101_);
						p = (ValaParameter*) _tmp102_;
						_tmp103_ = first;
						if (_tmp103_) {
							first = FALSE;
						} else {
							GString* _tmp104_ = NULL;
							GString* _tmp105_ = NULL;
							const gchar* _tmp106_ = NULL;
							_tmp104_ = calltip;
							g_string_append (_tmp104_, ",\n");
							_tmp105_ = calltip;
							_tmp106_ = prestring;
							g_string_append (_tmp105_, _tmp106_);
						}
						_tmp107_ = p;
						_tmp108_ = vala_parameter_get_ellipsis (_tmp107_);
						_tmp109_ = _tmp108_;
						if (_tmp109_) {
							GString* _tmp110_ = NULL;
							_tmp110_ = calltip;
							g_string_append (_tmp110_, "...");
						} else {
							GString* _tmp111_ = NULL;
							ValaParameter* _tmp112_ = NULL;
							ValaDataType* _tmp113_ = NULL;
							ValaDataType* _tmp114_ = NULL;
							gchar* _tmp115_ = NULL;
							gchar* _tmp116_ = NULL;
							GString* _tmp117_ = NULL;
							GString* _tmp118_ = NULL;
							ValaParameter* _tmp119_ = NULL;
							const gchar* _tmp120_ = NULL;
							const gchar* _tmp121_ = NULL;
							_tmp111_ = calltip;
							_tmp112_ = p;
							_tmp113_ = vala_variable_get_variable_type ((ValaVariable*) _tmp112_);
							_tmp114_ = _tmp113_;
							_tmp115_ = vala_data_type_to_qualified_string (_tmp114_, NULL);
							_tmp116_ = _tmp115_;
							g_string_append (_tmp111_, _tmp116_);
							_g_free0 (_tmp116_);
							_tmp117_ = calltip;
							_tmp118_ = g_string_append (_tmp117_, " ");
							_tmp119_ = p;
							_tmp120_ = vala_symbol_get_name ((ValaSymbol*) _tmp119_);
							_tmp121_ = _tmp120_;
							g_string_append (_tmp118_, _tmp121_);
						}
						_vala_code_node_unref0 (p);
					}
					_vala_iterable_unref0 (_p_list);
				}
				_tmp122_ = calltip;
				g_string_append (_tmp122_, ")");
				_tmp123_ = calltip;
				_tmp124_ = _tmp123_->str;
				_tmp125_ = g_strdup (_tmp124_);
				tips = g_list_append (tips, _tmp125_);
				_g_free0 (prestring);
				_vala_iterable_unref0 (parameters);
				_g_string_free0 (calltip);
				_vala_code_node_unref0 (sym);
			}
		}
	}
	_tmp127_ = editor;
	_tmp128_ = ianjuta_editor_get_position ((IAnjutaEditor*) _tmp127_, &_inner_error_);
	_tmp126_ = _tmp128_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		__g_list_free__vala_code_node_unref0_0 (syms);
		names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL);
		_g_match_info_free0 (match_info);
		__g_list_free__g_free0_0 (tips);
		_g_free0 (to_complete);
		_g_object_unref0 (line_start);
		_g_object_unref0 (current_position);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp129_ = editor;
	_tmp130_ = tips;
	ianjuta_editor_tip_show (_tmp129_, _tmp130_, _tmp126_, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (_tmp126_);
		__g_list_free__vala_code_node_unref0_0 (syms);
		names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL);
		_g_match_info_free0 (match_info);
		__g_list_free__g_free0_0 (tips);
		_g_free0 (to_complete);
		_g_object_unref0 (line_start);
		_g_object_unref0 (current_position);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_g_object_unref0 (_tmp126_);
	__g_list_free__vala_code_node_unref0_0 (syms);
	names = (_vala_array_free (names, names_length1, (GDestroyNotify) g_free), NULL);
	_g_match_info_free0 (match_info);
	__g_list_free__g_free0_0 (tips);
	_g_free0 (to_complete);
	_g_object_unref0 (line_start);
	_g_object_unref0 (current_position);
}


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* vala_provider_construct_member_access (ValaProvider* 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 vala_provider_class_init (ValaProviderClass * klass) {
	GError * _inner_error_ = NULL;
	vala_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ValaProviderPrivate));
	G_OBJECT_CLASS (klass)->finalize = vala_provider_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 __catch10_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 (vala_provider_member_access);
		vala_provider_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 __catch10_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 (vala_provider_member_access_split);
		vala_provider_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 __catch10_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 (vala_provider_function_call);
		vala_provider_function_call = _tmp8_;
		_g_regex_unref0 (_tmp6_);
		_g_regex_unref0 (_tmp3_);
		_g_regex_unref0 (_tmp0_);
	}
	goto __finally10;
	__catch10_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 ("provider.vala:37: Regular expressions failed to compile : %s", _tmp10_);
		_g_error_free0 (err);
	}
	__finally10:
	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 vala_provider_ianjuta_provider_interface_init (IAnjutaProviderIface * iface) {
	vala_provider_ianjuta_provider_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_name = (const gchar* (*)(IAnjutaProvider*, GError**)) vala_provider_real_get_name;
	iface->populate = (void (*)(IAnjutaProvider*, IAnjutaIterable*, GError**)) vala_provider_real_populate;
	iface->get_start_iter = (IAnjutaIterable* (*)(IAnjutaProvider*, GError**)) vala_provider_real_get_start_iter;
	iface->activate = (void (*)(IAnjutaProvider*, IAnjutaIterable*, void*, GError**)) vala_provider_real_activate;
}


static void vala_provider_instance_init (ValaProvider * self) {
	self->priv = VALA_PROVIDER_GET_PRIVATE (self);
}


static void vala_provider_finalize (GObject* obj) {
	ValaProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_VALA_PROVIDER, ValaProvider);
	_g_object_unref0 (self->priv->start_pos);
	G_OBJECT_CLASS (vala_provider_parent_class)->finalize (obj);
}


GType vala_provider_get_type (void) {
	return vala_provider_type_id;
}


GType vala_provider_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (ValaProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaProvider), 0, (GInstanceInitFunc) vala_provider_instance_init, NULL };
	static const GInterfaceInfo ianjuta_provider_info = { (GInterfaceInitFunc) vala_provider_ianjuta_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	vala_provider_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "ValaProvider", &g_define_type_info, 0);
	g_type_module_add_interface (module, vala_provider_type_id, ianjuta_provider_get_type (), &ianjuta_provider_info);
	return vala_provider_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;
}



