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

/* valadelegatetype.vala
 *
 * Copyright (C) 2007-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 "vala.h"
#include <valagee.h>
#include <stdlib.h>
#include <string.h>

#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_scope_unref0(var) ((var == NULL) ? NULL : (var = (vala_scope_unref (var), NULL)))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))

struct _ValaDelegateTypePrivate {
	ValaDelegate* _delegate_symbol;
	gboolean _is_called_once;
};


static gpointer vala_delegate_type_parent_class = NULL;

#define VALA_DELEGATE_TYPE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_DELEGATE_TYPE, ValaDelegateTypePrivate))
static gboolean vala_delegate_type_real_is_invokable (ValaDataType* base);
static ValaDataType* vala_delegate_type_real_get_return_type (ValaDataType* base);
static ValaList* vala_delegate_type_real_get_parameters (ValaDataType* base);
static gchar* vala_delegate_type_real_to_qualified_string (ValaDataType* base, ValaScope* scope);
static ValaDataType* vala_delegate_type_real_copy (ValaDataType* base);
static gboolean vala_delegate_type_real_is_accessible (ValaDataType* base, ValaSymbol* sym);
static gboolean vala_delegate_type_real_check (ValaCodeNode* base, ValaCodeContext* context);
static gboolean vala_delegate_type_real_is_disposable (ValaDataType* base);
static void vala_delegate_type_finalize (ValaCodeNode * obj);


ValaDelegateType* vala_delegate_type_construct (GType object_type, ValaDelegate* delegate_symbol) {
	ValaDelegateType* self = NULL;
	ValaDelegate* _tmp0_;
	ValaDelegate* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_val_if_fail (delegate_symbol != NULL, NULL);
	self = (ValaDelegateType*) vala_callable_type_construct (object_type);
	_tmp0_ = delegate_symbol;
	vala_delegate_type_set_delegate_symbol (self, _tmp0_);
	_tmp1_ = delegate_symbol;
	_tmp2_ = vala_code_node_get_attribute_string ((ValaCodeNode*) _tmp1_, "CCode", "scope", NULL);
	_tmp3_ = _tmp2_;
	vala_delegate_type_set_is_called_once (self, g_strcmp0 (_tmp3_, "async") == 0);
	_g_free0 (_tmp3_);
	return self;
}


ValaDelegateType* vala_delegate_type_new (ValaDelegate* delegate_symbol) {
	return vala_delegate_type_construct (VALA_TYPE_DELEGATE_TYPE, delegate_symbol);
}


static gboolean vala_delegate_type_real_is_invokable (ValaDataType* base) {
	ValaDelegateType * self;
	gboolean result = FALSE;
	self = (ValaDelegateType*) base;
	result = TRUE;
	return result;
}


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


static ValaDataType* vala_delegate_type_real_get_return_type (ValaDataType* base) {
	ValaDelegateType * self;
	ValaDataType* result = NULL;
	ValaDelegate* _tmp0_;
	ValaDataType* _tmp1_;
	ValaDataType* _tmp2_;
	ValaDataType* _tmp3_;
	self = (ValaDelegateType*) base;
	_tmp0_ = self->priv->_delegate_symbol;
	_tmp1_ = vala_callable_get_return_type ((ValaCallable*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _vala_code_node_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}


static ValaList* vala_delegate_type_real_get_parameters (ValaDataType* base) {
	ValaDelegateType * self;
	ValaList* result = NULL;
	ValaDelegate* _tmp0_;
	ValaList* _tmp1_;
	self = (ValaDelegateType*) base;
	_tmp0_ = self->priv->_delegate_symbol;
	_tmp1_ = vala_callable_get_parameters ((ValaCallable*) _tmp0_);
	result = _tmp1_;
	return result;
}


static gpointer _vala_scope_ref0 (gpointer self) {
	return self ? vala_scope_ref (self) : NULL;
}


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


static gchar* vala_delegate_type_real_to_qualified_string (ValaDataType* base, ValaScope* scope) {
	ValaDelegateType * self;
	gchar* result = NULL;
	ValaSymbol* global_symbol = NULL;
	ValaDelegate* _tmp0_;
	ValaSymbol* _tmp1_;
	ValaSymbol* sym = NULL;
	ValaScope* parent_scope = NULL;
	ValaScope* _tmp15_;
	ValaScope* _tmp16_;
	gchar* s = NULL;
	gboolean _tmp29_ = FALSE;
	ValaSymbol* _tmp30_;
	ValaList* type_args = NULL;
	ValaList* _tmp39_;
	ValaList* _tmp40_;
	gint _tmp41_;
	gint _tmp42_;
	gboolean _tmp72_;
	gboolean _tmp73_;
	self = (ValaDelegateType*) base;
	_tmp0_ = self->priv->_delegate_symbol;
	_tmp1_ = _vala_code_node_ref0 ((ValaSymbol*) _tmp0_);
	global_symbol = _tmp1_;
	while (TRUE) {
		gboolean _tmp2_ = FALSE;
		ValaSymbol* _tmp3_;
		ValaSymbol* _tmp4_;
		ValaSymbol* _tmp5_;
		ValaSymbol* _tmp11_;
		ValaSymbol* _tmp12_;
		ValaSymbol* _tmp13_;
		ValaSymbol* _tmp14_;
		_tmp3_ = global_symbol;
		_tmp4_ = vala_symbol_get_parent_symbol (_tmp3_);
		_tmp5_ = _tmp4_;
		if (_tmp5_ != NULL) {
			ValaSymbol* _tmp6_;
			ValaSymbol* _tmp7_;
			ValaSymbol* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			_tmp6_ = global_symbol;
			_tmp7_ = vala_symbol_get_parent_symbol (_tmp6_);
			_tmp8_ = _tmp7_;
			_tmp9_ = vala_symbol_get_name (_tmp8_);
			_tmp10_ = _tmp9_;
			_tmp2_ = _tmp10_ != NULL;
		} else {
			_tmp2_ = FALSE;
		}
		if (!_tmp2_) {
			break;
		}
		_tmp11_ = global_symbol;
		_tmp12_ = vala_symbol_get_parent_symbol (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = _vala_code_node_ref0 (_tmp13_);
		_vala_code_node_unref0 (global_symbol);
		global_symbol = _tmp14_;
	}
	sym = NULL;
	_tmp15_ = scope;
	_tmp16_ = _vala_scope_ref0 (_tmp15_);
	parent_scope = _tmp16_;
	while (TRUE) {
		gboolean _tmp17_ = FALSE;
		ValaSymbol* _tmp18_;
		ValaScope* _tmp20_;
		ValaSymbol* _tmp21_;
		const gchar* _tmp22_;
		const gchar* _tmp23_;
		ValaSymbol* _tmp24_;
		ValaScope* _tmp25_;
		ValaScope* _tmp26_;
		ValaScope* _tmp27_;
		ValaScope* _tmp28_;
		_tmp18_ = sym;
		if (_tmp18_ == NULL) {
			ValaScope* _tmp19_;
			_tmp19_ = parent_scope;
			_tmp17_ = _tmp19_ != NULL;
		} else {
			_tmp17_ = FALSE;
		}
		if (!_tmp17_) {
			break;
		}
		_tmp20_ = parent_scope;
		_tmp21_ = global_symbol;
		_tmp22_ = vala_symbol_get_name (_tmp21_);
		_tmp23_ = _tmp22_;
		_tmp24_ = vala_scope_lookup (_tmp20_, _tmp23_);
		_vala_code_node_unref0 (sym);
		sym = _tmp24_;
		_tmp25_ = parent_scope;
		_tmp26_ = vala_scope_get_parent_scope (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = _vala_scope_ref0 (_tmp27_);
		_vala_scope_unref0 (parent_scope);
		parent_scope = _tmp28_;
	}
	_tmp30_ = sym;
	if (_tmp30_ != NULL) {
		ValaSymbol* _tmp31_;
		ValaSymbol* _tmp32_;
		_tmp31_ = global_symbol;
		_tmp32_ = sym;
		_tmp29_ = _tmp31_ != _tmp32_;
	} else {
		_tmp29_ = FALSE;
	}
	if (_tmp29_) {
		ValaDelegate* _tmp33_;
		gchar* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
		_tmp33_ = self->priv->_delegate_symbol;
		_tmp34_ = vala_symbol_get_full_name ((ValaSymbol*) _tmp33_);
		_tmp35_ = _tmp34_;
		_tmp36_ = g_strconcat ("global::", _tmp35_, NULL);
		_g_free0 (s);
		s = _tmp36_;
		_g_free0 (_tmp35_);
	} else {
		ValaDelegate* _tmp37_;
		gchar* _tmp38_;
		_tmp37_ = self->priv->_delegate_symbol;
		_tmp38_ = vala_symbol_get_full_name ((ValaSymbol*) _tmp37_);
		_g_free0 (s);
		s = _tmp38_;
	}
	_tmp39_ = vala_data_type_get_type_arguments ((ValaDataType*) self);
	type_args = _tmp39_;
	_tmp40_ = type_args;
	_tmp41_ = vala_collection_get_size ((ValaCollection*) _tmp40_);
	_tmp42_ = _tmp41_;
	if (_tmp42_ > 0) {
		const gchar* _tmp43_;
		gchar* _tmp44_;
		gboolean first = FALSE;
		const gchar* _tmp70_;
		gchar* _tmp71_;
		_tmp43_ = s;
		_tmp44_ = g_strconcat (_tmp43_, "<", NULL);
		_g_free0 (s);
		s = _tmp44_;
		first = TRUE;
		{
			ValaList* _type_arg_list = NULL;
			ValaList* _tmp45_;
			ValaList* _tmp46_;
			gint _type_arg_size = 0;
			ValaList* _tmp47_;
			gint _tmp48_;
			gint _tmp49_;
			gint _type_arg_index = 0;
			_tmp45_ = type_args;
			_tmp46_ = _vala_iterable_ref0 (_tmp45_);
			_type_arg_list = _tmp46_;
			_tmp47_ = _type_arg_list;
			_tmp48_ = vala_collection_get_size ((ValaCollection*) _tmp47_);
			_tmp49_ = _tmp48_;
			_type_arg_size = _tmp49_;
			_type_arg_index = -1;
			while (TRUE) {
				gint _tmp50_;
				gint _tmp51_;
				gint _tmp52_;
				ValaDataType* type_arg = NULL;
				ValaList* _tmp53_;
				gint _tmp54_;
				gpointer _tmp55_;
				gboolean _tmp56_;
				ValaDataType* _tmp59_;
				gboolean _tmp60_;
				gboolean _tmp61_;
				const gchar* _tmp64_;
				ValaDataType* _tmp65_;
				ValaScope* _tmp66_;
				gchar* _tmp67_;
				gchar* _tmp68_;
				gchar* _tmp69_;
				_tmp50_ = _type_arg_index;
				_type_arg_index = _tmp50_ + 1;
				_tmp51_ = _type_arg_index;
				_tmp52_ = _type_arg_size;
				if (!(_tmp51_ < _tmp52_)) {
					break;
				}
				_tmp53_ = _type_arg_list;
				_tmp54_ = _type_arg_index;
				_tmp55_ = vala_list_get (_tmp53_, _tmp54_);
				type_arg = (ValaDataType*) _tmp55_;
				_tmp56_ = first;
				if (!_tmp56_) {
					const gchar* _tmp57_;
					gchar* _tmp58_;
					_tmp57_ = s;
					_tmp58_ = g_strconcat (_tmp57_, ",", NULL);
					_g_free0 (s);
					s = _tmp58_;
				} else {
					first = FALSE;
				}
				_tmp59_ = type_arg;
				_tmp60_ = vala_data_type_get_value_owned (_tmp59_);
				_tmp61_ = _tmp60_;
				if (!_tmp61_) {
					const gchar* _tmp62_;
					gchar* _tmp63_;
					_tmp62_ = s;
					_tmp63_ = g_strconcat (_tmp62_, "weak ", NULL);
					_g_free0 (s);
					s = _tmp63_;
				}
				_tmp64_ = s;
				_tmp65_ = type_arg;
				_tmp66_ = scope;
				_tmp67_ = vala_data_type_to_qualified_string (_tmp65_, _tmp66_);
				_tmp68_ = _tmp67_;
				_tmp69_ = g_strconcat (_tmp64_, _tmp68_, NULL);
				_g_free0 (s);
				s = _tmp69_;
				_g_free0 (_tmp68_);
				_vala_code_node_unref0 (type_arg);
			}
			_vala_iterable_unref0 (_type_arg_list);
		}
		_tmp70_ = s;
		_tmp71_ = g_strconcat (_tmp70_, ">", NULL);
		_g_free0 (s);
		s = _tmp71_;
	}
	_tmp72_ = vala_data_type_get_nullable ((ValaDataType*) self);
	_tmp73_ = _tmp72_;
	if (_tmp73_) {
		const gchar* _tmp74_;
		gchar* _tmp75_;
		_tmp74_ = s;
		_tmp75_ = g_strconcat (_tmp74_, "?", NULL);
		_g_free0 (s);
		s = _tmp75_;
	}
	result = s;
	_vala_iterable_unref0 (type_args);
	_vala_scope_unref0 (parent_scope);
	_vala_code_node_unref0 (sym);
	_vala_code_node_unref0 (global_symbol);
	return result;
}


static ValaDataType* vala_delegate_type_real_copy (ValaDataType* base) {
	ValaDelegateType * self;
	ValaDataType* result = NULL;
	ValaDelegateType* _result_ = NULL;
	ValaDelegate* _tmp0_;
	ValaDelegateType* _tmp1_;
	ValaDelegateType* _tmp2_;
	ValaSourceReference* _tmp3_;
	ValaSourceReference* _tmp4_;
	ValaDelegateType* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	ValaDelegateType* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	ValaDelegateType* _tmp25_;
	gboolean _tmp26_;
	self = (ValaDelegateType*) base;
	_tmp0_ = self->priv->_delegate_symbol;
	_tmp1_ = vala_delegate_type_new (_tmp0_);
	_result_ = _tmp1_;
	_tmp2_ = _result_;
	_tmp3_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp4_ = _tmp3_;
	vala_code_node_set_source_reference ((ValaCodeNode*) _tmp2_, _tmp4_);
	_tmp5_ = _result_;
	_tmp6_ = vala_data_type_get_value_owned ((ValaDataType*) self);
	_tmp7_ = _tmp6_;
	vala_data_type_set_value_owned ((ValaDataType*) _tmp5_, _tmp7_);
	_tmp8_ = _result_;
	_tmp9_ = vala_data_type_get_nullable ((ValaDataType*) self);
	_tmp10_ = _tmp9_;
	vala_data_type_set_nullable ((ValaDataType*) _tmp8_, _tmp10_);
	{
		ValaList* _arg_list = NULL;
		ValaList* _tmp11_;
		gint _arg_size = 0;
		ValaList* _tmp12_;
		gint _tmp13_;
		gint _tmp14_;
		gint _arg_index = 0;
		_tmp11_ = vala_data_type_get_type_arguments ((ValaDataType*) self);
		_arg_list = _tmp11_;
		_tmp12_ = _arg_list;
		_tmp13_ = vala_collection_get_size ((ValaCollection*) _tmp12_);
		_tmp14_ = _tmp13_;
		_arg_size = _tmp14_;
		_arg_index = -1;
		while (TRUE) {
			gint _tmp15_;
			gint _tmp16_;
			gint _tmp17_;
			ValaDataType* arg = NULL;
			ValaList* _tmp18_;
			gint _tmp19_;
			gpointer _tmp20_;
			ValaDelegateType* _tmp21_;
			ValaDataType* _tmp22_;
			ValaDataType* _tmp23_;
			ValaDataType* _tmp24_;
			_tmp15_ = _arg_index;
			_arg_index = _tmp15_ + 1;
			_tmp16_ = _arg_index;
			_tmp17_ = _arg_size;
			if (!(_tmp16_ < _tmp17_)) {
				break;
			}
			_tmp18_ = _arg_list;
			_tmp19_ = _arg_index;
			_tmp20_ = vala_list_get (_tmp18_, _tmp19_);
			arg = (ValaDataType*) _tmp20_;
			_tmp21_ = _result_;
			_tmp22_ = arg;
			_tmp23_ = vala_data_type_copy (_tmp22_);
			_tmp24_ = _tmp23_;
			vala_data_type_add_type_argument ((ValaDataType*) _tmp21_, _tmp24_);
			_vala_code_node_unref0 (_tmp24_);
			_vala_code_node_unref0 (arg);
		}
		_vala_iterable_unref0 (_arg_list);
	}
	_tmp25_ = _result_;
	_tmp26_ = self->priv->_is_called_once;
	vala_delegate_type_set_is_called_once (_tmp25_, _tmp26_);
	result = (ValaDataType*) _result_;
	return result;
}


static gboolean vala_delegate_type_real_is_accessible (ValaDataType* base, ValaSymbol* sym) {
	ValaDelegateType * self;
	gboolean result = FALSE;
	ValaDelegate* _tmp0_;
	ValaSymbol* _tmp1_;
	gboolean _tmp2_;
	self = (ValaDelegateType*) base;
	g_return_val_if_fail (sym != NULL, FALSE);
	_tmp0_ = self->priv->_delegate_symbol;
	_tmp1_ = sym;
	_tmp2_ = vala_symbol_is_accessible ((ValaSymbol*) _tmp0_, _tmp1_);
	result = _tmp2_;
	return result;
}


static gboolean vala_delegate_type_real_check (ValaCodeNode* base, ValaCodeContext* context) {
	ValaDelegateType * self;
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	ValaDelegate* _tmp6_;
	ValaCodeContext* _tmp7_;
	gboolean _tmp8_;
	gint n_type_params = 0;
	ValaDelegate* _tmp9_;
	ValaList* _tmp10_;
	ValaList* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	gint n_type_args = 0;
	ValaList* _tmp15_;
	ValaList* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	gboolean _tmp20_ = FALSE;
	gint _tmp21_;
	self = (ValaDelegateType*) base;
	g_return_val_if_fail (context != NULL, FALSE);
	_tmp1_ = self->priv->_is_called_once;
	if (_tmp1_) {
		gboolean _tmp2_;
		gboolean _tmp3_;
		_tmp2_ = vala_data_type_get_value_owned ((ValaDataType*) self);
		_tmp3_ = _tmp2_;
		_tmp0_ = !_tmp3_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ValaSourceReference* _tmp4_;
		ValaSourceReference* _tmp5_;
		_tmp4_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
		_tmp5_ = _tmp4_;
		vala_report_warning (_tmp5_, "delegates with scope=\"async\" must be owned");
	}
	_tmp6_ = self->priv->_delegate_symbol;
	_tmp7_ = context;
	_tmp8_ = vala_code_node_check ((ValaCodeNode*) _tmp6_, _tmp7_);
	if (!_tmp8_) {
		result = FALSE;
		return result;
	}
	_tmp9_ = self->priv->_delegate_symbol;
	_tmp10_ = vala_delegate_get_type_parameters (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = vala_collection_get_size ((ValaCollection*) _tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = _tmp13_;
	_vala_iterable_unref0 (_tmp11_);
	n_type_params = _tmp14_;
	_tmp15_ = vala_data_type_get_type_arguments ((ValaDataType*) self);
	_tmp16_ = _tmp15_;
	_tmp17_ = vala_collection_get_size ((ValaCollection*) _tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = _tmp18_;
	_vala_iterable_unref0 (_tmp16_);
	n_type_args = _tmp19_;
	_tmp21_ = n_type_args;
	if (_tmp21_ > 0) {
		gint _tmp22_;
		gint _tmp23_;
		_tmp22_ = n_type_args;
		_tmp23_ = n_type_params;
		_tmp20_ = _tmp22_ < _tmp23_;
	} else {
		_tmp20_ = FALSE;
	}
	if (_tmp20_) {
		ValaSourceReference* _tmp24_;
		ValaSourceReference* _tmp25_;
		_tmp24_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
		_tmp25_ = _tmp24_;
		vala_report_error (_tmp25_, "too few type arguments");
		result = FALSE;
		return result;
	} else {
		gboolean _tmp26_ = FALSE;
		gint _tmp27_;
		_tmp27_ = n_type_args;
		if (_tmp27_ > 0) {
			gint _tmp28_;
			gint _tmp29_;
			_tmp28_ = n_type_args;
			_tmp29_ = n_type_params;
			_tmp26_ = _tmp28_ > _tmp29_;
		} else {
			_tmp26_ = FALSE;
		}
		if (_tmp26_) {
			ValaSourceReference* _tmp30_;
			ValaSourceReference* _tmp31_;
			_tmp30_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
			_tmp31_ = _tmp30_;
			vala_report_error (_tmp31_, "too many type arguments");
			result = FALSE;
			return result;
		}
	}
	{
		ValaList* _type_list = NULL;
		ValaList* _tmp32_;
		gint _type_size = 0;
		ValaList* _tmp33_;
		gint _tmp34_;
		gint _tmp35_;
		gint _type_index = 0;
		_tmp32_ = vala_data_type_get_type_arguments ((ValaDataType*) self);
		_type_list = _tmp32_;
		_tmp33_ = _type_list;
		_tmp34_ = vala_collection_get_size ((ValaCollection*) _tmp33_);
		_tmp35_ = _tmp34_;
		_type_size = _tmp35_;
		_type_index = -1;
		while (TRUE) {
			gint _tmp36_;
			gint _tmp37_;
			gint _tmp38_;
			ValaDataType* type = NULL;
			ValaList* _tmp39_;
			gint _tmp40_;
			gpointer _tmp41_;
			ValaDataType* _tmp42_;
			ValaCodeContext* _tmp43_;
			gboolean _tmp44_;
			_tmp36_ = _type_index;
			_type_index = _tmp36_ + 1;
			_tmp37_ = _type_index;
			_tmp38_ = _type_size;
			if (!(_tmp37_ < _tmp38_)) {
				break;
			}
			_tmp39_ = _type_list;
			_tmp40_ = _type_index;
			_tmp41_ = vala_list_get (_tmp39_, _tmp40_);
			type = (ValaDataType*) _tmp41_;
			_tmp42_ = type;
			_tmp43_ = context;
			_tmp44_ = vala_code_node_check ((ValaCodeNode*) _tmp42_, _tmp43_);
			if (!_tmp44_) {
				result = FALSE;
				_vala_code_node_unref0 (type);
				_vala_iterable_unref0 (_type_list);
				return result;
			}
			_vala_code_node_unref0 (type);
		}
		_vala_iterable_unref0 (_type_list);
	}
	result = TRUE;
	return result;
}


static gboolean vala_delegate_type_real_is_disposable (ValaDataType* base) {
	ValaDelegateType * self;
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	ValaDelegate* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	self = (ValaDelegateType*) base;
	_tmp2_ = self->priv->_delegate_symbol;
	_tmp3_ = vala_delegate_get_has_target (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp5_ = vala_data_type_get_value_owned ((ValaDataType*) self);
		_tmp6_ = _tmp5_;
		_tmp1_ = _tmp6_;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		gboolean _tmp7_;
		_tmp7_ = self->priv->_is_called_once;
		_tmp0_ = !_tmp7_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}


ValaDelegate* vala_delegate_type_get_delegate_symbol (ValaDelegateType* self) {
	ValaDelegate* result;
	ValaDelegate* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_delegate_symbol;
	result = _tmp0_;
	return result;
}


void vala_delegate_type_set_delegate_symbol (ValaDelegateType* self, ValaDelegate* value) {
	ValaDelegate* _tmp0_;
	ValaDelegate* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->priv->_delegate_symbol);
	self->priv->_delegate_symbol = _tmp1_;
}


gboolean vala_delegate_type_get_is_called_once (ValaDelegateType* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_is_called_once;
	result = _tmp0_;
	return result;
}


void vala_delegate_type_set_is_called_once (ValaDelegateType* self, gboolean value) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_is_called_once = _tmp0_;
}


static void vala_delegate_type_class_init (ValaDelegateTypeClass * klass) {
	vala_delegate_type_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeNodeClass *) klass)->finalize = vala_delegate_type_finalize;
	g_type_class_add_private (klass, sizeof (ValaDelegateTypePrivate));
	((ValaDataTypeClass *) klass)->is_invokable = (gboolean (*) (ValaDataType *)) vala_delegate_type_real_is_invokable;
	((ValaDataTypeClass *) klass)->get_return_type = (ValaDataType* (*) (ValaDataType *)) vala_delegate_type_real_get_return_type;
	((ValaDataTypeClass *) klass)->get_parameters = (ValaList* (*) (ValaDataType *)) vala_delegate_type_real_get_parameters;
	((ValaDataTypeClass *) klass)->to_qualified_string = (gchar* (*) (ValaDataType *, ValaScope*)) vala_delegate_type_real_to_qualified_string;
	((ValaDataTypeClass *) klass)->copy = (ValaDataType* (*) (ValaDataType *)) vala_delegate_type_real_copy;
	((ValaDataTypeClass *) klass)->is_accessible = (gboolean (*) (ValaDataType *, ValaSymbol*)) vala_delegate_type_real_is_accessible;
	((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode *, ValaCodeContext*)) vala_delegate_type_real_check;
	((ValaDataTypeClass *) klass)->is_disposable = (gboolean (*) (ValaDataType *)) vala_delegate_type_real_is_disposable;
}


static void vala_delegate_type_instance_init (ValaDelegateType * self) {
	self->priv = VALA_DELEGATE_TYPE_GET_PRIVATE (self);
}


static void vala_delegate_type_finalize (ValaCodeNode * obj) {
	ValaDelegateType * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType);
	_vala_code_node_unref0 (self->priv->_delegate_symbol);
	VALA_CODE_NODE_CLASS (vala_delegate_type_parent_class)->finalize (obj);
}


/**
 * The type of an instance of a delegate.
 */
GType vala_delegate_type_get_type (void) {
	static volatile gsize vala_delegate_type_type_id__volatile = 0;
	if (g_once_init_enter (&vala_delegate_type_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValaDelegateTypeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_delegate_type_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaDelegateType), 0, (GInstanceInitFunc) vala_delegate_type_instance_init, NULL };
		GType vala_delegate_type_type_id;
		vala_delegate_type_type_id = g_type_register_static (VALA_TYPE_CALLABLE_TYPE, "ValaDelegateType", &g_define_type_info, 0);
		g_once_init_leave (&vala_delegate_type_type_id__volatile, vala_delegate_type_type_id);
	}
	return vala_delegate_type_type_id__volatile;
}



