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

/*
 * Copyright (C) 2008 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/>.
 */
/* Finds the innermost block containing the given location */

#include <glib.h>
#include <glib-object.h>
#include <vala.h>
#include <string.h>


#define TYPE_BLOCK_LOCATOR (block_locator_get_type ())
#define BLOCK_LOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BLOCK_LOCATOR, BlockLocator))
#define BLOCK_LOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BLOCK_LOCATOR, BlockLocatorClass))
#define IS_BLOCK_LOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BLOCK_LOCATOR))
#define IS_BLOCK_LOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BLOCK_LOCATOR))
#define BLOCK_LOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BLOCK_LOCATOR, BlockLocatorClass))

typedef struct _BlockLocator BlockLocator;
typedef struct _BlockLocatorClass BlockLocatorClass;
typedef struct _BlockLocatorPrivate BlockLocatorPrivate;

#define BLOCK_LOCATOR_TYPE_LOCATION (block_locator_location_get_type ())
typedef struct _BlockLocatorLocation BlockLocatorLocation;
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))

struct _BlockLocator {
	ValaCodeVisitor parent_instance;
	BlockLocatorPrivate * priv;
};

struct _BlockLocatorClass {
	ValaCodeVisitorClass parent_class;
};

struct _BlockLocatorLocation {
	gint line;
	gint column;
};

struct _BlockLocatorPrivate {
	BlockLocatorLocation location;
	ValaSymbol* innermost;
	BlockLocatorLocation innermost_begin;
	BlockLocatorLocation innermost_end;
};


static gpointer block_locator_parent_class = NULL;
static GType block_locator_type_id = 0;

GType block_locator_get_type (void) G_GNUC_CONST;
static GType block_locator_location_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
static BlockLocatorLocation* block_locator_location_dup (const BlockLocatorLocation* self);
static void block_locator_location_free (BlockLocatorLocation* self);
#define BLOCK_LOCATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_BLOCK_LOCATOR, BlockLocatorPrivate))
ValaSymbol* block_locator_locate (BlockLocator* self, ValaSourceFile* file, gint line, gint column);
static void block_locator_location_init (BlockLocatorLocation *self, gint line, gint column);
static gboolean block_locator_update_location (BlockLocator* self, ValaSymbol* s);
static gboolean block_locator_location_inside (BlockLocatorLocation *self, ValaSourceReference* src);
static gboolean block_locator_location_before (BlockLocatorLocation *self, BlockLocatorLocation* other);
static void block_locator_real_visit_block (ValaCodeVisitor* base, ValaBlock* b);
static void block_locator_real_visit_namespace (ValaCodeVisitor* base, ValaNamespace* ns);
static void block_locator_real_visit_class (ValaCodeVisitor* base, ValaClass* cl);
static void block_locator_real_visit_struct (ValaCodeVisitor* base, ValaStruct* st);
static void block_locator_real_visit_interface (ValaCodeVisitor* base, ValaInterface* iface);
static void block_locator_real_visit_method (ValaCodeVisitor* base, ValaMethod* m);
static void block_locator_real_visit_creation_method (ValaCodeVisitor* base, ValaCreationMethod* m);
static void block_locator_real_visit_property (ValaCodeVisitor* base, ValaProperty* prop);
static void block_locator_real_visit_property_accessor (ValaCodeVisitor* base, ValaPropertyAccessor* acc);
static void block_locator_real_visit_constructor (ValaCodeVisitor* base, ValaConstructor* c);
static void block_locator_real_visit_destructor (ValaCodeVisitor* base, ValaDestructor* d);
static void block_locator_real_visit_if_statement (ValaCodeVisitor* base, ValaIfStatement* stmt);
static void block_locator_real_visit_switch_statement (ValaCodeVisitor* base, ValaSwitchStatement* stmt);
static void block_locator_real_visit_switch_section (ValaCodeVisitor* base, ValaSwitchSection* section);
static void block_locator_real_visit_while_statement (ValaCodeVisitor* base, ValaWhileStatement* stmt);
static void block_locator_real_visit_do_statement (ValaCodeVisitor* base, ValaDoStatement* stmt);
static void block_locator_real_visit_for_statement (ValaCodeVisitor* base, ValaForStatement* stmt);
static void block_locator_real_visit_foreach_statement (ValaCodeVisitor* base, ValaForeachStatement* stmt);
static void block_locator_real_visit_try_statement (ValaCodeVisitor* base, ValaTryStatement* stmt);
static void block_locator_real_visit_catch_clause (ValaCodeVisitor* base, ValaCatchClause* clause);
static void block_locator_real_visit_lock_statement (ValaCodeVisitor* base, ValaLockStatement* stmt);
static void block_locator_real_visit_lambda_expression (ValaCodeVisitor* base, ValaLambdaExpression* expr);
static void block_locator_real_visit_expression_statement (ValaCodeVisitor* base, ValaExpressionStatement* stmt);
static void block_locator_real_visit_method_call (ValaCodeVisitor* base, ValaMethodCall* mc);
static void block_locator_real_visit_signal (ValaCodeVisitor* base, ValaSignal* sig);
BlockLocator* block_locator_new (void);
BlockLocator* block_locator_construct (GType object_type);
static void block_locator_finalize (ValaCodeVisitor * obj);


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


ValaSymbol* block_locator_locate (BlockLocator* self, ValaSourceFile* file, gint line, gint column) {
	ValaSymbol* result = NULL;
	gint _tmp0_;
	gint _tmp1_;
	ValaSourceFile* _tmp2_;
	ValaSymbol* _tmp3_;
	ValaSymbol* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (file != NULL, NULL);
	_tmp0_ = line;
	_tmp1_ = column;
	block_locator_location_init (&self->priv->location, _tmp0_, _tmp1_);
	_vala_code_node_unref0 (self->priv->innermost);
	self->priv->innermost = NULL;
	_tmp2_ = file;
	vala_source_file_accept_children (_tmp2_, (ValaCodeVisitor*) self);
	_tmp3_ = self->priv->innermost;
	_tmp4_ = _vala_code_node_ref0 (_tmp3_);
	result = _tmp4_;
	return result;
}


static gboolean block_locator_update_location (BlockLocator* self, ValaSymbol* s) {
	gboolean result = FALSE;
	ValaSymbol* _tmp0_;
	ValaSourceReference* _tmp1_;
	ValaSourceReference* _tmp2_;
	gboolean _tmp3_;
	BlockLocatorLocation begin = {0};
	ValaSymbol* _tmp4_;
	ValaSourceReference* _tmp5_;
	ValaSourceReference* _tmp6_;
	ValaSourceLocation _tmp7_ = {0};
	ValaSourceLocation _tmp8_;
	gint _tmp9_;
	ValaSymbol* _tmp10_;
	ValaSourceReference* _tmp11_;
	ValaSourceReference* _tmp12_;
	ValaSourceLocation _tmp13_ = {0};
	ValaSourceLocation _tmp14_;
	gint _tmp15_;
	BlockLocatorLocation end = {0};
	ValaSymbol* _tmp16_;
	ValaSourceReference* _tmp17_;
	ValaSourceReference* _tmp18_;
	ValaSourceLocation _tmp19_ = {0};
	ValaSourceLocation _tmp20_;
	gint _tmp21_;
	ValaSymbol* _tmp22_;
	ValaSourceReference* _tmp23_;
	ValaSourceReference* _tmp24_;
	ValaSourceLocation _tmp25_ = {0};
	ValaSourceLocation _tmp26_;
	gint _tmp27_;
	gboolean _tmp28_ = FALSE;
	ValaSymbol* _tmp29_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (s != NULL, FALSE);
	_tmp0_ = s;
	_tmp1_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = block_locator_location_inside (&self->priv->location, _tmp2_);
	if (!_tmp3_) {
		result = FALSE;
		return result;
	}
	_tmp4_ = s;
	_tmp5_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp4_);
	_tmp6_ = _tmp5_;
	vala_source_reference_get_begin (_tmp6_, &_tmp7_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_.line;
	_tmp10_ = s;
	_tmp11_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp10_);
	_tmp12_ = _tmp11_;
	vala_source_reference_get_begin (_tmp12_, &_tmp13_);
	_tmp14_ = _tmp13_;
	_tmp15_ = _tmp14_.column;
	block_locator_location_init (&begin, _tmp9_, _tmp15_);
	_tmp16_ = s;
	_tmp17_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp16_);
	_tmp18_ = _tmp17_;
	vala_source_reference_get_end (_tmp18_, &_tmp19_);
	_tmp20_ = _tmp19_;
	_tmp21_ = _tmp20_.line;
	_tmp22_ = s;
	_tmp23_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp22_);
	_tmp24_ = _tmp23_;
	vala_source_reference_get_end (_tmp24_, &_tmp25_);
	_tmp26_ = _tmp25_;
	_tmp27_ = _tmp26_.column;
	block_locator_location_init (&end, _tmp21_, _tmp27_);
	_tmp29_ = self->priv->innermost;
	if (_tmp29_ == NULL) {
		_tmp28_ = TRUE;
	} else {
		gboolean _tmp30_ = FALSE;
		BlockLocatorLocation _tmp31_;
		gboolean _tmp32_;
		_tmp31_ = begin;
		_tmp32_ = block_locator_location_before (&self->priv->innermost_begin, &_tmp31_);
		if (_tmp32_) {
			BlockLocatorLocation _tmp33_;
			gboolean _tmp34_;
			_tmp33_ = self->priv->innermost_end;
			_tmp34_ = block_locator_location_before (&end, &_tmp33_);
			_tmp30_ = _tmp34_;
		} else {
			_tmp30_ = FALSE;
		}
		_tmp28_ = _tmp30_;
	}
	if (_tmp28_) {
		ValaSymbol* _tmp35_;
		ValaSymbol* _tmp36_;
		BlockLocatorLocation _tmp37_;
		BlockLocatorLocation _tmp38_;
		_tmp35_ = s;
		_tmp36_ = _vala_code_node_ref0 (_tmp35_);
		_vala_code_node_unref0 (self->priv->innermost);
		self->priv->innermost = _tmp36_;
		_tmp37_ = begin;
		self->priv->innermost_begin = _tmp37_;
		_tmp38_ = end;
		self->priv->innermost_end = _tmp38_;
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}


static void block_locator_real_visit_block (ValaCodeVisitor* base, ValaBlock* b) {
	BlockLocator * self;
	ValaBlock* _tmp0_;
	gboolean _tmp1_;
	self = (BlockLocator*) base;
	g_return_if_fail (b != NULL);
	_tmp0_ = b;
	_tmp1_ = block_locator_update_location (self, (ValaSymbol*) _tmp0_);
	if (_tmp1_) {
		ValaBlock* _tmp2_;
		_tmp2_ = b;
		vala_code_node_accept_children ((ValaCodeNode*) _tmp2_, (ValaCodeVisitor*) self);
	}
}


static void block_locator_real_visit_namespace (ValaCodeVisitor* base, ValaNamespace* ns) {
	BlockLocator * self;
	ValaNamespace* _tmp0_;
	ValaNamespace* _tmp1_;
	self = (BlockLocator*) base;
	g_return_if_fail (ns != NULL);
	_tmp0_ = ns;
	block_locator_update_location (self, (ValaSymbol*) _tmp0_);
	_tmp1_ = ns;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp1_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_class (ValaCodeVisitor* base, ValaClass* cl) {
	BlockLocator * self;
	ValaClass* _tmp0_;
	gboolean _tmp1_;
	ValaClass* _tmp2_;
	self = (BlockLocator*) base;
	g_return_if_fail (cl != NULL);
	_tmp0_ = cl;
	_tmp1_ = block_locator_update_location (self, (ValaSymbol*) _tmp0_);
	if (_tmp1_) {
		return;
	}
	_tmp2_ = cl;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp2_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_struct (ValaCodeVisitor* base, ValaStruct* st) {
	BlockLocator * self;
	ValaStruct* _tmp0_;
	gboolean _tmp1_;
	ValaStruct* _tmp2_;
	self = (BlockLocator*) base;
	g_return_if_fail (st != NULL);
	_tmp0_ = st;
	_tmp1_ = block_locator_update_location (self, (ValaSymbol*) _tmp0_);
	if (_tmp1_) {
		return;
	}
	_tmp2_ = st;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp2_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_interface (ValaCodeVisitor* base, ValaInterface* iface) {
	BlockLocator * self;
	ValaInterface* _tmp0_;
	gboolean _tmp1_;
	ValaInterface* _tmp2_;
	self = (BlockLocator*) base;
	g_return_if_fail (iface != NULL);
	_tmp0_ = iface;
	_tmp1_ = block_locator_update_location (self, (ValaSymbol*) _tmp0_);
	if (_tmp1_) {
		return;
	}
	_tmp2_ = iface;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp2_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_method (ValaCodeVisitor* base, ValaMethod* m) {
	BlockLocator * self;
	ValaMethod* _tmp0_;
	gboolean _tmp1_;
	ValaMethod* _tmp2_;
	self = (BlockLocator*) base;
	g_return_if_fail (m != NULL);
	_tmp0_ = m;
	_tmp1_ = block_locator_update_location (self, (ValaSymbol*) _tmp0_);
	if (_tmp1_) {
		return;
	}
	_tmp2_ = m;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp2_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_creation_method (ValaCodeVisitor* base, ValaCreationMethod* m) {
	BlockLocator * self;
	ValaCreationMethod* _tmp0_;
	gboolean _tmp1_;
	ValaCreationMethod* _tmp2_;
	self = (BlockLocator*) base;
	g_return_if_fail (m != NULL);
	_tmp0_ = m;
	_tmp1_ = block_locator_update_location (self, (ValaSymbol*) _tmp0_);
	if (_tmp1_) {
		return;
	}
	_tmp2_ = m;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp2_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_property (ValaCodeVisitor* base, ValaProperty* prop) {
	BlockLocator * self;
	ValaProperty* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (prop != NULL);
	_tmp0_ = prop;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_property_accessor (ValaCodeVisitor* base, ValaPropertyAccessor* acc) {
	BlockLocator * self;
	ValaPropertyAccessor* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (acc != NULL);
	_tmp0_ = acc;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_constructor (ValaCodeVisitor* base, ValaConstructor* c) {
	BlockLocator * self;
	ValaConstructor* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (c != NULL);
	_tmp0_ = c;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_destructor (ValaCodeVisitor* base, ValaDestructor* d) {
	BlockLocator * self;
	ValaDestructor* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (d != NULL);
	_tmp0_ = d;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_if_statement (ValaCodeVisitor* base, ValaIfStatement* stmt) {
	BlockLocator * self;
	ValaIfStatement* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (stmt != NULL);
	_tmp0_ = stmt;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_switch_statement (ValaCodeVisitor* base, ValaSwitchStatement* stmt) {
	BlockLocator * self;
	ValaSwitchStatement* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (stmt != NULL);
	_tmp0_ = stmt;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_switch_section (ValaCodeVisitor* base, ValaSwitchSection* section) {
	BlockLocator * self;
	ValaSwitchSection* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (section != NULL);
	_tmp0_ = section;
	vala_code_visitor_visit_block ((ValaCodeVisitor*) self, (ValaBlock*) _tmp0_);
}


static void block_locator_real_visit_while_statement (ValaCodeVisitor* base, ValaWhileStatement* stmt) {
	BlockLocator * self;
	ValaWhileStatement* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (stmt != NULL);
	_tmp0_ = stmt;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_do_statement (ValaCodeVisitor* base, ValaDoStatement* stmt) {
	BlockLocator * self;
	ValaDoStatement* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (stmt != NULL);
	_tmp0_ = stmt;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_for_statement (ValaCodeVisitor* base, ValaForStatement* stmt) {
	BlockLocator * self;
	ValaForStatement* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (stmt != NULL);
	_tmp0_ = stmt;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_foreach_statement (ValaCodeVisitor* base, ValaForeachStatement* stmt) {
	BlockLocator * self;
	ValaForeachStatement* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (stmt != NULL);
	_tmp0_ = stmt;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_try_statement (ValaCodeVisitor* base, ValaTryStatement* stmt) {
	BlockLocator * self;
	ValaTryStatement* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (stmt != NULL);
	_tmp0_ = stmt;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_catch_clause (ValaCodeVisitor* base, ValaCatchClause* clause) {
	BlockLocator * self;
	ValaCatchClause* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (clause != NULL);
	_tmp0_ = clause;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_lock_statement (ValaCodeVisitor* base, ValaLockStatement* stmt) {
	BlockLocator * self;
	ValaLockStatement* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (stmt != NULL);
	_tmp0_ = stmt;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_lambda_expression (ValaCodeVisitor* base, ValaLambdaExpression* expr) {
	BlockLocator * self;
	ValaLambdaExpression* _tmp0_;
	ValaBlock* _tmp1_;
	ValaBlock* _tmp2_;
	self = (BlockLocator*) base;
	g_return_if_fail (expr != NULL);
	_tmp0_ = expr;
	_tmp1_ = vala_lambda_expression_get_statement_body (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		ValaLambdaExpression* _tmp3_;
		ValaBlock* _tmp4_;
		ValaBlock* _tmp5_;
		gboolean _tmp6_;
		_tmp3_ = expr;
		_tmp4_ = vala_lambda_expression_get_statement_body (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = block_locator_update_location (self, (ValaSymbol*) _tmp5_);
		if (_tmp6_) {
			ValaLambdaExpression* _tmp7_;
			ValaBlock* _tmp8_;
			ValaBlock* _tmp9_;
			_tmp7_ = expr;
			_tmp8_ = vala_lambda_expression_get_statement_body (_tmp7_);
			_tmp9_ = _tmp8_;
			vala_code_node_accept_children ((ValaCodeNode*) _tmp9_, (ValaCodeVisitor*) self);
		}
	} else {
		ValaLambdaExpression* _tmp10_;
		_tmp10_ = expr;
		vala_code_node_accept_children ((ValaCodeNode*) _tmp10_, (ValaCodeVisitor*) self);
	}
}


static void block_locator_real_visit_expression_statement (ValaCodeVisitor* base, ValaExpressionStatement* stmt) {
	BlockLocator * self;
	ValaExpressionStatement* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (stmt != NULL);
	_tmp0_ = stmt;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_method_call (ValaCodeVisitor* base, ValaMethodCall* mc) {
	BlockLocator * self;
	ValaMethodCall* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (mc != NULL);
	_tmp0_ = mc;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void block_locator_real_visit_signal (ValaCodeVisitor* base, ValaSignal* sig) {
	BlockLocator * self;
	ValaSignal* _tmp0_;
	self = (BlockLocator*) base;
	g_return_if_fail (sig != NULL);
	_tmp0_ = sig;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


BlockLocator* block_locator_construct (GType object_type) {
	BlockLocator* self = NULL;
	self = (BlockLocator*) vala_code_visitor_construct (object_type);
	return self;
}


BlockLocator* block_locator_new (void) {
	return block_locator_construct (TYPE_BLOCK_LOCATOR);
}


static void block_locator_location_init (BlockLocatorLocation *self, gint line, gint column) {
	gint _tmp0_;
	gint _tmp1_;
	memset (self, 0, sizeof (BlockLocatorLocation));
	_tmp0_ = line;
	(*self).line = _tmp0_;
	_tmp1_ = column;
	(*self).column = _tmp1_;
}


static gboolean block_locator_location_inside (BlockLocatorLocation *self, ValaSourceReference* src) {
	gboolean result = FALSE;
	BlockLocatorLocation begin = {0};
	ValaSourceReference* _tmp0_;
	ValaSourceLocation _tmp1_ = {0};
	ValaSourceLocation _tmp2_;
	gint _tmp3_;
	ValaSourceReference* _tmp4_;
	ValaSourceLocation _tmp5_ = {0};
	ValaSourceLocation _tmp6_;
	gint _tmp7_;
	BlockLocatorLocation end = {0};
	ValaSourceReference* _tmp8_;
	ValaSourceLocation _tmp9_ = {0};
	ValaSourceLocation _tmp10_;
	gint _tmp11_;
	ValaSourceReference* _tmp12_;
	ValaSourceLocation _tmp13_ = {0};
	ValaSourceLocation _tmp14_;
	gint _tmp15_;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_;
	g_return_val_if_fail (src != NULL, FALSE);
	_tmp0_ = src;
	vala_source_reference_get_begin (_tmp0_, &_tmp1_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_.line;
	_tmp4_ = src;
	vala_source_reference_get_begin (_tmp4_, &_tmp5_);
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_.column;
	block_locator_location_init (&begin, _tmp3_, _tmp7_);
	_tmp8_ = src;
	vala_source_reference_get_end (_tmp8_, &_tmp9_);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_.line;
	_tmp12_ = src;
	vala_source_reference_get_end (_tmp12_, &_tmp13_);
	_tmp14_ = _tmp13_;
	_tmp15_ = _tmp14_.column;
	block_locator_location_init (&end, _tmp11_, _tmp15_);
	_tmp17_ = block_locator_location_before (&begin, &(*self));
	if (_tmp17_) {
		BlockLocatorLocation _tmp18_;
		gboolean _tmp19_;
		_tmp18_ = end;
		_tmp19_ = block_locator_location_before (&(*self), &_tmp18_);
		_tmp16_ = _tmp19_;
	} else {
		_tmp16_ = FALSE;
	}
	result = _tmp16_;
	return result;
}


static gboolean block_locator_location_before (BlockLocatorLocation *self, BlockLocatorLocation* other) {
	gboolean result = FALSE;
	gint _tmp0_;
	BlockLocatorLocation _tmp1_;
	gint _tmp2_;
	gboolean _tmp3_ = FALSE;
	gint _tmp4_;
	BlockLocatorLocation _tmp5_;
	gint _tmp6_;
	g_return_val_if_fail (other != NULL, FALSE);
	_tmp0_ = (*self).line;
	_tmp1_ = *other;
	_tmp2_ = _tmp1_.line;
	if (_tmp0_ > _tmp2_) {
		result = FALSE;
		return result;
	}
	_tmp4_ = (*self).line;
	_tmp5_ = *other;
	_tmp6_ = _tmp5_.line;
	if (_tmp4_ == _tmp6_) {
		gint _tmp7_;
		BlockLocatorLocation _tmp8_;
		gint _tmp9_;
		_tmp7_ = (*self).column;
		_tmp8_ = *other;
		_tmp9_ = _tmp8_.column;
		_tmp3_ = _tmp7_ > _tmp9_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		result = FALSE;
		return result;
	}
	result = TRUE;
	return result;
}


static BlockLocatorLocation* block_locator_location_dup (const BlockLocatorLocation* self) {
	BlockLocatorLocation* dup;
	dup = g_new0 (BlockLocatorLocation, 1);
	memcpy (dup, self, sizeof (BlockLocatorLocation));
	return dup;
}


static void block_locator_location_free (BlockLocatorLocation* self) {
	g_free (self);
}


static GType block_locator_location_get_type (void) {
	static volatile gsize block_locator_location_type_id__volatile = 0;
	if (g_once_init_enter (&block_locator_location_type_id__volatile)) {
		GType block_locator_location_type_id;
		block_locator_location_type_id = g_boxed_type_register_static ("BlockLocatorLocation", (GBoxedCopyFunc) block_locator_location_dup, (GBoxedFreeFunc) block_locator_location_free);
		g_once_init_leave (&block_locator_location_type_id__volatile, block_locator_location_type_id);
	}
	return block_locator_location_type_id__volatile;
}


static void block_locator_class_init (BlockLocatorClass * klass) {
	block_locator_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeVisitorClass *) klass)->finalize = block_locator_finalize;
	g_type_class_add_private (klass, sizeof (BlockLocatorPrivate));
	((ValaCodeVisitorClass *) klass)->visit_block = (void (*) (ValaCodeVisitor *, ValaBlock*)) block_locator_real_visit_block;
	((ValaCodeVisitorClass *) klass)->visit_namespace = (void (*) (ValaCodeVisitor *, ValaNamespace*)) block_locator_real_visit_namespace;
	((ValaCodeVisitorClass *) klass)->visit_class = (void (*) (ValaCodeVisitor *, ValaClass*)) block_locator_real_visit_class;
	((ValaCodeVisitorClass *) klass)->visit_struct = (void (*) (ValaCodeVisitor *, ValaStruct*)) block_locator_real_visit_struct;
	((ValaCodeVisitorClass *) klass)->visit_interface = (void (*) (ValaCodeVisitor *, ValaInterface*)) block_locator_real_visit_interface;
	((ValaCodeVisitorClass *) klass)->visit_method = (void (*) (ValaCodeVisitor *, ValaMethod*)) block_locator_real_visit_method;
	((ValaCodeVisitorClass *) klass)->visit_creation_method = (void (*) (ValaCodeVisitor *, ValaCreationMethod*)) block_locator_real_visit_creation_method;
	((ValaCodeVisitorClass *) klass)->visit_property = (void (*) (ValaCodeVisitor *, ValaProperty*)) block_locator_real_visit_property;
	((ValaCodeVisitorClass *) klass)->visit_property_accessor = (void (*) (ValaCodeVisitor *, ValaPropertyAccessor*)) block_locator_real_visit_property_accessor;
	((ValaCodeVisitorClass *) klass)->visit_constructor = (void (*) (ValaCodeVisitor *, ValaConstructor*)) block_locator_real_visit_constructor;
	((ValaCodeVisitorClass *) klass)->visit_destructor = (void (*) (ValaCodeVisitor *, ValaDestructor*)) block_locator_real_visit_destructor;
	((ValaCodeVisitorClass *) klass)->visit_if_statement = (void (*) (ValaCodeVisitor *, ValaIfStatement*)) block_locator_real_visit_if_statement;
	((ValaCodeVisitorClass *) klass)->visit_switch_statement = (void (*) (ValaCodeVisitor *, ValaSwitchStatement*)) block_locator_real_visit_switch_statement;
	((ValaCodeVisitorClass *) klass)->visit_switch_section = (void (*) (ValaCodeVisitor *, ValaSwitchSection*)) block_locator_real_visit_switch_section;
	((ValaCodeVisitorClass *) klass)->visit_while_statement = (void (*) (ValaCodeVisitor *, ValaWhileStatement*)) block_locator_real_visit_while_statement;
	((ValaCodeVisitorClass *) klass)->visit_do_statement = (void (*) (ValaCodeVisitor *, ValaDoStatement*)) block_locator_real_visit_do_statement;
	((ValaCodeVisitorClass *) klass)->visit_for_statement = (void (*) (ValaCodeVisitor *, ValaForStatement*)) block_locator_real_visit_for_statement;
	((ValaCodeVisitorClass *) klass)->visit_foreach_statement = (void (*) (ValaCodeVisitor *, ValaForeachStatement*)) block_locator_real_visit_foreach_statement;
	((ValaCodeVisitorClass *) klass)->visit_try_statement = (void (*) (ValaCodeVisitor *, ValaTryStatement*)) block_locator_real_visit_try_statement;
	((ValaCodeVisitorClass *) klass)->visit_catch_clause = (void (*) (ValaCodeVisitor *, ValaCatchClause*)) block_locator_real_visit_catch_clause;
	((ValaCodeVisitorClass *) klass)->visit_lock_statement = (void (*) (ValaCodeVisitor *, ValaLockStatement*)) block_locator_real_visit_lock_statement;
	((ValaCodeVisitorClass *) klass)->visit_lambda_expression = (void (*) (ValaCodeVisitor *, ValaLambdaExpression*)) block_locator_real_visit_lambda_expression;
	((ValaCodeVisitorClass *) klass)->visit_expression_statement = (void (*) (ValaCodeVisitor *, ValaExpressionStatement*)) block_locator_real_visit_expression_statement;
	((ValaCodeVisitorClass *) klass)->visit_method_call = (void (*) (ValaCodeVisitor *, ValaMethodCall*)) block_locator_real_visit_method_call;
	((ValaCodeVisitorClass *) klass)->visit_signal = (void (*) (ValaCodeVisitor *, ValaSignal*)) block_locator_real_visit_signal;
}


static void block_locator_instance_init (BlockLocator * self) {
	self->priv = BLOCK_LOCATOR_GET_PRIVATE (self);
}


static void block_locator_finalize (ValaCodeVisitor * obj) {
	BlockLocator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BLOCK_LOCATOR, BlockLocator);
	_vala_code_node_unref0 (self->priv->innermost);
	VALA_CODE_VISITOR_CLASS (block_locator_parent_class)->finalize (obj);
}


GType block_locator_get_type (void) {
	return block_locator_type_id;
}


GType block_locator_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (BlockLocatorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) block_locator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BlockLocator), 0, (GInstanceInitFunc) block_locator_instance_init, NULL };
	block_locator_type_id = g_type_module_register_type (module, VALA_TYPE_CODE_VISITOR, "BlockLocator", &g_define_type_info, 0);
	return block_locator_type_id;
}



