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