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

/* ide-vala-symbol-tree.vala
 *
 * Copyright (C) 2015 Christian Hergert <christian@hergert.me>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <vala.h>
#include <valagee.h>
#include <ide.h>


#define IDE_TYPE_VALA_SYMBOL_TREE_VISITOR (ide_vala_symbol_tree_visitor_get_type ())
#define IDE_VALA_SYMBOL_TREE_VISITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_SYMBOL_TREE_VISITOR, IdeValaSymbolTreeVisitor))
#define IDE_VALA_SYMBOL_TREE_VISITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_SYMBOL_TREE_VISITOR, IdeValaSymbolTreeVisitorClass))
#define IDE_IS_VALA_SYMBOL_TREE_VISITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_SYMBOL_TREE_VISITOR))
#define IDE_IS_VALA_SYMBOL_TREE_VISITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_SYMBOL_TREE_VISITOR))
#define IDE_VALA_SYMBOL_TREE_VISITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_SYMBOL_TREE_VISITOR, IdeValaSymbolTreeVisitorClass))

typedef struct _IdeValaSymbolTreeVisitor IdeValaSymbolTreeVisitor;
typedef struct _IdeValaSymbolTreeVisitorClass IdeValaSymbolTreeVisitorClass;
typedef struct _IdeValaSymbolTreeVisitorPrivate IdeValaSymbolTreeVisitorPrivate;
#define _vala_map_unref0(var) ((var == NULL) ? NULL : (var = (vala_map_unref (var), NULL)))
#define __g_queue_free__vala_iterable_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_queue_free__vala_iterable_unref0_ (var), NULL)))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))

#define IDE_TYPE_VALA_SYMBOL_TREE (ide_vala_symbol_tree_get_type ())
#define IDE_VALA_SYMBOL_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_SYMBOL_TREE, IdeValaSymbolTree))
#define IDE_VALA_SYMBOL_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_SYMBOL_TREE, IdeValaSymbolTreeClass))
#define IDE_IS_VALA_SYMBOL_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_SYMBOL_TREE))
#define IDE_IS_VALA_SYMBOL_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_SYMBOL_TREE))
#define IDE_VALA_SYMBOL_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_SYMBOL_TREE, IdeValaSymbolTreeClass))

typedef struct _IdeValaSymbolTree IdeValaSymbolTree;
typedef struct _IdeValaSymbolTreeClass IdeValaSymbolTreeClass;
typedef struct _IdeValaSymbolTreePrivate IdeValaSymbolTreePrivate;

#define IDE_TYPE_VALA_SYMBOL_NODE (ide_vala_symbol_node_get_type ())
#define IDE_VALA_SYMBOL_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_SYMBOL_NODE, IdeValaSymbolNode))
#define IDE_VALA_SYMBOL_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_SYMBOL_NODE, IdeValaSymbolNodeClass))
#define IDE_IS_VALA_SYMBOL_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_SYMBOL_NODE))
#define IDE_IS_VALA_SYMBOL_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_SYMBOL_NODE))
#define IDE_VALA_SYMBOL_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_SYMBOL_NODE, IdeValaSymbolNodeClass))

typedef struct _IdeValaSymbolNode IdeValaSymbolNode;
typedef struct _IdeValaSymbolNodeClass IdeValaSymbolNodeClass;
typedef struct _IdeValaSymbolNodePrivate IdeValaSymbolNodePrivate;
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define IDE_TYPE_VALA_SOURCE_FILE (ide_vala_source_file_get_type ())
#define IDE_VALA_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_SOURCE_FILE, IdeValaSourceFile))
#define IDE_VALA_SOURCE_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_SOURCE_FILE, IdeValaSourceFileClass))
#define IDE_IS_VALA_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_SOURCE_FILE))
#define IDE_IS_VALA_SOURCE_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_SOURCE_FILE))
#define IDE_VALA_SOURCE_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_SOURCE_FILE, IdeValaSourceFileClass))

typedef struct _IdeValaSourceFile IdeValaSourceFile;
typedef struct _IdeValaSourceFileClass IdeValaSourceFileClass;
typedef struct _IdeValaSourceFilePrivate IdeValaSourceFilePrivate;
#define _vala_source_reference_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_reference_unref (var), NULL)))

struct _IdeValaSymbolTreeVisitor {
	ValaCodeVisitor parent_instance;
	IdeValaSymbolTreeVisitorPrivate * priv;
};

struct _IdeValaSymbolTreeVisitorClass {
	ValaCodeVisitorClass parent_class;
};

struct _IdeValaSymbolTreeVisitorPrivate {
	ValaHashMap* table;
	GQueue* queue;
};

struct _IdeValaSymbolTree {
	GObject parent_instance;
	IdeValaSymbolTreePrivate * priv;
};

struct _IdeValaSymbolTreeClass {
	GObjectClass parent_class;
};

struct _IdeValaSymbolTreePrivate {
	ValaHashMap* table;
};

struct _IdeValaSymbolNode {
	IdeSymbolNode parent_instance;
	IdeValaSymbolNodePrivate * priv;
	ValaCodeNode* node;
};

struct _IdeValaSymbolNodeClass {
	IdeSymbolNodeClass parent_class;
};

struct _IdeValaSourceFile {
	ValaSourceFile parent_instance;
	IdeValaSourceFilePrivate * priv;
	IdeFile* file;
};

struct _IdeValaSourceFileClass {
	ValaSourceFileClass parent_class;
};


static gpointer ide_vala_symbol_tree_visitor_parent_class = NULL;
static GType ide_vala_symbol_tree_visitor_type_id = 0;
static gpointer ide_vala_symbol_tree_parent_class = NULL;
static IdeSymbolTreeInterface* ide_vala_symbol_tree_ide_symbol_tree_parent_iface = NULL;
static GType ide_vala_symbol_tree_type_id = 0;
static gpointer ide_vala_symbol_node_parent_class = NULL;
static GType ide_vala_symbol_node_type_id = 0;

GType ide_vala_symbol_tree_visitor_get_type (void) G_GNUC_CONST;
GType ide_vala_symbol_tree_visitor_register_type (GTypeModule * module);
#define IDE_VALA_SYMBOL_TREE_VISITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IDE_TYPE_VALA_SYMBOL_TREE_VISITOR, IdeValaSymbolTreeVisitorPrivate))
enum  {
	IDE_VALA_SYMBOL_TREE_VISITOR_DUMMY_PROPERTY
};
static void _vala_iterable_unref0_ (gpointer var);
static void _g_queue_free__vala_iterable_unref0_ (GQueue* self);
IdeValaSymbolTreeVisitor* ide_vala_symbol_tree_visitor_new (void);
IdeValaSymbolTreeVisitor* ide_vala_symbol_tree_visitor_construct (GType object_type);
IdeSymbolTree* ide_vala_symbol_tree_visitor_build_tree (IdeValaSymbolTreeVisitor* self);
IdeValaSymbolTree* ide_vala_symbol_tree_new (ValaHashMap* table);
IdeValaSymbolTree* ide_vala_symbol_tree_construct (GType object_type, ValaHashMap* table);
GType ide_vala_symbol_tree_get_type (void) G_GNUC_CONST;
GType ide_vala_symbol_tree_register_type (GTypeModule * module);
static void ide_vala_symbol_tree_visitor_visit_generic (IdeValaSymbolTreeVisitor* self, ValaCodeNode* node);
static void ide_vala_symbol_tree_visitor_real_visit_class (ValaCodeVisitor* base, ValaClass* node);
static void ide_vala_symbol_tree_visitor_real_visit_method (ValaCodeVisitor* base, ValaMethod* node);
static void ide_vala_symbol_tree_visitor_real_visit_local_variable (ValaCodeVisitor* base, ValaLocalVariable* node);
static void ide_vala_symbol_tree_visitor_real_visit_interface (ValaCodeVisitor* base, ValaInterface* node);
static void ide_vala_symbol_tree_visitor_real_visit_struct (ValaCodeVisitor* base, ValaStruct* node);
static void ide_vala_symbol_tree_visitor_real_visit_creation_method (ValaCodeVisitor* base, ValaCreationMethod* node);
static void ide_vala_symbol_tree_visitor_real_visit_property (ValaCodeVisitor* base, ValaProperty* node);
static void ide_vala_symbol_tree_visitor_real_visit_property_accessor (ValaCodeVisitor* base, ValaPropertyAccessor* node);
static void ide_vala_symbol_tree_visitor_real_visit_constructor (ValaCodeVisitor* base, ValaConstructor* node);
static void ide_vala_symbol_tree_visitor_real_visit_destructor (ValaCodeVisitor* base, ValaDestructor* node);
static void ide_vala_symbol_tree_visitor_real_visit_block (ValaCodeVisitor* base, ValaBlock* node);
static void ide_vala_symbol_tree_visitor_real_visit_source_file (ValaCodeVisitor* base, ValaSourceFile* source_file);
static void ide_vala_symbol_tree_visitor_finalize (ValaCodeVisitor* obj);
#define IDE_VALA_SYMBOL_TREE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IDE_TYPE_VALA_SYMBOL_TREE, IdeValaSymbolTreePrivate))
enum  {
	IDE_VALA_SYMBOL_TREE_DUMMY_PROPERTY
};
static ValaArrayList* ide_vala_symbol_tree_find (IdeValaSymbolTree* self, IdeSymbolNode* node);
GType ide_vala_symbol_node_get_type (void) G_GNUC_CONST;
GType ide_vala_symbol_node_register_type (GTypeModule * module);
static guint ide_vala_symbol_tree_real_get_n_children (IdeSymbolTree* base, IdeSymbolNode* node);
static IdeSymbolNode* ide_vala_symbol_tree_real_get_nth_child (IdeSymbolTree* base, IdeSymbolNode* node, guint nth);
IdeValaSymbolNode* ide_vala_symbol_node_new (ValaCodeNode* node);
IdeValaSymbolNode* ide_vala_symbol_node_construct (GType object_type, ValaCodeNode* node);
static void ide_vala_symbol_tree_finalize (GObject* obj);
enum  {
	IDE_VALA_SYMBOL_NODE_DUMMY_PROPERTY
};
static IdeSourceLocation* ide_vala_symbol_node_real_get_location (IdeSymbolNode* base);
GType ide_vala_source_file_get_type (void) G_GNUC_CONST;
GType ide_vala_source_file_register_type (GTypeModule * module);
static void ide_vala_symbol_node_finalize (GObject* obj);


static void _vala_iterable_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL));
}


static void _g_queue_free__vala_iterable_unref0_ (GQueue* self) {
	g_queue_foreach (self, (GFunc) _vala_iterable_unref0_, NULL);
	g_queue_free (self);
}


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


IdeValaSymbolTreeVisitor* ide_vala_symbol_tree_visitor_construct (GType object_type) {
	IdeValaSymbolTreeVisitor* self = NULL;
	GHashFunc _tmp0_ = NULL;
	GEqualFunc _tmp1_ = NULL;
	GEqualFunc _tmp2_ = NULL;
	ValaHashMap* _tmp3_ = NULL;
	GQueue* _tmp4_ = NULL;
	ValaArrayList* root = NULL;
	GEqualFunc _tmp5_ = NULL;
	ValaArrayList* _tmp6_ = NULL;
	ValaHashMap* _tmp7_ = NULL;
	GQueue* _tmp8_ = NULL;
	ValaArrayList* _tmp9_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) vala_code_visitor_construct (object_type);
	_tmp0_ = g_direct_hash;
	_tmp1_ = g_direct_equal;
	_tmp2_ = g_direct_equal;
	_tmp3_ = vala_hash_map_new (VALA_TYPE_CODE_NODE, (GBoxedCopyFunc) vala_code_node_ref, vala_code_node_unref, VALA_TYPE_ARRAY_LIST, (GBoxedCopyFunc) vala_iterable_ref, vala_iterable_unref, _tmp0_, _tmp1_, _tmp2_);
	_vala_map_unref0 (self->priv->table);
	self->priv->table = _tmp3_;
	_tmp4_ = g_queue_new ();
	__g_queue_free__vala_iterable_unref0_0 (self->priv->queue);
	self->priv->queue = _tmp4_;
	_tmp5_ = g_direct_equal;
	_tmp6_ = vala_array_list_new (VALA_TYPE_CODE_NODE, (GBoxedCopyFunc) vala_code_node_ref, vala_code_node_unref, _tmp5_);
	root = _tmp6_;
	_tmp7_ = self->priv->table;
	vala_map_set ((ValaMap*) _tmp7_, NULL, root);
	_tmp8_ = self->priv->queue;
	_tmp9_ = _vala_iterable_ref0 (root);
	g_queue_push_head (_tmp8_, _tmp9_);
	_vala_iterable_unref0 (root);
	return self;
}


IdeValaSymbolTreeVisitor* ide_vala_symbol_tree_visitor_new (void) {
	return ide_vala_symbol_tree_visitor_construct (IDE_TYPE_VALA_SYMBOL_TREE_VISITOR);
}


IdeSymbolTree* ide_vala_symbol_tree_visitor_build_tree (IdeValaSymbolTreeVisitor* self) {
	IdeSymbolTree* result = NULL;
	ValaHashMap* _tmp0_ = NULL;
	IdeValaSymbolTree* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->table;
	_tmp1_ = ide_vala_symbol_tree_new (_tmp0_);
	result = (IdeSymbolTree*) _tmp1_;
	return result;
}


static void ide_vala_symbol_tree_visitor_visit_generic (IdeValaSymbolTreeVisitor* self, ValaCodeNode* node) {
	ValaArrayList* current = NULL;
	GQueue* _tmp0_ = NULL;
	gconstpointer _tmp1_ = NULL;
	ValaArrayList* _tmp2_ = NULL;
	ValaCodeNode* _tmp3_ = NULL;
	ValaArrayList* list = NULL;
	GEqualFunc _tmp4_ = NULL;
	ValaArrayList* _tmp5_ = NULL;
	GQueue* _tmp6_ = NULL;
	ValaArrayList* _tmp7_ = NULL;
	ValaHashMap* _tmp8_ = NULL;
	ValaCodeNode* _tmp9_ = NULL;
	ValaCodeNode* _tmp10_ = NULL;
	GQueue* _tmp11_ = NULL;
	gpointer _tmp12_ = NULL;
	ValaArrayList* _tmp13_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = self->priv->queue;
	_tmp1_ = g_queue_peek_head (_tmp0_);
	_tmp2_ = _vala_iterable_ref0 ((ValaArrayList*) _tmp1_);
	current = _tmp2_;
	_tmp3_ = node;
	vala_collection_add ((ValaCollection*) current, _tmp3_);
	_tmp4_ = g_direct_equal;
	_tmp5_ = vala_array_list_new (VALA_TYPE_CODE_NODE, (GBoxedCopyFunc) vala_code_node_ref, vala_code_node_unref, _tmp4_);
	list = _tmp5_;
	_tmp6_ = self->priv->queue;
	_tmp7_ = _vala_iterable_ref0 (list);
	g_queue_push_head (_tmp6_, _tmp7_);
	_tmp8_ = self->priv->table;
	_tmp9_ = node;
	vala_map_set ((ValaMap*) _tmp8_, _tmp9_, list);
	_tmp10_ = node;
	vala_code_node_accept_children (_tmp10_, (ValaCodeVisitor*) self);
	_tmp11_ = self->priv->queue;
	_tmp12_ = g_queue_pop_head (_tmp11_);
	_tmp13_ = (ValaArrayList*) _tmp12_;
	_vala_iterable_unref0 (_tmp13_);
	_vala_iterable_unref0 (list);
	_vala_iterable_unref0 (current);
}


static void ide_vala_symbol_tree_visitor_real_visit_class (ValaCodeVisitor* base, ValaClass* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaClass* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	ide_vala_symbol_tree_visitor_visit_generic (self, (ValaCodeNode*) _tmp0_);
}


static void ide_vala_symbol_tree_visitor_real_visit_method (ValaCodeVisitor* base, ValaMethod* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaMethod* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	ide_vala_symbol_tree_visitor_visit_generic (self, (ValaCodeNode*) _tmp0_);
}


static void ide_vala_symbol_tree_visitor_real_visit_local_variable (ValaCodeVisitor* base, ValaLocalVariable* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaLocalVariable* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	ide_vala_symbol_tree_visitor_visit_generic (self, (ValaCodeNode*) _tmp0_);
}


static void ide_vala_symbol_tree_visitor_real_visit_interface (ValaCodeVisitor* base, ValaInterface* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaInterface* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	ide_vala_symbol_tree_visitor_visit_generic (self, (ValaCodeNode*) _tmp0_);
}


static void ide_vala_symbol_tree_visitor_real_visit_struct (ValaCodeVisitor* base, ValaStruct* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaStruct* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	ide_vala_symbol_tree_visitor_visit_generic (self, (ValaCodeNode*) _tmp0_);
}


static void ide_vala_symbol_tree_visitor_real_visit_creation_method (ValaCodeVisitor* base, ValaCreationMethod* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaCreationMethod* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	ide_vala_symbol_tree_visitor_visit_generic (self, (ValaCodeNode*) _tmp0_);
}


static void ide_vala_symbol_tree_visitor_real_visit_property (ValaCodeVisitor* base, ValaProperty* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaProperty* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	ide_vala_symbol_tree_visitor_visit_generic (self, (ValaCodeNode*) _tmp0_);
}


static void ide_vala_symbol_tree_visitor_real_visit_property_accessor (ValaCodeVisitor* base, ValaPropertyAccessor* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaPropertyAccessor* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	ide_vala_symbol_tree_visitor_visit_generic (self, (ValaCodeNode*) _tmp0_);
}


static void ide_vala_symbol_tree_visitor_real_visit_constructor (ValaCodeVisitor* base, ValaConstructor* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaConstructor* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	ide_vala_symbol_tree_visitor_visit_generic (self, (ValaCodeNode*) _tmp0_);
}


static void ide_vala_symbol_tree_visitor_real_visit_destructor (ValaCodeVisitor* base, ValaDestructor* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaDestructor* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	ide_vala_symbol_tree_visitor_visit_generic (self, (ValaCodeNode*) _tmp0_);
}


static void ide_vala_symbol_tree_visitor_real_visit_block (ValaCodeVisitor* base, ValaBlock* node) {
	IdeValaSymbolTreeVisitor * self;
	ValaBlock* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = node;
	vala_code_node_accept_children ((ValaCodeNode*) _tmp0_, (ValaCodeVisitor*) self);
}


static void ide_vala_symbol_tree_visitor_real_visit_source_file (ValaCodeVisitor* base, ValaSourceFile* source_file) {
	IdeValaSymbolTreeVisitor * self;
	ValaSourceFile* _tmp0_ = NULL;
	self = (IdeValaSymbolTreeVisitor*) base;
	g_return_if_fail (source_file != NULL);
	_tmp0_ = source_file;
	vala_source_file_accept_children (_tmp0_, (ValaCodeVisitor*) self);
}


static void ide_vala_symbol_tree_visitor_class_init (IdeValaSymbolTreeVisitorClass * klass) {
	ide_vala_symbol_tree_visitor_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeVisitorClass *) klass)->finalize = ide_vala_symbol_tree_visitor_finalize;
	g_type_class_add_private (klass, sizeof (IdeValaSymbolTreeVisitorPrivate));
	((ValaCodeVisitorClass *) klass)->visit_class = ide_vala_symbol_tree_visitor_real_visit_class;
	((ValaCodeVisitorClass *) klass)->visit_method = ide_vala_symbol_tree_visitor_real_visit_method;
	((ValaCodeVisitorClass *) klass)->visit_local_variable = ide_vala_symbol_tree_visitor_real_visit_local_variable;
	((ValaCodeVisitorClass *) klass)->visit_interface = ide_vala_symbol_tree_visitor_real_visit_interface;
	((ValaCodeVisitorClass *) klass)->visit_struct = ide_vala_symbol_tree_visitor_real_visit_struct;
	((ValaCodeVisitorClass *) klass)->visit_creation_method = ide_vala_symbol_tree_visitor_real_visit_creation_method;
	((ValaCodeVisitorClass *) klass)->visit_property = ide_vala_symbol_tree_visitor_real_visit_property;
	((ValaCodeVisitorClass *) klass)->visit_property_accessor = ide_vala_symbol_tree_visitor_real_visit_property_accessor;
	((ValaCodeVisitorClass *) klass)->visit_constructor = ide_vala_symbol_tree_visitor_real_visit_constructor;
	((ValaCodeVisitorClass *) klass)->visit_destructor = ide_vala_symbol_tree_visitor_real_visit_destructor;
	((ValaCodeVisitorClass *) klass)->visit_block = ide_vala_symbol_tree_visitor_real_visit_block;
	((ValaCodeVisitorClass *) klass)->visit_source_file = ide_vala_symbol_tree_visitor_real_visit_source_file;
}


static void ide_vala_symbol_tree_visitor_instance_init (IdeValaSymbolTreeVisitor * self) {
	self->priv = IDE_VALA_SYMBOL_TREE_VISITOR_GET_PRIVATE (self);
}


static void ide_vala_symbol_tree_visitor_finalize (ValaCodeVisitor* obj) {
	IdeValaSymbolTreeVisitor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, IDE_TYPE_VALA_SYMBOL_TREE_VISITOR, IdeValaSymbolTreeVisitor);
	_vala_map_unref0 (self->priv->table);
	__g_queue_free__vala_iterable_unref0_0 (self->priv->queue);
	VALA_CODE_VISITOR_CLASS (ide_vala_symbol_tree_visitor_parent_class)->finalize (obj);
}


GType ide_vala_symbol_tree_visitor_get_type (void) {
	return ide_vala_symbol_tree_visitor_type_id;
}


GType ide_vala_symbol_tree_visitor_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (IdeValaSymbolTreeVisitorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ide_vala_symbol_tree_visitor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IdeValaSymbolTreeVisitor), 0, (GInstanceInitFunc) ide_vala_symbol_tree_visitor_instance_init, NULL };
	ide_vala_symbol_tree_visitor_type_id = g_type_module_register_type (module, VALA_TYPE_CODE_VISITOR, "IdeValaSymbolTreeVisitor", &g_define_type_info, 0);
	return ide_vala_symbol_tree_visitor_type_id;
}


static gpointer _vala_map_ref0 (gpointer self) {
	return self ? vala_map_ref (self) : NULL;
}


IdeValaSymbolTree* ide_vala_symbol_tree_construct (GType object_type, ValaHashMap* table) {
	IdeValaSymbolTree * self = NULL;
	ValaHashMap* _tmp0_ = NULL;
	ValaHashMap* _tmp1_ = NULL;
	ValaHashMap* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	gint _tmp4_ = 0;
	g_return_val_if_fail (table != NULL, NULL);
	self = (IdeValaSymbolTree*) g_object_new (object_type, NULL);
	_tmp0_ = table;
	_tmp1_ = _vala_map_ref0 (_tmp0_);
	_vala_map_unref0 (self->priv->table);
	self->priv->table = _tmp1_;
	_tmp2_ = table;
	_tmp3_ = vala_map_get_size ((ValaMap*) _tmp2_);
	_tmp4_ = _tmp3_;
	g_debug ("ide-vala-symbol-tree.vala:83: Tree created with %u rows", (guint) _tmp4_);
	return self;
}


IdeValaSymbolTree* ide_vala_symbol_tree_new (ValaHashMap* table) {
	return ide_vala_symbol_tree_construct (IDE_TYPE_VALA_SYMBOL_TREE, table);
}


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 ValaArrayList* ide_vala_symbol_tree_find (IdeValaSymbolTree* self, IdeSymbolNode* node) {
	ValaArrayList* result = NULL;
	IdeValaSymbolNode* symbol_node = NULL;
	IdeSymbolNode* _tmp0_ = NULL;
	IdeValaSymbolNode* _tmp1_ = NULL;
	ValaCodeNode* key = NULL;
	IdeValaSymbolNode* _tmp2_ = NULL;
	ValaHashMap* _tmp10_ = NULL;
	ValaCodeNode* _tmp11_ = NULL;
	gpointer _tmp12_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = node;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, IDE_TYPE_VALA_SYMBOL_NODE, IdeValaSymbolNode));
	symbol_node = _tmp1_;
	key = NULL;
	_tmp2_ = symbol_node;
	if (_tmp2_ != NULL) {
		ValaHashMap* _tmp3_ = NULL;
		IdeValaSymbolNode* _tmp4_ = NULL;
		ValaCodeNode* _tmp5_ = NULL;
		gboolean _tmp6_ = FALSE;
		IdeValaSymbolNode* _tmp7_ = NULL;
		ValaCodeNode* _tmp8_ = NULL;
		ValaCodeNode* _tmp9_ = NULL;
		_tmp3_ = self->priv->table;
		_tmp4_ = symbol_node;
		_tmp5_ = _tmp4_->node;
		_tmp6_ = vala_map_contains ((ValaMap*) _tmp3_, _tmp5_);
		if (!_tmp6_) {
			result = NULL;
			_vala_code_node_unref0 (key);
			_g_object_unref0 (symbol_node);
			return result;
		}
		_tmp7_ = symbol_node;
		_tmp8_ = _tmp7_->node;
		_tmp9_ = _vala_code_node_ref0 (_tmp8_);
		_vala_code_node_unref0 (key);
		key = _tmp9_;
	}
	_tmp10_ = self->priv->table;
	_tmp11_ = key;
	_tmp12_ = vala_map_get ((ValaMap*) _tmp10_, _tmp11_);
	result = (ValaArrayList*) _tmp12_;
	_vala_code_node_unref0 (key);
	_g_object_unref0 (symbol_node);
	return result;
}


static guint ide_vala_symbol_tree_real_get_n_children (IdeSymbolTree* base, IdeSymbolNode* node) {
	IdeValaSymbolTree * self;
	guint result = 0U;
	ValaArrayList* list = NULL;
	IdeSymbolNode* _tmp0_ = NULL;
	ValaArrayList* _tmp1_ = NULL;
	ValaArrayList* _tmp2_ = NULL;
	gint _tmp7_ = 0;
	ValaArrayList* _tmp8_ = NULL;
	self = (IdeValaSymbolTree*) base;
	_tmp0_ = node;
	_tmp1_ = ide_vala_symbol_tree_find (self, _tmp0_);
	list = _tmp1_;
	_tmp2_ = list;
	if (_tmp2_ == NULL) {
		IdeSymbolNode* _tmp3_ = NULL;
		_tmp3_ = node;
		g_debug ("ide-vala-symbol-tree.vala:105: Failed to find child! %p", _tmp3_);
	} else {
		ValaArrayList* _tmp4_ = NULL;
		gint _tmp5_ = 0;
		gint _tmp6_ = 0;
		_tmp4_ = list;
		_tmp5_ = vala_collection_get_size ((ValaCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		g_debug ("ide-vala-symbol-tree.vala:107: node has %u children.", (guint) _tmp6_);
	}
	_tmp8_ = list;
	if (_tmp8_ != NULL) {
		ValaArrayList* _tmp9_ = NULL;
		gint _tmp10_ = 0;
		gint _tmp11_ = 0;
		_tmp9_ = list;
		_tmp10_ = vala_collection_get_size ((ValaCollection*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp7_ = _tmp11_;
	} else {
		_tmp7_ = 0;
	}
	result = (guint) _tmp7_;
	_vala_iterable_unref0 (list);
	return result;
}


static IdeSymbolNode* ide_vala_symbol_tree_real_get_nth_child (IdeSymbolTree* base, IdeSymbolNode* node, guint nth) {
	IdeValaSymbolTree * self;
	IdeSymbolNode* result = NULL;
	ValaArrayList* list = NULL;
	IdeSymbolNode* _tmp0_ = NULL;
	ValaArrayList* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	ValaArrayList* _tmp3_ = NULL;
	self = (IdeValaSymbolTree*) base;
	_tmp0_ = node;
	_tmp1_ = ide_vala_symbol_tree_find (self, _tmp0_);
	list = _tmp1_;
	_tmp3_ = list;
	if (_tmp3_ != NULL) {
		ValaArrayList* _tmp4_ = NULL;
		gint _tmp5_ = 0;
		gint _tmp6_ = 0;
		guint _tmp7_ = 0U;
		_tmp4_ = list;
		_tmp5_ = vala_collection_get_size ((ValaCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = nth;
		_tmp2_ = ((guint) _tmp6_) > _tmp7_;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		ValaArrayList* _tmp8_ = NULL;
		guint _tmp9_ = 0U;
		gpointer _tmp10_ = NULL;
		ValaCodeNode* _tmp11_ = NULL;
		IdeValaSymbolNode* _tmp12_ = NULL;
		IdeSymbolNode* _tmp13_ = NULL;
		_tmp8_ = list;
		_tmp9_ = nth;
		_tmp10_ = vala_list_get ((ValaList*) _tmp8_, (gint) _tmp9_);
		_tmp11_ = (ValaCodeNode*) _tmp10_;
		_tmp12_ = ide_vala_symbol_node_new (_tmp11_);
		_tmp13_ = (IdeSymbolNode*) _tmp12_;
		_vala_code_node_unref0 (_tmp11_);
		result = _tmp13_;
		_vala_iterable_unref0 (list);
		return result;
	}
	result = NULL;
	_vala_iterable_unref0 (list);
	return result;
}


static void ide_vala_symbol_tree_class_init (IdeValaSymbolTreeClass * klass) {
	ide_vala_symbol_tree_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (IdeValaSymbolTreePrivate));
	G_OBJECT_CLASS (klass)->finalize = ide_vala_symbol_tree_finalize;
}


static void ide_vala_symbol_tree_ide_symbol_tree_interface_init (IdeSymbolTreeInterface * iface) {
	ide_vala_symbol_tree_ide_symbol_tree_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_n_children = (guint (*)(IdeSymbolTree*, IdeSymbolNode*)) ide_vala_symbol_tree_real_get_n_children;
	iface->get_nth_child = (IdeSymbolNode* (*)(IdeSymbolTree*, IdeSymbolNode*, guint)) ide_vala_symbol_tree_real_get_nth_child;
}


static void ide_vala_symbol_tree_instance_init (IdeValaSymbolTree * self) {
	self->priv = IDE_VALA_SYMBOL_TREE_GET_PRIVATE (self);
}


static void ide_vala_symbol_tree_finalize (GObject* obj) {
	IdeValaSymbolTree * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, IDE_TYPE_VALA_SYMBOL_TREE, IdeValaSymbolTree);
	_vala_map_unref0 (self->priv->table);
	G_OBJECT_CLASS (ide_vala_symbol_tree_parent_class)->finalize (obj);
}


GType ide_vala_symbol_tree_get_type (void) {
	return ide_vala_symbol_tree_type_id;
}


GType ide_vala_symbol_tree_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (IdeValaSymbolTreeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ide_vala_symbol_tree_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IdeValaSymbolTree), 0, (GInstanceInitFunc) ide_vala_symbol_tree_instance_init, NULL };
	static const GInterfaceInfo ide_symbol_tree_info = { (GInterfaceInitFunc) ide_vala_symbol_tree_ide_symbol_tree_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	ide_vala_symbol_tree_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "IdeValaSymbolTree", &g_define_type_info, 0);
	g_type_module_add_interface (module, ide_vala_symbol_tree_type_id, ide_symbol_tree_get_type (), &ide_symbol_tree_info);
	return ide_vala_symbol_tree_type_id;
}


IdeValaSymbolNode* ide_vala_symbol_node_construct (GType object_type, ValaCodeNode* node) {
	IdeValaSymbolNode * self = NULL;
	ValaCodeNode* _tmp0_ = NULL;
	ValaCodeNode* _tmp1_ = NULL;
	ValaCodeNode* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	ValaCodeNode* _tmp5_ = NULL;
	g_return_val_if_fail (node != NULL, NULL);
	self = (IdeValaSymbolNode*) g_object_new (object_type, NULL);
	_tmp0_ = node;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->node);
	self->node = _tmp1_;
	_tmp2_ = node;
	_tmp3_ = vala_symbol_get_name (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, VALA_TYPE_SYMBOL) ? ((ValaSymbol*) _tmp2_) : NULL);
	_tmp4_ = _tmp3_;
	g_object_set ((IdeSymbolNode*) self, "name", _tmp4_, NULL);
	g_object_set ((IdeSymbolNode*) self, "kind", IDE_SYMBOL_NONE, NULL);
	g_object_set ((IdeSymbolNode*) self, "flags", IDE_SYMBOL_FLAGS_NONE, NULL);
	_tmp5_ = node;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, VALA_TYPE_METHOD)) {
		g_object_set ((IdeSymbolNode*) self, "kind", IDE_SYMBOL_FUNCTION, NULL);
	} else {
		ValaCodeNode* _tmp6_ = NULL;
		_tmp6_ = node;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, VALA_TYPE_CLASS)) {
			g_object_set ((IdeSymbolNode*) self, "kind", IDE_SYMBOL_CLASS, NULL);
		} else {
			ValaCodeNode* _tmp7_ = NULL;
			_tmp7_ = node;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_STRUCT)) {
				g_object_set ((IdeSymbolNode*) self, "kind", IDE_SYMBOL_STRUCT, NULL);
			} else {
				ValaCodeNode* _tmp8_ = NULL;
				_tmp8_ = node;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, VALA_TYPE_PROPERTY)) {
					g_object_set ((IdeSymbolNode*) self, "kind", IDE_SYMBOL_FIELD, NULL);
				}
			}
		}
	}
	return self;
}


IdeValaSymbolNode* ide_vala_symbol_node_new (ValaCodeNode* node) {
	return ide_vala_symbol_node_construct (IDE_TYPE_VALA_SYMBOL_NODE, node);
}


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


static IdeSourceLocation* ide_vala_symbol_node_real_get_location (IdeSymbolNode* base) {
	IdeValaSymbolNode * self;
	IdeSourceLocation* result = NULL;
	ValaSourceReference* source_reference = NULL;
	ValaCodeNode* _tmp0_ = NULL;
	ValaSourceReference* _tmp1_ = NULL;
	ValaSourceReference* _tmp2_ = NULL;
	ValaSourceReference* _tmp3_ = NULL;
	IdeFile* file = NULL;
	ValaSourceFile* _tmp4_ = NULL;
	ValaSourceFile* _tmp5_ = NULL;
	IdeFile* _tmp6_ = NULL;
	IdeFile* _tmp7_ = NULL;
	ValaSourceLocation _tmp8_ = {0};
	ValaSourceLocation _tmp9_ = {0};
	gint _tmp10_ = 0;
	ValaSourceLocation _tmp11_ = {0};
	ValaSourceLocation _tmp12_ = {0};
	gint _tmp13_ = 0;
	IdeSourceLocation* _tmp14_ = NULL;
	self = (IdeValaSymbolNode*) base;
	_tmp0_ = self->node;
	_tmp1_ = vala_code_node_get_source_reference (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _vala_source_reference_ref0 (_tmp2_);
	source_reference = _tmp3_;
	_tmp4_ = vala_source_reference_get_file (source_reference);
	_tmp5_ = _tmp4_;
	_tmp6_ = (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, IDE_TYPE_VALA_SOURCE_FILE) ? ((IdeValaSourceFile*) _tmp5_) : NULL)->file;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	file = _tmp7_;
	vala_source_reference_get_begin (source_reference, &_tmp8_);
	_tmp9_ = _tmp8_;
	_tmp10_ = _tmp9_.line;
	vala_source_reference_get_begin (source_reference, &_tmp11_);
	_tmp12_ = _tmp11_;
	_tmp13_ = _tmp12_.column;
	_tmp14_ = ide_source_location_new (file, (guint) (_tmp10_ - 1), (guint) (_tmp13_ - 1), (guint) 0);
	result = _tmp14_;
	_g_object_unref0 (file);
	_vala_source_reference_unref0 (source_reference);
	return result;
}


static void ide_vala_symbol_node_class_init (IdeValaSymbolNodeClass * klass) {
	ide_vala_symbol_node_parent_class = g_type_class_peek_parent (klass);
	((IdeSymbolNodeClass *) klass)->get_location = ide_vala_symbol_node_real_get_location;
	G_OBJECT_CLASS (klass)->finalize = ide_vala_symbol_node_finalize;
}


static void ide_vala_symbol_node_instance_init (IdeValaSymbolNode * self) {
}


static void ide_vala_symbol_node_finalize (GObject* obj) {
	IdeValaSymbolNode * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, IDE_TYPE_VALA_SYMBOL_NODE, IdeValaSymbolNode);
	_vala_code_node_unref0 (self->node);
	G_OBJECT_CLASS (ide_vala_symbol_node_parent_class)->finalize (obj);
}


GType ide_vala_symbol_node_get_type (void) {
	return ide_vala_symbol_node_type_id;
}


GType ide_vala_symbol_node_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (IdeValaSymbolNodeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ide_vala_symbol_node_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IdeValaSymbolNode), 0, (GInstanceInitFunc) ide_vala_symbol_node_instance_init, NULL };
	ide_vala_symbol_node_type_id = g_type_module_register_type (module, ide_symbol_node_get_type (), "IdeValaSymbolNode", &g_define_type_info, 0);
	return ide_vala_symbol_node_type_id;
}



