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

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

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


static gpointer vala_slice_expression_parent_class = NULL;

#define VALA_SLICE_EXPRESSION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_SLICE_EXPRESSION, ValaSliceExpressionPrivate))
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);


ValaSliceExpression* vala_slice_expression_construct (GType object_type, ValaExpression* container, ValaExpression* start, ValaExpression* stop, ValaSourceReference* source_reference) {
	ValaSliceExpression* self = NULL;
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	ValaExpression* _tmp2_;
	ValaSourceReference* _tmp3_;
	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);
	_tmp0_ = container;
	vala_slice_expression_set_container (self, _tmp0_);
	_tmp1_ = start;
	vala_slice_expression_set_start (self, _tmp1_);
	_tmp2_ = stop;
	vala_slice_expression_set_stop (self, _tmp2_);
	_tmp3_ = source_reference;
	vala_code_node_set_source_reference ((ValaCodeNode*) self, _tmp3_);
	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;
	ValaCodeVisitor* _tmp0_;
	ValaCodeVisitor* _tmp1_;
	self = (ValaSliceExpression*) base;
	g_return_if_fail (visitor != NULL);
	_tmp0_ = visitor;
	vala_code_visitor_visit_slice_expression (_tmp0_, self);
	_tmp1_ = visitor;
	vala_code_visitor_visit_expression (_tmp1_, (ValaExpression*) self);
}


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


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* _tmp4_;
	ValaExpression* _tmp5_;
	ValaExpression* _tmp6_;
	ValaExpression* _tmp8_;
	ValaExpression* _tmp9_;
	ValaExpression* _tmp10_;
	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_;
	_tmp2_ = old_node;
	if (_tmp1_ == _tmp2_) {
		ValaExpression* _tmp3_;
		_tmp3_ = new_node;
		vala_slice_expression_set_container (self, _tmp3_);
	}
	_tmp4_ = vala_slice_expression_get_start (self);
	_tmp5_ = _tmp4_;
	_tmp6_ = old_node;
	if (_tmp5_ == _tmp6_) {
		ValaExpression* _tmp7_;
		_tmp7_ = new_node;
		vala_slice_expression_set_start (self, _tmp7_);
	}
	_tmp8_ = vala_slice_expression_get_stop (self);
	_tmp9_ = _tmp8_;
	_tmp10_ = old_node;
	if (_tmp9_ == _tmp10_) {
		ValaExpression* _tmp11_;
		_tmp11_ = new_node;
		vala_slice_expression_set_stop (self, _tmp11_);
	}
}


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


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


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


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


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


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


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


void vala_slice_expression_set_container (ValaSliceExpression* self, ValaExpression* value) {
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	ValaExpression* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->priv->_container);
	self->priv->_container = _tmp1_;
	_tmp2_ = self->priv->_container;
	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp2_, (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_;
	ValaExpression* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->priv->_start);
	self->priv->_start = _tmp1_;
	_tmp2_ = self->priv->_start;
	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp2_, (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_;
	ValaExpression* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->priv->_stop);
	self->priv->_stop = _tmp1_;
	_tmp2_ = self->priv->_stop;
	vala_code_node_set_parent_node ((ValaCodeNode*) _tmp2_, (ValaCodeNode*) self);
}


static void vala_slice_expression_class_init (ValaSliceExpressionClass * klass) {
	vala_slice_expression_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeNodeClass *) klass)->finalize = vala_slice_expression_finalize;
	g_type_class_add_private (klass, sizeof (ValaSliceExpressionPrivate));
	((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) {
	self->priv = VALA_SLICE_EXPRESSION_GET_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 e.g "a[1:5]".
 */
GType vala_slice_expression_get_type (void) {
	static volatile gsize vala_slice_expression_type_id__volatile = 0;
	if (g_once_init_enter (&vala_slice_expression_type_id__volatile)) {
		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);
		g_once_init_leave (&vala_slice_expression_type_id__volatile, vala_slice_expression_type_id);
	}
	return vala_slice_expression_type_id__volatile;
}



