/* 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 <stdlib.h>
#include <string.h>
#include <valagee.h>


#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;
typedef struct _ValaCodeNodePrivate ValaCodeNodePrivate;

#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 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_CODE_GENERATOR (vala_code_generator_get_type ())
#define VALA_CODE_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CODE_GENERATOR, ValaCodeGenerator))
#define VALA_CODE_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CODE_GENERATOR, ValaCodeGeneratorClass))
#define VALA_IS_CODE_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CODE_GENERATOR))
#define VALA_IS_CODE_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CODE_GENERATOR))
#define VALA_CODE_GENERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CODE_GENERATOR, ValaCodeGeneratorClass))

typedef struct _ValaCodeGenerator ValaCodeGenerator;
typedef struct _ValaCodeGeneratorClass ValaCodeGeneratorClass;

#define VALA_TYPE_DATA_TYPE (vala_data_type_get_type ())
#define VALA_DATA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_DATA_TYPE, ValaDataType))
#define VALA_DATA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_DATA_TYPE, ValaDataTypeClass))
#define VALA_IS_DATA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_DATA_TYPE))
#define VALA_IS_DATA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_DATA_TYPE))
#define VALA_DATA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_DATA_TYPE, ValaDataTypeClass))

typedef struct _ValaDataType ValaDataType;
typedef struct _ValaDataTypeClass ValaDataTypeClass;

#define VALA_TYPE_EXPRESSION (vala_expression_get_type ())
#define VALA_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_EXPRESSION, ValaExpression))
#define VALA_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_EXPRESSION, ValaExpressionClass))
#define VALA_IS_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_EXPRESSION))
#define VALA_IS_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_EXPRESSION))
#define VALA_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_EXPRESSION, ValaExpressionClass))

typedef struct _ValaExpression ValaExpression;
typedef struct _ValaExpressionClass ValaExpressionClass;

#define VALA_TYPE_SYMBOL (vala_symbol_get_type ())
#define VALA_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_SYMBOL, ValaSymbol))
#define VALA_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_SYMBOL, ValaSymbolClass))
#define VALA_IS_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_SYMBOL))
#define VALA_IS_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_SYMBOL))
#define VALA_SYMBOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_SYMBOL, ValaSymbolClass))

typedef struct _ValaSymbol ValaSymbol;
typedef struct _ValaSymbolClass ValaSymbolClass;

#define VALA_TYPE_VARIABLE (vala_variable_get_type ())
#define VALA_VARIABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_VARIABLE, ValaVariable))
#define VALA_VARIABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_VARIABLE, ValaVariableClass))
#define VALA_IS_VARIABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_VARIABLE))
#define VALA_IS_VARIABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_VARIABLE))
#define VALA_VARIABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_VARIABLE, ValaVariableClass))

typedef struct _ValaVariable ValaVariable;
typedef struct _ValaVariableClass ValaVariableClass;

#define VALA_TYPE_ATTRIBUTE (vala_attribute_get_type ())
#define VALA_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_ATTRIBUTE, ValaAttribute))
#define VALA_ATTRIBUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_ATTRIBUTE, ValaAttributeClass))
#define VALA_IS_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_ATTRIBUTE))
#define VALA_IS_ATTRIBUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_ATTRIBUTE))
#define VALA_ATTRIBUTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_ATTRIBUTE, ValaAttributeClass))

typedef struct _ValaAttribute ValaAttribute;
typedef struct _ValaAttributeClass ValaAttributeClass;
typedef struct _ValaDataTypePrivate ValaDataTypePrivate;

#define VALA_TYPE_SCOPE (vala_scope_get_type ())
#define VALA_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_SCOPE, ValaScope))
#define VALA_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_SCOPE, ValaScopeClass))
#define VALA_IS_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_SCOPE))
#define VALA_IS_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_SCOPE))
#define VALA_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_SCOPE, ValaScopeClass))

typedef struct _ValaScope ValaScope;
typedef struct _ValaScopeClass ValaScopeClass;

#define VALA_TYPE_PARAMETER (vala_parameter_get_type ())
#define VALA_PARAMETER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_PARAMETER, ValaParameter))
#define VALA_PARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_PARAMETER, ValaParameterClass))
#define VALA_IS_PARAMETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_PARAMETER))
#define VALA_IS_PARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_PARAMETER))
#define VALA_PARAMETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_PARAMETER, ValaParameterClass))

typedef struct _ValaParameter ValaParameter;
typedef struct _ValaParameterClass ValaParameterClass;

#define VALA_TYPE_TYPEPARAMETER (vala_typeparameter_get_type ())
#define VALA_TYPEPARAMETER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_TYPEPARAMETER, ValaTypeParameter))
#define VALA_TYPEPARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_TYPEPARAMETER, ValaTypeParameterClass))
#define VALA_IS_TYPEPARAMETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_TYPEPARAMETER))
#define VALA_IS_TYPEPARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_TYPEPARAMETER))
#define VALA_TYPEPARAMETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_TYPEPARAMETER, ValaTypeParameterClass))

typedef struct _ValaTypeParameter ValaTypeParameter;
typedef struct _ValaTypeParameterClass ValaTypeParameterClass;

#define VALA_TYPE_DELEGATE_TYPE (vala_delegate_type_get_type ())
#define VALA_DELEGATE_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_DELEGATE_TYPE, ValaDelegateType))
#define VALA_DELEGATE_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_DELEGATE_TYPE, ValaDelegateTypeClass))
#define VALA_IS_DELEGATE_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_DELEGATE_TYPE))
#define VALA_IS_DELEGATE_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_DELEGATE_TYPE))
#define VALA_DELEGATE_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_DELEGATE_TYPE, ValaDelegateTypeClass))

typedef struct _ValaDelegateType ValaDelegateType;
typedef struct _ValaDelegateTypeClass ValaDelegateTypeClass;
typedef struct _ValaDelegateTypePrivate ValaDelegateTypePrivate;

#define VALA_TYPE_TYPESYMBOL (vala_typesymbol_get_type ())
#define VALA_TYPESYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_TYPESYMBOL, ValaTypeSymbol))
#define VALA_TYPESYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_TYPESYMBOL, ValaTypeSymbolClass))
#define VALA_IS_TYPESYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_TYPESYMBOL))
#define VALA_IS_TYPESYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_TYPESYMBOL))
#define VALA_TYPESYMBOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_TYPESYMBOL, ValaTypeSymbolClass))

typedef struct _ValaTypeSymbol ValaTypeSymbol;
typedef struct _ValaTypeSymbolClass ValaTypeSymbolClass;

#define VALA_TYPE_DELEGATE (vala_delegate_get_type ())
#define VALA_DELEGATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_DELEGATE, ValaDelegate))
#define VALA_DELEGATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_DELEGATE, ValaDelegateClass))
#define VALA_IS_DELEGATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_DELEGATE))
#define VALA_IS_DELEGATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_DELEGATE))
#define VALA_DELEGATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_DELEGATE, ValaDelegateClass))

typedef struct _ValaDelegate ValaDelegate;
typedef struct _ValaDelegateClass ValaDelegateClass;
#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_TYPE_CALLABLE (vala_callable_get_type ())
#define VALA_CALLABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CALLABLE, ValaCallable))
#define VALA_IS_CALLABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CALLABLE))
#define VALA_CALLABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), VALA_TYPE_CALLABLE, ValaCallableIface))

typedef struct _ValaCallable ValaCallable;
typedef struct _ValaCallableIface ValaCallableIface;
#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)))

#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;

struct _ValaCodeNode {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ValaCodeNodePrivate * priv;
	GList* attributes;
};

struct _ValaCodeNodeClass {
	GTypeClass parent_class;
	void (*finalize) (ValaCodeNode *self);
	void (*accept) (ValaCodeNode* self, ValaCodeVisitor* visitor);
	void (*accept_children) (ValaCodeNode* self, ValaCodeVisitor* visitor);
	gboolean (*check) (ValaCodeNode* self, ValaCodeContext* context);
	void (*emit) (ValaCodeNode* self, ValaCodeGenerator* codegen);
	void (*replace_type) (ValaCodeNode* self, ValaDataType* old_type, ValaDataType* new_type);
	void (*replace_expression) (ValaCodeNode* self, ValaExpression* old_node, ValaExpression* new_node);
	gchar* (*to_string) (ValaCodeNode* self);
	void (*get_defined_variables) (ValaCodeNode* self, ValaCollection* collection);
	void (*get_used_variables) (ValaCodeNode* self, ValaCollection* collection);
};

struct _ValaDataType {
	ValaCodeNode parent_instance;
	ValaDataTypePrivate * priv;
};

struct _ValaDataTypeClass {
	ValaCodeNodeClass parent_class;
	gchar* (*to_qualified_string) (ValaDataType* self, ValaScope* scope);
	ValaDataType* (*copy) (ValaDataType* self);
	gboolean (*equals) (ValaDataType* self, ValaDataType* type2);
	gboolean (*stricter) (ValaDataType* self, ValaDataType* type2);
	gboolean (*compatible) (ValaDataType* self, ValaDataType* target_type);
	gboolean (*is_invokable) (ValaDataType* self);
	ValaDataType* (*get_return_type) (ValaDataType* self);
	ValaList* (*get_parameters) (ValaDataType* self);
	gboolean (*is_reference_type_or_type_parameter) (ValaDataType* self);
	gboolean (*is_array) (ValaDataType* self);
	gboolean (*is_accessible) (ValaDataType* self, ValaSymbol* sym);
	ValaSymbol* (*get_member) (ValaDataType* self, const gchar* member_name);
	ValaSymbol* (*get_pointer_member) (ValaDataType* self, const gchar* member_name);
	gboolean (*is_real_struct_type) (ValaDataType* self);
	gboolean (*is_disposable) (ValaDataType* self);
	ValaDataType* (*get_actual_type) (ValaDataType* self, ValaDataType* derived_instance_type, ValaList* method_type_arguments, ValaCodeNode* node_reference);
	ValaDataType* (*infer_type_argument) (ValaDataType* self, ValaTypeParameter* type_param, ValaDataType* value_type);
};

struct _ValaDelegateType {
	ValaDataType parent_instance;
	ValaDelegateTypePrivate * priv;
};

struct _ValaDelegateTypeClass {
	ValaDataTypeClass parent_class;
};

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

struct _ValaCallableIface {
	GTypeInterface parent_iface;
	void (*add_parameter) (ValaCallable* self, ValaParameter* param);
	ValaList* (*get_parameters) (ValaCallable* self);
	ValaDataType* (*get_return_type) (ValaCallable* self);
	void (*set_return_type) (ValaCallable* self, ValaDataType* value);
};


static gpointer vala_delegate_type_parent_class = NULL;

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;
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;
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;
GType vala_code_generator_get_type (void) G_GNUC_CONST;
GType vala_data_type_get_type (void) G_GNUC_CONST;
GType vala_expression_get_type (void) G_GNUC_CONST;
GType vala_symbol_get_type (void) G_GNUC_CONST;
GType vala_variable_get_type (void) G_GNUC_CONST;
GType vala_attribute_get_type (void) G_GNUC_CONST;
gpointer vala_scope_ref (gpointer instance);
void vala_scope_unref (gpointer instance);
GParamSpec* vala_param_spec_scope (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vala_value_set_scope (GValue* value, gpointer v_object);
void vala_value_take_scope (GValue* value, gpointer v_object);
gpointer vala_value_get_scope (const GValue* value);
GType vala_scope_get_type (void) G_GNUC_CONST;
GType vala_parameter_get_type (void) G_GNUC_CONST;
GType vala_typeparameter_get_type (void) G_GNUC_CONST;
GType vala_delegate_type_get_type (void) G_GNUC_CONST;
GType vala_typesymbol_get_type (void) G_GNUC_CONST;
GType vala_delegate_get_type (void) G_GNUC_CONST;
#define VALA_DELEGATE_TYPE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_DELEGATE_TYPE, ValaDelegateTypePrivate))
enum  {
	VALA_DELEGATE_TYPE_DUMMY_PROPERTY
};
ValaDelegateType* vala_delegate_type_new (ValaDelegate* delegate_symbol);
ValaDelegateType* vala_delegate_type_construct (GType object_type, ValaDelegate* delegate_symbol);
ValaDataType* vala_data_type_construct (GType object_type);
void vala_delegate_type_set_delegate_symbol (ValaDelegateType* self, ValaDelegate* value);
gchar* vala_code_node_get_attribute_string (ValaCodeNode* self, const gchar* attribute, const gchar* argument, const gchar* default_value);
void vala_delegate_type_set_is_called_once (ValaDelegateType* self, gboolean value);
static gboolean vala_delegate_type_real_is_invokable (ValaDataType* base);
static ValaDataType* vala_delegate_type_real_get_return_type (ValaDataType* base);
ValaDelegate* vala_delegate_type_get_delegate_symbol (ValaDelegateType* self);
GType vala_callable_get_type (void) G_GNUC_CONST;
ValaDataType* vala_callable_get_return_type (ValaCallable* self);
static ValaList* vala_delegate_type_real_get_parameters (ValaDataType* base);
ValaList* vala_callable_get_parameters (ValaCallable* self);
static gchar* vala_delegate_type_real_to_qualified_string (ValaDataType* base, ValaScope* scope);
ValaSymbol* vala_symbol_get_parent_symbol (ValaSymbol* self);
const gchar* vala_symbol_get_name (ValaSymbol* self);
ValaSymbol* vala_scope_lookup (ValaScope* self, const gchar* name);
ValaScope* vala_scope_get_parent_scope (ValaScope* self);
gchar* vala_symbol_get_full_name (ValaSymbol* self);
ValaList* vala_data_type_get_type_arguments (ValaDataType* self);
gboolean vala_data_type_get_value_owned (ValaDataType* self);
gchar* vala_data_type_to_qualified_string (ValaDataType* self, ValaScope* scope);
gboolean vala_data_type_get_nullable (ValaDataType* self);
static ValaDataType* vala_delegate_type_real_copy (ValaDataType* base);
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;
ValaSourceReference* vala_code_node_get_source_reference (ValaCodeNode* self);
void vala_code_node_set_source_reference (ValaCodeNode* self, ValaSourceReference* value);
void vala_data_type_set_value_owned (ValaDataType* self, gboolean value);
void vala_data_type_set_nullable (ValaDataType* self, gboolean value);
void vala_data_type_add_type_argument (ValaDataType* self, ValaDataType* arg);
ValaDataType* vala_data_type_copy (ValaDataType* self);
gboolean vala_delegate_type_get_is_called_once (ValaDelegateType* self);
static gboolean vala_delegate_type_real_is_accessible (ValaDataType* base, ValaSymbol* sym);
gboolean vala_symbol_is_accessible (ValaSymbol* self, ValaSymbol* sym);
static gboolean vala_delegate_type_real_check (ValaCodeNode* base, ValaCodeContext* context);
void vala_report_warning (ValaSourceReference* source, const gchar* message);
gboolean vala_code_node_check (ValaCodeNode* self, ValaCodeContext* context);
ValaList* vala_delegate_get_type_parameters (ValaDelegate* self);
void vala_report_error (ValaSourceReference* source, const gchar* message);
static gboolean vala_delegate_type_real_is_disposable (ValaDataType* base);
gboolean vala_delegate_get_has_target (ValaDelegate* self);
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_data_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_DATA_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;
}



