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

/* valalockstatement.vala
 *
 * Copyright (C) 2009  Jiří Zárevúcky
 * Copyright (C) 2006-2010  Jürg Billeter
 * Copyright (C) 2006-2007  Raffaele Sandrini
 *
 * 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
 *
 * Authors:
 * 	Raffaele Sandrini <raffaele@sandrini.ch>
 * 	Jiří Zárevúcky <zarevucky.jiri@gmail.com>
 */

#include "vala.h"
#include <glib.h>
#include <glib-object.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))

struct _ValaLockStatementPrivate {
	ValaExpression* _resource;
	ValaBlock* _body;
};

static gint ValaLockStatement_private_offset;
static gpointer vala_lock_statement_parent_class = NULL;
static ValaStatementIface * vala_lock_statement_vala_statement_parent_iface = NULL;

static void vala_lock_statement_set_resource (ValaLockStatement* self,
                                       ValaExpression* value);
static void vala_lock_statement_set_body (ValaLockStatement* self,
                                   ValaBlock* value);
static void vala_lock_statement_real_accept (ValaCodeNode* base,
                                      ValaCodeVisitor* visitor);
static void vala_lock_statement_real_replace_expression (ValaCodeNode* base,
                                                  ValaExpression* old_node,
                                                  ValaExpression* new_node);
static gboolean vala_lock_statement_real_check (ValaCodeNode* base,
                                         ValaCodeContext* context);
static void vala_lock_statement_real_emit (ValaCodeNode* base,
                                    ValaCodeGenerator* codegen);
static void vala_lock_statement_finalize (ValaCodeNode * obj);
static GType vala_lock_statement_get_type_once (void);

static inline gpointer
vala_lock_statement_get_instance_private (ValaLockStatement* self)
{
	return G_STRUCT_MEMBER_P (self, ValaLockStatement_private_offset);
}

ValaExpression*
vala_lock_statement_get_resource (ValaLockStatement* self)
{
	ValaExpression* result;
	ValaExpression* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_resource;
	result = _tmp0_;
	return result;
}

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

static void
vala_lock_statement_set_resource (ValaLockStatement* self,
                                  ValaExpression* value)
{
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _vala_code_node_ref0 (value);
	_vala_code_node_unref0 (self->priv->_resource);
	self->priv->_resource = _tmp0_;
	_tmp1_ = self->priv->_resource;
	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp1_, (ValaCodeNode*) self);
}

ValaBlock*
vala_lock_statement_get_body (ValaLockStatement* self)
{
	ValaBlock* result;
	ValaBlock* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_body;
	result = _tmp0_;
	return result;
}

static void
vala_lock_statement_set_body (ValaLockStatement* self,
                              ValaBlock* value)
{
	ValaBlock* _tmp0_;
	ValaBlock* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _vala_code_node_ref0 (value);
	_vala_code_node_unref0 (self->priv->_body);
	self->priv->_body = _tmp0_;
	_tmp1_ = self->priv->_body;
	if (_tmp1_ != NULL) {
		ValaBlock* _tmp2_;
		_tmp2_ = self->priv->_body;
		vala_code_node_set_parent_node ((ValaCodeNode*) _tmp2_, (ValaCodeNode*) self);
	}
}

ValaLockStatement*
vala_lock_statement_construct (GType object_type,
                               ValaExpression* resource,
                               ValaBlock* body,
                               ValaSourceReference* source_reference)
{
	ValaLockStatement* self = NULL;
	g_return_val_if_fail (resource != NULL, NULL);
	self = (ValaLockStatement*) vala_code_node_construct (object_type);
	vala_lock_statement_set_body (self, body);
	vala_code_node_set_source_reference ((ValaCodeNode*) self, source_reference);
	vala_lock_statement_set_resource (self, resource);
	return self;
}

ValaLockStatement*
vala_lock_statement_new (ValaExpression* resource,
                         ValaBlock* body,
                         ValaSourceReference* source_reference)
{
	return vala_lock_statement_construct (VALA_TYPE_LOCK_STATEMENT, resource, body, source_reference);
}

static void
vala_lock_statement_real_accept (ValaCodeNode* base,
                                 ValaCodeVisitor* visitor)
{
	ValaLockStatement * self;
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	ValaBlock* _tmp2_;
	ValaBlock* _tmp3_;
	self = (ValaLockStatement*) base;
	g_return_if_fail (visitor != NULL);
	_tmp0_ = vala_lock_statement_get_resource (self);
	_tmp1_ = _tmp0_;
	vala_code_node_accept ((ValaCodeNode*) _tmp1_, visitor);
	_tmp2_ = vala_lock_statement_get_body (self);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != NULL) {
		ValaBlock* _tmp4_;
		ValaBlock* _tmp5_;
		_tmp4_ = vala_lock_statement_get_body (self);
		_tmp5_ = _tmp4_;
		vala_code_node_accept ((ValaCodeNode*) _tmp5_, visitor);
	}
	vala_code_visitor_visit_lock_statement (visitor, self);
}

static void
vala_lock_statement_real_replace_expression (ValaCodeNode* base,
                                             ValaExpression* old_node,
                                             ValaExpression* new_node)
{
	ValaLockStatement * self;
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	self = (ValaLockStatement*) base;
	g_return_if_fail (old_node != NULL);
	g_return_if_fail (new_node != NULL);
	_tmp0_ = vala_lock_statement_get_resource (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == old_node) {
		vala_lock_statement_set_resource (self, new_node);
	}
}

static gboolean
vala_lock_statement_real_check (ValaCodeNode* base,
                                ValaCodeContext* context)
{
	ValaLockStatement * self;
	ValaBlock* _tmp0_;
	ValaBlock* _tmp1_;
	gboolean _tmp66_;
	gboolean _tmp67_;
	ValaExpression* _tmp70_;
	ValaExpression* _tmp71_;
	gboolean _tmp72_ = FALSE;
	ValaExpression* _tmp73_;
	ValaExpression* _tmp74_;
	ValaExpression* _tmp85_;
	ValaExpression* _tmp86_;
	ValaSymbol* _tmp87_;
	ValaSymbol* _tmp88_;
	ValaSymbol* _tmp89_;
	ValaSymbol* _tmp90_;
	ValaSemanticAnalyzer* _tmp91_;
	ValaSemanticAnalyzer* _tmp92_;
	ValaClass* _tmp93_;
	ValaClass* _tmp94_;
	ValaSemanticAnalyzer* _tmp101_;
	ValaSemanticAnalyzer* _tmp102_;
	ValaClass* _tmp103_;
	ValaClass* _tmp104_;
	gboolean _tmp105_;
	gboolean _tmp106_;
	ValaExpression* _tmp113_;
	ValaExpression* _tmp114_;
	ValaSymbol* _tmp115_;
	ValaSymbol* _tmp116_;
	gboolean _tmp117_;
	gboolean _tmp118_;
	gboolean result;
	self = (ValaLockStatement*) base;
	g_return_val_if_fail (context != NULL, FALSE);
	_tmp0_ = vala_lock_statement_get_body (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != NULL) {
		ValaBlock* _tmp2_;
		ValaBlock* _tmp3_;
		ValaBlock* fin_body = NULL;
		ValaSourceReference* _tmp4_;
		ValaSourceReference* _tmp5_;
		ValaBlock* _tmp6_;
		ValaBlock* _tmp7_;
		ValaExpression* _tmp8_;
		ValaExpression* _tmp9_;
		ValaSourceReference* _tmp10_;
		ValaSourceReference* _tmp11_;
		ValaUnlockStatement* _tmp12_;
		ValaUnlockStatement* _tmp13_;
		ValaTryStatement* try_stmt = NULL;
		ValaBlock* _tmp14_;
		ValaBlock* _tmp15_;
		ValaBlock* _tmp16_;
		ValaSourceReference* _tmp17_;
		ValaSourceReference* _tmp18_;
		ValaTryStatement* _tmp19_;
		ValaBlock* _tmp20_;
		ValaBlock* _tmp21_;
		gboolean _tmp22_;
		gboolean _tmp23_;
		ValaBlock* block = NULL;
		ValaSourceReference* _tmp48_;
		ValaSourceReference* _tmp49_;
		ValaBlock* _tmp50_;
		ValaBlock* _tmp51_;
		ValaExpression* _tmp52_;
		ValaExpression* _tmp53_;
		ValaSourceReference* _tmp54_;
		ValaSourceReference* _tmp55_;
		ValaLockStatement* _tmp56_;
		ValaLockStatement* _tmp57_;
		ValaBlock* _tmp58_;
		ValaTryStatement* _tmp59_;
		ValaBlock* parent_block = NULL;
		ValaCodeNode* _tmp60_;
		ValaCodeNode* _tmp61_;
		ValaBlock* _tmp62_;
		ValaBlock* _tmp63_;
		ValaBlock* _tmp64_;
		ValaBlock* _tmp65_;
		_tmp2_ = vala_lock_statement_get_body (self);
		_tmp3_ = _tmp2_;
		if (!vala_code_node_check ((ValaCodeNode*) _tmp3_, context)) {
			result = FALSE;
			return result;
		}
		_tmp4_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = vala_block_new (_tmp5_);
		fin_body = _tmp6_;
		_tmp7_ = fin_body;
		_tmp8_ = vala_lock_statement_get_resource (self);
		_tmp9_ = _tmp8_;
		_tmp10_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
		_tmp11_ = _tmp10_;
		_tmp12_ = vala_unlock_statement_new (_tmp9_, _tmp11_);
		_tmp13_ = _tmp12_;
		vala_block_add_statement (_tmp7_, (ValaStatement*) _tmp13_);
		_vala_code_node_unref0 (_tmp13_);
		_tmp14_ = vala_lock_statement_get_body (self);
		_tmp15_ = _tmp14_;
		_tmp16_ = fin_body;
		_tmp17_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
		_tmp18_ = _tmp17_;
		_tmp19_ = vala_try_statement_new (_tmp15_, _tmp16_, _tmp18_);
		try_stmt = _tmp19_;
		_tmp20_ = vala_lock_statement_get_body (self);
		_tmp21_ = _tmp20_;
		_tmp22_ = vala_code_node_get_tree_can_fail ((ValaCodeNode*) _tmp21_);
		_tmp23_ = _tmp22_;
		if (_tmp23_) {
			ValaBlock* catch_body = NULL;
			ValaSourceReference* _tmp24_;
			ValaSourceReference* _tmp25_;
			ValaBlock* _tmp26_;
			ValaBlock* _tmp27_;
			ValaMemberAccess* _tmp28_;
			ValaMemberAccess* _tmp29_;
			ValaReferenceTransferExpression* _tmp30_;
			ValaReferenceTransferExpression* _tmp31_;
			ValaSourceReference* _tmp32_;
			ValaSourceReference* _tmp33_;
			ValaThrowStatement* _tmp34_;
			ValaThrowStatement* _tmp35_;
			ValaCatchClause* catch_clause = NULL;
			ValaErrorType* _tmp36_;
			ValaErrorType* _tmp37_;
			ValaBlock* _tmp38_;
			ValaSourceReference* _tmp39_;
			ValaSourceReference* _tmp40_;
			ValaCatchClause* _tmp41_;
			ValaCatchClause* _tmp42_;
			ValaCatchClause* _tmp43_;
			ValaDataType* _tmp44_;
			ValaDataType* _tmp45_;
			ValaTryStatement* _tmp46_;
			ValaCatchClause* _tmp47_;
			_tmp24_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
			_tmp25_ = _tmp24_;
			_tmp26_ = vala_block_new (_tmp25_);
			catch_body = _tmp26_;
			_tmp27_ = catch_body;
			_tmp28_ = vala_member_access_new_simple ("_lock_error_", NULL);
			_tmp29_ = _tmp28_;
			_tmp30_ = vala_reference_transfer_expression_new ((ValaExpression*) _tmp29_, NULL);
			_tmp31_ = _tmp30_;
			_tmp32_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
			_tmp33_ = _tmp32_;
			_tmp34_ = vala_throw_statement_new ((ValaExpression*) _tmp31_, _tmp33_);
			_tmp35_ = _tmp34_;
			vala_block_add_statement (_tmp27_, (ValaStatement*) _tmp35_);
			_vala_code_node_unref0 (_tmp35_);
			_vala_code_node_unref0 (_tmp31_);
			_vala_code_node_unref0 (_tmp29_);
			_tmp36_ = vala_error_type_new (NULL, NULL, NULL);
			_tmp37_ = _tmp36_;
			_tmp38_ = catch_body;
			_tmp39_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
			_tmp40_ = _tmp39_;
			_tmp41_ = vala_catch_clause_new ((ValaDataType*) _tmp37_, "_lock_error_", _tmp38_, _tmp40_);
			_tmp42_ = _tmp41_;
			_vala_code_node_unref0 (_tmp37_);
			catch_clause = _tmp42_;
			_tmp43_ = catch_clause;
			_tmp44_ = vala_catch_clause_get_error_type (_tmp43_);
			_tmp45_ = _tmp44_;
			vala_data_type_set_value_owned (_tmp45_, TRUE);
			_tmp46_ = try_stmt;
			_tmp47_ = catch_clause;
			vala_try_statement_add_catch_clause (_tmp46_, _tmp47_);
			_vala_code_node_unref0 (catch_clause);
			_vala_code_node_unref0 (catch_body);
		}
		_tmp48_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
		_tmp49_ = _tmp48_;
		_tmp50_ = vala_block_new (_tmp49_);
		block = _tmp50_;
		_tmp51_ = block;
		_tmp52_ = vala_lock_statement_get_resource (self);
		_tmp53_ = _tmp52_;
		_tmp54_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
		_tmp55_ = _tmp54_;
		_tmp56_ = vala_lock_statement_new (_tmp53_, NULL, _tmp55_);
		_tmp57_ = _tmp56_;
		vala_block_add_statement (_tmp51_, (ValaStatement*) _tmp57_);
		_vala_code_node_unref0 (_tmp57_);
		_tmp58_ = block;
		_tmp59_ = try_stmt;
		vala_block_add_statement (_tmp58_, (ValaStatement*) _tmp59_);
		_tmp60_ = vala_code_node_get_parent_node ((ValaCodeNode*) self);
		_tmp61_ = _tmp60_;
		_tmp62_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp61_, VALA_TYPE_BLOCK, ValaBlock));
		parent_block = _tmp62_;
		_tmp63_ = parent_block;
		_tmp64_ = block;
		vala_block_replace_statement (_tmp63_, (ValaStatement*) self, (ValaStatement*) _tmp64_);
		_tmp65_ = block;
		result = vala_code_node_check ((ValaCodeNode*) _tmp65_, context);
		_vala_code_node_unref0 (parent_block);
		_vala_code_node_unref0 (block);
		_vala_code_node_unref0 (try_stmt);
		_vala_code_node_unref0 (fin_body);
		return result;
	}
	_tmp66_ = vala_code_node_get_checked ((ValaCodeNode*) self);
	_tmp67_ = _tmp66_;
	if (_tmp67_) {
		gboolean _tmp68_;
		gboolean _tmp69_;
		_tmp68_ = vala_code_node_get_error ((ValaCodeNode*) self);
		_tmp69_ = _tmp68_;
		result = !_tmp69_;
		return result;
	}
	vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
	_tmp70_ = vala_lock_statement_get_resource (self);
	_tmp71_ = _tmp70_;
	vala_code_node_check ((ValaCodeNode*) _tmp71_, context);
	_tmp73_ = vala_lock_statement_get_resource (self);
	_tmp74_ = _tmp73_;
	if (VALA_IS_MEMBER_ACCESS (_tmp74_)) {
		ValaExpression* _tmp75_;
		ValaExpression* _tmp76_;
		ValaSymbol* _tmp77_;
		ValaSymbol* _tmp78_;
		_tmp75_ = vala_lock_statement_get_resource (self);
		_tmp76_ = _tmp75_;
		_tmp77_ = vala_expression_get_symbol_reference (_tmp76_);
		_tmp78_ = _tmp77_;
		_tmp72_ = VALA_IS_LOCKABLE (_tmp78_);
	} else {
		_tmp72_ = FALSE;
	}
	if (!_tmp72_) {
		ValaExpression* _tmp79_;
		ValaExpression* _tmp80_;
		ValaExpression* _tmp81_;
		ValaExpression* _tmp82_;
		ValaSourceReference* _tmp83_;
		ValaSourceReference* _tmp84_;
		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
		_tmp79_ = vala_lock_statement_get_resource (self);
		_tmp80_ = _tmp79_;
		vala_code_node_set_error ((ValaCodeNode*) _tmp80_, TRUE);
		_tmp81_ = vala_lock_statement_get_resource (self);
		_tmp82_ = _tmp81_;
		_tmp83_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp82_);
		_tmp84_ = _tmp83_;
		vala_report_error (_tmp84_, "Expression is either not a member access or does not denote a lockable" \
" member");
		result = FALSE;
		return result;
	}
	_tmp85_ = vala_lock_statement_get_resource (self);
	_tmp86_ = _tmp85_;
	_tmp87_ = vala_expression_get_symbol_reference (_tmp86_);
	_tmp88_ = _tmp87_;
	_tmp89_ = vala_symbol_get_parent_symbol (_tmp88_);
	_tmp90_ = _tmp89_;
	_tmp91_ = vala_code_context_get_analyzer (context);
	_tmp92_ = _tmp91_;
	_tmp93_ = vala_semantic_analyzer_get_current_class (_tmp92_);
	_tmp94_ = _tmp93_;
	if (_tmp90_ != G_TYPE_CHECK_INSTANCE_CAST (_tmp94_, VALA_TYPE_SYMBOL, ValaSymbol)) {
		ValaExpression* _tmp95_;
		ValaExpression* _tmp96_;
		ValaExpression* _tmp97_;
		ValaExpression* _tmp98_;
		ValaSourceReference* _tmp99_;
		ValaSourceReference* _tmp100_;
		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
		_tmp95_ = vala_lock_statement_get_resource (self);
		_tmp96_ = _tmp95_;
		vala_code_node_set_error ((ValaCodeNode*) _tmp96_, TRUE);
		_tmp97_ = vala_lock_statement_get_resource (self);
		_tmp98_ = _tmp97_;
		_tmp99_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp98_);
		_tmp100_ = _tmp99_;
		vala_report_error (_tmp100_, "Only members of the current class are lockable");
		result = FALSE;
		return result;
	}
	_tmp101_ = vala_code_context_get_analyzer (context);
	_tmp102_ = _tmp101_;
	_tmp103_ = vala_semantic_analyzer_get_current_class (_tmp102_);
	_tmp104_ = _tmp103_;
	_tmp105_ = vala_class_get_is_compact (_tmp104_);
	_tmp106_ = _tmp105_;
	if (_tmp106_) {
		ValaExpression* _tmp107_;
		ValaExpression* _tmp108_;
		ValaExpression* _tmp109_;
		ValaExpression* _tmp110_;
		ValaSourceReference* _tmp111_;
		ValaSourceReference* _tmp112_;
		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
		_tmp107_ = vala_lock_statement_get_resource (self);
		_tmp108_ = _tmp107_;
		vala_code_node_set_error ((ValaCodeNode*) _tmp108_, TRUE);
		_tmp109_ = vala_lock_statement_get_resource (self);
		_tmp110_ = _tmp109_;
		_tmp111_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp110_);
		_tmp112_ = _tmp111_;
		vala_report_error (_tmp112_, "Only members of the non-compact classes are lockable");
		result = FALSE;
		return result;
	}
	_tmp113_ = vala_lock_statement_get_resource (self);
	_tmp114_ = _tmp113_;
	_tmp115_ = vala_expression_get_symbol_reference (_tmp114_);
	_tmp116_ = _tmp115_;
	vala_lockable_set_lock_used (G_TYPE_CHECK_INSTANCE_CAST (_tmp116_, VALA_TYPE_LOCKABLE, ValaLockable), TRUE);
	_tmp117_ = vala_code_node_get_error ((ValaCodeNode*) self);
	_tmp118_ = _tmp117_;
	result = !_tmp118_;
	return result;
}

static void
vala_lock_statement_real_emit (ValaCodeNode* base,
                               ValaCodeGenerator* codegen)
{
	ValaLockStatement * self;
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	self = (ValaLockStatement*) base;
	g_return_if_fail (codegen != NULL);
	_tmp0_ = vala_lock_statement_get_resource (self);
	_tmp1_ = _tmp0_;
	vala_code_node_emit ((ValaCodeNode*) _tmp1_, codegen);
	vala_code_visitor_visit_lock_statement ((ValaCodeVisitor*) codegen, self);
}

static void
vala_lock_statement_class_init (ValaLockStatementClass * klass,
                                gpointer klass_data)
{
	vala_lock_statement_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeNodeClass *) klass)->finalize = vala_lock_statement_finalize;
	g_type_class_adjust_private_offset (klass, &ValaLockStatement_private_offset);
	((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_lock_statement_real_accept;
	((ValaCodeNodeClass *) klass)->replace_expression = (void (*) (ValaCodeNode*, ValaExpression*, ValaExpression*)) vala_lock_statement_real_replace_expression;
	((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_lock_statement_real_check;
	((ValaCodeNodeClass *) klass)->emit = (void (*) (ValaCodeNode*, ValaCodeGenerator*)) vala_lock_statement_real_emit;
}

static void
vala_lock_statement_vala_statement_interface_init (ValaStatementIface * iface,
                                                   gpointer iface_data)
{
	vala_lock_statement_vala_statement_parent_iface = g_type_interface_peek_parent (iface);
}

static void
vala_lock_statement_instance_init (ValaLockStatement * self,
                                   gpointer klass)
{
	self->priv = vala_lock_statement_get_instance_private (self);
}

static void
vala_lock_statement_finalize (ValaCodeNode * obj)
{
	ValaLockStatement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_LOCK_STATEMENT, ValaLockStatement);
	_vala_code_node_unref0 (self->priv->_resource);
	_vala_code_node_unref0 (self->priv->_body);
	VALA_CODE_NODE_CLASS (vala_lock_statement_parent_class)->finalize (obj);
}

/**
 * Represents a lock statement.
 *
 * {{{ lock (foo); }}} or {{{ lock (foo) { ... } }}}
 *
 * If the statement is empty, the mutex remains locked until a corresponding
 * {@link Vala.UnlockStatement} occurs. Otherwise it's translated into a
 * try/finally statement which unlocks the mutex after the block is finished.
 */
static GType
vala_lock_statement_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValaLockStatementClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_lock_statement_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaLockStatement), 0, (GInstanceInitFunc) vala_lock_statement_instance_init, NULL };
	static const GInterfaceInfo vala_statement_info = { (GInterfaceInitFunc) vala_lock_statement_vala_statement_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType vala_lock_statement_type_id;
	vala_lock_statement_type_id = g_type_register_static (VALA_TYPE_CODE_NODE, "ValaLockStatement", &g_define_type_info, 0);
	g_type_add_interface_static (vala_lock_statement_type_id, VALA_TYPE_STATEMENT, &vala_statement_info);
	ValaLockStatement_private_offset = g_type_add_instance_private (vala_lock_statement_type_id, sizeof (ValaLockStatementPrivate));
	return vala_lock_statement_type_id;
}

GType
vala_lock_statement_get_type (void)
{
	static volatile gsize vala_lock_statement_type_id__once = 0;
	if (g_once_init_enter (&vala_lock_statement_type_id__once)) {
		GType vala_lock_statement_type_id;
		vala_lock_statement_type_id = vala_lock_statement_get_type_once ();
		g_once_init_leave (&vala_lock_statement_type_id__once, vala_lock_statement_type_id);
	}
	return vala_lock_statement_type_id__once;
}

