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

/* valasliceexpression.vala
 *
 * Copyright (C) 2009 Robin Sonefors
 * Copyright (C) 2009-2013 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:
 * 	Robin Sonefors <ozamosi@flukkost.nu>
 * 	Jürg Billeter <j@bitron.ch>
 */

#include "vala.h"
#include <glib.h>
#include <valagee.h>
#include <glib-object.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))

struct _ValaSliceExpressionPrivate {
	gboolean _null_safe_access;
	ValaExpression* _container;
	ValaExpression* _start;
	ValaExpression* _stop;
};

static gint ValaSliceExpression_private_offset;
static gpointer vala_slice_expression_parent_class = NULL;

static void vala_slice_expression_set_container (ValaSliceExpression* self,
                                          ValaExpression* value);
static void vala_slice_expression_set_start (ValaSliceExpression* self,
                                      ValaExpression* value);
static void vala_slice_expression_set_stop (ValaSliceExpression* self,
                                     ValaExpression* value);
static void vala_slice_expression_real_accept (ValaCodeNode* base,
                                        ValaCodeVisitor* visitor);
static void vala_slice_expression_real_accept_children (ValaCodeNode* base,
                                                 ValaCodeVisitor* visitor);
static void vala_slice_expression_real_replace_expression (ValaCodeNode* base,
                                                    ValaExpression* old_node,
                                                    ValaExpression* new_node);
static gboolean vala_slice_expression_real_is_pure (ValaExpression* base);
static gboolean vala_slice_expression_real_is_accessible (ValaExpression* base,
                                                   ValaSymbol* sym);
static gboolean vala_slice_expression_real_check (ValaCodeNode* base,
                                           ValaCodeContext* context);
static void vala_slice_expression_real_emit (ValaCodeNode* base,
                                      ValaCodeGenerator* codegen);
static void vala_slice_expression_real_get_defined_variables (ValaCodeNode* base,
                                                       ValaCollection* collection);
static void vala_slice_expression_real_get_used_variables (ValaCodeNode* base,
                                                    ValaCollection* collection);
static void vala_slice_expression_finalize (ValaCodeNode * obj);
static GType vala_slice_expression_get_type_once (void);

static inline gpointer
vala_slice_expression_get_instance_private (ValaSliceExpression* self)
{
	return G_STRUCT_MEMBER_P (self, ValaSliceExpression_private_offset);
}

ValaExpression*
vala_slice_expression_get_container (ValaSliceExpression* self)
{
	ValaExpression* result;
	ValaExpression* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_container;
	result = _tmp0_;
	return result;
}

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

static void
vala_slice_expression_set_container (ValaSliceExpression* 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->_container);
	self->priv->_container = _tmp0_;
	_tmp1_ = self->priv->_container;
	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp1_, (ValaCodeNode*) self);
}

ValaExpression*
vala_slice_expression_get_start (ValaSliceExpression* self)
{
	ValaExpression* result;
	ValaExpression* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_start;
	result = _tmp0_;
	return result;
}

static void
vala_slice_expression_set_start (ValaSliceExpression* 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->_start);
	self->priv->_start = _tmp0_;
	_tmp1_ = self->priv->_start;
	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp1_, (ValaCodeNode*) self);
}

ValaExpression*
vala_slice_expression_get_stop (ValaSliceExpression* self)
{
	ValaExpression* result;
	ValaExpression* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_stop;
	result = _tmp0_;
	return result;
}

static void
vala_slice_expression_set_stop (ValaSliceExpression* 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->_stop);
	self->priv->_stop = _tmp0_;
	_tmp1_ = self->priv->_stop;
	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp1_, (ValaCodeNode*) self);
}

gboolean
vala_slice_expression_get_null_safe_access (ValaSliceExpression* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_null_safe_access;
	return result;
}

void
vala_slice_expression_set_null_safe_access (ValaSliceExpression* self,
                                            gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_null_safe_access = value;
}

ValaSliceExpression*
vala_slice_expression_construct (GType object_type,
                                 ValaExpression* container,
                                 ValaExpression* start,
                                 ValaExpression* stop,
                                 ValaSourceReference* source_reference)
{
	ValaSliceExpression* self = NULL;
	g_return_val_if_fail (container != NULL, NULL);
	g_return_val_if_fail (start != NULL, NULL);
	g_return_val_if_fail (stop != NULL, NULL);
	self = (ValaSliceExpression*) vala_expression_construct (object_type);
	vala_slice_expression_set_container (self, container);
	vala_slice_expression_set_start (self, start);
	vala_slice_expression_set_stop (self, stop);
	vala_code_node_set_source_reference ((ValaCodeNode*) self, source_reference);
	return self;
}

ValaSliceExpression*
vala_slice_expression_new (ValaExpression* container,
                           ValaExpression* start,
                           ValaExpression* stop,
                           ValaSourceReference* source_reference)
{
	return vala_slice_expression_construct (VALA_TYPE_SLICE_EXPRESSION, container, start, stop, source_reference);
}

static void
vala_slice_expression_real_accept (ValaCodeNode* base,
                                   ValaCodeVisitor* visitor)
{
	ValaSliceExpression * self;
	self = (ValaSliceExpression*) base;
	g_return_if_fail (visitor != NULL);
	vala_code_visitor_visit_slice_expression (visitor, self);
	vala_code_visitor_visit_expression (visitor, (ValaExpression*) self);
}

static void
vala_slice_expression_real_accept_children (ValaCodeNode* base,
                                            ValaCodeVisitor* visitor)
{
	ValaSliceExpression * self;
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	ValaExpression* _tmp2_;
	ValaExpression* _tmp3_;
	ValaExpression* _tmp4_;
	ValaExpression* _tmp5_;
	self = (ValaSliceExpression*) base;
	g_return_if_fail (visitor != NULL);
	_tmp0_ = vala_slice_expression_get_container (self);
	_tmp1_ = _tmp0_;
	vala_code_node_accept ((ValaCodeNode*) _tmp1_, visitor);
	_tmp2_ = vala_slice_expression_get_start (self);
	_tmp3_ = _tmp2_;
	vala_code_node_accept ((ValaCodeNode*) _tmp3_, visitor);
	_tmp4_ = vala_slice_expression_get_stop (self);
	_tmp5_ = _tmp4_;
	vala_code_node_accept ((ValaCodeNode*) _tmp5_, visitor);
}

static void
vala_slice_expression_real_replace_expression (ValaCodeNode* base,
                                               ValaExpression* old_node,
                                               ValaExpression* new_node)
{
	ValaSliceExpression * self;
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	ValaExpression* _tmp2_;
	ValaExpression* _tmp3_;
	ValaExpression* _tmp4_;
	ValaExpression* _tmp5_;
	self = (ValaSliceExpression*) base;
	g_return_if_fail (old_node != NULL);
	g_return_if_fail (new_node != NULL);
	_tmp0_ = vala_slice_expression_get_container (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == old_node) {
		vala_slice_expression_set_container (self, new_node);
	}
	_tmp2_ = vala_slice_expression_get_start (self);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == old_node) {
		vala_slice_expression_set_start (self, new_node);
	}
	_tmp4_ = vala_slice_expression_get_stop (self);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == old_node) {
		vala_slice_expression_set_stop (self, new_node);
	}
}

static gboolean
vala_slice_expression_real_is_pure (ValaExpression* base)
{
	ValaSliceExpression * self;
	gboolean result;
	self = (ValaSliceExpression*) base;
	result = FALSE;
	return result;
}

static gboolean
vala_slice_expression_real_is_accessible (ValaExpression* base,
                                          ValaSymbol* sym)
{
	ValaSliceExpression * self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	ValaExpression* _tmp2_;
	ValaExpression* _tmp3_;
	gboolean result;
	self = (ValaSliceExpression*) base;
	g_return_val_if_fail (sym != NULL, FALSE);
	_tmp2_ = vala_slice_expression_get_container (self);
	_tmp3_ = _tmp2_;
	if (vala_expression_is_accessible (_tmp3_, sym)) {
		ValaExpression* _tmp4_;
		ValaExpression* _tmp5_;
		_tmp4_ = vala_slice_expression_get_start (self);
		_tmp5_ = _tmp4_;
		_tmp1_ = vala_expression_is_accessible (_tmp5_, sym);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		ValaExpression* _tmp6_;
		ValaExpression* _tmp7_;
		_tmp6_ = vala_slice_expression_get_stop (self);
		_tmp7_ = _tmp6_;
		_tmp0_ = vala_expression_is_accessible (_tmp7_, sym);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gboolean
vala_slice_expression_real_check (ValaCodeNode* base,
                                  ValaCodeContext* context)
{
	ValaSliceExpression * self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp4_;
	ValaExpression* _tmp7_;
	ValaExpression* _tmp8_;
	ValaExpression* _tmp9_;
	ValaExpression* _tmp10_;
	ValaDataType* _tmp11_;
	ValaDataType* _tmp12_;
	ValaExpression* _tmp31_;
	ValaExpression* _tmp32_;
	ValaExpression* _tmp33_;
	ValaExpression* _tmp34_;
	ValaExpression* _tmp35_;
	ValaExpression* _tmp36_;
	ValaDataType* _tmp37_;
	ValaDataType* _tmp38_;
	gboolean _tmp43_;
	gboolean _tmp44_;
	ValaExpression* _tmp49_;
	ValaExpression* _tmp50_;
	ValaDataType* _tmp51_;
	ValaDataType* _tmp52_;
	gboolean _tmp132_;
	gboolean _tmp133_;
	gboolean result;
	self = (ValaSliceExpression*) base;
	g_return_val_if_fail (context != NULL, FALSE);
	_tmp0_ = vala_code_node_get_checked ((ValaCodeNode*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		gboolean _tmp2_;
		gboolean _tmp3_;
		_tmp2_ = vala_code_node_get_error ((ValaCodeNode*) self);
		_tmp3_ = _tmp2_;
		result = !_tmp3_;
		return result;
	}
	vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
	_tmp4_ = self->priv->_null_safe_access;
	if (_tmp4_) {
		gboolean _tmp5_;
		gboolean _tmp6_;
		vala_code_node_set_error ((ValaCodeNode*) self, !VALA_CODE_NODE_CLASS (vala_slice_expression_parent_class)->check ((ValaCodeNode*) G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_EXPRESSION, ValaExpression), context));
		_tmp5_ = vala_code_node_get_error ((ValaCodeNode*) self);
		_tmp6_ = _tmp5_;
		result = !_tmp6_;
		return result;
	}
	_tmp7_ = vala_slice_expression_get_container (self);
	_tmp8_ = _tmp7_;
	if (!vala_code_node_check ((ValaCodeNode*) _tmp8_, context)) {
		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
		result = FALSE;
		return result;
	}
	_tmp9_ = vala_slice_expression_get_container (self);
	_tmp10_ = _tmp9_;
	_tmp11_ = vala_expression_get_value_type (_tmp10_);
	_tmp12_ = _tmp11_;
	if (VALA_IS_ARRAY_TYPE (_tmp12_)) {
		ValaArrayType* array_type = NULL;
		ValaExpression* _tmp13_;
		ValaExpression* _tmp14_;
		ValaDataType* _tmp15_;
		ValaDataType* _tmp16_;
		ValaExpression* _tmp17_;
		ValaExpression* _tmp18_;
		ValaArrayType* _tmp19_;
		ValaDataType* _tmp20_;
		ValaDataType* _tmp21_;
		ValaDataType* _tmp22_;
		ValaDataType* _tmp23_;
		ValaExpression* _tmp24_;
		ValaExpression* _tmp25_;
		ValaArrayType* _tmp26_;
		ValaDataType* _tmp27_;
		ValaDataType* _tmp28_;
		ValaDataType* _tmp29_;
		ValaDataType* _tmp30_;
		_tmp13_ = vala_slice_expression_get_container (self);
		_tmp14_ = _tmp13_;
		_tmp15_ = vala_expression_get_value_type (_tmp14_);
		_tmp16_ = _tmp15_;
		array_type = G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, VALA_TYPE_ARRAY_TYPE, ValaArrayType);
		_tmp17_ = vala_slice_expression_get_start (self);
		_tmp18_ = _tmp17_;
		_tmp19_ = array_type;
		_tmp20_ = vala_array_type_get_length_type (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = vala_data_type_copy (_tmp21_);
		_tmp23_ = _tmp22_;
		vala_expression_set_target_type (_tmp18_, _tmp23_);
		_vala_code_node_unref0 (_tmp23_);
		_tmp24_ = vala_slice_expression_get_stop (self);
		_tmp25_ = _tmp24_;
		_tmp26_ = array_type;
		_tmp27_ = vala_array_type_get_length_type (_tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = vala_data_type_copy (_tmp28_);
		_tmp30_ = _tmp29_;
		vala_expression_set_target_type (_tmp25_, _tmp30_);
		_vala_code_node_unref0 (_tmp30_);
	}
	_tmp31_ = vala_slice_expression_get_start (self);
	_tmp32_ = _tmp31_;
	if (!vala_code_node_check ((ValaCodeNode*) _tmp32_, context)) {
		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
		result = FALSE;
		return result;
	}
	_tmp33_ = vala_slice_expression_get_stop (self);
	_tmp34_ = _tmp33_;
	if (!vala_code_node_check ((ValaCodeNode*) _tmp34_, context)) {
		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
		result = FALSE;
		return result;
	}
	_tmp35_ = vala_slice_expression_get_container (self);
	_tmp36_ = _tmp35_;
	_tmp37_ = vala_expression_get_value_type (_tmp36_);
	_tmp38_ = _tmp37_;
	if (_tmp38_ == NULL) {
		ValaExpression* _tmp39_;
		ValaExpression* _tmp40_;
		ValaSourceReference* _tmp41_;
		ValaSourceReference* _tmp42_;
		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
		_tmp39_ = vala_slice_expression_get_container (self);
		_tmp40_ = _tmp39_;
		_tmp41_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp40_);
		_tmp42_ = _tmp41_;
		vala_report_error (_tmp42_, "Invalid container expression");
		result = FALSE;
		return result;
	}
	_tmp43_ = vala_expression_get_lvalue ((ValaExpression*) self);
	_tmp44_ = _tmp43_;
	if (_tmp44_) {
		ValaExpression* _tmp45_;
		ValaExpression* _tmp46_;
		ValaSourceReference* _tmp47_;
		ValaSourceReference* _tmp48_;
		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
		_tmp45_ = vala_slice_expression_get_container (self);
		_tmp46_ = _tmp45_;
		_tmp47_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp46_);
		_tmp48_ = _tmp47_;
		vala_report_error (_tmp48_, "Slice expressions cannot be used as lvalue");
		result = FALSE;
		return result;
	}
	_tmp49_ = vala_slice_expression_get_container (self);
	_tmp50_ = _tmp49_;
	_tmp51_ = vala_expression_get_value_type (_tmp50_);
	_tmp52_ = _tmp51_;
	if (VALA_IS_ARRAY_TYPE (_tmp52_)) {
		ValaExpression* _tmp53_;
		ValaExpression* _tmp54_;
		ValaDataType* _tmp55_;
		ValaDataType* _tmp56_;
		ValaDataType* _tmp57_;
		ValaDataType* _tmp58_;
		ValaDataType* _tmp59_;
		ValaDataType* _tmp60_;
		ValaArrayType* array_type = NULL;
		ValaDataType* _tmp61_;
		ValaDataType* _tmp62_;
		ValaArrayType* _tmp63_;
		ValaArrayType* _tmp64_;
		ValaArrayType* _tmp65_;
		ValaDataType* _tmp66_;
		ValaDataType* _tmp67_;
		gboolean _tmp68_ = FALSE;
		ValaExpression* _tmp69_;
		ValaExpression* _tmp70_;
		ValaDataType* _tmp71_;
		ValaDataType* _tmp72_;
		gboolean _tmp81_ = FALSE;
		ValaExpression* _tmp82_;
		ValaExpression* _tmp83_;
		ValaDataType* _tmp84_;
		ValaDataType* _tmp85_;
		_tmp53_ = vala_slice_expression_get_container (self);
		_tmp54_ = _tmp53_;
		_tmp55_ = vala_expression_get_value_type (_tmp54_);
		_tmp56_ = _tmp55_;
		_tmp57_ = vala_data_type_copy (_tmp56_);
		_tmp58_ = _tmp57_;
		vala_expression_set_value_type ((ValaExpression*) self, _tmp58_);
		_vala_code_node_unref0 (_tmp58_);
		_tmp59_ = vala_expression_get_value_type ((ValaExpression*) self);
		_tmp60_ = _tmp59_;
		vala_data_type_set_value_owned (_tmp60_, FALSE);
		_tmp61_ = vala_expression_get_value_type ((ValaExpression*) self);
		_tmp62_ = _tmp61_;
		array_type = G_TYPE_CHECK_INSTANCE_CAST (_tmp62_, VALA_TYPE_ARRAY_TYPE, ValaArrayType);
		_tmp63_ = array_type;
		vala_array_type_set_fixed_length (_tmp63_, FALSE);
		_tmp64_ = array_type;
		vala_array_type_set_inline_allocated (_tmp64_, FALSE);
		_tmp65_ = array_type;
		vala_array_type_set_length (_tmp65_, NULL);
		_tmp66_ = vala_expression_get_value_type ((ValaExpression*) self);
		_tmp67_ = _tmp66_;
		vala_code_node_check ((ValaCodeNode*) _tmp67_, context);
		_tmp69_ = vala_slice_expression_get_start (self);
		_tmp70_ = _tmp69_;
		_tmp71_ = vala_expression_get_value_type (_tmp70_);
		_tmp72_ = _tmp71_;
		if (VALA_IS_INTEGER_TYPE (_tmp72_)) {
			_tmp68_ = TRUE;
		} else {
			ValaExpression* _tmp73_;
			ValaExpression* _tmp74_;
			ValaDataType* _tmp75_;
			ValaDataType* _tmp76_;
			_tmp73_ = vala_slice_expression_get_start (self);
			_tmp74_ = _tmp73_;
			_tmp75_ = vala_expression_get_value_type (_tmp74_);
			_tmp76_ = _tmp75_;
			_tmp68_ = VALA_IS_ENUM_VALUE_TYPE (_tmp76_);
		}
		if (!_tmp68_) {
			ValaExpression* _tmp77_;
			ValaExpression* _tmp78_;
			ValaSourceReference* _tmp79_;
			ValaSourceReference* _tmp80_;
			vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
			_tmp77_ = vala_slice_expression_get_start (self);
			_tmp78_ = _tmp77_;
			_tmp79_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp78_);
			_tmp80_ = _tmp79_;
			vala_report_error (_tmp80_, "Expression of integer type expected");
		}
		_tmp82_ = vala_slice_expression_get_stop (self);
		_tmp83_ = _tmp82_;
		_tmp84_ = vala_expression_get_value_type (_tmp83_);
		_tmp85_ = _tmp84_;
		if (VALA_IS_INTEGER_TYPE (_tmp85_)) {
			_tmp81_ = TRUE;
		} else {
			ValaExpression* _tmp86_;
			ValaExpression* _tmp87_;
			ValaDataType* _tmp88_;
			ValaDataType* _tmp89_;
			_tmp86_ = vala_slice_expression_get_stop (self);
			_tmp87_ = _tmp86_;
			_tmp88_ = vala_expression_get_value_type (_tmp87_);
			_tmp89_ = _tmp88_;
			_tmp81_ = VALA_IS_ENUM_VALUE_TYPE (_tmp89_);
		}
		if (!_tmp81_) {
			ValaExpression* _tmp90_;
			ValaExpression* _tmp91_;
			ValaSourceReference* _tmp92_;
			ValaSourceReference* _tmp93_;
			vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
			_tmp90_ = vala_slice_expression_get_stop (self);
			_tmp91_ = _tmp90_;
			_tmp92_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp91_);
			_tmp93_ = _tmp92_;
			vala_report_error (_tmp93_, "Expression of integer type expected");
		}
	} else {
		ValaMethod* slice_method = NULL;
		ValaExpression* _tmp94_;
		ValaExpression* _tmp95_;
		ValaDataType* _tmp96_;
		ValaDataType* _tmp97_;
		ValaSymbol* _tmp98_;
		ValaMethod* _tmp99_;
		ValaMethod* _tmp100_;
		ValaSourceReference* _tmp124_;
		ValaSourceReference* _tmp125_;
		ValaExpression* _tmp126_;
		ValaExpression* _tmp127_;
		ValaDataType* _tmp128_;
		ValaDataType* _tmp129_;
		gchar* _tmp130_;
		gchar* _tmp131_;
		_tmp94_ = vala_slice_expression_get_container (self);
		_tmp95_ = _tmp94_;
		_tmp96_ = vala_expression_get_value_type (_tmp95_);
		_tmp97_ = _tmp96_;
		_tmp98_ = vala_data_type_get_member (_tmp97_, "slice");
		_tmp99_ = VALA_IS_METHOD (_tmp98_) ? ((ValaMethod*) _tmp98_) : NULL;
		if (_tmp99_ == NULL) {
			_vala_code_node_unref0 (_tmp98_);
		}
		slice_method = _tmp99_;
		_tmp100_ = slice_method;
		if (_tmp100_ != NULL) {
			ValaMethodCall* slice_call = NULL;
			ValaExpression* _tmp101_;
			ValaExpression* _tmp102_;
			ValaSourceReference* _tmp103_;
			ValaSourceReference* _tmp104_;
			ValaMemberAccess* _tmp105_;
			ValaMemberAccess* _tmp106_;
			ValaSourceReference* _tmp107_;
			ValaSourceReference* _tmp108_;
			ValaMethodCall* _tmp109_;
			ValaMethodCall* _tmp110_;
			ValaMethodCall* _tmp111_;
			ValaExpression* _tmp112_;
			ValaExpression* _tmp113_;
			ValaMethodCall* _tmp114_;
			ValaExpression* _tmp115_;
			ValaExpression* _tmp116_;
			ValaMethodCall* _tmp117_;
			ValaDataType* _tmp118_;
			ValaDataType* _tmp119_;
			ValaCodeNode* _tmp120_;
			ValaCodeNode* _tmp121_;
			ValaMethodCall* _tmp122_;
			ValaMethodCall* _tmp123_;
			_tmp101_ = vala_slice_expression_get_container (self);
			_tmp102_ = _tmp101_;
			_tmp103_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
			_tmp104_ = _tmp103_;
			_tmp105_ = vala_member_access_new (_tmp102_, "slice", _tmp104_);
			_tmp106_ = _tmp105_;
			_tmp107_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
			_tmp108_ = _tmp107_;
			_tmp109_ = vala_method_call_new ((ValaExpression*) _tmp106_, _tmp108_);
			_tmp110_ = _tmp109_;
			_vala_code_node_unref0 (_tmp106_);
			slice_call = _tmp110_;
			_tmp111_ = slice_call;
			_tmp112_ = vala_slice_expression_get_start (self);
			_tmp113_ = _tmp112_;
			vala_callable_expression_add_argument ((ValaCallableExpression*) _tmp111_, _tmp113_);
			_tmp114_ = slice_call;
			_tmp115_ = vala_slice_expression_get_stop (self);
			_tmp116_ = _tmp115_;
			vala_callable_expression_add_argument ((ValaCallableExpression*) _tmp114_, _tmp116_);
			_tmp117_ = slice_call;
			_tmp118_ = vala_expression_get_target_type ((ValaExpression*) self);
			_tmp119_ = _tmp118_;
			vala_expression_set_target_type ((ValaExpression*) _tmp117_, _tmp119_);
			_tmp120_ = vala_code_node_get_parent_node ((ValaCodeNode*) self);
			_tmp121_ = _tmp120_;
			_tmp122_ = slice_call;
			vala_code_node_replace_expression (_tmp121_, (ValaExpression*) self, (ValaExpression*) _tmp122_);
			_tmp123_ = slice_call;
			result = vala_code_node_check ((ValaCodeNode*) _tmp123_, context);
			_vala_code_node_unref0 (slice_call);
			_vala_code_node_unref0 (slice_method);
			return result;
		}
		vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
		_tmp124_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
		_tmp125_ = _tmp124_;
		_tmp126_ = vala_slice_expression_get_container (self);
		_tmp127_ = _tmp126_;
		_tmp128_ = vala_expression_get_value_type (_tmp127_);
		_tmp129_ = _tmp128_;
		_tmp130_ = vala_code_node_to_string ((ValaCodeNode*) _tmp129_);
		_tmp131_ = _tmp130_;
		vala_report_error (_tmp125_, "The expression `%s' does not denote an array", _tmp131_);
		_g_free0 (_tmp131_);
		_vala_code_node_unref0 (slice_method);
	}
	_tmp132_ = vala_code_node_get_error ((ValaCodeNode*) self);
	_tmp133_ = _tmp132_;
	result = !_tmp133_;
	return result;
}

static void
vala_slice_expression_real_emit (ValaCodeNode* base,
                                 ValaCodeGenerator* codegen)
{
	ValaSliceExpression * self;
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	ValaExpression* _tmp2_;
	ValaExpression* _tmp3_;
	ValaExpression* _tmp4_;
	ValaExpression* _tmp5_;
	self = (ValaSliceExpression*) base;
	g_return_if_fail (codegen != NULL);
	_tmp0_ = vala_slice_expression_get_container (self);
	_tmp1_ = _tmp0_;
	vala_code_node_emit ((ValaCodeNode*) _tmp1_, codegen);
	_tmp2_ = vala_slice_expression_get_start (self);
	_tmp3_ = _tmp2_;
	vala_code_node_emit ((ValaCodeNode*) _tmp3_, codegen);
	_tmp4_ = vala_slice_expression_get_stop (self);
	_tmp5_ = _tmp4_;
	vala_code_node_emit ((ValaCodeNode*) _tmp5_, codegen);
	vala_code_visitor_visit_slice_expression ((ValaCodeVisitor*) codegen, self);
	vala_code_visitor_visit_expression ((ValaCodeVisitor*) codegen, (ValaExpression*) self);
}

static void
vala_slice_expression_real_get_defined_variables (ValaCodeNode* base,
                                                  ValaCollection* collection)
{
	ValaSliceExpression * self;
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	ValaExpression* _tmp2_;
	ValaExpression* _tmp3_;
	ValaExpression* _tmp4_;
	ValaExpression* _tmp5_;
	self = (ValaSliceExpression*) base;
	g_return_if_fail (collection != NULL);
	_tmp0_ = vala_slice_expression_get_container (self);
	_tmp1_ = _tmp0_;
	vala_code_node_get_defined_variables ((ValaCodeNode*) _tmp1_, collection);
	_tmp2_ = vala_slice_expression_get_start (self);
	_tmp3_ = _tmp2_;
	vala_code_node_get_defined_variables ((ValaCodeNode*) _tmp3_, collection);
	_tmp4_ = vala_slice_expression_get_stop (self);
	_tmp5_ = _tmp4_;
	vala_code_node_get_defined_variables ((ValaCodeNode*) _tmp5_, collection);
}

static void
vala_slice_expression_real_get_used_variables (ValaCodeNode* base,
                                               ValaCollection* collection)
{
	ValaSliceExpression * self;
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	ValaExpression* _tmp2_;
	ValaExpression* _tmp3_;
	ValaExpression* _tmp4_;
	ValaExpression* _tmp5_;
	self = (ValaSliceExpression*) base;
	g_return_if_fail (collection != NULL);
	_tmp0_ = vala_slice_expression_get_container (self);
	_tmp1_ = _tmp0_;
	vala_code_node_get_used_variables ((ValaCodeNode*) _tmp1_, collection);
	_tmp2_ = vala_slice_expression_get_start (self);
	_tmp3_ = _tmp2_;
	vala_code_node_get_used_variables ((ValaCodeNode*) _tmp3_, collection);
	_tmp4_ = vala_slice_expression_get_stop (self);
	_tmp5_ = _tmp4_;
	vala_code_node_get_used_variables ((ValaCodeNode*) _tmp5_, collection);
}

static void
vala_slice_expression_class_init (ValaSliceExpressionClass * klass,
                                  gpointer klass_data)
{
	vala_slice_expression_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeNodeClass *) klass)->finalize = vala_slice_expression_finalize;
	g_type_class_adjust_private_offset (klass, &ValaSliceExpression_private_offset);
	((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_slice_expression_real_accept;
	((ValaCodeNodeClass *) klass)->accept_children = (void (*) (ValaCodeNode*, ValaCodeVisitor*)) vala_slice_expression_real_accept_children;
	((ValaCodeNodeClass *) klass)->replace_expression = (void (*) (ValaCodeNode*, ValaExpression*, ValaExpression*)) vala_slice_expression_real_replace_expression;
	((ValaExpressionClass *) klass)->is_pure = (gboolean (*) (ValaExpression*)) vala_slice_expression_real_is_pure;
	((ValaExpressionClass *) klass)->is_accessible = (gboolean (*) (ValaExpression*, ValaSymbol*)) vala_slice_expression_real_is_accessible;
	((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode*, ValaCodeContext*)) vala_slice_expression_real_check;
	((ValaCodeNodeClass *) klass)->emit = (void (*) (ValaCodeNode*, ValaCodeGenerator*)) vala_slice_expression_real_emit;
	((ValaCodeNodeClass *) klass)->get_defined_variables = (void (*) (ValaCodeNode*, ValaCollection*)) vala_slice_expression_real_get_defined_variables;
	((ValaCodeNodeClass *) klass)->get_used_variables = (void (*) (ValaCodeNode*, ValaCollection*)) vala_slice_expression_real_get_used_variables;
}

static void
vala_slice_expression_instance_init (ValaSliceExpression * self,
                                     gpointer klass)
{
	self->priv = vala_slice_expression_get_instance_private (self);
}

static void
vala_slice_expression_finalize (ValaCodeNode * obj)
{
	ValaSliceExpression * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_SLICE_EXPRESSION, ValaSliceExpression);
	_vala_code_node_unref0 (self->priv->_container);
	_vala_code_node_unref0 (self->priv->_start);
	_vala_code_node_unref0 (self->priv->_stop);
	VALA_CODE_NODE_CLASS (vala_slice_expression_parent_class)->finalize (obj);
}

/**
 * Represents an array slice expression.
 *
 * {{{ foo[1:5] }}}
 */
static GType
vala_slice_expression_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValaSliceExpressionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_slice_expression_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaSliceExpression), 0, (GInstanceInitFunc) vala_slice_expression_instance_init, NULL };
	GType vala_slice_expression_type_id;
	vala_slice_expression_type_id = g_type_register_static (VALA_TYPE_EXPRESSION, "ValaSliceExpression", &g_define_type_info, 0);
	ValaSliceExpression_private_offset = g_type_add_instance_private (vala_slice_expression_type_id, sizeof (ValaSliceExpressionPrivate));
	return vala_slice_expression_type_id;
}

GType
vala_slice_expression_get_type (void)
{
	static volatile gsize vala_slice_expression_type_id__once = 0;
	if (g_once_init_enter (&vala_slice_expression_type_id__once)) {
		GType vala_slice_expression_type_id;
		vala_slice_expression_type_id = vala_slice_expression_get_type_once ();
		g_once_init_leave (&vala_slice_expression_type_id__once, vala_slice_expression_type_id);
	}
	return vala_slice_expression_type_id__once;
}

