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

/* valasourcefile.vala
 *
 * Copyright (C) 2006-2009  Jürg Billeter
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library 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
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <valagee.h>
#include <glib/gstdio.h>
#include <gobject/gvaluecollector.h>


#define VALA_TYPE_SOURCE_FILE (vala_source_file_get_type ())
#define VALA_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_SOURCE_FILE, ValaSourceFile))
#define VALA_SOURCE_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_SOURCE_FILE, ValaSourceFileClass))
#define VALA_IS_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_SOURCE_FILE))
#define VALA_IS_SOURCE_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_SOURCE_FILE))
#define VALA_SOURCE_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_SOURCE_FILE, ValaSourceFileClass))

typedef struct _ValaSourceFile ValaSourceFile;
typedef struct _ValaSourceFileClass ValaSourceFileClass;
typedef struct _ValaSourceFilePrivate ValaSourceFilePrivate;

#define VALA_TYPE_SOURCE_FILE_TYPE (vala_source_file_type_get_type ())

#define VALA_TYPE_CODE_CONTEXT (vala_code_context_get_type ())
#define VALA_CODE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CODE_CONTEXT, ValaCodeContext))
#define VALA_CODE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CODE_CONTEXT, ValaCodeContextClass))
#define VALA_IS_CODE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CODE_CONTEXT))
#define VALA_IS_CODE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CODE_CONTEXT))
#define VALA_CODE_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CODE_CONTEXT, ValaCodeContextClass))

typedef struct _ValaCodeContext ValaCodeContext;
typedef struct _ValaCodeContextClass ValaCodeContextClass;

#define VALA_TYPE_COMMENT (vala_comment_get_type ())
#define VALA_COMMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_COMMENT, ValaComment))
#define VALA_COMMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_COMMENT, ValaCommentClass))
#define VALA_IS_COMMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_COMMENT))
#define VALA_IS_COMMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_COMMENT))
#define VALA_COMMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_COMMENT, ValaCommentClass))

typedef struct _ValaComment ValaComment;
typedef struct _ValaCommentClass ValaCommentClass;

#define VALA_TYPE_CODE_NODE (vala_code_node_get_type ())
#define VALA_CODE_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CODE_NODE, ValaCodeNode))
#define VALA_CODE_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CODE_NODE, ValaCodeNodeClass))
#define VALA_IS_CODE_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CODE_NODE))
#define VALA_IS_CODE_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CODE_NODE))
#define VALA_CODE_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CODE_NODE, ValaCodeNodeClass))

typedef struct _ValaCodeNode ValaCodeNode;
typedef struct _ValaCodeNodeClass ValaCodeNodeClass;

#define VALA_TYPE_USING_DIRECTIVE (vala_using_directive_get_type ())
#define VALA_USING_DIRECTIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_USING_DIRECTIVE, ValaUsingDirective))
#define VALA_USING_DIRECTIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_USING_DIRECTIVE, ValaUsingDirectiveClass))
#define VALA_IS_USING_DIRECTIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_USING_DIRECTIVE))
#define VALA_IS_USING_DIRECTIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_USING_DIRECTIVE))
#define VALA_USING_DIRECTIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_USING_DIRECTIVE, ValaUsingDirectiveClass))

typedef struct _ValaUsingDirective ValaUsingDirective;
typedef struct _ValaUsingDirectiveClass ValaUsingDirectiveClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _g_mapped_file_unref0(var) ((var == NULL) ? NULL : (var = (g_mapped_file_unref (var), NULL)))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))

#define VALA_TYPE_CODE_VISITOR (vala_code_visitor_get_type ())
#define VALA_CODE_VISITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CODE_VISITOR, ValaCodeVisitor))
#define VALA_CODE_VISITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CODE_VISITOR, ValaCodeVisitorClass))
#define VALA_IS_CODE_VISITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CODE_VISITOR))
#define VALA_IS_CODE_VISITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CODE_VISITOR))
#define VALA_CODE_VISITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CODE_VISITOR, ValaCodeVisitorClass))

typedef struct _ValaCodeVisitor ValaCodeVisitor;
typedef struct _ValaCodeVisitorClass ValaCodeVisitorClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define VALA_TYPE_SOURCE_REFERENCE (vala_source_reference_get_type ())
#define VALA_SOURCE_REFERENCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_SOURCE_REFERENCE, ValaSourceReference))
#define VALA_SOURCE_REFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_SOURCE_REFERENCE, ValaSourceReferenceClass))
#define VALA_IS_SOURCE_REFERENCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_SOURCE_REFERENCE))
#define VALA_IS_SOURCE_REFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_SOURCE_REFERENCE))
#define VALA_SOURCE_REFERENCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_SOURCE_REFERENCE, ValaSourceReferenceClass))

typedef struct _ValaSourceReference ValaSourceReference;
typedef struct _ValaSourceReferenceClass ValaSourceReferenceClass;
typedef struct _ValaParamSpecSourceFile ValaParamSpecSourceFile;

struct _ValaSourceFile {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ValaSourceFilePrivate * priv;
};

struct _ValaSourceFileClass {
	GTypeClass parent_class;
	void (*finalize) (ValaSourceFile *self);
};

typedef enum  {
	VALA_SOURCE_FILE_TYPE_NONE,
	VALA_SOURCE_FILE_TYPE_SOURCE,
	VALA_SOURCE_FILE_TYPE_PACKAGE,
	VALA_SOURCE_FILE_TYPE_FAST
} ValaSourceFileType;

struct _ValaSourceFilePrivate {
	gchar* _filename;
	gchar* _package_name;
	gchar* _installed_version;
	gboolean _version_requested;
	ValaSourceFileType _file_type;
	gboolean _from_commandline;
	gchar* _gir_namespace;
	gchar* _gir_version;
	ValaCodeContext* _context;
	gboolean _used;
	ValaArrayList* comments;
	ValaList* _current_using_directives;
	ValaList* nodes;
	gchar* _relative_filename;
	gchar* csource_filename;
	gchar* cinclude_filename;
	ValaArrayList* source_array;
	GMappedFile* mapped_file;
	gchar* _content;
};

struct _ValaParamSpecSourceFile {
	GParamSpec parent_instance;
};


static gpointer vala_source_file_parent_class = NULL;

gpointer vala_source_file_ref (gpointer instance);
void vala_source_file_unref (gpointer instance);
GParamSpec* vala_param_spec_source_file (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vala_value_set_source_file (GValue* value, gpointer v_object);
void vala_value_take_source_file (GValue* value, gpointer v_object);
gpointer vala_value_get_source_file (const GValue* value);
GType vala_source_file_get_type (void) G_GNUC_CONST;
GType vala_source_file_type_get_type (void) G_GNUC_CONST;
gpointer vala_code_context_ref (gpointer instance);
void vala_code_context_unref (gpointer instance);
GParamSpec* vala_param_spec_code_context (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vala_value_set_code_context (GValue* value, gpointer v_object);
void vala_value_take_code_context (GValue* value, gpointer v_object);
gpointer vala_value_get_code_context (const GValue* value);
GType vala_code_context_get_type (void) G_GNUC_CONST;
gpointer vala_comment_ref (gpointer instance);
void vala_comment_unref (gpointer instance);
GParamSpec* vala_param_spec_comment (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vala_value_set_comment (GValue* value, gpointer v_object);
void vala_value_take_comment (GValue* value, gpointer v_object);
gpointer vala_value_get_comment (const GValue* value);
GType vala_comment_get_type (void) G_GNUC_CONST;
gpointer vala_code_node_ref (gpointer instance);
void vala_code_node_unref (gpointer instance);
GParamSpec* vala_param_spec_code_node (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vala_value_set_code_node (GValue* value, gpointer v_object);
void vala_value_take_code_node (GValue* value, gpointer v_object);
gpointer vala_value_get_code_node (const GValue* value);
GType vala_code_node_get_type (void) G_GNUC_CONST;
GType vala_using_directive_get_type (void) G_GNUC_CONST;
#define VALA_SOURCE_FILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_SOURCE_FILE, ValaSourceFilePrivate))
enum  {
	VALA_SOURCE_FILE_DUMMY_PROPERTY
};
ValaSourceFile* vala_source_file_new (ValaCodeContext* context, ValaSourceFileType type, const gchar* filename, const gchar* content, gboolean cmdline);
ValaSourceFile* vala_source_file_construct (GType object_type, ValaCodeContext* context, ValaSourceFileType type, const gchar* filename, const gchar* content, gboolean cmdline);
void vala_source_file_set_context (ValaSourceFile* self, ValaCodeContext* value);
void vala_source_file_set_file_type (ValaSourceFile* self, ValaSourceFileType value);
void vala_source_file_set_filename (ValaSourceFile* self, const gchar* value);
void vala_source_file_set_content (ValaSourceFile* self, const gchar* value);
void vala_source_file_set_from_commandline (ValaSourceFile* self, gboolean value);
void vala_source_file_add_comment (ValaSourceFile* self, ValaComment* comment);
ValaList* vala_source_file_get_comments (ValaSourceFile* self);
void vala_source_file_add_using_directive (ValaSourceFile* self, ValaUsingDirective* ns);
ValaList* vala_source_file_get_current_using_directives (ValaSourceFile* self);
void vala_source_file_set_current_using_directives (ValaSourceFile* self, ValaList* value);
void vala_source_file_add_node (ValaSourceFile* self, ValaCodeNode* node);
void vala_source_file_remove_node (ValaSourceFile* self, ValaCodeNode* node);
ValaList* vala_source_file_get_nodes (ValaSourceFile* self);
gpointer vala_code_visitor_ref (gpointer instance);
void vala_code_visitor_unref (gpointer instance);
GParamSpec* vala_param_spec_code_visitor (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vala_value_set_code_visitor (GValue* value, gpointer v_object);
void vala_value_take_code_visitor (GValue* value, gpointer v_object);
gpointer vala_value_get_code_visitor (const GValue* value);
GType vala_code_visitor_get_type (void) G_GNUC_CONST;
void vala_source_file_accept (ValaSourceFile* self, ValaCodeVisitor* visitor);
void vala_code_visitor_visit_source_file (ValaCodeVisitor* self, ValaSourceFile* source_file);
void vala_source_file_accept_children (ValaSourceFile* self, ValaCodeVisitor* visitor);
void vala_code_node_accept (ValaCodeNode* self, ValaCodeVisitor* visitor);
static gchar* vala_source_file_get_subdir (ValaSourceFile* self);
ValaCodeContext* vala_source_file_get_context (ValaSourceFile* self);
const gchar* vala_code_context_get_basedir (ValaCodeContext* self);
const gchar* vala_source_file_get_filename (ValaSourceFile* self);
static gchar* vala_source_file_get_destination_directory (ValaSourceFile* self);
const gchar* vala_code_context_get_directory (ValaCodeContext* self);
static gchar* vala_source_file_get_basename (ValaSourceFile* self);
gchar* vala_source_file_get_relative_filename (ValaSourceFile* self);
gchar* vala_source_file_get_csource_filename (ValaSourceFile* self);
gboolean vala_code_context_get_run_output (ValaCodeContext* self);
const gchar* vala_code_context_get_output (ValaCodeContext* self);
gboolean vala_code_context_get_ccode_only (ValaCodeContext* self);
gboolean vala_code_context_get_save_csources (ValaCodeContext* self);
gchar* vala_source_file_get_cinclude_filename (ValaSourceFile* self);
const gchar* vala_code_context_get_header_filename (ValaCodeContext* self);
const gchar* vala_code_context_get_includedir (ValaCodeContext* self);
gchar* vala_source_file_get_source_line (ValaSourceFile* self, gint lineno);
const gchar* vala_source_file_get_content (ValaSourceFile* self);
static void vala_source_file_read_source_lines (ValaSourceFile* self, const gchar* cont);
static void vala_source_file_read_source_file (ValaSourceFile* self);
gchar* vala_source_file_get_mapped_contents (ValaSourceFile* self);
gpointer vala_source_reference_ref (gpointer instance);
void vala_source_reference_unref (gpointer instance);
GParamSpec* vala_param_spec_source_reference (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vala_value_set_source_reference (GValue* value, gpointer v_object);
void vala_value_take_source_reference (GValue* value, gpointer v_object);
gpointer vala_value_get_source_reference (const GValue* value);
GType vala_source_reference_get_type (void) G_GNUC_CONST;
void vala_report_error (ValaSourceReference* source, const gchar* message);
gsize vala_source_file_get_mapped_length (ValaSourceFile* self);
gboolean vala_source_file_check (ValaSourceFile* self, ValaCodeContext* context);
gboolean vala_code_node_check (ValaCodeNode* self, ValaCodeContext* context);
void vala_source_file_set_relative_filename (ValaSourceFile* self, const gchar* value);
const gchar* vala_source_file_get_package_name (ValaSourceFile* self);
ValaSourceFileType vala_source_file_get_file_type (ValaSourceFile* self);
void vala_source_file_set_package_name (ValaSourceFile* self, const gchar* value);
const gchar* vala_source_file_get_installed_version (ValaSourceFile* self);
void vala_source_file_set_installed_version (ValaSourceFile* self, const gchar* value);
gboolean vala_source_file_get_from_commandline (ValaSourceFile* self);
const gchar* vala_source_file_get_gir_namespace (ValaSourceFile* self);
void vala_source_file_set_gir_namespace (ValaSourceFile* self, const gchar* value);
const gchar* vala_source_file_get_gir_version (ValaSourceFile* self);
void vala_source_file_set_gir_version (ValaSourceFile* self, const gchar* value);
gboolean vala_source_file_get_used (ValaSourceFile* self);
void vala_source_file_set_used (ValaSourceFile* self, gboolean value);
static void vala_source_file_finalize (ValaSourceFile * obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


/**
 * Creates a new source file.
 *
 * @param filename source file name
 * @return         newly created source file
 */
ValaSourceFile* vala_source_file_construct (GType object_type, ValaCodeContext* context, ValaSourceFileType type, const gchar* filename, const gchar* content, gboolean cmdline) {
	ValaSourceFile* self = NULL;
	ValaCodeContext* _tmp0_;
	ValaSourceFileType _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp4_;
	g_return_val_if_fail (context != NULL, NULL);
	g_return_val_if_fail (filename != NULL, NULL);
	self = (ValaSourceFile*) g_type_create_instance (object_type);
	_tmp0_ = context;
	vala_source_file_set_context (self, _tmp0_);
	_tmp1_ = type;
	vala_source_file_set_file_type (self, _tmp1_);
	_tmp2_ = filename;
	vala_source_file_set_filename (self, _tmp2_);
	_tmp3_ = content;
	vala_source_file_set_content (self, _tmp3_);
	_tmp4_ = cmdline;
	vala_source_file_set_from_commandline (self, _tmp4_);
	return self;
}


ValaSourceFile* vala_source_file_new (ValaCodeContext* context, ValaSourceFileType type, const gchar* filename, const gchar* content, gboolean cmdline) {
	return vala_source_file_construct (VALA_TYPE_SOURCE_FILE, context, type, filename, content, cmdline);
}


/**
 * Adds a header comment to this source file.
 */
void vala_source_file_add_comment (ValaSourceFile* self, ValaComment* comment) {
	ValaArrayList* _tmp0_;
	ValaComment* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (comment != NULL);
	_tmp0_ = self->priv->comments;
	_tmp1_ = comment;
	vala_collection_add ((ValaCollection*) _tmp0_, _tmp1_);
}


/**
 * Returns a copy of the list of header comments.
 *
 * @return list of comments
 */
static gpointer _vala_iterable_ref0 (gpointer self) {
	return self ? vala_iterable_ref (self) : NULL;
}


ValaList* vala_source_file_get_comments (ValaSourceFile* self) {
	ValaList* result = NULL;
	ValaArrayList* _tmp0_;
	ValaList* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->comments;
	_tmp1_ = _vala_iterable_ref0 ((ValaList*) _tmp0_);
	result = _tmp1_;
	return result;
}


/**
 * Adds a new using directive with the specified namespace.
 *
 * @param ns reference to namespace
 */
void vala_source_file_add_using_directive (ValaSourceFile* self, ValaUsingDirective* ns) {
	ValaList* old_using_directives = NULL;
	ValaList* _tmp0_;
	ValaList* _tmp1_;
	GEqualFunc _tmp2_;
	ValaArrayList* _tmp3_;
	ValaArrayList* _tmp4_;
	ValaList* _tmp18_;
	ValaUsingDirective* _tmp19_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ns != NULL);
	_tmp0_ = self->priv->_current_using_directives;
	_tmp1_ = _vala_iterable_ref0 (_tmp0_);
	old_using_directives = _tmp1_;
	_tmp2_ = g_direct_equal;
	_tmp3_ = vala_array_list_new (VALA_TYPE_USING_DIRECTIVE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp2_);
	_tmp4_ = _tmp3_;
	vala_source_file_set_current_using_directives (self, (ValaList*) _tmp4_);
	_vala_iterable_unref0 (_tmp4_);
	{
		ValaList* _using_directive_list = NULL;
		ValaList* _tmp5_;
		ValaList* _tmp6_;
		gint _using_directive_size = 0;
		ValaList* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gint _using_directive_index = 0;
		_tmp5_ = old_using_directives;
		_tmp6_ = _vala_iterable_ref0 (_tmp5_);
		_using_directive_list = _tmp6_;
		_tmp7_ = _using_directive_list;
		_tmp8_ = vala_collection_get_size ((ValaCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_using_directive_size = _tmp9_;
		_using_directive_index = -1;
		while (TRUE) {
			gint _tmp10_;
			gint _tmp11_;
			gint _tmp12_;
			ValaUsingDirective* using_directive = NULL;
			ValaList* _tmp13_;
			gint _tmp14_;
			gpointer _tmp15_;
			ValaList* _tmp16_;
			ValaUsingDirective* _tmp17_;
			_tmp10_ = _using_directive_index;
			_using_directive_index = _tmp10_ + 1;
			_tmp11_ = _using_directive_index;
			_tmp12_ = _using_directive_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _using_directive_list;
			_tmp14_ = _using_directive_index;
			_tmp15_ = vala_list_get (_tmp13_, _tmp14_);
			using_directive = (ValaUsingDirective*) _tmp15_;
			_tmp16_ = self->priv->_current_using_directives;
			_tmp17_ = using_directive;
			vala_collection_add ((ValaCollection*) _tmp16_, _tmp17_);
			_vala_code_node_unref0 (using_directive);
		}
		_vala_iterable_unref0 (_using_directive_list);
	}
	_tmp18_ = self->priv->_current_using_directives;
	_tmp19_ = ns;
	vala_collection_add ((ValaCollection*) _tmp18_, _tmp19_);
	_vala_iterable_unref0 (old_using_directives);
}


/**
 * Adds the specified code node to this source file.
 *
 * @param node a code node
 */
void vala_source_file_add_node (ValaSourceFile* self, ValaCodeNode* node) {
	ValaList* _tmp0_;
	ValaCodeNode* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = self->priv->nodes;
	_tmp1_ = node;
	vala_collection_add ((ValaCollection*) _tmp0_, _tmp1_);
}


void vala_source_file_remove_node (ValaSourceFile* self, ValaCodeNode* node) {
	ValaList* _tmp0_;
	ValaCodeNode* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = self->priv->nodes;
	_tmp1_ = node;
	vala_collection_remove ((ValaCollection*) _tmp0_, _tmp1_);
}


/**
 * Returns a copy of the list of code nodes.
 *
 * @return code node list
 */
ValaList* vala_source_file_get_nodes (ValaSourceFile* self) {
	ValaList* result = NULL;
	ValaList* _tmp0_;
	ValaList* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->nodes;
	_tmp1_ = _vala_iterable_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


void vala_source_file_accept (ValaSourceFile* self, ValaCodeVisitor* visitor) {
	ValaCodeVisitor* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (visitor != NULL);
	_tmp0_ = visitor;
	vala_code_visitor_visit_source_file (_tmp0_, self);
}


void vala_source_file_accept_children (ValaSourceFile* self, ValaCodeVisitor* visitor) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (visitor != NULL);
	{
		ValaList* _node_list = NULL;
		ValaList* _tmp0_;
		ValaList* _tmp1_;
		gint _node_size = 0;
		ValaList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _node_index = 0;
		_tmp0_ = self->priv->nodes;
		_tmp1_ = _vala_iterable_ref0 (_tmp0_);
		_node_list = _tmp1_;
		_tmp2_ = _node_list;
		_tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_node_size = _tmp4_;
		_node_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			ValaCodeNode* node = NULL;
			ValaList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_;
			ValaCodeNode* _tmp11_;
			ValaCodeVisitor* _tmp12_;
			_tmp5_ = _node_index;
			_node_index = _tmp5_ + 1;
			_tmp6_ = _node_index;
			_tmp7_ = _node_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _node_list;
			_tmp9_ = _node_index;
			_tmp10_ = vala_list_get (_tmp8_, _tmp9_);
			node = (ValaCodeNode*) _tmp10_;
			_tmp11_ = node;
			_tmp12_ = visitor;
			vala_code_node_accept (_tmp11_, _tmp12_);
			_vala_code_node_unref0 (node);
		}
		_vala_iterable_unref0 (_node_list);
	}
}


static glong string_strnlen (gchar* str, glong maxlen) {
	glong result = 0L;
	gchar* end = NULL;
	gchar* _tmp0_;
	glong _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	_tmp0_ = str;
	_tmp1_ = maxlen;
	_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
	end = _tmp2_;
	_tmp3_ = end;
	if (_tmp3_ == NULL) {
		glong _tmp4_;
		_tmp4_ = maxlen;
		result = _tmp4_;
		return result;
	} else {
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = end;
		_tmp6_ = str;
		result = (glong) (_tmp5_ - _tmp6_);
		return result;
	}
}


static gchar* string_substring (const gchar* self, glong offset, glong len) {
	gchar* result = NULL;
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	glong _tmp1_;
	glong _tmp8_;
	glong _tmp14_;
	glong _tmp17_;
	glong _tmp18_;
	glong _tmp19_;
	glong _tmp20_;
	glong _tmp21_;
	gchar* _tmp22_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = offset;
	if (_tmp1_ >= ((glong) 0)) {
		glong _tmp2_;
		_tmp2_ = len;
		_tmp0_ = _tmp2_ >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		glong _tmp3_;
		glong _tmp4_;
		glong _tmp5_;
		_tmp3_ = offset;
		_tmp4_ = len;
		_tmp5_ = string_strnlen ((gchar*) self, _tmp3_ + _tmp4_);
		string_length = _tmp5_;
	} else {
		gint _tmp6_;
		gint _tmp7_;
		_tmp6_ = strlen (self);
		_tmp7_ = _tmp6_;
		string_length = (glong) _tmp7_;
	}
	_tmp8_ = offset;
	if (_tmp8_ < ((glong) 0)) {
		glong _tmp9_;
		glong _tmp10_;
		glong _tmp11_;
		_tmp9_ = string_length;
		_tmp10_ = offset;
		offset = _tmp9_ + _tmp10_;
		_tmp11_ = offset;
		g_return_val_if_fail (_tmp11_ >= ((glong) 0), NULL);
	} else {
		glong _tmp12_;
		glong _tmp13_;
		_tmp12_ = offset;
		_tmp13_ = string_length;
		g_return_val_if_fail (_tmp12_ <= _tmp13_, NULL);
	}
	_tmp14_ = len;
	if (_tmp14_ < ((glong) 0)) {
		glong _tmp15_;
		glong _tmp16_;
		_tmp15_ = string_length;
		_tmp16_ = offset;
		len = _tmp15_ - _tmp16_;
	}
	_tmp17_ = offset;
	_tmp18_ = len;
	_tmp19_ = string_length;
	g_return_val_if_fail ((_tmp17_ + _tmp18_) <= _tmp19_, NULL);
	_tmp20_ = offset;
	_tmp21_ = len;
	_tmp22_ = g_strndup (((gchar*) self) + _tmp20_, (gsize) _tmp21_);
	result = _tmp22_;
	return result;
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_;
	gchar _tmp1_;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = index;
	_tmp1_ = ((gchar*) self)[_tmp0_];
	result = _tmp1_;
	return result;
}


static gchar* vala_source_file_get_subdir (ValaSourceFile* self) {
	gchar* result = NULL;
	ValaCodeContext* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp4_;
	ValaCodeContext* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	gchar* _tmp36_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_context;
	_tmp1_ = vala_code_context_get_basedir (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup ("");
		result = _tmp3_;
		return result;
	}
	_tmp4_ = self->priv->_filename;
	_tmp5_ = self->priv->_context;
	_tmp6_ = vala_code_context_get_basedir (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strconcat (_tmp7_, "/", NULL);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_str_has_prefix (_tmp4_, _tmp9_);
	_tmp11_ = _tmp10_;
	_g_free0 (_tmp9_);
	if (_tmp11_) {
		gchar* basename = NULL;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* subdir = NULL;
		const gchar* _tmp14_;
		ValaCodeContext* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		gint _tmp18_;
		gint _tmp19_;
		const gchar* _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
		ValaCodeContext* _tmp23_;
		const gchar* _tmp24_;
		const gchar* _tmp25_;
		gint _tmp26_;
		gint _tmp27_;
		const gchar* _tmp28_;
		gint _tmp29_;
		gint _tmp30_;
		gchar* _tmp31_;
		_tmp12_ = self->priv->_filename;
		_tmp13_ = g_path_get_basename (_tmp12_);
		basename = _tmp13_;
		_tmp14_ = self->priv->_filename;
		_tmp15_ = self->priv->_context;
		_tmp16_ = vala_code_context_get_basedir (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = strlen (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = self->priv->_filename;
		_tmp21_ = strlen (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = self->priv->_context;
		_tmp24_ = vala_code_context_get_basedir (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp26_ = strlen (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = basename;
		_tmp29_ = strlen (_tmp28_);
		_tmp30_ = _tmp29_;
		_tmp31_ = string_substring (_tmp14_, (glong) _tmp19_, (glong) ((_tmp22_ - _tmp27_) - _tmp30_));
		subdir = _tmp31_;
		while (TRUE) {
			const gchar* _tmp32_;
			gchar _tmp33_;
			const gchar* _tmp34_;
			gchar* _tmp35_;
			_tmp32_ = subdir;
			_tmp33_ = string_get (_tmp32_, (glong) 0);
			if (!(_tmp33_ == '/')) {
				break;
			}
			_tmp34_ = subdir;
			_tmp35_ = string_substring (_tmp34_, (glong) 1, (glong) -1);
			_g_free0 (subdir);
			subdir = _tmp35_;
		}
		result = subdir;
		_g_free0 (basename);
		return result;
	}
	_tmp36_ = g_strdup ("");
	result = _tmp36_;
	return result;
}


static gchar* vala_source_file_get_destination_directory (ValaSourceFile* self) {
	gchar* result = NULL;
	ValaCodeContext* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	ValaCodeContext* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_context;
	_tmp1_ = vala_code_context_get_directory (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		gchar* _tmp3_;
		_tmp3_ = vala_source_file_get_subdir (self);
		result = _tmp3_;
		return result;
	}
	_tmp4_ = self->priv->_context;
	_tmp5_ = vala_code_context_get_directory (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = vala_source_file_get_subdir (self);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_build_path ("/", _tmp6_, _tmp8_, NULL);
	_tmp10_ = _tmp9_;
	_g_free0 (_tmp8_);
	result = _tmp10_;
	return result;
}


static gint string_last_index_of_char (const gchar* self, gunichar c, gint start_index) {
	gint result = 0;
	gchar* _result_ = NULL;
	gint _tmp0_;
	gunichar _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = start_index;
	_tmp1_ = c;
	_tmp2_ = g_utf8_strrchr (((gchar*) self) + _tmp0_, (gssize) -1, _tmp1_);
	_result_ = _tmp2_;
	_tmp3_ = _result_;
	if (_tmp3_ != NULL) {
		gchar* _tmp4_;
		_tmp4_ = _result_;
		result = (gint) (_tmp4_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}


static gchar* vala_source_file_get_basename (ValaSourceFile* self) {
	gchar* result = NULL;
	gint dot = 0;
	const gchar* _tmp0_;
	gint _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_filename;
	_tmp1_ = string_last_index_of_char (_tmp0_, (gunichar) '.', 0);
	dot = _tmp1_;
	_tmp2_ = self->priv->_filename;
	_tmp3_ = string_substring (_tmp2_, (glong) 0, (glong) dot);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_path_get_basename (_tmp4_);
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	result = _tmp6_;
	return result;
}


gchar* vala_source_file_get_relative_filename (ValaSourceFile* self) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_relative_filename;
	if (_tmp0_ != NULL) {
		const gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = self->priv->_relative_filename;
		_tmp2_ = g_strdup (_tmp1_);
		result = _tmp2_;
		return result;
	} else {
		const gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = self->priv->_filename;
		_tmp4_ = g_path_get_basename (_tmp3_);
		result = _tmp4_;
		return result;
	}
}


/**
 * Returns the filename to use when generating C source files.
 *
 * @return generated C source filename
 */
gchar* vala_source_file_get_csource_filename (ValaSourceFile* self) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->csource_filename;
	if (_tmp0_ == NULL) {
		ValaCodeContext* _tmp1_;
		gboolean _tmp2_;
		gboolean _tmp3_;
		_tmp1_ = self->priv->_context;
		_tmp2_ = vala_code_context_get_run_output (_tmp1_);
		_tmp3_ = _tmp2_;
		if (_tmp3_) {
			ValaCodeContext* _tmp4_;
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			gchar* _tmp7_;
			_tmp4_ = self->priv->_context;
			_tmp5_ = vala_code_context_get_output (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp7_ = g_strconcat (_tmp6_, ".c", NULL);
			_g_free0 (self->priv->csource_filename);
			self->priv->csource_filename = _tmp7_;
		} else {
			gboolean _tmp8_ = FALSE;
			ValaCodeContext* _tmp9_;
			gboolean _tmp10_;
			gboolean _tmp11_;
			_tmp9_ = self->priv->_context;
			_tmp10_ = vala_code_context_get_ccode_only (_tmp9_);
			_tmp11_ = _tmp10_;
			if (_tmp11_) {
				_tmp8_ = TRUE;
			} else {
				ValaCodeContext* _tmp12_;
				gboolean _tmp13_;
				gboolean _tmp14_;
				_tmp12_ = self->priv->_context;
				_tmp13_ = vala_code_context_get_save_csources (_tmp12_);
				_tmp14_ = _tmp13_;
				_tmp8_ = _tmp14_;
			}
			if (_tmp8_) {
				gchar* _tmp15_;
				gchar* _tmp16_;
				gchar* _tmp17_;
				gchar* _tmp18_;
				gchar* _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				_tmp15_ = vala_source_file_get_destination_directory (self);
				_tmp16_ = _tmp15_;
				_tmp17_ = vala_source_file_get_basename (self);
				_tmp18_ = _tmp17_;
				_tmp19_ = g_strconcat (_tmp18_, ".c", NULL);
				_tmp20_ = _tmp19_;
				_tmp21_ = g_build_path ("/", _tmp16_, _tmp20_, NULL);
				_g_free0 (self->priv->csource_filename);
				self->priv->csource_filename = _tmp21_;
				_g_free0 (_tmp20_);
				_g_free0 (_tmp18_);
				_g_free0 (_tmp16_);
			} else {
				gchar* _tmp22_;
				gchar* _tmp23_;
				gchar* _tmp24_;
				gchar* _tmp25_;
				gchar* _tmp26_;
				gchar* _tmp27_;
				gchar* _tmp28_;
				_tmp22_ = vala_source_file_get_destination_directory (self);
				_tmp23_ = _tmp22_;
				_tmp24_ = vala_source_file_get_basename (self);
				_tmp25_ = _tmp24_;
				_tmp26_ = g_strconcat (_tmp25_, ".vala.c", NULL);
				_tmp27_ = _tmp26_;
				_tmp28_ = g_build_path ("/", _tmp23_, _tmp27_, NULL);
				_g_free0 (self->priv->csource_filename);
				self->priv->csource_filename = _tmp28_;
				_g_free0 (_tmp27_);
				_g_free0 (_tmp25_);
				_g_free0 (_tmp23_);
			}
		}
	}
	_tmp29_ = self->priv->csource_filename;
	_tmp30_ = g_strdup (_tmp29_);
	result = _tmp30_;
	return result;
}


/**
 * Returns the filename to use when including the generated C header
 * file.
 *
 * @return C header filename to include
 */
gchar* vala_source_file_get_cinclude_filename (ValaSourceFile* self) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->cinclude_filename;
	if (_tmp0_ == NULL) {
		ValaCodeContext* _tmp1_;
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		_tmp1_ = self->priv->_context;
		_tmp2_ = vala_code_context_get_header_filename (_tmp1_);
		_tmp3_ = _tmp2_;
		if (_tmp3_ != NULL) {
			ValaCodeContext* _tmp4_;
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			gchar* _tmp7_;
			ValaCodeContext* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			_tmp4_ = self->priv->_context;
			_tmp5_ = vala_code_context_get_header_filename (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp7_ = g_path_get_basename (_tmp6_);
			_g_free0 (self->priv->cinclude_filename);
			self->priv->cinclude_filename = _tmp7_;
			_tmp8_ = self->priv->_context;
			_tmp9_ = vala_code_context_get_includedir (_tmp8_);
			_tmp10_ = _tmp9_;
			if (_tmp10_ != NULL) {
				ValaCodeContext* _tmp11_;
				const gchar* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				gchar* _tmp15_;
				_tmp11_ = self->priv->_context;
				_tmp12_ = vala_code_context_get_includedir (_tmp11_);
				_tmp13_ = _tmp12_;
				_tmp14_ = self->priv->cinclude_filename;
				_tmp15_ = g_build_path ("/", _tmp13_, _tmp14_, NULL);
				_g_free0 (self->priv->cinclude_filename);
				self->priv->cinclude_filename = _tmp15_;
			}
		} else {
			gchar* _tmp16_;
			gchar* _tmp17_;
			gchar* _tmp18_;
			gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			gchar* _tmp22_;
			_tmp16_ = vala_source_file_get_subdir (self);
			_tmp17_ = _tmp16_;
			_tmp18_ = vala_source_file_get_basename (self);
			_tmp19_ = _tmp18_;
			_tmp20_ = g_strconcat (_tmp19_, ".h", NULL);
			_tmp21_ = _tmp20_;
			_tmp22_ = g_build_path ("/", _tmp17_, _tmp21_, NULL);
			_g_free0 (self->priv->cinclude_filename);
			self->priv->cinclude_filename = _tmp22_;
			_g_free0 (_tmp21_);
			_g_free0 (_tmp19_);
			_g_free0 (_tmp17_);
		}
	}
	_tmp23_ = self->priv->cinclude_filename;
	_tmp24_ = g_strdup (_tmp23_);
	result = _tmp24_;
	return result;
}


/**
 * Returns the requested line from this file, loading it if needed.
 *
 * @param lineno 1-based line number
 * @return       the specified source line
 */
gchar* vala_source_file_get_source_line (ValaSourceFile* self, gint lineno) {
	gchar* result = NULL;
	ValaArrayList* _tmp0_;
	gboolean _tmp5_ = FALSE;
	gint _tmp6_;
	ValaArrayList* _tmp11_;
	gint _tmp12_;
	gpointer _tmp13_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->source_array;
	if (_tmp0_ == NULL) {
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		_tmp1_ = vala_source_file_get_content (self);
		_tmp2_ = _tmp1_;
		if (_tmp2_ != NULL) {
			const gchar* _tmp3_;
			const gchar* _tmp4_;
			_tmp3_ = vala_source_file_get_content (self);
			_tmp4_ = _tmp3_;
			vala_source_file_read_source_lines (self, _tmp4_);
		} else {
			vala_source_file_read_source_file (self);
		}
	}
	_tmp6_ = lineno;
	if (_tmp6_ < 1) {
		_tmp5_ = TRUE;
	} else {
		gint _tmp7_;
		ValaArrayList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp7_ = lineno;
		_tmp8_ = self->priv->source_array;
		_tmp9_ = vala_collection_get_size ((ValaCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp5_ = _tmp7_ > _tmp10_;
	}
	if (_tmp5_) {
		result = NULL;
		return result;
	}
	_tmp11_ = self->priv->source_array;
	_tmp12_ = lineno;
	_tmp13_ = vala_list_get ((ValaList*) _tmp11_, _tmp12_ - 1);
	result = (gchar*) _tmp13_;
	return result;
}


/**
 * Parses the input file into ::source_array.
 */
static void vala_source_file_read_source_file (ValaSourceFile* self) {
	gchar* cont = NULL;
	const gchar* _tmp2_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	{
		const gchar* _tmp0_;
		gchar* _tmp1_ = NULL;
		_tmp0_ = self->priv->_filename;
		g_file_get_contents (_tmp0_, &_tmp1_, NULL, &_inner_error_);
		_g_free0 (cont);
		cont = _tmp1_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_FILE_ERROR) {
				goto __catch18_g_file_error;
			}
			_g_free0 (cont);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	goto __finally18;
	__catch18_g_file_error:
	{
		GError* fe = NULL;
		fe = _inner_error_;
		_inner_error_ = NULL;
		_g_error_free0 (fe);
		_g_free0 (cont);
		return;
	}
	__finally18:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_free0 (cont);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp2_ = cont;
	vala_source_file_read_source_lines (self, _tmp2_);
	_g_free0 (cont);
}


static void vala_source_file_read_source_lines (ValaSourceFile* self, const gchar* cont) {
	GEqualFunc _tmp0_;
	ValaArrayList* _tmp1_;
	gchar** lines = NULL;
	const gchar* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gint lines_length1;
	gint _lines_size_;
	gint idx = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cont != NULL);
	_tmp0_ = g_direct_equal;
	_tmp1_ = vala_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp0_);
	_vala_iterable_unref0 (self->priv->source_array);
	self->priv->source_array = _tmp1_;
	_tmp2_ = cont;
	_tmp4_ = _tmp3_ = g_strsplit (_tmp2_, "\n", 0);
	lines = _tmp4_;
	lines_length1 = _vala_array_length (_tmp3_);
	_lines_size_ = lines_length1;
	{
		gboolean _tmp5_ = FALSE;
		idx = 0;
		_tmp5_ = TRUE;
		while (TRUE) {
			gchar** _tmp7_;
			gint _tmp7__length1;
			gint _tmp8_;
			const gchar* _tmp9_;
			ValaArrayList* _tmp10_;
			gchar** _tmp11_;
			gint _tmp11__length1;
			gint _tmp12_;
			const gchar* _tmp13_;
			if (!_tmp5_) {
				gint _tmp6_;
				_tmp6_ = idx;
				idx = _tmp6_ + 1;
			}
			_tmp5_ = FALSE;
			_tmp7_ = lines;
			_tmp7__length1 = lines_length1;
			_tmp8_ = idx;
			_tmp9_ = _tmp7_[_tmp8_];
			if (!(_tmp9_ != NULL)) {
				break;
			}
			_tmp10_ = self->priv->source_array;
			_tmp11_ = lines;
			_tmp11__length1 = lines_length1;
			_tmp12_ = idx;
			_tmp13_ = _tmp11_[_tmp12_];
			vala_collection_add ((ValaCollection*) _tmp10_, _tmp13_);
		}
	}
	lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL);
}


gchar* vala_source_file_get_mapped_contents (ValaSourceFile* self) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GMappedFile* _tmp4_;
	GMappedFile* _tmp14_;
	gchar* _tmp15_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = vala_source_file_get_content (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		_tmp2_ = vala_source_file_get_content (self);
		_tmp3_ = _tmp2_;
		result = (gchar*) _tmp3_;
		return result;
	}
	_tmp4_ = self->priv->mapped_file;
	if (_tmp4_ == NULL) {
		{
			GMappedFile* _tmp5_ = NULL;
			const gchar* _tmp6_;
			GMappedFile* _tmp7_;
			GMappedFile* _tmp8_;
			_tmp6_ = self->priv->_filename;
			_tmp7_ = g_mapped_file_new (_tmp6_, FALSE, &_inner_error_);
			_tmp5_ = _tmp7_;
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				if (_inner_error_->domain == G_FILE_ERROR) {
					goto __catch19_g_file_error;
				}
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return NULL;
			}
			_tmp8_ = _tmp5_;
			_tmp5_ = NULL;
			_g_mapped_file_unref0 (self->priv->mapped_file);
			self->priv->mapped_file = _tmp8_;
			_g_mapped_file_unref0 (_tmp5_);
		}
		goto __finally19;
		__catch19_g_file_error:
		{
			GError* e = NULL;
			const gchar* _tmp9_;
			GError* _tmp10_;
			const gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp9_ = self->priv->_filename;
			_tmp10_ = e;
			_tmp11_ = _tmp10_->message;
			_tmp12_ = g_strdup_printf ("Unable to map file `%s': %s", _tmp9_, _tmp11_);
			_tmp13_ = _tmp12_;
			vala_report_error (NULL, _tmp13_);
			_g_free0 (_tmp13_);
			result = NULL;
			_g_error_free0 (e);
			return result;
		}
		__finally19:
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
	}
	_tmp14_ = self->priv->mapped_file;
	_tmp15_ = g_mapped_file_get_contents (_tmp14_);
	result = _tmp15_;
	return result;
}


gsize vala_source_file_get_mapped_length (ValaSourceFile* self) {
	gsize result = 0UL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GMappedFile* _tmp6_;
	gsize _tmp7_;
	g_return_val_if_fail (self != NULL, 0UL);
	_tmp0_ = vala_source_file_get_content (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		_tmp2_ = vala_source_file_get_content (self);
		_tmp3_ = _tmp2_;
		_tmp4_ = strlen (_tmp3_);
		_tmp5_ = _tmp4_;
		result = (gsize) _tmp5_;
		return result;
	}
	_tmp6_ = self->priv->mapped_file;
	_tmp7_ = g_mapped_file_get_length (_tmp6_);
	result = _tmp7_;
	return result;
}


gboolean vala_source_file_check (ValaSourceFile* self, ValaCodeContext* context) {
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (context != NULL, FALSE);
	{
		ValaList* _node_list = NULL;
		ValaList* _tmp0_;
		ValaList* _tmp1_;
		gint _node_size = 0;
		ValaList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _node_index = 0;
		_tmp0_ = self->priv->nodes;
		_tmp1_ = _vala_iterable_ref0 (_tmp0_);
		_node_list = _tmp1_;
		_tmp2_ = _node_list;
		_tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_node_size = _tmp4_;
		_node_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			ValaCodeNode* node = NULL;
			ValaList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_;
			ValaCodeNode* _tmp11_;
			ValaCodeContext* _tmp12_;
			_tmp5_ = _node_index;
			_node_index = _tmp5_ + 1;
			_tmp6_ = _node_index;
			_tmp7_ = _node_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _node_list;
			_tmp9_ = _node_index;
			_tmp10_ = vala_list_get (_tmp8_, _tmp9_);
			node = (ValaCodeNode*) _tmp10_;
			_tmp11_ = node;
			_tmp12_ = context;
			vala_code_node_check (_tmp11_, _tmp12_);
			_vala_code_node_unref0 (node);
		}
		_vala_iterable_unref0 (_node_list);
	}
	result = TRUE;
	return result;
}


const gchar* vala_source_file_get_filename (ValaSourceFile* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_filename;
	result = _tmp0_;
	return result;
}


void vala_source_file_set_filename (ValaSourceFile* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_filename);
	self->priv->_filename = _tmp1_;
}


void vala_source_file_set_relative_filename (ValaSourceFile* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_relative_filename);
	self->priv->_relative_filename = _tmp1_;
}


static gchar* string_slice (const gchar* self, glong start, glong end) {
	gchar* result = NULL;
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	glong _tmp2_;
	glong _tmp5_;
	gboolean _tmp8_ = FALSE;
	glong _tmp9_;
	gboolean _tmp12_ = FALSE;
	glong _tmp13_;
	glong _tmp16_;
	glong _tmp17_;
	glong _tmp18_;
	glong _tmp19_;
	glong _tmp20_;
	gchar* _tmp21_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	_tmp2_ = start;
	if (_tmp2_ < ((glong) 0)) {
		glong _tmp3_;
		glong _tmp4_;
		_tmp3_ = string_length;
		_tmp4_ = start;
		start = _tmp3_ + _tmp4_;
	}
	_tmp5_ = end;
	if (_tmp5_ < ((glong) 0)) {
		glong _tmp6_;
		glong _tmp7_;
		_tmp6_ = string_length;
		_tmp7_ = end;
		end = _tmp6_ + _tmp7_;
	}
	_tmp9_ = start;
	if (_tmp9_ >= ((glong) 0)) {
		glong _tmp10_;
		glong _tmp11_;
		_tmp10_ = start;
		_tmp11_ = string_length;
		_tmp8_ = _tmp10_ <= _tmp11_;
	} else {
		_tmp8_ = FALSE;
	}
	g_return_val_if_fail (_tmp8_, NULL);
	_tmp13_ = end;
	if (_tmp13_ >= ((glong) 0)) {
		glong _tmp14_;
		glong _tmp15_;
		_tmp14_ = end;
		_tmp15_ = string_length;
		_tmp12_ = _tmp14_ <= _tmp15_;
	} else {
		_tmp12_ = FALSE;
	}
	g_return_val_if_fail (_tmp12_, NULL);
	_tmp16_ = start;
	_tmp17_ = end;
	g_return_val_if_fail (_tmp16_ <= _tmp17_, NULL);
	_tmp18_ = start;
	_tmp19_ = end;
	_tmp20_ = start;
	_tmp21_ = g_strndup (((gchar*) self) + _tmp18_, (gsize) (_tmp19_ - _tmp20_));
	result = _tmp21_;
	return result;
}


const gchar* vala_source_file_get_package_name (ValaSourceFile* self) {
	const gchar* result;
	ValaSourceFileType _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp8_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file_type;
	if (_tmp0_ != VALA_SOURCE_FILE_TYPE_PACKAGE) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->priv->_package_name;
	if (_tmp1_ == NULL) {
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		gint _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp2_ = self->priv->_filename;
		_tmp3_ = self->priv->_filename;
		_tmp4_ = string_last_index_of_char (_tmp3_, (gunichar) '.', 0);
		_tmp5_ = string_slice (_tmp2_, (glong) 0, (glong) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = g_path_get_basename (_tmp6_);
		_g_free0 (self->priv->_package_name);
		self->priv->_package_name = _tmp7_;
		_g_free0 (_tmp6_);
	}
	_tmp8_ = self->priv->_package_name;
	result = _tmp8_;
	return result;
}


void vala_source_file_set_package_name (ValaSourceFile* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_package_name);
	self->priv->_package_name = _tmp1_;
}


const gchar* vala_source_file_get_installed_version (ValaSourceFile* self) {
	const gchar* result;
	gboolean _tmp0_;
	gchar* pkg_config_name = NULL;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* standard_output = NULL;
	gint exit_status = 0;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp17_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_version_requested;
	if (_tmp0_) {
		const gchar* _tmp1_;
		_tmp1_ = self->priv->_installed_version;
		result = _tmp1_;
		return result;
	}
	self->priv->_version_requested = TRUE;
	_tmp2_ = vala_source_file_get_package_name (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup (_tmp3_);
	pkg_config_name = _tmp4_;
	_tmp5_ = pkg_config_name;
	if (_tmp5_ == NULL) {
		result = NULL;
		_g_free0 (pkg_config_name);
		return result;
	}
	{
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_ = NULL;
		gint _tmp10_ = 0;
		gint _tmp11_;
		_tmp6_ = pkg_config_name;
		_tmp7_ = g_strdup_printf ("pkg-config --silence-errors --modversion %s", _tmp6_);
		_tmp8_ = _tmp7_;
		g_spawn_command_line_sync (_tmp8_, &_tmp9_, NULL, &_tmp10_, &_inner_error_);
		_g_free0 (standard_output);
		standard_output = _tmp9_;
		exit_status = _tmp10_;
		_g_free0 (_tmp8_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_SPAWN_ERROR) {
				goto __catch20_g_spawn_error;
			}
			_g_free0 (standard_output);
			_g_free0 (pkg_config_name);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
		_tmp11_ = exit_status;
		if (_tmp11_ != 0) {
			result = NULL;
			_g_free0 (standard_output);
			_g_free0 (pkg_config_name);
			return result;
		}
	}
	goto __finally20;
	__catch20_g_spawn_error:
	{
		GError* err = NULL;
		err = _inner_error_;
		_inner_error_ = NULL;
		result = NULL;
		_g_error_free0 (err);
		_g_free0 (standard_output);
		_g_free0 (pkg_config_name);
		return result;
	}
	__finally20:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_free0 (standard_output);
		_g_free0 (pkg_config_name);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	_tmp12_ = standard_output;
	_tmp13_ = string_slice (_tmp12_, (glong) 0, (glong) -1);
	_g_free0 (standard_output);
	standard_output = _tmp13_;
	_tmp14_ = standard_output;
	if (g_strcmp0 (_tmp14_, "") != 0) {
		const gchar* _tmp15_;
		gchar* _tmp16_;
		_tmp15_ = standard_output;
		_tmp16_ = g_strdup (_tmp15_);
		_g_free0 (self->priv->_installed_version);
		self->priv->_installed_version = _tmp16_;
	}
	_tmp17_ = self->priv->_installed_version;
	result = _tmp17_;
	_g_free0 (standard_output);
	_g_free0 (pkg_config_name);
	return result;
}


void vala_source_file_set_installed_version (ValaSourceFile* self, const gchar* value) {
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_version_requested = _tmp0_ != NULL;
	_tmp1_ = value;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->priv->_installed_version);
	self->priv->_installed_version = _tmp2_;
}


ValaSourceFileType vala_source_file_get_file_type (ValaSourceFile* self) {
	ValaSourceFileType result;
	ValaSourceFileType _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_file_type;
	result = _tmp0_;
	return result;
}


void vala_source_file_set_file_type (ValaSourceFile* self, ValaSourceFileType value) {
	ValaSourceFileType _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_file_type = _tmp0_;
}


gboolean vala_source_file_get_from_commandline (ValaSourceFile* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_from_commandline;
	result = _tmp0_;
	return result;
}


void vala_source_file_set_from_commandline (ValaSourceFile* self, gboolean value) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_from_commandline = _tmp0_;
}


const gchar* vala_source_file_get_gir_namespace (ValaSourceFile* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_gir_namespace;
	result = _tmp0_;
	return result;
}


void vala_source_file_set_gir_namespace (ValaSourceFile* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_gir_namespace);
	self->priv->_gir_namespace = _tmp1_;
}


const gchar* vala_source_file_get_gir_version (ValaSourceFile* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_gir_version;
	result = _tmp0_;
	return result;
}


void vala_source_file_set_gir_version (ValaSourceFile* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_gir_version);
	self->priv->_gir_version = _tmp1_;
}


ValaCodeContext* vala_source_file_get_context (ValaSourceFile* self) {
	ValaCodeContext* result;
	ValaCodeContext* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_context;
	result = _tmp0_;
	return result;
}


void vala_source_file_set_context (ValaSourceFile* self, ValaCodeContext* value) {
	ValaCodeContext* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_context = _tmp0_;
}


const gchar* vala_source_file_get_content (ValaSourceFile* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content;
	result = _tmp0_;
	return result;
}


void vala_source_file_set_content (ValaSourceFile* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_content);
	self->priv->_content = _tmp1_;
	_vala_iterable_unref0 (self->priv->source_array);
	self->priv->source_array = NULL;
}


gboolean vala_source_file_get_used (ValaSourceFile* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_used;
	result = _tmp0_;
	return result;
}


void vala_source_file_set_used (ValaSourceFile* self, gboolean value) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_used = _tmp0_;
}


ValaList* vala_source_file_get_current_using_directives (ValaSourceFile* self) {
	ValaList* result;
	ValaList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_current_using_directives;
	result = _tmp0_;
	return result;
}


void vala_source_file_set_current_using_directives (ValaSourceFile* self, ValaList* value) {
	ValaList* _tmp0_;
	ValaList* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_iterable_ref0 (_tmp0_);
	_vala_iterable_unref0 (self->priv->_current_using_directives);
	self->priv->_current_using_directives = _tmp1_;
}


static void vala_value_source_file_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void vala_value_source_file_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		vala_source_file_unref (value->data[0].v_pointer);
	}
}


static void vala_value_source_file_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = vala_source_file_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer vala_value_source_file_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* vala_value_source_file_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		ValaSourceFile * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = vala_source_file_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* vala_value_source_file_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	ValaSourceFile ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = vala_source_file_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* vala_param_spec_source_file (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ValaParamSpecSourceFile* spec;
	g_return_val_if_fail (g_type_is_a (object_type, VALA_TYPE_SOURCE_FILE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer vala_value_get_source_file (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VALA_TYPE_SOURCE_FILE), NULL);
	return value->data[0].v_pointer;
}


void vala_value_set_source_file (GValue* value, gpointer v_object) {
	ValaSourceFile * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VALA_TYPE_SOURCE_FILE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, VALA_TYPE_SOURCE_FILE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		vala_source_file_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		vala_source_file_unref (old);
	}
}


void vala_value_take_source_file (GValue* value, gpointer v_object) {
	ValaSourceFile * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VALA_TYPE_SOURCE_FILE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, VALA_TYPE_SOURCE_FILE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		vala_source_file_unref (old);
	}
}


static void vala_source_file_class_init (ValaSourceFileClass * klass) {
	vala_source_file_parent_class = g_type_class_peek_parent (klass);
	((ValaSourceFileClass *) klass)->finalize = vala_source_file_finalize;
	g_type_class_add_private (klass, sizeof (ValaSourceFilePrivate));
}


static void vala_source_file_instance_init (ValaSourceFile * self) {
	GEqualFunc _tmp0_;
	ValaArrayList* _tmp1_;
	GEqualFunc _tmp2_;
	ValaArrayList* _tmp3_;
	GEqualFunc _tmp4_;
	ValaArrayList* _tmp5_;
	self->priv = VALA_SOURCE_FILE_GET_PRIVATE (self);
	self->priv->_installed_version = NULL;
	self->priv->_version_requested = FALSE;
	_tmp0_ = g_direct_equal;
	_tmp1_ = vala_array_list_new (VALA_TYPE_COMMENT, (GBoxedCopyFunc) vala_comment_ref, (GDestroyNotify) vala_comment_unref, _tmp0_);
	self->priv->comments = _tmp1_;
	_tmp2_ = g_direct_equal;
	_tmp3_ = vala_array_list_new (VALA_TYPE_USING_DIRECTIVE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp2_);
	self->priv->_current_using_directives = (ValaList*) _tmp3_;
	_tmp4_ = g_direct_equal;
	_tmp5_ = vala_array_list_new (VALA_TYPE_CODE_NODE, (GBoxedCopyFunc) vala_code_node_ref, (GDestroyNotify) vala_code_node_unref, _tmp4_);
	self->priv->nodes = (ValaList*) _tmp5_;
	self->priv->csource_filename = NULL;
	self->priv->cinclude_filename = NULL;
	self->priv->source_array = NULL;
	self->priv->mapped_file = NULL;
	self->priv->_content = NULL;
	self->ref_count = 1;
}


static void vala_source_file_finalize (ValaSourceFile * obj) {
	ValaSourceFile * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_SOURCE_FILE, ValaSourceFile);
	g_signal_handlers_destroy (self);
	_g_free0 (self->priv->_filename);
	_g_free0 (self->priv->_package_name);
	_g_free0 (self->priv->_installed_version);
	_g_free0 (self->priv->_gir_namespace);
	_g_free0 (self->priv->_gir_version);
	_vala_iterable_unref0 (self->priv->comments);
	_vala_iterable_unref0 (self->priv->_current_using_directives);
	_vala_iterable_unref0 (self->priv->nodes);
	_g_free0 (self->priv->_relative_filename);
	_g_free0 (self->priv->csource_filename);
	_g_free0 (self->priv->cinclude_filename);
	_vala_iterable_unref0 (self->priv->source_array);
	_g_mapped_file_unref0 (self->priv->mapped_file);
	_g_free0 (self->priv->_content);
}


/**
 * Represents a Vala source or VAPI package file.
 */
GType vala_source_file_get_type (void) {
	static volatile gsize vala_source_file_type_id__volatile = 0;
	if (g_once_init_enter (&vala_source_file_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { vala_value_source_file_init, vala_value_source_file_free_value, vala_value_source_file_copy_value, vala_value_source_file_peek_pointer, "p", vala_value_source_file_collect_value, "p", vala_value_source_file_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (ValaSourceFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_source_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaSourceFile), 0, (GInstanceInitFunc) vala_source_file_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType vala_source_file_type_id;
		vala_source_file_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ValaSourceFile", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&vala_source_file_type_id__volatile, vala_source_file_type_id);
	}
	return vala_source_file_type_id__volatile;
}


gpointer vala_source_file_ref (gpointer instance) {
	ValaSourceFile * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void vala_source_file_unref (gpointer instance) {
	ValaSourceFile * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		VALA_SOURCE_FILE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


GType vala_source_file_type_get_type (void) {
	static volatile gsize vala_source_file_type_type_id__volatile = 0;
	if (g_once_init_enter (&vala_source_file_type_type_id__volatile)) {
		static const GEnumValue values[] = {{VALA_SOURCE_FILE_TYPE_NONE, "VALA_SOURCE_FILE_TYPE_NONE", "none"}, {VALA_SOURCE_FILE_TYPE_SOURCE, "VALA_SOURCE_FILE_TYPE_SOURCE", "source"}, {VALA_SOURCE_FILE_TYPE_PACKAGE, "VALA_SOURCE_FILE_TYPE_PACKAGE", "package"}, {VALA_SOURCE_FILE_TYPE_FAST, "VALA_SOURCE_FILE_TYPE_FAST", "fast"}, {0, NULL, NULL}};
		GType vala_source_file_type_type_id;
		vala_source_file_type_type_id = g_enum_register_static ("ValaSourceFileType", values);
		g_once_init_leave (&vala_source_file_type_type_id__volatile, vala_source_file_type_type_id);
	}
	return vala_source_file_type_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



