/* gcp-source-index.c generated by valac 0.19.0, the Vala compiler
 * generated from gcp-source-index.vala, do not modify */

/*
 * This file is part of gedit-code-assistant.
 *
 * Copyright (C) 2011 - Jesse van den Kieboom
 *
 * gedit-code-assistant 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.
 *
 * gedit-code-assistant 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 gedit-code-assistant.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <gee.h>


#define GCP_TYPE_SOURCE_INDEX (gcp_source_index_get_type ())
#define GCP_SOURCE_INDEX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_SOURCE_INDEX, GcpSourceIndex))
#define GCP_SOURCE_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_SOURCE_INDEX, GcpSourceIndexClass))
#define GCP_IS_SOURCE_INDEX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_SOURCE_INDEX))
#define GCP_IS_SOURCE_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_SOURCE_INDEX))
#define GCP_SOURCE_INDEX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_SOURCE_INDEX, GcpSourceIndexClass))

typedef struct _GcpSourceIndex GcpSourceIndex;
typedef struct _GcpSourceIndexClass GcpSourceIndexClass;
typedef struct _GcpSourceIndexPrivate GcpSourceIndexPrivate;

#define GCP_SOURCE_INDEX_TYPE_WRAPPER (gcp_source_index_wrapper_get_type ())
#define GCP_SOURCE_INDEX_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_SOURCE_INDEX_TYPE_WRAPPER, GcpSourceIndexWrapper))
#define GCP_SOURCE_INDEX_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_SOURCE_INDEX_TYPE_WRAPPER, GcpSourceIndexWrapperClass))
#define GCP_SOURCE_INDEX_IS_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_SOURCE_INDEX_TYPE_WRAPPER))
#define GCP_SOURCE_INDEX_IS_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_SOURCE_INDEX_TYPE_WRAPPER))
#define GCP_SOURCE_INDEX_WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_SOURCE_INDEX_TYPE_WRAPPER, GcpSourceIndexWrapperClass))

typedef struct _GcpSourceIndexWrapper GcpSourceIndexWrapper;
typedef struct _GcpSourceIndexWrapperClass GcpSourceIndexWrapperClass;

#define GCP_SOURCE_INDEX_TYPE_FIND_FLAGS (gcp_source_index_find_flags_get_type ())
#define _g_sequence_free0(var) ((var == NULL) ? NULL : (var = (g_sequence_free (var), NULL)))

#define GCP_TYPE_SOURCE_RANGE_SUPPORT (gcp_source_range_support_get_type ())
#define GCP_SOURCE_RANGE_SUPPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_SOURCE_RANGE_SUPPORT, GcpSourceRangeSupport))
#define GCP_IS_SOURCE_RANGE_SUPPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_SOURCE_RANGE_SUPPORT))
#define GCP_SOURCE_RANGE_SUPPORT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GCP_TYPE_SOURCE_RANGE_SUPPORT, GcpSourceRangeSupportIface))

typedef struct _GcpSourceRangeSupport GcpSourceRangeSupport;
typedef struct _GcpSourceRangeSupportIface GcpSourceRangeSupportIface;

#define GCP_TYPE_SOURCE_RANGE (gcp_source_range_get_type ())
#define GCP_SOURCE_RANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_SOURCE_RANGE, GcpSourceRange))
#define GCP_SOURCE_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_SOURCE_RANGE, GcpSourceRangeClass))
#define GCP_IS_SOURCE_RANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_SOURCE_RANGE))
#define GCP_IS_SOURCE_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_SOURCE_RANGE))
#define GCP_SOURCE_RANGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_SOURCE_RANGE, GcpSourceRangeClass))

typedef struct _GcpSourceRange GcpSourceRange;
typedef struct _GcpSourceRangeClass GcpSourceRangeClass;
typedef struct _GcpSourceIndexWrapperPrivate GcpSourceIndexWrapperPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GCP_TYPE_SOURCE_LOCATION (gcp_source_location_get_type ())
#define GCP_SOURCE_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_SOURCE_LOCATION, GcpSourceLocation))
#define GCP_SOURCE_LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_SOURCE_LOCATION, GcpSourceLocationClass))
#define GCP_IS_SOURCE_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_SOURCE_LOCATION))
#define GCP_IS_SOURCE_LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_SOURCE_LOCATION))
#define GCP_SOURCE_LOCATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_SOURCE_LOCATION, GcpSourceLocationClass))

typedef struct _GcpSourceLocation GcpSourceLocation;
typedef struct _GcpSourceLocationClass GcpSourceLocationClass;

#define GCP_SOURCE_INDEX_TYPE_ITERATOR (gcp_source_index_iterator_get_type ())
#define GCP_SOURCE_INDEX_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_SOURCE_INDEX_TYPE_ITERATOR, GcpSourceIndexIterator))
#define GCP_SOURCE_INDEX_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_SOURCE_INDEX_TYPE_ITERATOR, GcpSourceIndexIteratorClass))
#define GCP_SOURCE_INDEX_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_SOURCE_INDEX_TYPE_ITERATOR))
#define GCP_SOURCE_INDEX_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_SOURCE_INDEX_TYPE_ITERATOR))
#define GCP_SOURCE_INDEX_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_SOURCE_INDEX_TYPE_ITERATOR, GcpSourceIndexIteratorClass))

typedef struct _GcpSourceIndexIterator GcpSourceIndexIterator;
typedef struct _GcpSourceIndexIteratorClass GcpSourceIndexIteratorClass;
typedef struct _GcpSourceIndexIteratorPrivate GcpSourceIndexIteratorPrivate;

struct _GcpSourceIndex {
	GObject parent_instance;
	GcpSourceIndexPrivate * priv;
};

struct _GcpSourceIndexClass {
	GObjectClass parent_class;
};

struct _GcpSourceIndexPrivate {
	GSequence* d_index;
};

typedef enum  {
	GCP_SOURCE_INDEX_FIND_FLAGS_NONE = 0,
	GCP_SOURCE_INDEX_FIND_FLAGS_LINE_ONLY = 1 << 0,
	GCP_SOURCE_INDEX_FIND_FLAGS_INNER_MOST = 1 << 1
} GcpSourceIndexFindFlags;

struct _GcpSourceRangeSupportIface {
	GTypeInterface parent_iface;
	GcpSourceRange* (*get_range) (GcpSourceRangeSupport* self);
	GcpSourceRange** (*get_ranges) (GcpSourceRangeSupport* self, int* result_length1);
};

typedef void (*GcpSourceIndexWrapEachFunc) (GcpSourceIndexWrapper* wrapper, void* user_data);
struct _GcpSourceIndexWrapper {
	GObject parent_instance;
	GcpSourceIndexWrapperPrivate * priv;
	GcpSourceRangeSupport* obj;
	GcpSourceRange* range;
	gint idx;
	gboolean encapsulated;
};

struct _GcpSourceIndexWrapperClass {
	GObjectClass parent_class;
};

struct _GcpSourceIndexIterator {
	GObject parent_instance;
	GcpSourceIndexIteratorPrivate * priv;
};

struct _GcpSourceIndexIteratorClass {
	GObjectClass parent_class;
};

struct _GcpSourceIndexIteratorPrivate {
	GSequenceIter* d_iter;
	gboolean d_first;
};


static gpointer gcp_source_index_parent_class = NULL;
static gpointer gcp_source_index_wrapper_parent_class = NULL;
static gpointer gcp_source_index_iterator_parent_class = NULL;

GType gcp_source_index_get_type (void) G_GNUC_CONST;
GType gcp_source_index_wrapper_get_type (void) G_GNUC_CONST;
#define GCP_SOURCE_INDEX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCP_TYPE_SOURCE_INDEX, GcpSourceIndexPrivate))
enum  {
	GCP_SOURCE_INDEX_DUMMY_PROPERTY,
	GCP_SOURCE_INDEX_LENGTH
};
static GType gcp_source_index_find_flags_get_type (void) G_GNUC_UNUSED;
GType gcp_source_range_get_type (void) G_GNUC_CONST;
GType gcp_source_range_support_get_type (void) G_GNUC_CONST;
void gcp_source_index_add (GcpSourceIndex* self, GcpSourceRangeSupport* range);
static void gcp_source_index_wrap_each (GcpSourceIndex* self, GcpSourceRangeSupport* range, GcpSourceIndexWrapEachFunc func, void* func_target);
static void __lambda3_ (GcpSourceIndex* self, GcpSourceIndexWrapper* wrapper);
static gint gcp_source_index_compare_func (GcpSourceIndex* self, GcpSourceIndexWrapper* a, GcpSourceIndexWrapper* b);
static gint _gcp_source_index_compare_func_gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self);
gboolean gcp_source_range_contains_range (GcpSourceRange* self, GcpSourceRange* range);
static void ___lambda3__gcp_source_index_wrap_each_func (GcpSourceIndexWrapper* wrapper, gpointer self);
GObject* gcp_source_index_get (GcpSourceIndex* self, gint idx);
static GSequenceIter* gcp_source_index_find_iter (GcpSourceIndex* self, GcpSourceIndexWrapper* wrapper);
gint gcp_source_range_compare_to (GcpSourceRange* self, GcpSourceRange* other);
GcpSourceRange** gcp_source_range_support_get_ranges (GcpSourceRangeSupport* self, int* result_length1);
GcpSourceIndexWrapper* gcp_source_index_wrapper_new (GcpSourceRangeSupport* obj, GcpSourceRange* range, gint idx);
GcpSourceIndexWrapper* gcp_source_index_wrapper_construct (GType object_type, GcpSourceRangeSupport* obj, GcpSourceRange* range, gint idx);
void gcp_source_index_remove (GcpSourceIndex* self, GcpSourceRangeSupport* range);
static void __lambda4_ (GcpSourceIndex* self, GcpSourceIndexWrapper* wrapper);
static void ___lambda4__gcp_source_index_wrap_each_func (GcpSourceIndexWrapper* wrapper, gpointer self);
GObject** gcp_source_index_find_at_line (GcpSourceIndex* self, gint line, int* result_length1);
GType gcp_source_location_get_type (void) G_GNUC_CONST;
static GObject** gcp_source_index_find_at_priv (GcpSourceIndex* self, GcpSourceLocation* location, GcpSourceIndexFindFlags flags, int* result_length1);
GcpSourceLocation* gcp_source_location_new (GFile* file, gint line, gint column);
GcpSourceLocation* gcp_source_location_construct (GType object_type, GFile* file, gint line, gint column);
GObject** gcp_source_index_find_at (GcpSourceIndex* self, GcpSourceLocation* location, int* result_length1);
GObject* gcp_source_index_find_inner_at (GcpSourceIndex* self, GcpSourceLocation* location);
static gboolean gcp_source_index_find_at_condition (GcpSourceIndex* self, GcpSourceIndexWrapper* wrapper, GcpSourceLocation* location, GcpSourceIndexFindFlags flags);
gboolean gcp_source_range_contains_line (GcpSourceRange* self, gint line);
gint gcp_source_location_get_line (GcpSourceLocation* self);
gboolean gcp_source_range_contains_location (GcpSourceRange* self, GcpSourceLocation* location);
GcpSourceRange* gcp_source_range_support_get_range (GcpSourceRangeSupport* self);
void gcp_source_index_clear (GcpSourceIndex* self);
GType gcp_source_index_iterator_get_type (void) G_GNUC_CONST;
GcpSourceIndexIterator* gcp_source_index_iterator (GcpSourceIndex* self);
GcpSourceIndexIterator* gcp_source_index_iterator_new (GSequenceIter* iter);
GcpSourceIndexIterator* gcp_source_index_iterator_construct (GType object_type, GSequenceIter* iter);
GcpSourceIndex* gcp_source_index_new (void);
GcpSourceIndex* gcp_source_index_construct (GType object_type);
gint gcp_source_index_get_length (GcpSourceIndex* self);
static GObject * gcp_source_index_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _g_object_unref0_ (gpointer var);
enum  {
	GCP_SOURCE_INDEX_WRAPPER_DUMMY_PROPERTY
};
static void gcp_source_index_wrapper_finalize (GObject* obj);
#define GCP_SOURCE_INDEX_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCP_SOURCE_INDEX_TYPE_ITERATOR, GcpSourceIndexIteratorPrivate))
enum  {
	GCP_SOURCE_INDEX_ITERATOR_DUMMY_PROPERTY
};
gboolean gcp_source_index_iterator_next (GcpSourceIndexIterator* self);
GObject* gcp_source_index_iterator_get (GcpSourceIndexIterator* self);
static void gcp_source_index_iterator_finalize (GObject* obj);
static void gcp_source_index_finalize (GObject* obj);
static void _vala_gcp_source_index_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
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 GType gcp_source_index_find_flags_get_type (void) {
	static volatile gsize gcp_source_index_find_flags_type_id__volatile = 0;
	if (g_once_init_enter (&gcp_source_index_find_flags_type_id__volatile)) {
		static const GFlagsValue values[] = {{GCP_SOURCE_INDEX_FIND_FLAGS_NONE, "GCP_SOURCE_INDEX_FIND_FLAGS_NONE", "none"}, {GCP_SOURCE_INDEX_FIND_FLAGS_LINE_ONLY, "GCP_SOURCE_INDEX_FIND_FLAGS_LINE_ONLY", "line-only"}, {GCP_SOURCE_INDEX_FIND_FLAGS_INNER_MOST, "GCP_SOURCE_INDEX_FIND_FLAGS_INNER_MOST", "inner-most"}, {0, NULL, NULL}};
		GType gcp_source_index_find_flags_type_id;
		gcp_source_index_find_flags_type_id = g_flags_register_static ("GcpSourceIndexFindFlags", values);
		g_once_init_leave (&gcp_source_index_find_flags_type_id__volatile, gcp_source_index_find_flags_type_id);
	}
	return gcp_source_index_find_flags_type_id__volatile;
}


static gint _gcp_source_index_compare_func_gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self) {
	gint result;
	result = gcp_source_index_compare_func (self, a, b);
	return result;
}


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


static void __lambda3_ (GcpSourceIndex* self, GcpSourceIndexWrapper* wrapper) {
	GSequence* _tmp0_;
	GcpSourceIndexWrapper* _tmp1_;
	GSequenceIter* _tmp2_ = NULL;
	GSequenceIter* iter;
	GSequenceIter* _tmp3_;
	GSequenceIter* prev;
	GSequence* _tmp18_;
	GSequenceIter* _tmp19_;
	GcpSourceIndexWrapper* _tmp20_;
	GcpSourceIndexWrapper* _tmp21_;
	GSequenceIter* _tmp22_ = NULL;
	g_return_if_fail (wrapper != NULL);
	_tmp0_ = self->priv->d_index;
	_tmp1_ = wrapper;
	_tmp2_ = g_sequence_search (_tmp0_, _tmp1_, _gcp_source_index_compare_func_gcompare_data_func, self);
	iter = _tmp2_;
	_tmp3_ = iter;
	prev = _tmp3_;
	while (TRUE) {
		GSequenceIter* _tmp4_;
		gboolean _tmp5_ = FALSE;
		GSequenceIter* _tmp6_;
		GSequenceIter* _tmp7_ = NULL;
		GSequenceIter* _tmp8_;
		gconstpointer _tmp9_ = NULL;
		GcpSourceRange* _tmp10_;
		GcpSourceIndexWrapper* _tmp11_;
		GcpSourceRange* _tmp12_;
		gboolean _tmp13_ = FALSE;
		GSequenceIter* _tmp15_;
		gconstpointer _tmp16_ = NULL;
		gboolean _tmp17_;
		_tmp4_ = prev;
		_tmp5_ = g_sequence_iter_is_begin (_tmp4_);
		if (!(!_tmp5_)) {
			break;
		}
		_tmp6_ = prev;
		_tmp7_ = g_sequence_iter_prev (_tmp6_);
		prev = _tmp7_;
		_tmp8_ = prev;
		_tmp9_ = g_sequence_get (_tmp8_);
		_tmp10_ = ((GcpSourceIndexWrapper*) _tmp9_)->range;
		_tmp11_ = wrapper;
		_tmp12_ = _tmp11_->range;
		_tmp13_ = gcp_source_range_contains_range (_tmp10_, _tmp12_);
		if (_tmp13_) {
			GcpSourceIndexWrapper* _tmp14_;
			_tmp14_ = wrapper;
			_tmp14_->encapsulated = TRUE;
			break;
		}
		_tmp15_ = prev;
		_tmp16_ = g_sequence_get (_tmp15_);
		_tmp17_ = ((GcpSourceIndexWrapper*) _tmp16_)->encapsulated;
		if (!_tmp17_) {
			break;
		}
	}
	_tmp18_ = self->priv->d_index;
	_tmp19_ = iter;
	_tmp20_ = wrapper;
	_tmp21_ = _g_object_ref0 (_tmp20_);
	_tmp22_ = g_sequence_insert_before (_tmp19_, _tmp21_);
	while (TRUE) {
		gboolean _tmp23_ = FALSE;
		GSequenceIter* _tmp24_;
		gboolean _tmp25_ = FALSE;
		gboolean _tmp32_;
		GSequenceIter* _tmp33_;
		gconstpointer _tmp34_ = NULL;
		GSequenceIter* _tmp35_;
		GSequenceIter* _tmp36_ = NULL;
		_tmp24_ = iter;
		_tmp25_ = g_sequence_iter_is_end (_tmp24_);
		if (!_tmp25_) {
			GcpSourceIndexWrapper* _tmp26_;
			GcpSourceRange* _tmp27_;
			GSequenceIter* _tmp28_;
			gconstpointer _tmp29_ = NULL;
			GcpSourceRange* _tmp30_;
			gboolean _tmp31_ = FALSE;
			_tmp26_ = wrapper;
			_tmp27_ = _tmp26_->range;
			_tmp28_ = iter;
			_tmp29_ = g_sequence_get (_tmp28_);
			_tmp30_ = ((GcpSourceIndexWrapper*) _tmp29_)->range;
			_tmp31_ = gcp_source_range_contains_range (_tmp27_, _tmp30_);
			_tmp23_ = _tmp31_;
		} else {
			_tmp23_ = FALSE;
		}
		_tmp32_ = _tmp23_;
		if (!_tmp32_) {
			break;
		}
		_tmp33_ = iter;
		_tmp34_ = g_sequence_get (_tmp33_);
		((GcpSourceIndexWrapper*) _tmp34_)->encapsulated = TRUE;
		_tmp35_ = iter;
		_tmp36_ = g_sequence_iter_next (_tmp35_);
		iter = _tmp36_;
	}
}


static void ___lambda3__gcp_source_index_wrap_each_func (GcpSourceIndexWrapper* wrapper, gpointer self) {
	__lambda3_ (self, wrapper);
}


void gcp_source_index_add (GcpSourceIndex* self, GcpSourceRangeSupport* range) {
	GcpSourceRangeSupport* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (range != NULL);
	_tmp0_ = range;
	gcp_source_index_wrap_each (self, _tmp0_, ___lambda3__gcp_source_index_wrap_each_func, self);
}


GObject* gcp_source_index_get (GcpSourceIndex* self, gint idx) {
	GObject* result = NULL;
	GSequence* _tmp0_;
	gint _tmp1_;
	GSequenceIter* _tmp2_ = NULL;
	GSequenceIter* iter;
	GSequenceIter* _tmp3_;
	GSequenceIter* _tmp4_;
	gconstpointer _tmp5_ = NULL;
	GcpSourceRangeSupport* _tmp6_;
	GObject* _tmp7_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_index;
	_tmp1_ = idx;
	_tmp2_ = g_sequence_get_iter_at_pos (_tmp0_, _tmp1_);
	iter = _tmp2_;
	_tmp3_ = iter;
	if (_tmp3_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp4_ = iter;
	_tmp5_ = g_sequence_get (_tmp4_);
	_tmp6_ = ((GcpSourceIndexWrapper*) _tmp5_)->obj;
	_tmp7_ = _g_object_ref0 ((GObject*) _tmp6_);
	result = _tmp7_;
	return result;
}


static GSequenceIter* gcp_source_index_find_iter (GcpSourceIndex* self, GcpSourceIndexWrapper* wrapper) {
	GSequenceIter* result = NULL;
	GSequenceIter* iter = NULL;
	GSequence* _tmp0_;
	GcpSourceIndexWrapper* _tmp1_;
	GSequenceIter* _tmp2_ = NULL;
	GSequenceIter* _tmp3_;
	GSequenceIter* _tmp34_ = NULL;
	GSequenceIter* _tmp35_;
	gconstpointer _tmp36_ = NULL;
	GcpSourceRangeSupport* _tmp37_;
	GcpSourceIndexWrapper* _tmp38_;
	GcpSourceRangeSupport* _tmp39_;
	GSequenceIter* _tmp41_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (wrapper != NULL, NULL);
	_tmp0_ = self->priv->d_index;
	_tmp1_ = wrapper;
	_tmp2_ = g_sequence_search (_tmp0_, _tmp1_, _gcp_source_index_compare_func_gcompare_data_func, self);
	iter = _tmp2_;
	_tmp3_ = iter;
	if (_tmp3_ == NULL) {
		result = NULL;
		return result;
	}
	while (TRUE) {
		GSequenceIter* _tmp4_;
		gboolean _tmp5_ = FALSE;
		GSequenceIter* _tmp6_;
		GSequenceIter* _tmp7_ = NULL;
		GSequenceIter* prev;
		GSequenceIter* _tmp8_;
		gconstpointer _tmp9_ = NULL;
		GcpSourceRange* _tmp10_;
		GcpSourceIndexWrapper* _tmp11_;
		GcpSourceRange* _tmp12_;
		gint _tmp13_ = 0;
		GSequenceIter* _tmp14_;
		_tmp4_ = iter;
		_tmp5_ = g_sequence_iter_is_begin (_tmp4_);
		if (!(!_tmp5_)) {
			break;
		}
		_tmp6_ = iter;
		_tmp7_ = g_sequence_iter_prev (_tmp6_);
		prev = _tmp7_;
		_tmp8_ = prev;
		_tmp9_ = g_sequence_get (_tmp8_);
		_tmp10_ = ((GcpSourceIndexWrapper*) _tmp9_)->range;
		_tmp11_ = wrapper;
		_tmp12_ = _tmp11_->range;
		_tmp13_ = gcp_source_range_compare_to (_tmp10_, _tmp12_);
		if (_tmp13_ != 0) {
			break;
		}
		_tmp14_ = prev;
		iter = _tmp14_;
	}
	while (TRUE) {
		gboolean _tmp15_ = FALSE;
		gboolean _tmp16_ = FALSE;
		GSequenceIter* _tmp17_;
		gboolean _tmp18_ = FALSE;
		gboolean _tmp25_;
		gboolean _tmp31_;
		GSequenceIter* _tmp32_;
		GSequenceIter* _tmp33_ = NULL;
		_tmp17_ = iter;
		_tmp18_ = g_sequence_iter_is_end (_tmp17_);
		if (!_tmp18_) {
			GSequenceIter* _tmp19_;
			gconstpointer _tmp20_ = NULL;
			GcpSourceRange* _tmp21_;
			GcpSourceIndexWrapper* _tmp22_;
			GcpSourceRange* _tmp23_;
			gint _tmp24_ = 0;
			_tmp19_ = iter;
			_tmp20_ = g_sequence_get (_tmp19_);
			_tmp21_ = ((GcpSourceIndexWrapper*) _tmp20_)->range;
			_tmp22_ = wrapper;
			_tmp23_ = _tmp22_->range;
			_tmp24_ = gcp_source_range_compare_to (_tmp21_, _tmp23_);
			_tmp16_ = _tmp24_ == 0;
		} else {
			_tmp16_ = FALSE;
		}
		_tmp25_ = _tmp16_;
		if (_tmp25_) {
			GSequenceIter* _tmp26_;
			gconstpointer _tmp27_ = NULL;
			GcpSourceRangeSupport* _tmp28_;
			GcpSourceIndexWrapper* _tmp29_;
			GcpSourceRangeSupport* _tmp30_;
			_tmp26_ = iter;
			_tmp27_ = g_sequence_get (_tmp26_);
			_tmp28_ = ((GcpSourceIndexWrapper*) _tmp27_)->obj;
			_tmp29_ = wrapper;
			_tmp30_ = _tmp29_->obj;
			_tmp15_ = _tmp28_ != _tmp30_;
		} else {
			_tmp15_ = FALSE;
		}
		_tmp31_ = _tmp15_;
		if (!_tmp31_) {
			break;
		}
		_tmp32_ = iter;
		_tmp33_ = g_sequence_iter_next (_tmp32_);
		iter = _tmp33_;
	}
	_tmp35_ = iter;
	_tmp36_ = g_sequence_get (_tmp35_);
	_tmp37_ = ((GcpSourceIndexWrapper*) _tmp36_)->obj;
	_tmp38_ = wrapper;
	_tmp39_ = _tmp38_->obj;
	if (_tmp37_ == _tmp39_) {
		GSequenceIter* _tmp40_;
		_tmp40_ = iter;
		_tmp34_ = _tmp40_;
	} else {
		_tmp34_ = NULL;
	}
	_tmp41_ = _tmp34_;
	result = _tmp41_;
	return result;
}


static void gcp_source_index_wrap_each (GcpSourceIndex* self, GcpSourceRangeSupport* range, GcpSourceIndexWrapEachFunc func, void* func_target) {
	GcpSourceRangeSupport* _tmp0_;
	GcpSourceRange** _tmp1_;
	gint _tmp1__length1;
	GcpSourceRange** _tmp2_;
	gint _tmp2__length1;
	GcpSourceRange** ranges;
	gint ranges_length1;
	gint _ranges_size_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (range != NULL);
	_tmp0_ = range;
	_tmp1_ = gcp_source_range_support_get_ranges (_tmp0_, &_tmp1__length1);
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	ranges = _tmp2_;
	ranges_length1 = _tmp2__length1;
	_ranges_size_ = ranges_length1;
	{
		gint i;
		i = 0;
		{
			gboolean _tmp3_;
			_tmp3_ = TRUE;
			while (TRUE) {
				gboolean _tmp4_;
				gint _tmp6_;
				GcpSourceRange** _tmp7_;
				gint _tmp7__length1;
				GcpSourceIndexWrapEachFunc _tmp8_;
				void* _tmp8__target;
				GcpSourceRangeSupport* _tmp9_;
				GcpSourceRange** _tmp10_;
				gint _tmp10__length1;
				gint _tmp11_;
				GcpSourceRange* _tmp12_;
				gint _tmp13_;
				GcpSourceIndexWrapper* _tmp14_;
				GcpSourceIndexWrapper* _tmp15_;
				_tmp4_ = _tmp3_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp6_ = i;
				_tmp7_ = ranges;
				_tmp7__length1 = ranges_length1;
				if (!(_tmp6_ < _tmp7__length1)) {
					break;
				}
				_tmp8_ = func;
				_tmp8__target = func_target;
				_tmp9_ = range;
				_tmp10_ = ranges;
				_tmp10__length1 = ranges_length1;
				_tmp11_ = i;
				_tmp12_ = _tmp10_[_tmp11_];
				_tmp13_ = i;
				_tmp14_ = gcp_source_index_wrapper_new (_tmp9_, _tmp12_, _tmp13_);
				_tmp15_ = _tmp14_;
				_tmp8_ (_tmp15_, _tmp8__target);
				_g_object_unref0 (_tmp15_);
			}
		}
	}
	ranges = (_vala_array_free (ranges, ranges_length1, (GDestroyNotify) g_object_unref), NULL);
}


static void __lambda4_ (GcpSourceIndex* self, GcpSourceIndexWrapper* wrapper) {
	GSequenceIter* iter = NULL;
	GcpSourceIndexWrapper* _tmp0_;
	GSequenceIter* _tmp1_ = NULL;
	GSequenceIter* _tmp2_;
	g_return_if_fail (wrapper != NULL);
	_tmp0_ = wrapper;
	_tmp1_ = gcp_source_index_find_iter (self, _tmp0_);
	iter = _tmp1_;
	_tmp2_ = iter;
	if (_tmp2_ != NULL) {
		GSequence* _tmp3_;
		GSequenceIter* _tmp4_;
		_tmp3_ = self->priv->d_index;
		_tmp4_ = iter;
		g_sequence_remove (_tmp4_);
	}
}


static void ___lambda4__gcp_source_index_wrap_each_func (GcpSourceIndexWrapper* wrapper, gpointer self) {
	__lambda4_ (self, wrapper);
}


void gcp_source_index_remove (GcpSourceIndex* self, GcpSourceRangeSupport* range) {
	GcpSourceRangeSupport* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (range != NULL);
	_tmp0_ = range;
	gcp_source_index_wrap_each (self, _tmp0_, ___lambda4__gcp_source_index_wrap_each_func, self);
}


GObject** gcp_source_index_find_at_line (GcpSourceIndex* self, gint line, int* result_length1) {
	GObject** result = NULL;
	gint _tmp0_;
	GcpSourceLocation* _tmp1_;
	GcpSourceLocation* _tmp2_;
	gint _tmp3_ = 0;
	GObject** _tmp4_ = NULL;
	GObject** _tmp5_;
	gint _tmp5__length1;
	GObject** _tmp6_;
	gint _tmp6__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = line;
	_tmp1_ = gcp_source_location_new (NULL, _tmp0_, 0);
	_tmp2_ = _tmp1_;
	_tmp4_ = gcp_source_index_find_at_priv (self, _tmp2_, GCP_SOURCE_INDEX_FIND_FLAGS_LINE_ONLY, &_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp5__length1 = _tmp3_;
	_g_object_unref0 (_tmp2_);
	_tmp6_ = _tmp5_;
	_tmp6__length1 = _tmp5__length1;
	if (result_length1) {
		*result_length1 = _tmp6__length1;
	}
	result = _tmp6_;
	return result;
}


GObject** gcp_source_index_find_at (GcpSourceIndex* self, GcpSourceLocation* location, int* result_length1) {
	GObject** result = NULL;
	GcpSourceLocation* _tmp0_;
	gint _tmp1_ = 0;
	GObject** _tmp2_ = NULL;
	GObject** _tmp3_;
	gint _tmp3__length1;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (location != NULL, NULL);
	_tmp0_ = location;
	_tmp2_ = gcp_source_index_find_at_priv (self, _tmp0_, GCP_SOURCE_INDEX_FIND_FLAGS_NONE, &_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp1_;
	if (result_length1) {
		*result_length1 = _tmp3__length1;
	}
	result = _tmp3_;
	return result;
}


GObject* gcp_source_index_find_inner_at (GcpSourceIndex* self, GcpSourceLocation* location) {
	GObject* result = NULL;
	GcpSourceLocation* _tmp0_;
	gint _tmp1_ = 0;
	GObject** _tmp2_ = NULL;
	GObject** ret;
	gint ret_length1;
	gint _ret_size_;
	GObject** _tmp3_;
	gint _tmp3__length1;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (location != NULL, NULL);
	_tmp0_ = location;
	_tmp2_ = gcp_source_index_find_at_priv (self, _tmp0_, GCP_SOURCE_INDEX_FIND_FLAGS_INNER_MOST, &_tmp1_);
	ret = _tmp2_;
	ret_length1 = _tmp1_;
	_ret_size_ = ret_length1;
	_tmp3_ = ret;
	_tmp3__length1 = ret_length1;
	if (_tmp3__length1 == 0) {
		result = NULL;
		ret = (_vala_array_free (ret, ret_length1, (GDestroyNotify) g_object_unref), NULL);
		return result;
	} else {
		GObject** _tmp4_;
		gint _tmp4__length1;
		GObject* _tmp5_;
		_tmp4_ = ret;
		_tmp4__length1 = ret_length1;
		_tmp5_ = _tmp4_[0];
		_tmp4_[0] = NULL;
		result = _tmp5_;
		ret = (_vala_array_free (ret, ret_length1, (GDestroyNotify) g_object_unref), NULL);
		return result;
	}
	ret = (_vala_array_free (ret, ret_length1, (GDestroyNotify) g_object_unref), NULL);
}


static gboolean gcp_source_index_find_at_condition (GcpSourceIndex* self, GcpSourceIndexWrapper* wrapper, GcpSourceLocation* location, GcpSourceIndexFindFlags flags) {
	gboolean result = FALSE;
	GcpSourceIndexFindFlags _tmp0_;
	gboolean lineonly;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_;
	gboolean _tmp10_;
	gboolean _tmp18_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (wrapper != NULL, FALSE);
	g_return_val_if_fail (location != NULL, FALSE);
	_tmp0_ = flags;
	lineonly = (_tmp0_ & GCP_SOURCE_INDEX_FIND_FLAGS_LINE_ONLY) != 0;
	_tmp3_ = lineonly;
	if (_tmp3_) {
		GcpSourceIndexWrapper* _tmp4_;
		GcpSourceRange* _tmp5_;
		GcpSourceLocation* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gboolean _tmp9_ = FALSE;
		_tmp4_ = wrapper;
		_tmp5_ = _tmp4_->range;
		_tmp6_ = location;
		_tmp7_ = gcp_source_location_get_line (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = gcp_source_range_contains_line (_tmp5_, _tmp8_);
		_tmp2_ = _tmp9_;
	} else {
		_tmp2_ = FALSE;
	}
	_tmp10_ = _tmp2_;
	if (_tmp10_) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp11_ = FALSE;
		gboolean _tmp12_;
		gboolean _tmp17_;
		_tmp12_ = lineonly;
		if (!_tmp12_) {
			GcpSourceIndexWrapper* _tmp13_;
			GcpSourceRange* _tmp14_;
			GcpSourceLocation* _tmp15_;
			gboolean _tmp16_ = FALSE;
			_tmp13_ = wrapper;
			_tmp14_ = _tmp13_->range;
			_tmp15_ = location;
			_tmp16_ = gcp_source_range_contains_location (_tmp14_, _tmp15_);
			_tmp11_ = _tmp16_;
		} else {
			_tmp11_ = FALSE;
		}
		_tmp17_ = _tmp11_;
		_tmp1_ = _tmp17_;
	}
	_tmp18_ = _tmp1_;
	result = _tmp18_;
	return result;
}


static GObject** gcp_source_index_find_at_priv (GcpSourceIndex* self, GcpSourceLocation* location, GcpSourceIndexFindFlags flags, int* result_length1) {
	GObject** result = NULL;
	GeeLinkedList* _tmp0_;
	GeeLinkedList* ret;
	GSequenceIter* iter = NULL;
	GHashFunc _tmp1_;
	GEqualFunc _tmp2_;
	GeeHashMap* _tmp3_;
	GeeHashMap* uniq;
	GSequence* _tmp4_;
	GcpSourceLocation* _tmp5_;
	GcpSourceLocation* _tmp6_;
	GcpSourceRange* _tmp7_;
	GcpSourceRange* _tmp8_;
	GcpSourceRange* _tmp9_;
	GcpSourceIndexWrapper* _tmp10_;
	GcpSourceIndexWrapper* _tmp11_;
	GSequenceIter* _tmp12_ = NULL;
	GcpSourceIndexFindFlags _tmp13_;
	GSequenceIter* _tmp34_;
	gboolean _tmp35_ = FALSE;
	GeeLinkedList* _tmp104_;
	gint _tmp105_ = 0;
	gpointer* _tmp106_ = NULL;
	GObject** _tmp107_;
	gint _tmp107__length1;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (location != NULL, NULL);
	_tmp0_ = gee_linked_list_new (G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
	ret = _tmp0_;
	_tmp1_ = g_direct_hash;
	_tmp2_ = g_direct_equal;
	_tmp3_ = gee_hash_map_new (G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, g_object_unref, G_TYPE_BOOLEAN, NULL, NULL, _tmp1_, _tmp2_, NULL);
	uniq = _tmp3_;
	_tmp4_ = self->priv->d_index;
	_tmp5_ = location;
	_tmp6_ = location;
	_tmp7_ = gcp_source_range_support_get_range ((GcpSourceRangeSupport*) _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_;
	_tmp10_ = gcp_source_index_wrapper_new ((GcpSourceRangeSupport*) _tmp5_, _tmp9_, 0);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_sequence_search (_tmp4_, _tmp11_, _gcp_source_index_compare_func_gcompare_data_func, self);
	iter = _tmp12_;
	_g_object_unref0 (_tmp11_);
	_g_object_unref0 (_tmp9_);
	_tmp13_ = flags;
	if ((_tmp13_ & GCP_SOURCE_INDEX_FIND_FLAGS_INNER_MOST) != 0) {
		GObject** _tmp32_ = NULL;
		GObject** _tmp33_;
		gint _tmp33__length1;
		while (TRUE) {
			GSequenceIter* _tmp14_;
			gboolean _tmp15_ = FALSE;
			GSequenceIter* _tmp16_;
			GSequenceIter* _tmp17_ = NULL;
			GSequenceIter* _tmp18_;
			gconstpointer _tmp19_ = NULL;
			GcpSourceLocation* _tmp20_;
			GcpSourceIndexFindFlags _tmp21_;
			gboolean _tmp22_ = FALSE;
			_tmp14_ = iter;
			_tmp15_ = g_sequence_iter_is_begin (_tmp14_);
			if (!(!_tmp15_)) {
				break;
			}
			_tmp16_ = iter;
			_tmp17_ = g_sequence_iter_prev (_tmp16_);
			iter = _tmp17_;
			_tmp18_ = iter;
			_tmp19_ = g_sequence_get (_tmp18_);
			_tmp20_ = location;
			_tmp21_ = flags;
			_tmp22_ = gcp_source_index_find_at_condition (self, (GcpSourceIndexWrapper*) _tmp19_, _tmp20_, _tmp21_);
			if (_tmp22_) {
				GSequenceIter* _tmp23_;
				gconstpointer _tmp24_ = NULL;
				GcpSourceRangeSupport* _tmp25_;
				GObject* _tmp26_;
				GObject** _tmp27_ = NULL;
				GObject** _tmp28_;
				gint _tmp28__length1;
				_tmp23_ = iter;
				_tmp24_ = g_sequence_get (_tmp23_);
				_tmp25_ = ((GcpSourceIndexWrapper*) _tmp24_)->obj;
				_tmp26_ = _g_object_ref0 ((GObject*) _tmp25_);
				_tmp27_ = g_new0 (GObject*, 1 + 1);
				_tmp27_[0] = _tmp26_;
				_tmp28_ = _tmp27_;
				_tmp28__length1 = 1;
				if (result_length1) {
					*result_length1 = _tmp28__length1;
				}
				result = _tmp28_;
				_g_object_unref0 (uniq);
				_g_object_unref0 (ret);
				return result;
			} else {
				GSequenceIter* _tmp29_;
				gconstpointer _tmp30_ = NULL;
				gboolean _tmp31_;
				_tmp29_ = iter;
				_tmp30_ = g_sequence_get (_tmp29_);
				_tmp31_ = ((GcpSourceIndexWrapper*) _tmp30_)->encapsulated;
				if (!_tmp31_) {
					break;
				}
			}
		}
		_tmp32_ = g_new0 (GObject*, 0 + 1);
		_tmp33_ = _tmp32_;
		_tmp33__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp33__length1;
		}
		result = _tmp33_;
		_g_object_unref0 (uniq);
		_g_object_unref0 (ret);
		return result;
	}
	_tmp34_ = iter;
	_tmp35_ = g_sequence_iter_is_begin (_tmp34_);
	if (!_tmp35_) {
		GSequenceIter* _tmp36_;
		GSequenceIter* _tmp37_ = NULL;
		GSequenceIter* prev;
		_tmp36_ = iter;
		_tmp37_ = g_sequence_iter_prev (_tmp36_);
		prev = _tmp37_;
		while (TRUE) {
			gboolean _tmp38_ = FALSE;
			GSequenceIter* _tmp39_;
			gconstpointer _tmp40_ = NULL;
			GcpSourceLocation* _tmp41_;
			GcpSourceIndexFindFlags _tmp42_;
			gboolean _tmp43_ = FALSE;
			gboolean _tmp47_;
			GSequenceIter* _tmp48_;
			gconstpointer _tmp49_ = NULL;
			GcpSourceRangeSupport* _tmp50_;
			GObject* _tmp51_;
			GObject* val;
			gboolean _tmp52_ = FALSE;
			GSequenceIter* _tmp53_;
			gconstpointer _tmp54_ = NULL;
			GcpSourceLocation* _tmp55_;
			GcpSourceIndexFindFlags _tmp56_;
			gboolean _tmp57_ = FALSE;
			gboolean _tmp61_;
			GSequenceIter* _tmp66_;
			gboolean _tmp67_ = FALSE;
			GSequenceIter* _tmp68_;
			GSequenceIter* _tmp69_ = NULL;
			_tmp39_ = prev;
			_tmp40_ = g_sequence_get (_tmp39_);
			_tmp41_ = location;
			_tmp42_ = flags;
			_tmp43_ = gcp_source_index_find_at_condition (self, (GcpSourceIndexWrapper*) _tmp40_, _tmp41_, _tmp42_);
			if (_tmp43_) {
				_tmp38_ = TRUE;
			} else {
				GSequenceIter* _tmp44_;
				gconstpointer _tmp45_ = NULL;
				gboolean _tmp46_;
				_tmp44_ = prev;
				_tmp45_ = g_sequence_get (_tmp44_);
				_tmp46_ = ((GcpSourceIndexWrapper*) _tmp45_)->encapsulated;
				_tmp38_ = _tmp46_;
			}
			_tmp47_ = _tmp38_;
			if (!_tmp47_) {
				break;
			}
			_tmp48_ = prev;
			_tmp49_ = g_sequence_get (_tmp48_);
			_tmp50_ = ((GcpSourceIndexWrapper*) _tmp49_)->obj;
			_tmp51_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp50_, G_TYPE_OBJECT, GObject));
			val = _tmp51_;
			_tmp53_ = prev;
			_tmp54_ = g_sequence_get (_tmp53_);
			_tmp55_ = location;
			_tmp56_ = flags;
			_tmp57_ = gcp_source_index_find_at_condition (self, (GcpSourceIndexWrapper*) _tmp54_, _tmp55_, _tmp56_);
			if (_tmp57_) {
				GeeHashMap* _tmp58_;
				GObject* _tmp59_;
				gboolean _tmp60_ = FALSE;
				_tmp58_ = uniq;
				_tmp59_ = val;
				_tmp60_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp58_, _tmp59_);
				_tmp52_ = !_tmp60_;
			} else {
				_tmp52_ = FALSE;
			}
			_tmp61_ = _tmp52_;
			if (_tmp61_) {
				GeeLinkedList* _tmp62_;
				GObject* _tmp63_;
				GeeHashMap* _tmp64_;
				GObject* _tmp65_;
				_tmp62_ = ret;
				_tmp63_ = val;
				gee_abstract_list_insert ((GeeAbstractList*) _tmp62_, 0, _tmp63_);
				_tmp64_ = uniq;
				_tmp65_ = val;
				gee_abstract_map_set ((GeeAbstractMap*) _tmp64_, _tmp65_, (gpointer) ((gintptr) TRUE));
			}
			_tmp66_ = prev;
			_tmp67_ = g_sequence_iter_is_begin (_tmp66_);
			if (_tmp67_) {
				_g_object_unref0 (val);
				break;
			}
			_tmp68_ = prev;
			_tmp69_ = g_sequence_iter_prev (_tmp68_);
			prev = _tmp69_;
			_g_object_unref0 (val);
		}
	}
	while (TRUE) {
		gboolean _tmp70_ = FALSE;
		GSequenceIter* _tmp71_;
		gboolean _tmp72_ = FALSE;
		gboolean _tmp83_;
		GSequenceIter* _tmp84_;
		gconstpointer _tmp85_ = NULL;
		GcpSourceRangeSupport* _tmp86_;
		GObject* _tmp87_;
		GObject* val;
		gboolean _tmp88_ = FALSE;
		GSequenceIter* _tmp89_;
		gconstpointer _tmp90_ = NULL;
		GcpSourceLocation* _tmp91_;
		GcpSourceIndexFindFlags _tmp92_;
		gboolean _tmp93_ = FALSE;
		gboolean _tmp97_;
		GSequenceIter* _tmp102_;
		GSequenceIter* _tmp103_ = NULL;
		_tmp71_ = iter;
		_tmp72_ = g_sequence_iter_is_end (_tmp71_);
		if (!_tmp72_) {
			gboolean _tmp73_ = FALSE;
			GSequenceIter* _tmp74_;
			gconstpointer _tmp75_ = NULL;
			GcpSourceLocation* _tmp76_;
			GcpSourceIndexFindFlags _tmp77_;
			gboolean _tmp78_ = FALSE;
			gboolean _tmp82_;
			_tmp74_ = iter;
			_tmp75_ = g_sequence_get (_tmp74_);
			_tmp76_ = location;
			_tmp77_ = flags;
			_tmp78_ = gcp_source_index_find_at_condition (self, (GcpSourceIndexWrapper*) _tmp75_, _tmp76_, _tmp77_);
			if (_tmp78_) {
				_tmp73_ = TRUE;
			} else {
				GSequenceIter* _tmp79_;
				gconstpointer _tmp80_ = NULL;
				gboolean _tmp81_;
				_tmp79_ = iter;
				_tmp80_ = g_sequence_get (_tmp79_);
				_tmp81_ = ((GcpSourceIndexWrapper*) _tmp80_)->encapsulated;
				_tmp73_ = _tmp81_;
			}
			_tmp82_ = _tmp73_;
			_tmp70_ = _tmp82_;
		} else {
			_tmp70_ = FALSE;
		}
		_tmp83_ = _tmp70_;
		if (!_tmp83_) {
			break;
		}
		_tmp84_ = iter;
		_tmp85_ = g_sequence_get (_tmp84_);
		_tmp86_ = ((GcpSourceIndexWrapper*) _tmp85_)->obj;
		_tmp87_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp86_, G_TYPE_OBJECT, GObject));
		val = _tmp87_;
		_tmp89_ = iter;
		_tmp90_ = g_sequence_get (_tmp89_);
		_tmp91_ = location;
		_tmp92_ = flags;
		_tmp93_ = gcp_source_index_find_at_condition (self, (GcpSourceIndexWrapper*) _tmp90_, _tmp91_, _tmp92_);
		if (_tmp93_) {
			GeeHashMap* _tmp94_;
			GObject* _tmp95_;
			gboolean _tmp96_ = FALSE;
			_tmp94_ = uniq;
			_tmp95_ = val;
			_tmp96_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp94_, _tmp95_);
			_tmp88_ = !_tmp96_;
		} else {
			_tmp88_ = FALSE;
		}
		_tmp97_ = _tmp88_;
		if (_tmp97_) {
			GeeLinkedList* _tmp98_;
			GObject* _tmp99_;
			GeeHashMap* _tmp100_;
			GObject* _tmp101_;
			_tmp98_ = ret;
			_tmp99_ = val;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp98_, _tmp99_);
			_tmp100_ = uniq;
			_tmp101_ = val;
			gee_abstract_map_set ((GeeAbstractMap*) _tmp100_, _tmp101_, (gpointer) ((gintptr) TRUE));
		}
		_tmp102_ = iter;
		_tmp103_ = g_sequence_iter_next (_tmp102_);
		iter = _tmp103_;
		_g_object_unref0 (val);
	}
	_tmp104_ = ret;
	_tmp106_ = gee_abstract_collection_to_array ((GeeAbstractCollection*) _tmp104_, &_tmp105_);
	_tmp107_ = _tmp106_;
	_tmp107__length1 = _tmp105_;
	if (result_length1) {
		*result_length1 = _tmp107__length1;
	}
	result = _tmp107_;
	_g_object_unref0 (uniq);
	_g_object_unref0 (ret);
	return result;
}


void gcp_source_index_clear (GcpSourceIndex* self) {
	GSequence* _tmp0_;
	GSequence* _tmp1_;
	GSequenceIter* _tmp2_ = NULL;
	GSequence* _tmp3_;
	GSequenceIter* _tmp4_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_index;
	_tmp1_ = self->priv->d_index;
	_tmp2_ = g_sequence_get_begin_iter (_tmp1_);
	_tmp3_ = self->priv->d_index;
	_tmp4_ = g_sequence_get_end_iter (_tmp3_);
	g_sequence_remove_range (_tmp2_, _tmp4_);
}


static gint gcp_source_index_compare_func (GcpSourceIndex* self, GcpSourceIndexWrapper* a, GcpSourceIndexWrapper* b) {
	gint result = 0;
	GcpSourceIndexWrapper* _tmp0_;
	GcpSourceRange* _tmp1_;
	GcpSourceRange* _tmp2_;
	GcpSourceRange* ra;
	GcpSourceIndexWrapper* _tmp3_;
	GcpSourceRange* _tmp4_;
	GcpSourceRange* _tmp5_;
	GcpSourceRange* rb;
	gint _tmp6_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	_tmp0_ = a;
	_tmp1_ = _tmp0_->range;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	ra = _tmp2_;
	_tmp3_ = b;
	_tmp4_ = _tmp3_->range;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	rb = _tmp5_;
	_tmp6_ = gcp_source_range_compare_to (ra, rb);
	result = _tmp6_;
	_g_object_unref0 (rb);
	_g_object_unref0 (ra);
	return result;
}


GcpSourceIndexIterator* gcp_source_index_iterator (GcpSourceIndex* self) {
	GcpSourceIndexIterator* result = NULL;
	GSequence* _tmp0_;
	GSequenceIter* _tmp1_ = NULL;
	GcpSourceIndexIterator* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_index;
	_tmp1_ = g_sequence_get_begin_iter (_tmp0_);
	_tmp2_ = gcp_source_index_iterator_new (_tmp1_);
	result = _tmp2_;
	return result;
}


GcpSourceIndex* gcp_source_index_construct (GType object_type) {
	GcpSourceIndex * self = NULL;
	self = (GcpSourceIndex*) g_object_new (object_type, NULL);
	return self;
}


GcpSourceIndex* gcp_source_index_new (void) {
	return gcp_source_index_construct (GCP_TYPE_SOURCE_INDEX);
}


gint gcp_source_index_get_length (GcpSourceIndex* self) {
	gint result;
	GSequence* _tmp0_;
	gint _tmp1_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->d_index;
	_tmp1_ = g_sequence_get_length (_tmp0_);
	result = _tmp1_;
	return result;
}


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static GObject * gcp_source_index_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	GcpSourceIndex * self;
	GSequence* _tmp0_;
	parent_class = G_OBJECT_CLASS (gcp_source_index_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCP_TYPE_SOURCE_INDEX, GcpSourceIndex);
	_tmp0_ = g_sequence_new (_g_object_unref0_);
	_g_sequence_free0 (self->priv->d_index);
	self->priv->d_index = _tmp0_;
	return obj;
}


GcpSourceIndexWrapper* gcp_source_index_wrapper_construct (GType object_type, GcpSourceRangeSupport* obj, GcpSourceRange* range, gint idx) {
	GcpSourceIndexWrapper * self = NULL;
	GcpSourceRangeSupport* _tmp0_;
	GcpSourceRangeSupport* _tmp1_;
	GcpSourceRange* _tmp2_;
	GcpSourceRange* _tmp3_;
	gint _tmp4_;
	g_return_val_if_fail (obj != NULL, NULL);
	g_return_val_if_fail (range != NULL, NULL);
	self = (GcpSourceIndexWrapper*) g_object_new (object_type, NULL);
	_tmp0_ = obj;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->obj);
	self->obj = _tmp1_;
	_tmp2_ = range;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->range);
	self->range = _tmp3_;
	_tmp4_ = idx;
	self->idx = _tmp4_;
	self->encapsulated = FALSE;
	return self;
}


GcpSourceIndexWrapper* gcp_source_index_wrapper_new (GcpSourceRangeSupport* obj, GcpSourceRange* range, gint idx) {
	return gcp_source_index_wrapper_construct (GCP_SOURCE_INDEX_TYPE_WRAPPER, obj, range, idx);
}


static void gcp_source_index_wrapper_class_init (GcpSourceIndexWrapperClass * klass) {
	gcp_source_index_wrapper_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = gcp_source_index_wrapper_finalize;
}


static void gcp_source_index_wrapper_instance_init (GcpSourceIndexWrapper * self) {
}


static void gcp_source_index_wrapper_finalize (GObject* obj) {
	GcpSourceIndexWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCP_SOURCE_INDEX_TYPE_WRAPPER, GcpSourceIndexWrapper);
	_g_object_unref0 (self->obj);
	_g_object_unref0 (self->range);
	G_OBJECT_CLASS (gcp_source_index_wrapper_parent_class)->finalize (obj);
}


GType gcp_source_index_wrapper_get_type (void) {
	static volatile gsize gcp_source_index_wrapper_type_id__volatile = 0;
	if (g_once_init_enter (&gcp_source_index_wrapper_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcpSourceIndexWrapperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gcp_source_index_wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcpSourceIndexWrapper), 0, (GInstanceInitFunc) gcp_source_index_wrapper_instance_init, NULL };
		GType gcp_source_index_wrapper_type_id;
		gcp_source_index_wrapper_type_id = g_type_register_static (G_TYPE_OBJECT, "GcpSourceIndexWrapper", &g_define_type_info, 0);
		g_once_init_leave (&gcp_source_index_wrapper_type_id__volatile, gcp_source_index_wrapper_type_id);
	}
	return gcp_source_index_wrapper_type_id__volatile;
}


GcpSourceIndexIterator* gcp_source_index_iterator_construct (GType object_type, GSequenceIter* iter) {
	GcpSourceIndexIterator * self = NULL;
	GSequenceIter* _tmp0_;
	g_return_val_if_fail (iter != NULL, NULL);
	self = (GcpSourceIndexIterator*) g_object_new (object_type, NULL);
	_tmp0_ = iter;
	self->priv->d_iter = _tmp0_;
	self->priv->d_first = TRUE;
	return self;
}


GcpSourceIndexIterator* gcp_source_index_iterator_new (GSequenceIter* iter) {
	return gcp_source_index_iterator_construct (GCP_SOURCE_INDEX_TYPE_ITERATOR, iter);
}


gboolean gcp_source_index_iterator_next (GcpSourceIndexIterator* self) {
	gboolean result = FALSE;
	gboolean _tmp0_;
	GSequenceIter* _tmp5_;
	gboolean _tmp6_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->d_first;
	if (_tmp0_) {
		self->priv->d_first = FALSE;
	} else {
		GSequenceIter* _tmp1_;
		gboolean _tmp2_ = FALSE;
		_tmp1_ = self->priv->d_iter;
		_tmp2_ = g_sequence_iter_is_end (_tmp1_);
		if (!_tmp2_) {
			GSequenceIter* _tmp3_;
			GSequenceIter* _tmp4_ = NULL;
			_tmp3_ = self->priv->d_iter;
			_tmp4_ = g_sequence_iter_next (_tmp3_);
			self->priv->d_iter = _tmp4_;
		}
	}
	_tmp5_ = self->priv->d_iter;
	_tmp6_ = g_sequence_iter_is_end (_tmp5_);
	result = !_tmp6_;
	return result;
}


GObject* gcp_source_index_iterator_get (GcpSourceIndexIterator* self) {
	GObject* result = NULL;
	GSequenceIter* _tmp0_;
	gconstpointer _tmp1_ = NULL;
	GcpSourceRangeSupport* _tmp2_;
	GObject* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_iter;
	_tmp1_ = g_sequence_get (_tmp0_);
	_tmp2_ = ((GcpSourceIndexWrapper*) _tmp1_)->obj;
	_tmp3_ = _g_object_ref0 ((GObject*) _tmp2_);
	result = _tmp3_;
	return result;
}


static void gcp_source_index_iterator_class_init (GcpSourceIndexIteratorClass * klass) {
	gcp_source_index_iterator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcpSourceIndexIteratorPrivate));
	G_OBJECT_CLASS (klass)->finalize = gcp_source_index_iterator_finalize;
}


static void gcp_source_index_iterator_instance_init (GcpSourceIndexIterator * self) {
	self->priv = GCP_SOURCE_INDEX_ITERATOR_GET_PRIVATE (self);
}


static void gcp_source_index_iterator_finalize (GObject* obj) {
	GcpSourceIndexIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCP_SOURCE_INDEX_TYPE_ITERATOR, GcpSourceIndexIterator);
	G_OBJECT_CLASS (gcp_source_index_iterator_parent_class)->finalize (obj);
}


GType gcp_source_index_iterator_get_type (void) {
	static volatile gsize gcp_source_index_iterator_type_id__volatile = 0;
	if (g_once_init_enter (&gcp_source_index_iterator_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcpSourceIndexIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gcp_source_index_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcpSourceIndexIterator), 0, (GInstanceInitFunc) gcp_source_index_iterator_instance_init, NULL };
		GType gcp_source_index_iterator_type_id;
		gcp_source_index_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GcpSourceIndexIterator", &g_define_type_info, 0);
		g_once_init_leave (&gcp_source_index_iterator_type_id__volatile, gcp_source_index_iterator_type_id);
	}
	return gcp_source_index_iterator_type_id__volatile;
}


static void gcp_source_index_class_init (GcpSourceIndexClass * klass) {
	gcp_source_index_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcpSourceIndexPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gcp_source_index_get_property;
	G_OBJECT_CLASS (klass)->constructor = gcp_source_index_constructor;
	G_OBJECT_CLASS (klass)->finalize = gcp_source_index_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCP_SOURCE_INDEX_LENGTH, g_param_spec_int ("length", "length", "length", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void gcp_source_index_instance_init (GcpSourceIndex * self) {
	self->priv = GCP_SOURCE_INDEX_GET_PRIVATE (self);
}


static void gcp_source_index_finalize (GObject* obj) {
	GcpSourceIndex * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCP_TYPE_SOURCE_INDEX, GcpSourceIndex);
	_g_sequence_free0 (self->priv->d_index);
	G_OBJECT_CLASS (gcp_source_index_parent_class)->finalize (obj);
}


GType gcp_source_index_get_type (void) {
	static volatile gsize gcp_source_index_type_id__volatile = 0;
	if (g_once_init_enter (&gcp_source_index_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcpSourceIndexClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gcp_source_index_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcpSourceIndex), 0, (GInstanceInitFunc) gcp_source_index_instance_init, NULL };
		GType gcp_source_index_type_id;
		gcp_source_index_type_id = g_type_register_static (G_TYPE_OBJECT, "GcpSourceIndex", &g_define_type_info, 0);
		g_once_init_leave (&gcp_source_index_type_id__volatile, gcp_source_index_type_id);
	}
	return gcp_source_index_type_id__volatile;
}


static void _vala_gcp_source_index_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GcpSourceIndex * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCP_TYPE_SOURCE_INDEX, GcpSourceIndex);
	switch (property_id) {
		case GCP_SOURCE_INDEX_LENGTH:
		g_value_set_int (value, gcp_source_index_get_length (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


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



