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

/* valaccodefunction.vala
 *
 * Copyright (C) 2006-2012  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 "valaccode.h"
#include <stdlib.h>
#include <string.h>
#include <valagee.h>

#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_ccode_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_node_unref (var), NULL)))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _ValaCCodeFunctionPrivate {
	gchar* _name;
	gchar* _return_type;
	gboolean _is_declaration;
	ValaCCodeBlock* _block;
	ValaCCodeLineDirective* _current_line;
	ValaCCodeBlock* _current_block;
	ValaList* parameters;
	ValaList* statement_stack;
};


static gpointer vala_ccode_function_parent_class = NULL;

#define VALA_CCODE_FUNCTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_CCODE_FUNCTION, ValaCCodeFunctionPrivate))
static void vala_ccode_function_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer);
static void vala_ccode_function_finalize (ValaCCodeNode * obj);


ValaCCodeFunction* vala_ccode_function_construct (GType object_type, const gchar* name, const gchar* return_type) {
	ValaCCodeFunction* self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ValaCCodeBlock* _tmp2_;
	ValaCCodeBlock* _tmp3_;
	ValaCCodeBlock* _tmp4_;
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (return_type != NULL, NULL);
	self = (ValaCCodeFunction*) vala_ccode_node_construct (object_type);
	_tmp0_ = name;
	vala_ccode_function_set_name (self, _tmp0_);
	_tmp1_ = return_type;
	vala_ccode_function_set_return_type (self, _tmp1_);
	_tmp2_ = vala_ccode_block_new ();
	_tmp3_ = _tmp2_;
	vala_ccode_function_set_block (self, _tmp3_);
	_vala_ccode_node_unref0 (_tmp3_);
	_tmp4_ = self->priv->_block;
	vala_ccode_function_set_current_block (self, _tmp4_);
	return self;
}


ValaCCodeFunction* vala_ccode_function_new (const gchar* name, const gchar* return_type) {
	return vala_ccode_function_construct (VALA_TYPE_CCODE_FUNCTION, name, return_type);
}


/**
 * Appends the specified parameter to the list of function parameters.
 *
 * @param param a formal parameter
 */
void vala_ccode_function_add_parameter (ValaCCodeFunction* self, ValaCCodeParameter* param) {
	ValaList* _tmp0_;
	ValaCCodeParameter* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (param != NULL);
	_tmp0_ = self->priv->parameters;
	_tmp1_ = param;
	vala_collection_add ((ValaCollection*) _tmp0_, _tmp1_);
}


void vala_ccode_function_insert_parameter (ValaCCodeFunction* self, gint position, ValaCCodeParameter* param) {
	ValaList* _tmp0_;
	gint _tmp1_;
	ValaCCodeParameter* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (param != NULL);
	_tmp0_ = self->priv->parameters;
	_tmp1_ = position;
	_tmp2_ = param;
	vala_list_insert (_tmp0_, _tmp1_, _tmp2_);
}


gint vala_ccode_function_get_parameter_count (ValaCCodeFunction* self) {
	gint result = 0;
	ValaList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->parameters;
	_tmp1_ = vala_collection_get_size ((ValaCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


ValaCCodeParameter* vala_ccode_function_get_parameter (ValaCCodeFunction* self, gint position) {
	ValaCCodeParameter* result = NULL;
	ValaList* _tmp0_;
	gint _tmp1_;
	gpointer _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->parameters;
	_tmp1_ = position;
	_tmp2_ = vala_list_get (_tmp0_, _tmp1_);
	result = (ValaCCodeParameter*) _tmp2_;
	return result;
}


/**
 * Returns a copy of this function.
 *
 * @return copied function
 */
static gpointer _vala_iterable_ref0 (gpointer self) {
	return self ? vala_iterable_ref (self) : NULL;
}


ValaCCodeFunction* vala_ccode_function_copy (ValaCCodeFunction* self) {
	ValaCCodeFunction* result = NULL;
	ValaCCodeFunction* func = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ValaCCodeFunction* _tmp2_;
	ValaCCodeFunction* _tmp3_;
	ValaCCodeModifiers _tmp4_;
	ValaCCodeModifiers _tmp5_;
	ValaCCodeFunction* _tmp20_;
	gboolean _tmp21_;
	ValaCCodeFunction* _tmp22_;
	ValaCCodeBlock* _tmp23_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name;
	_tmp1_ = self->priv->_return_type;
	_tmp2_ = vala_ccode_function_new (_tmp0_, _tmp1_);
	func = _tmp2_;
	_tmp3_ = func;
	_tmp4_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
	_tmp5_ = _tmp4_;
	vala_ccode_node_set_modifiers ((ValaCCodeNode*) _tmp3_, _tmp5_);
	{
		ValaList* _param_list = NULL;
		ValaList* _tmp6_;
		ValaList* _tmp7_;
		gint _param_size = 0;
		ValaList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gint _param_index = 0;
		_tmp6_ = self->priv->parameters;
		_tmp7_ = _vala_iterable_ref0 (_tmp6_);
		_param_list = _tmp7_;
		_tmp8_ = _param_list;
		_tmp9_ = vala_collection_get_size ((ValaCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		_param_size = _tmp10_;
		_param_index = -1;
		while (TRUE) {
			gint _tmp11_;
			gint _tmp12_;
			gint _tmp13_;
			ValaCCodeParameter* param = NULL;
			ValaList* _tmp14_;
			gint _tmp15_;
			gpointer _tmp16_;
			ValaCCodeFunction* _tmp17_;
			ValaList* _tmp18_;
			ValaCCodeParameter* _tmp19_;
			_tmp11_ = _param_index;
			_param_index = _tmp11_ + 1;
			_tmp12_ = _param_index;
			_tmp13_ = _param_size;
			if (!(_tmp12_ < _tmp13_)) {
				break;
			}
			_tmp14_ = _param_list;
			_tmp15_ = _param_index;
			_tmp16_ = vala_list_get (_tmp14_, _tmp15_);
			param = (ValaCCodeParameter*) _tmp16_;
			_tmp17_ = func;
			_tmp18_ = _tmp17_->priv->parameters;
			_tmp19_ = param;
			vala_collection_add ((ValaCollection*) _tmp18_, _tmp19_);
			_vala_ccode_node_unref0 (param);
		}
		_vala_iterable_unref0 (_param_list);
	}
	_tmp20_ = func;
	_tmp21_ = self->priv->_is_declaration;
	vala_ccode_function_set_is_declaration (_tmp20_, _tmp21_);
	_tmp22_ = func;
	_tmp23_ = self->priv->_block;
	vala_ccode_function_set_block (_tmp22_, _tmp23_);
	result = func;
	return result;
}


static void vala_ccode_function_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer) {
	ValaCCodeFunction * self;
	ValaCCodeWriter* _tmp0_;
	ValaCCodeLineDirective* _tmp1_;
	ValaCCodeLineDirective* _tmp2_;
	ValaCCodeModifiers _tmp3_;
	ValaCCodeModifiers _tmp4_;
	ValaCCodeModifiers _tmp6_;
	ValaCCodeModifiers _tmp7_;
	ValaCCodeModifiers _tmp9_;
	ValaCCodeModifiers _tmp10_;
	ValaCCodeWriter* _tmp12_;
	const gchar* _tmp13_;
	ValaCCodeWriter* _tmp14_;
	ValaCCodeWriter* _tmp15_;
	const gchar* _tmp16_;
	ValaCCodeWriter* _tmp17_;
	gboolean _tmp18_ = FALSE;
	ValaCCodeModifiers _tmp19_;
	ValaCCodeModifiers _tmp20_;
	gboolean has_args = FALSE;
	gint i = 0;
	gint format_arg_index = 0;
	gint args_index = 0;
	gint _tmp57_;
	ValaCCodeWriter* _tmp59_;
	gboolean _tmp60_;
	ValaCCodeWriter* _tmp107_;
	self = (ValaCCodeFunction*) base;
	g_return_if_fail (writer != NULL);
	_tmp0_ = writer;
	_tmp1_ = vala_ccode_node_get_line ((ValaCCodeNode*) self);
	_tmp2_ = _tmp1_;
	vala_ccode_writer_write_indent (_tmp0_, _tmp2_);
	_tmp3_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
	_tmp4_ = _tmp3_;
	if ((_tmp4_ & VALA_CCODE_MODIFIERS_INTERNAL) == VALA_CCODE_MODIFIERS_INTERNAL) {
		ValaCCodeWriter* _tmp5_;
		_tmp5_ = writer;
		vala_ccode_writer_write_string (_tmp5_, "G_GNUC_INTERNAL ");
	}
	_tmp6_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
	_tmp7_ = _tmp6_;
	if ((_tmp7_ & VALA_CCODE_MODIFIERS_STATIC) == VALA_CCODE_MODIFIERS_STATIC) {
		ValaCCodeWriter* _tmp8_;
		_tmp8_ = writer;
		vala_ccode_writer_write_string (_tmp8_, "static ");
	}
	_tmp9_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
	_tmp10_ = _tmp9_;
	if ((_tmp10_ & VALA_CCODE_MODIFIERS_INLINE) == VALA_CCODE_MODIFIERS_INLINE) {
		ValaCCodeWriter* _tmp11_;
		_tmp11_ = writer;
		vala_ccode_writer_write_string (_tmp11_, "inline ");
	}
	_tmp12_ = writer;
	_tmp13_ = self->priv->_return_type;
	vala_ccode_writer_write_string (_tmp12_, _tmp13_);
	_tmp14_ = writer;
	vala_ccode_writer_write_string (_tmp14_, " ");
	_tmp15_ = writer;
	_tmp16_ = self->priv->_name;
	vala_ccode_writer_write_string (_tmp15_, _tmp16_);
	_tmp17_ = writer;
	vala_ccode_writer_write_string (_tmp17_, " (");
	_tmp19_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
	_tmp20_ = _tmp19_;
	if ((_tmp20_ & VALA_CCODE_MODIFIERS_PRINTF) == VALA_CCODE_MODIFIERS_PRINTF) {
		_tmp18_ = TRUE;
	} else {
		ValaCCodeModifiers _tmp21_;
		ValaCCodeModifiers _tmp22_;
		_tmp21_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
		_tmp22_ = _tmp21_;
		_tmp18_ = (_tmp22_ & VALA_CCODE_MODIFIERS_SCANF) == VALA_CCODE_MODIFIERS_SCANF;
	}
	has_args = _tmp18_;
	i = 0;
	format_arg_index = -1;
	args_index = -1;
	{
		ValaList* _param_list = NULL;
		ValaList* _tmp23_;
		ValaList* _tmp24_;
		gint _param_size = 0;
		ValaList* _tmp25_;
		gint _tmp26_;
		gint _tmp27_;
		gint _param_index = 0;
		_tmp23_ = self->priv->parameters;
		_tmp24_ = _vala_iterable_ref0 (_tmp23_);
		_param_list = _tmp24_;
		_tmp25_ = _param_list;
		_tmp26_ = vala_collection_get_size ((ValaCollection*) _tmp25_);
		_tmp27_ = _tmp26_;
		_param_size = _tmp27_;
		_param_index = -1;
		while (TRUE) {
			gint _tmp28_;
			gint _tmp29_;
			gint _tmp30_;
			ValaCCodeParameter* param = NULL;
			ValaList* _tmp31_;
			gint _tmp32_;
			gpointer _tmp33_;
			gint _tmp34_;
			ValaCCodeParameter* _tmp36_;
			ValaCCodeWriter* _tmp37_;
			ValaCCodeParameter* _tmp38_;
			ValaCCodeModifiers _tmp39_;
			ValaCCodeModifiers _tmp40_;
			gboolean _tmp42_ = FALSE;
			gboolean _tmp43_;
			gint _tmp56_;
			_tmp28_ = _param_index;
			_param_index = _tmp28_ + 1;
			_tmp29_ = _param_index;
			_tmp30_ = _param_size;
			if (!(_tmp29_ < _tmp30_)) {
				break;
			}
			_tmp31_ = _param_list;
			_tmp32_ = _param_index;
			_tmp33_ = vala_list_get (_tmp31_, _tmp32_);
			param = (ValaCCodeParameter*) _tmp33_;
			_tmp34_ = i;
			if (_tmp34_ > 0) {
				ValaCCodeWriter* _tmp35_;
				_tmp35_ = writer;
				vala_ccode_writer_write_string (_tmp35_, ", ");
			}
			_tmp36_ = param;
			_tmp37_ = writer;
			vala_ccode_node_write ((ValaCCodeNode*) _tmp36_, _tmp37_);
			_tmp38_ = param;
			_tmp39_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) _tmp38_);
			_tmp40_ = _tmp39_;
			if ((_tmp40_ & VALA_CCODE_MODIFIERS_FORMAT_ARG) == VALA_CCODE_MODIFIERS_FORMAT_ARG) {
				gint _tmp41_;
				_tmp41_ = i;
				format_arg_index = _tmp41_;
			}
			_tmp43_ = has_args;
			if (_tmp43_) {
				ValaCCodeParameter* _tmp44_;
				gboolean _tmp45_;
				gboolean _tmp46_;
				_tmp44_ = param;
				_tmp45_ = vala_ccode_parameter_get_ellipsis (_tmp44_);
				_tmp46_ = _tmp45_;
				_tmp42_ = _tmp46_;
			} else {
				_tmp42_ = FALSE;
			}
			if (_tmp42_) {
				gint _tmp47_;
				_tmp47_ = i;
				args_index = _tmp47_;
			} else {
				gboolean _tmp48_ = FALSE;
				gboolean _tmp49_ = FALSE;
				gboolean _tmp50_;
				_tmp50_ = has_args;
				if (_tmp50_) {
					ValaCCodeParameter* _tmp51_;
					const gchar* _tmp52_;
					const gchar* _tmp53_;
					_tmp51_ = param;
					_tmp52_ = vala_ccode_parameter_get_type_name (_tmp51_);
					_tmp53_ = _tmp52_;
					_tmp49_ = g_strcmp0 (_tmp53_, "va_list") == 0;
				} else {
					_tmp49_ = FALSE;
				}
				if (_tmp49_) {
					gint _tmp54_;
					_tmp54_ = format_arg_index;
					_tmp48_ = _tmp54_ < 0;
				} else {
					_tmp48_ = FALSE;
				}
				if (_tmp48_) {
					gint _tmp55_;
					_tmp55_ = i;
					format_arg_index = _tmp55_ - 1;
				}
			}
			_tmp56_ = i;
			i = _tmp56_ + 1;
			_vala_ccode_node_unref0 (param);
		}
		_vala_iterable_unref0 (_param_list);
	}
	_tmp57_ = i;
	if (_tmp57_ == 0) {
		ValaCCodeWriter* _tmp58_;
		_tmp58_ = writer;
		vala_ccode_writer_write_string (_tmp58_, "void");
	}
	_tmp59_ = writer;
	vala_ccode_writer_write_string (_tmp59_, ")");
	_tmp60_ = self->priv->_is_declaration;
	if (_tmp60_) {
		ValaCCodeModifiers _tmp61_;
		ValaCCodeModifiers _tmp62_;
		ValaCCodeModifiers _tmp64_;
		ValaCCodeModifiers _tmp65_;
		ValaCCodeModifiers _tmp91_;
		ValaCCodeModifiers _tmp92_;
		ValaCCodeModifiers _tmp94_;
		ValaCCodeModifiers _tmp95_;
		ValaCCodeModifiers _tmp97_;
		ValaCCodeModifiers _tmp98_;
		ValaCCodeWriter* _tmp103_;
		_tmp61_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
		_tmp62_ = _tmp61_;
		if ((_tmp62_ & VALA_CCODE_MODIFIERS_DEPRECATED) == VALA_CCODE_MODIFIERS_DEPRECATED) {
			ValaCCodeWriter* _tmp63_;
			_tmp63_ = writer;
			vala_ccode_writer_write_string (_tmp63_, " G_GNUC_DEPRECATED");
		}
		_tmp64_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
		_tmp65_ = _tmp64_;
		if ((_tmp65_ & VALA_CCODE_MODIFIERS_PRINTF) == VALA_CCODE_MODIFIERS_PRINTF) {
			gint _tmp66_ = 0;
			gint _tmp67_;
			ValaCCodeWriter* _tmp70_;
			gint _tmp71_;
			gint _tmp72_;
			gchar* _tmp73_;
			gchar* _tmp74_;
			_tmp67_ = format_arg_index;
			if (_tmp67_ >= 0) {
				gint _tmp68_;
				_tmp68_ = format_arg_index;
				_tmp66_ = _tmp68_ + 1;
			} else {
				gint _tmp69_;
				_tmp69_ = args_index;
				_tmp66_ = _tmp69_;
			}
			format_arg_index = _tmp66_;
			_tmp70_ = writer;
			_tmp71_ = format_arg_index;
			_tmp72_ = args_index;
			_tmp73_ = g_strdup_printf (" G_GNUC_PRINTF(%d,%d)", _tmp71_, _tmp72_ + 1);
			_tmp74_ = _tmp73_;
			vala_ccode_writer_write_string (_tmp70_, _tmp74_);
			_g_free0 (_tmp74_);
		} else {
			ValaCCodeModifiers _tmp75_;
			ValaCCodeModifiers _tmp76_;
			_tmp75_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
			_tmp76_ = _tmp75_;
			if ((_tmp76_ & VALA_CCODE_MODIFIERS_SCANF) == VALA_CCODE_MODIFIERS_SCANF) {
				gint _tmp77_ = 0;
				gint _tmp78_;
				ValaCCodeWriter* _tmp81_;
				gint _tmp82_;
				gint _tmp83_;
				gchar* _tmp84_;
				gchar* _tmp85_;
				_tmp78_ = format_arg_index;
				if (_tmp78_ >= 0) {
					gint _tmp79_;
					_tmp79_ = format_arg_index;
					_tmp77_ = _tmp79_ + 1;
				} else {
					gint _tmp80_;
					_tmp80_ = args_index;
					_tmp77_ = _tmp80_;
				}
				format_arg_index = _tmp77_;
				_tmp81_ = writer;
				_tmp82_ = format_arg_index;
				_tmp83_ = args_index;
				_tmp84_ = g_strdup_printf (" G_GNUC_SCANF(%d,%d)", _tmp82_, _tmp83_ + 1);
				_tmp85_ = _tmp84_;
				vala_ccode_writer_write_string (_tmp81_, _tmp85_);
				_g_free0 (_tmp85_);
			} else {
				gint _tmp86_;
				_tmp86_ = format_arg_index;
				if (_tmp86_ >= 0) {
					ValaCCodeWriter* _tmp87_;
					gint _tmp88_;
					gchar* _tmp89_;
					gchar* _tmp90_;
					_tmp87_ = writer;
					_tmp88_ = format_arg_index;
					_tmp89_ = g_strdup_printf (" G_GNUC_FORMAT(%d)", _tmp88_ + 1);
					_tmp90_ = _tmp89_;
					vala_ccode_writer_write_string (_tmp87_, _tmp90_);
					_g_free0 (_tmp90_);
				}
			}
		}
		_tmp91_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
		_tmp92_ = _tmp91_;
		if ((_tmp92_ & VALA_CCODE_MODIFIERS_CONST) == VALA_CCODE_MODIFIERS_CONST) {
			ValaCCodeWriter* _tmp93_;
			_tmp93_ = writer;
			vala_ccode_writer_write_string (_tmp93_, " G_GNUC_CONST");
		}
		_tmp94_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
		_tmp95_ = _tmp94_;
		if ((_tmp95_ & VALA_CCODE_MODIFIERS_UNUSED) == VALA_CCODE_MODIFIERS_UNUSED) {
			ValaCCodeWriter* _tmp96_;
			_tmp96_ = writer;
			vala_ccode_writer_write_string (_tmp96_, " G_GNUC_UNUSED");
		}
		_tmp97_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
		_tmp98_ = _tmp97_;
		if ((_tmp98_ & VALA_CCODE_MODIFIERS_CONSTRUCTOR) == VALA_CCODE_MODIFIERS_CONSTRUCTOR) {
			ValaCCodeWriter* _tmp99_;
			_tmp99_ = writer;
			vala_ccode_writer_write_string (_tmp99_, " __attribute__((constructor))");
		} else {
			ValaCCodeModifiers _tmp100_;
			ValaCCodeModifiers _tmp101_;
			_tmp100_ = vala_ccode_node_get_modifiers ((ValaCCodeNode*) self);
			_tmp101_ = _tmp100_;
			if ((_tmp101_ & VALA_CCODE_MODIFIERS_DESTRUCTOR) == VALA_CCODE_MODIFIERS_DESTRUCTOR) {
				ValaCCodeWriter* _tmp102_;
				_tmp102_ = writer;
				vala_ccode_writer_write_string (_tmp102_, " __attribute__((destructor))");
			}
		}
		_tmp103_ = writer;
		vala_ccode_writer_write_string (_tmp103_, ";");
	} else {
		ValaCCodeBlock* _tmp104_;
		ValaCCodeWriter* _tmp105_;
		ValaCCodeWriter* _tmp106_;
		_tmp104_ = self->priv->_block;
		_tmp105_ = writer;
		vala_ccode_node_write ((ValaCCodeNode*) _tmp104_, _tmp105_);
		_tmp106_ = writer;
		vala_ccode_writer_write_newline (_tmp106_);
	}
	_tmp107_ = writer;
	vala_ccode_writer_write_newline (_tmp107_);
}


void vala_ccode_function_add_statement (ValaCCodeFunction* self, ValaCCodeNode* stmt) {
	ValaCCodeNode* _tmp0_;
	ValaCCodeLineDirective* _tmp1_;
	ValaCCodeBlock* _tmp2_;
	ValaCCodeNode* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stmt != NULL);
	_tmp0_ = stmt;
	_tmp1_ = self->priv->_current_line;
	vala_ccode_node_set_line (_tmp0_, _tmp1_);
	_tmp2_ = self->priv->_current_block;
	_tmp3_ = stmt;
	vala_ccode_block_add_statement (_tmp2_, _tmp3_);
}


static gpointer _vala_ccode_node_ref0 (gpointer self) {
	return self ? vala_ccode_node_ref (self) : NULL;
}


void vala_ccode_function_open_block (ValaCCodeFunction* self) {
	ValaList* _tmp0_;
	ValaCCodeBlock* _tmp1_;
	ValaCCodeBlock* parent_block = NULL;
	ValaCCodeBlock* _tmp2_;
	ValaCCodeBlock* _tmp3_;
	ValaCCodeBlock* _tmp4_;
	ValaCCodeBlock* _tmp5_;
	ValaCCodeBlock* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->statement_stack;
	_tmp1_ = self->priv->_current_block;
	vala_collection_add ((ValaCollection*) _tmp0_, (ValaCCodeStatement*) _tmp1_);
	_tmp2_ = self->priv->_current_block;
	_tmp3_ = _vala_ccode_node_ref0 (_tmp2_);
	parent_block = _tmp3_;
	_tmp4_ = vala_ccode_block_new ();
	_tmp5_ = _tmp4_;
	vala_ccode_function_set_current_block (self, _tmp5_);
	_vala_ccode_node_unref0 (_tmp5_);
	_tmp6_ = self->priv->_current_block;
	vala_ccode_block_add_statement (parent_block, (ValaCCodeNode*) _tmp6_);
	_vala_ccode_node_unref0 (parent_block);
}


void vala_ccode_function_open_if (ValaCCodeFunction* self, ValaCCodeExpression* condition) {
	ValaList* _tmp0_;
	ValaCCodeBlock* _tmp1_;
	ValaCCodeBlock* parent_block = NULL;
	ValaCCodeBlock* _tmp2_;
	ValaCCodeBlock* _tmp3_;
	ValaCCodeBlock* _tmp4_;
	ValaCCodeBlock* _tmp5_;
	ValaCCodeIfStatement* cif = NULL;
	ValaCCodeExpression* _tmp6_;
	ValaCCodeBlock* _tmp7_;
	ValaCCodeIfStatement* _tmp8_;
	ValaCCodeLineDirective* _tmp9_;
	ValaList* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (condition != NULL);
	_tmp0_ = self->priv->statement_stack;
	_tmp1_ = self->priv->_current_block;
	vala_collection_add ((ValaCollection*) _tmp0_, (ValaCCodeStatement*) _tmp1_);
	_tmp2_ = self->priv->_current_block;
	_tmp3_ = _vala_ccode_node_ref0 (_tmp2_);
	parent_block = _tmp3_;
	_tmp4_ = vala_ccode_block_new ();
	_tmp5_ = _tmp4_;
	vala_ccode_function_set_current_block (self, _tmp5_);
	_vala_ccode_node_unref0 (_tmp5_);
	_tmp6_ = condition;
	_tmp7_ = self->priv->_current_block;
	_tmp8_ = vala_ccode_if_statement_new (_tmp6_, (ValaCCodeStatement*) _tmp7_, NULL);
	cif = _tmp8_;
	_tmp9_ = self->priv->_current_line;
	vala_ccode_node_set_line ((ValaCCodeNode*) cif, _tmp9_);
	_tmp10_ = self->priv->statement_stack;
	vala_collection_add ((ValaCollection*) _tmp10_, (ValaCCodeStatement*) cif);
	vala_ccode_block_add_statement (parent_block, (ValaCCodeNode*) cif);
	_vala_ccode_node_unref0 (cif);
	_vala_ccode_node_unref0 (parent_block);
}


void vala_ccode_function_add_else (ValaCCodeFunction* self) {
	ValaCCodeBlock* _tmp0_;
	ValaCCodeBlock* _tmp1_;
	ValaCCodeIfStatement* cif = NULL;
	ValaList* _tmp2_;
	ValaList* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gpointer _tmp6_;
	ValaCCodeLineDirective* _tmp7_;
	ValaCCodeStatement* _tmp8_;
	ValaCCodeStatement* _tmp9_;
	ValaCCodeBlock* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = vala_ccode_block_new ();
	_tmp1_ = _tmp0_;
	vala_ccode_function_set_current_block (self, _tmp1_);
	_vala_ccode_node_unref0 (_tmp1_);
	_tmp2_ = self->priv->statement_stack;
	_tmp3_ = self->priv->statement_stack;
	_tmp4_ = vala_collection_get_size ((ValaCollection*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = vala_list_get (_tmp2_, _tmp5_ - 1);
	cif = G_TYPE_CHECK_INSTANCE_CAST ((ValaCCodeStatement*) _tmp6_, VALA_TYPE_CCODE_IF_STATEMENT, ValaCCodeIfStatement);
	_tmp7_ = self->priv->_current_line;
	vala_ccode_node_set_line ((ValaCCodeNode*) cif, _tmp7_);
	_tmp8_ = vala_ccode_if_statement_get_false_statement (cif);
	_tmp9_ = _tmp8_;
	_vala_assert (_tmp9_ == NULL, "cif.false_statement == null");
	_tmp10_ = self->priv->_current_block;
	vala_ccode_if_statement_set_false_statement (cif, (ValaCCodeStatement*) _tmp10_);
	_vala_ccode_node_unref0 (cif);
}


void vala_ccode_function_else_if (ValaCCodeFunction* self, ValaCCodeExpression* condition) {
	ValaCCodeIfStatement* parent_if = NULL;
	ValaList* _tmp0_;
	ValaList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gpointer _tmp4_;
	ValaCCodeStatement* _tmp5_;
	ValaCCodeStatement* _tmp6_;
	ValaCCodeBlock* _tmp7_;
	ValaCCodeBlock* _tmp8_;
	ValaCCodeIfStatement* cif = NULL;
	ValaCCodeExpression* _tmp9_;
	ValaCCodeBlock* _tmp10_;
	ValaCCodeIfStatement* _tmp11_;
	ValaCCodeLineDirective* _tmp12_;
	ValaList* _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (condition != NULL);
	_tmp0_ = self->priv->statement_stack;
	_tmp1_ = self->priv->statement_stack;
	_tmp2_ = vala_collection_get_size ((ValaCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = vala_list_remove_at (_tmp0_, _tmp3_ - 1);
	parent_if = G_TYPE_CHECK_INSTANCE_CAST ((ValaCCodeStatement*) _tmp4_, VALA_TYPE_CCODE_IF_STATEMENT, ValaCCodeIfStatement);
	_tmp5_ = vala_ccode_if_statement_get_false_statement (parent_if);
	_tmp6_ = _tmp5_;
	_vala_assert (_tmp6_ == NULL, "parent_if.false_statement == null");
	_tmp7_ = vala_ccode_block_new ();
	_tmp8_ = _tmp7_;
	vala_ccode_function_set_current_block (self, _tmp8_);
	_vala_ccode_node_unref0 (_tmp8_);
	_tmp9_ = condition;
	_tmp10_ = self->priv->_current_block;
	_tmp11_ = vala_ccode_if_statement_new (_tmp9_, (ValaCCodeStatement*) _tmp10_, NULL);
	cif = _tmp11_;
	_tmp12_ = self->priv->_current_line;
	vala_ccode_node_set_line ((ValaCCodeNode*) cif, _tmp12_);
	vala_ccode_if_statement_set_false_statement (parent_if, (ValaCCodeStatement*) cif);
	_tmp13_ = self->priv->statement_stack;
	vala_collection_add ((ValaCollection*) _tmp13_, (ValaCCodeStatement*) cif);
	_vala_ccode_node_unref0 (cif);
	_vala_ccode_node_unref0 (parent_if);
}


void vala_ccode_function_open_while (ValaCCodeFunction* self, ValaCCodeExpression* condition) {
	ValaList* _tmp0_;
	ValaCCodeBlock* _tmp1_;
	ValaCCodeBlock* parent_block = NULL;
	ValaCCodeBlock* _tmp2_;
	ValaCCodeBlock* _tmp3_;
	ValaCCodeBlock* _tmp4_;
	ValaCCodeBlock* _tmp5_;
	ValaCCodeWhileStatement* cwhile = NULL;
	ValaCCodeExpression* _tmp6_;
	ValaCCodeBlock* _tmp7_;
	ValaCCodeWhileStatement* _tmp8_;
	ValaCCodeLineDirective* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (condition != NULL);
	_tmp0_ = self->priv->statement_stack;
	_tmp1_ = self->priv->_current_block;
	vala_collection_add ((ValaCollection*) _tmp0_, (ValaCCodeStatement*) _tmp1_);
	_tmp2_ = self->priv->_current_block;
	_tmp3_ = _vala_ccode_node_ref0 (_tmp2_);
	parent_block = _tmp3_;
	_tmp4_ = vala_ccode_block_new ();
	_tmp5_ = _tmp4_;
	vala_ccode_function_set_current_block (self, _tmp5_);
	_vala_ccode_node_unref0 (_tmp5_);
	_tmp6_ = condition;
	_tmp7_ = self->priv->_current_block;
	_tmp8_ = vala_ccode_while_statement_new (_tmp6_, (ValaCCodeStatement*) _tmp7_);
	cwhile = _tmp8_;
	_tmp9_ = self->priv->_current_line;
	vala_ccode_node_set_line ((ValaCCodeNode*) cwhile, _tmp9_);
	vala_ccode_block_add_statement (parent_block, (ValaCCodeNode*) cwhile);
	_vala_ccode_node_unref0 (cwhile);
	_vala_ccode_node_unref0 (parent_block);
}


void vala_ccode_function_open_for (ValaCCodeFunction* self, ValaCCodeExpression* initializer, ValaCCodeExpression* condition, ValaCCodeExpression* iterator) {
	ValaList* _tmp0_;
	ValaCCodeBlock* _tmp1_;
	ValaCCodeBlock* parent_block = NULL;
	ValaCCodeBlock* _tmp2_;
	ValaCCodeBlock* _tmp3_;
	ValaCCodeBlock* _tmp4_;
	ValaCCodeBlock* _tmp5_;
	ValaCCodeForStatement* cfor = NULL;
	ValaCCodeExpression* _tmp6_;
	ValaCCodeBlock* _tmp7_;
	ValaCCodeForStatement* _tmp8_;
	ValaCCodeForStatement* _tmp9_;
	ValaCCodeLineDirective* _tmp10_;
	ValaCCodeExpression* _tmp11_;
	ValaCCodeExpression* _tmp14_;
	ValaCCodeBlock* _tmp17_;
	ValaCCodeForStatement* _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (condition != NULL);
	_tmp0_ = self->priv->statement_stack;
	_tmp1_ = self->priv->_current_block;
	vala_collection_add ((ValaCollection*) _tmp0_, (ValaCCodeStatement*) _tmp1_);
	_tmp2_ = self->priv->_current_block;
	_tmp3_ = _vala_ccode_node_ref0 (_tmp2_);
	parent_block = _tmp3_;
	_tmp4_ = vala_ccode_block_new ();
	_tmp5_ = _tmp4_;
	vala_ccode_function_set_current_block (self, _tmp5_);
	_vala_ccode_node_unref0 (_tmp5_);
	_tmp6_ = condition;
	_tmp7_ = self->priv->_current_block;
	_tmp8_ = vala_ccode_for_statement_new (_tmp6_, (ValaCCodeStatement*) _tmp7_);
	cfor = _tmp8_;
	_tmp9_ = cfor;
	_tmp10_ = self->priv->_current_line;
	vala_ccode_node_set_line ((ValaCCodeNode*) _tmp9_, _tmp10_);
	_tmp11_ = initializer;
	if (_tmp11_ != NULL) {
		ValaCCodeForStatement* _tmp12_;
		ValaCCodeExpression* _tmp13_;
		_tmp12_ = cfor;
		_tmp13_ = initializer;
		vala_ccode_for_statement_add_initializer (_tmp12_, _tmp13_);
	}
	_tmp14_ = iterator;
	if (_tmp14_ != NULL) {
		ValaCCodeForStatement* _tmp15_;
		ValaCCodeExpression* _tmp16_;
		_tmp15_ = cfor;
		_tmp16_ = iterator;
		vala_ccode_for_statement_add_iterator (_tmp15_, _tmp16_);
	}
	_tmp17_ = parent_block;
	_tmp18_ = cfor;
	vala_ccode_block_add_statement (_tmp17_, (ValaCCodeNode*) _tmp18_);
	_vala_ccode_node_unref0 (cfor);
	_vala_ccode_node_unref0 (parent_block);
}


void vala_ccode_function_open_switch (ValaCCodeFunction* self, ValaCCodeExpression* expression) {
	ValaList* _tmp0_;
	ValaCCodeBlock* _tmp1_;
	ValaCCodeBlock* parent_block = NULL;
	ValaCCodeBlock* _tmp2_;
	ValaCCodeBlock* _tmp3_;
	ValaCCodeSwitchStatement* cswitch = NULL;
	ValaCCodeExpression* _tmp4_;
	ValaCCodeSwitchStatement* _tmp5_;
	ValaCCodeLineDirective* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (expression != NULL);
	_tmp0_ = self->priv->statement_stack;
	_tmp1_ = self->priv->_current_block;
	vala_collection_add ((ValaCollection*) _tmp0_, (ValaCCodeStatement*) _tmp1_);
	_tmp2_ = self->priv->_current_block;
	_tmp3_ = _vala_ccode_node_ref0 (_tmp2_);
	parent_block = _tmp3_;
	_tmp4_ = expression;
	_tmp5_ = vala_ccode_switch_statement_new (_tmp4_);
	cswitch = _tmp5_;
	_tmp6_ = self->priv->_current_line;
	vala_ccode_node_set_line ((ValaCCodeNode*) cswitch, _tmp6_);
	vala_ccode_function_set_current_block (self, (ValaCCodeBlock*) cswitch);
	vala_ccode_block_add_statement (parent_block, (ValaCCodeNode*) cswitch);
	_vala_ccode_node_unref0 (cswitch);
	_vala_ccode_node_unref0 (parent_block);
}


void vala_ccode_function_add_label (ValaCCodeFunction* self, const gchar* label) {
	const gchar* _tmp0_;
	ValaCCodeLabel* _tmp1_;
	ValaCCodeLabel* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = label;
	_tmp1_ = vala_ccode_label_new (_tmp0_);
	_tmp2_ = _tmp1_;
	vala_ccode_function_add_statement (self, (ValaCCodeNode*) _tmp2_);
	_vala_ccode_node_unref0 (_tmp2_);
}


void vala_ccode_function_add_case (ValaCCodeFunction* self, ValaCCodeExpression* expression) {
	ValaCCodeExpression* _tmp0_;
	ValaCCodeCaseStatement* _tmp1_;
	ValaCCodeCaseStatement* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (expression != NULL);
	_tmp0_ = expression;
	_tmp1_ = vala_ccode_case_statement_new (_tmp0_);
	_tmp2_ = _tmp1_;
	vala_ccode_function_add_statement (self, (ValaCCodeNode*) _tmp2_);
	_vala_ccode_node_unref0 (_tmp2_);
}


void vala_ccode_function_add_default (ValaCCodeFunction* self) {
	ValaCCodeLabel* _tmp0_;
	ValaCCodeLabel* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = vala_ccode_label_new ("default");
	_tmp1_ = _tmp0_;
	vala_ccode_function_add_statement (self, (ValaCCodeNode*) _tmp1_);
	_vala_ccode_node_unref0 (_tmp1_);
}


void vala_ccode_function_add_goto (ValaCCodeFunction* self, const gchar* target) {
	const gchar* _tmp0_;
	ValaCCodeGotoStatement* _tmp1_;
	ValaCCodeGotoStatement* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (target != NULL);
	_tmp0_ = target;
	_tmp1_ = vala_ccode_goto_statement_new (_tmp0_);
	_tmp2_ = _tmp1_;
	vala_ccode_function_add_statement (self, (ValaCCodeNode*) _tmp2_);
	_vala_ccode_node_unref0 (_tmp2_);
}


void vala_ccode_function_add_expression (ValaCCodeFunction* self, ValaCCodeExpression* expression) {
	ValaCCodeExpression* _tmp0_;
	ValaCCodeExpressionStatement* _tmp1_;
	ValaCCodeExpressionStatement* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (expression != NULL);
	_tmp0_ = expression;
	_tmp1_ = vala_ccode_expression_statement_new (_tmp0_);
	_tmp2_ = _tmp1_;
	vala_ccode_function_add_statement (self, (ValaCCodeNode*) _tmp2_);
	_vala_ccode_node_unref0 (_tmp2_);
}


void vala_ccode_function_add_assignment (ValaCCodeFunction* self, ValaCCodeExpression* left, ValaCCodeExpression* right) {
	ValaCCodeExpression* _tmp0_;
	ValaCCodeExpression* _tmp1_;
	ValaCCodeAssignment* _tmp2_;
	ValaCCodeAssignment* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (left != NULL);
	g_return_if_fail (right != NULL);
	_tmp0_ = left;
	_tmp1_ = right;
	_tmp2_ = vala_ccode_assignment_new (_tmp0_, _tmp1_, VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE);
	_tmp3_ = _tmp2_;
	vala_ccode_function_add_expression (self, (ValaCCodeExpression*) _tmp3_);
	_vala_ccode_node_unref0 (_tmp3_);
}


void vala_ccode_function_add_return (ValaCCodeFunction* self, ValaCCodeExpression* expression) {
	ValaCCodeExpression* _tmp0_;
	ValaCCodeReturnStatement* _tmp1_;
	ValaCCodeReturnStatement* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = expression;
	_tmp1_ = vala_ccode_return_statement_new (_tmp0_);
	_tmp2_ = _tmp1_;
	vala_ccode_function_add_statement (self, (ValaCCodeNode*) _tmp2_);
	_vala_ccode_node_unref0 (_tmp2_);
}


void vala_ccode_function_add_break (ValaCCodeFunction* self) {
	ValaCCodeBreakStatement* _tmp0_;
	ValaCCodeBreakStatement* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = vala_ccode_break_statement_new ();
	_tmp1_ = _tmp0_;
	vala_ccode_function_add_statement (self, (ValaCCodeNode*) _tmp1_);
	_vala_ccode_node_unref0 (_tmp1_);
}


void vala_ccode_function_add_continue (ValaCCodeFunction* self) {
	ValaCCodeContinueStatement* _tmp0_;
	ValaCCodeContinueStatement* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = vala_ccode_continue_statement_new ();
	_tmp1_ = _tmp0_;
	vala_ccode_function_add_statement (self, (ValaCCodeNode*) _tmp1_);
	_vala_ccode_node_unref0 (_tmp1_);
}


void vala_ccode_function_add_declaration (ValaCCodeFunction* self, const gchar* type_name, ValaCCodeDeclarator* declarator, ValaCCodeModifiers modifiers) {
	ValaCCodeDeclaration* stmt = NULL;
	const gchar* _tmp0_;
	ValaCCodeDeclaration* _tmp1_;
	ValaCCodeDeclarator* _tmp2_;
	ValaCCodeModifiers _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (type_name != NULL);
	g_return_if_fail (declarator != NULL);
	_tmp0_ = type_name;
	_tmp1_ = vala_ccode_declaration_new (_tmp0_);
	stmt = _tmp1_;
	_tmp2_ = declarator;
	vala_ccode_declaration_add_declarator (stmt, _tmp2_);
	_tmp3_ = modifiers;
	vala_ccode_node_set_modifiers ((ValaCCodeNode*) stmt, _tmp3_);
	vala_ccode_function_add_statement (self, (ValaCCodeNode*) stmt);
	_vala_ccode_node_unref0 (stmt);
}


void vala_ccode_function_close (ValaCCodeFunction* self) {
	g_return_if_fail (self != NULL);
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = TRUE;
		while (TRUE) {
			ValaCCodeStatement* top = NULL;
			ValaList* _tmp2_;
			ValaList* _tmp3_;
			gint _tmp4_;
			gint _tmp5_;
			gpointer _tmp6_;
			ValaCCodeStatement* _tmp7_;
			if (!_tmp0_) {
				ValaCCodeBlock* _tmp1_;
				_tmp1_ = self->priv->_current_block;
				if (!(_tmp1_ == NULL)) {
					break;
				}
			}
			_tmp0_ = FALSE;
			_tmp2_ = self->priv->statement_stack;
			_tmp3_ = self->priv->statement_stack;
			_tmp4_ = vala_collection_get_size ((ValaCollection*) _tmp3_);
			_tmp5_ = _tmp4_;
			_tmp6_ = vala_list_remove_at (_tmp2_, _tmp5_ - 1);
			top = (ValaCCodeStatement*) _tmp6_;
			_tmp7_ = top;
			vala_ccode_function_set_current_block (self, G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_CCODE_BLOCK) ? ((ValaCCodeBlock*) _tmp7_) : NULL);
			_vala_ccode_node_unref0 (top);
		}
	}
}


const gchar* vala_ccode_function_get_name (ValaCCodeFunction* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name;
	result = _tmp0_;
	return result;
}


void vala_ccode_function_set_name (ValaCCodeFunction* 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->_name);
	self->priv->_name = _tmp1_;
}


const gchar* vala_ccode_function_get_return_type (ValaCCodeFunction* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_return_type;
	result = _tmp0_;
	return result;
}


void vala_ccode_function_set_return_type (ValaCCodeFunction* 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->_return_type);
	self->priv->_return_type = _tmp1_;
}


gboolean vala_ccode_function_get_is_declaration (ValaCCodeFunction* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_is_declaration;
	result = _tmp0_;
	return result;
}


void vala_ccode_function_set_is_declaration (ValaCCodeFunction* self, gboolean value) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_is_declaration = _tmp0_;
}


ValaCCodeBlock* vala_ccode_function_get_block (ValaCCodeFunction* self) {
	ValaCCodeBlock* result;
	ValaCCodeBlock* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_block;
	result = _tmp0_;
	return result;
}


void vala_ccode_function_set_block (ValaCCodeFunction* self, ValaCCodeBlock* value) {
	ValaCCodeBlock* _tmp0_;
	ValaCCodeBlock* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_ccode_node_ref0 (_tmp0_);
	_vala_ccode_node_unref0 (self->priv->_block);
	self->priv->_block = _tmp1_;
}


ValaCCodeLineDirective* vala_ccode_function_get_current_line (ValaCCodeFunction* self) {
	ValaCCodeLineDirective* result;
	ValaCCodeLineDirective* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_current_line;
	result = _tmp0_;
	return result;
}


void vala_ccode_function_set_current_line (ValaCCodeFunction* self, ValaCCodeLineDirective* value) {
	ValaCCodeLineDirective* _tmp0_;
	ValaCCodeLineDirective* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_ccode_node_ref0 (_tmp0_);
	_vala_ccode_node_unref0 (self->priv->_current_line);
	self->priv->_current_line = _tmp1_;
}


ValaCCodeBlock* vala_ccode_function_get_current_block (ValaCCodeFunction* self) {
	ValaCCodeBlock* result;
	ValaCCodeBlock* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_current_block;
	result = _tmp0_;
	return result;
}


void vala_ccode_function_set_current_block (ValaCCodeFunction* self, ValaCCodeBlock* value) {
	ValaCCodeBlock* _tmp0_;
	ValaCCodeBlock* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_ccode_node_ref0 (_tmp0_);
	_vala_ccode_node_unref0 (self->priv->_current_block);
	self->priv->_current_block = _tmp1_;
}


static void vala_ccode_function_class_init (ValaCCodeFunctionClass * klass) {
	vala_ccode_function_parent_class = g_type_class_peek_parent (klass);
	((ValaCCodeNodeClass *) klass)->finalize = vala_ccode_function_finalize;
	g_type_class_add_private (klass, sizeof (ValaCCodeFunctionPrivate));
	((ValaCCodeNodeClass *) klass)->write = (void (*) (ValaCCodeNode *, ValaCCodeWriter*)) vala_ccode_function_real_write;
}


static void vala_ccode_function_instance_init (ValaCCodeFunction * self) {
	GEqualFunc _tmp0_;
	ValaArrayList* _tmp1_;
	GEqualFunc _tmp2_;
	ValaArrayList* _tmp3_;
	self->priv = VALA_CCODE_FUNCTION_GET_PRIVATE (self);
	_tmp0_ = g_direct_equal;
	_tmp1_ = vala_array_list_new (VALA_TYPE_CCODE_PARAMETER, (GBoxedCopyFunc) vala_ccode_node_ref, (GDestroyNotify) vala_ccode_node_unref, _tmp0_);
	self->priv->parameters = (ValaList*) _tmp1_;
	_tmp2_ = g_direct_equal;
	_tmp3_ = vala_array_list_new (VALA_TYPE_CCODE_STATEMENT, (GBoxedCopyFunc) vala_ccode_node_ref, (GDestroyNotify) vala_ccode_node_unref, _tmp2_);
	self->priv->statement_stack = (ValaList*) _tmp3_;
}


static void vala_ccode_function_finalize (ValaCCodeNode * obj) {
	ValaCCodeFunction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_CCODE_FUNCTION, ValaCCodeFunction);
	_g_free0 (self->priv->_name);
	_g_free0 (self->priv->_return_type);
	_vala_ccode_node_unref0 (self->priv->_block);
	_vala_ccode_node_unref0 (self->priv->_current_line);
	_vala_ccode_node_unref0 (self->priv->_current_block);
	_vala_iterable_unref0 (self->priv->parameters);
	_vala_iterable_unref0 (self->priv->statement_stack);
	VALA_CCODE_NODE_CLASS (vala_ccode_function_parent_class)->finalize (obj);
}


/**
 * Represents a function declaration in the C code.
 */
GType vala_ccode_function_get_type (void) {
	static volatile gsize vala_ccode_function_type_id__volatile = 0;
	if (g_once_init_enter (&vala_ccode_function_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValaCCodeFunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_ccode_function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCCodeFunction), 0, (GInstanceInitFunc) vala_ccode_function_instance_init, NULL };
		GType vala_ccode_function_type_id;
		vala_ccode_function_type_id = g_type_register_static (VALA_TYPE_CCODE_NODE, "ValaCCodeFunction", &g_define_type_info, 0);
		g_once_init_leave (&vala_ccode_function_type_id__volatile, vala_ccode_function_type_id);
	}
	return vala_ccode_function_type_id__volatile;
}



