var splicelen = new CCodeBinaryExpression (CCodeBinaryOperator.MINUS, cstop, cstart);
set_cvalue (expr, cstartpointer);
+ ((GLibValue) expr.target_value).non_null = get_non_null (expr.container.target_value);
// Make sure no previous length values are preserved
set_array_length (expr, splicelen);
}
return store_temp_value (new GLibValue (type, ccall), node);
} else {
+ CCodeExpression ccallarg;
+ if (node is SliceExpression) {
+ ccallarg = cexpr;
+ cexpr = get_cvalue (((SliceExpression) node).container);
+ } else {
+ ccallarg = cexpr;
+ }
var cnotnull = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, cexpr, new CCodeConstant ("NULL"));
if (type is GenericType) {
// dup functions are optional for type parameters
if (type is GenericType) {
// cast from gconstpointer to gpointer as GBoxedCopyFunc expects gpointer
- ccall.add_argument (new CCodeCastExpression (cexpr, get_ccode_name (pointer_type)));
+ ccall.add_argument (new CCodeCastExpression (ccallarg, get_ccode_name (pointer_type)));
} else {
- ccall.add_argument (cexpr);
+ ccall.add_argument (ccallarg);
}
if (type is ArrayType) {
gint _foo_size_;
const gchar* _tmp6_;
const gchar* _tmp7_;
- _tmp5_ = ((bar + 1) != NULL) ? _vala_array_dup1 (bar + 1, 3 - 1) : (bar + 1);
+ _tmp5_ = _vala_array_dup1 (bar + 1, 3 - 1);
_tmp5__length1 = 3 - 1;
foo = _tmp5_;
foo_length1 = _tmp5__length1;
const gchar* _tmp11_;
const gchar* _tmp12_;
begin = 1;
- _tmp10_ = ((bar + begin) != NULL) ? _vala_array_dup2 (bar + begin, 3 - begin) : (bar + begin);
+ _tmp10_ = _vala_array_dup2 (bar + begin, 3 - begin);
_tmp10__length1 = 3 - begin;
foo = _tmp10_;
foo_length1 = _tmp10__length1;
gint _foo_size_;
const gchar* _tmp14_;
const gchar* _tmp15_;
- _tmp13_ = ((bar + 1) != NULL) ? _vala_array_dup3 (bar + 1, 3 - 1) : (bar + 1);
+ _tmp13_ = _vala_array_dup3 (bar + 1, 3 - 1);
_tmp13__length1 = 3 - 1;
foo = _tmp13_;
foo_length1 = _tmp13__length1;
const gchar* _tmp19_;
const gchar* _tmp20_;
end = 3;
- _tmp18_ = ((bar + 1) != NULL) ? _vala_array_dup4 (bar + 1, end - 1) : (bar + 1);
+ _tmp18_ = _vala_array_dup4 (bar + 1, end - 1);
_tmp18__length1 = end - 1;
foo = _tmp18_;
foo_length1 = _tmp18__length1;
{
gchar** _tmp21_;
gint _tmp21__length1;
- _tmp21_ = ((bar + 1) != NULL) ? _vala_array_dup5 (bar + 1, 3 - 1) : (bar + 1);
+ _tmp21_ = _vala_array_dup5 (bar + 1, 3 - 1);
_tmp21__length1 = 3 - 1;
minim (_tmp21_, (gint) _tmp21__length1);
}
gchar** _tmp22_;
gint _tmp22__length1;
begin = 1;
- _tmp22_ = ((bar + begin) != NULL) ? _vala_array_dup6 (bar + begin, 3 - begin) : (bar + begin);
+ _tmp22_ = _vala_array_dup6 (bar + begin, 3 - begin);
_tmp22__length1 = 3 - begin;
minim (_tmp22_, (gint) _tmp22__length1);
}
gchar** _tmp23_;
gint _tmp23__length1;
end = 3;
- _tmp23_ = ((bar + 1) != NULL) ? _vala_array_dup7 (bar + 1, end - 1) : (bar + 1);
+ _tmp23_ = _vala_array_dup7 (bar + 1, end - 1);
_tmp23__length1 = end - 1;
minim (_tmp23_, (gint) _tmp23__length1);
}
_vala_assert (_tmp22_ == 23, "b[1] == 23");
_tmp23_ = a;
_tmp23__length1 = a_length1;
- _tmp24_ = ((_tmp23_ + 1) != NULL) ? _vala_array_dup2 (_tmp23_ + 1, 3 - 1) : (_tmp23_ + 1);
+ _tmp24_ = (_tmp23_ != NULL) ? _vala_array_dup2 (_tmp23_ + 1, 3 - 1) : _tmp23_;
_tmp24__length1 = 3 - 1;
c = _tmp24_;
c_length1 = _tmp24__length1;
_vala_assert (_tmp26_ == 11, "c[1] == 11");
_tmp27_ = a;
_tmp27__length1 = a_length1;
- _tmp28_ = ((_tmp27_ + 0) != NULL) ? _vala_array_dup3 (_tmp27_ + 0, 0 - 0) : (_tmp27_ + 0);
+ _tmp28_ = (_tmp27_ != NULL) ? _vala_array_dup3 (_tmp27_ + 0, 0 - 0) : _tmp27_;
_tmp28__length1 = 0 - 0;
c0 = _tmp28_;
c0_length1 = _tmp28__length1;
_tmp29__length1 = a_length1;
_tmp30_ = a;
_tmp30__length1 = a_length1;
- _tmp31_ = ((_tmp30_ + 1) != NULL) ? _vala_array_dup4 (_tmp30_ + 1, _tmp30__length1 - 1) : (_tmp30_ + 1);
+ _tmp31_ = (_tmp30_ != NULL) ? _vala_array_dup4 (_tmp30_ + 1, _tmp30__length1 - 1) : _tmp30_;
_tmp31__length1 = _tmp30__length1 - 1;
c1 = _tmp31_;
c1_length1 = _tmp31__length1;
_vala_assert (_tmp33_ == 11, "c1[1] == 11");
_tmp34_ = a;
_tmp34__length1 = a_length1;
- _tmp35_ = ((_tmp34_ + 0) != NULL) ? _vala_array_dup5 (_tmp34_ + 0, 2 - 0) : (_tmp34_ + 0);
+ _tmp35_ = (_tmp34_ != NULL) ? _vala_array_dup5 (_tmp34_ + 0, 2 - 0) : _tmp34_;
_tmp35__length1 = 2 - 0;
c2 = _tmp35_;
c2_length1 = _tmp35__length1;
_tmp38__length1 = a_length1;
_tmp39_ = a;
_tmp39__length1 = a_length1;
- _tmp40_ = ((_tmp39_ + 0) != NULL) ? _vala_array_dup6 (_tmp39_ + 0, _tmp39__length1 - 0) : (_tmp39_ + 0);
+ _tmp40_ = (_tmp39_ != NULL) ? _vala_array_dup6 (_tmp39_ + 0, _tmp39__length1 - 0) : _tmp39_;
_tmp40__length1 = _tmp39__length1 - 0;
c3 = _tmp40_;
c3_length1 = _tmp40__length1;
assert (_tmp22_ == 23);
_tmp23_ = a;
_tmp23__length1 = a_length1;
- _tmp24_ = ((_tmp23_ + 1) != NULL) ? _vala_array_dup2 (_tmp23_ + 1, 3 - 1) : (_tmp23_ + 1);
+ _tmp24_ = (_tmp23_ != NULL) ? _vala_array_dup2 (_tmp23_ + 1, 3 - 1) : _tmp23_;
_tmp24__length1 = 3 - 1;
c = _tmp24_;
c_length1 = _tmp24__length1;
assert (_tmp26_ == 11);
_tmp27_ = a;
_tmp27__length1 = a_length1;
- _tmp28_ = ((_tmp27_ + 0) != NULL) ? _vala_array_dup3 (_tmp27_ + 0, 0 - 0) : (_tmp27_ + 0);
+ _tmp28_ = (_tmp27_ != NULL) ? _vala_array_dup3 (_tmp27_ + 0, 0 - 0) : _tmp27_;
_tmp28__length1 = 0 - 0;
c0 = _tmp28_;
c0_length1 = _tmp28__length1;
_tmp29__length1 = a_length1;
_tmp30_ = a;
_tmp30__length1 = a_length1;
- _tmp31_ = ((_tmp30_ + 1) != NULL) ? _vala_array_dup4 (_tmp30_ + 1, _tmp30__length1 - 1) : (_tmp30_ + 1);
+ _tmp31_ = (_tmp30_ != NULL) ? _vala_array_dup4 (_tmp30_ + 1, _tmp30__length1 - 1) : _tmp30_;
_tmp31__length1 = _tmp30__length1 - 1;
c1 = _tmp31_;
c1_length1 = _tmp31__length1;
assert (_tmp33_ == 11);
_tmp34_ = a;
_tmp34__length1 = a_length1;
- _tmp35_ = ((_tmp34_ + 0) != NULL) ? _vala_array_dup5 (_tmp34_ + 0, 2 - 0) : (_tmp34_ + 0);
+ _tmp35_ = (_tmp34_ != NULL) ? _vala_array_dup5 (_tmp34_ + 0, 2 - 0) : _tmp34_;
_tmp35__length1 = 2 - 0;
c2 = _tmp35_;
c2_length1 = _tmp35__length1;
_tmp38__length1 = a_length1;
_tmp39_ = a;
_tmp39__length1 = a_length1;
- _tmp40_ = ((_tmp39_ + 0) != NULL) ? _vala_array_dup6 (_tmp39_ + 0, _tmp39__length1 - 0) : (_tmp39_ + 0);
+ _tmp40_ = (_tmp39_ != NULL) ? _vala_array_dup6 (_tmp39_ + 0, _tmp39__length1 - 0) : _tmp39_;
_tmp40__length1 = _tmp39__length1 - 0;
c3 = _tmp40_;
c3_length1 = _tmp40__length1;
public override bool is_non_null () {
unowned Constant? c = symbol_reference as Constant;
+ unowned LocalVariable? l = symbol_reference as LocalVariable;
if (c != null) {
return (c is EnumValue || !c.type_reference.nullable);
+ } else if (l != null) {
+ return (l.variable_type is ArrayType && ((ArrayType) l.variable_type).inline_allocated);
} else {
return false;
}