}
} else if (node is ValueType && ((ValueType) node).nullable) {
return "POINTER";
- } else if (node is PointerType || ((DataType) node).type_parameter != null) {
+ } else if (node is PointerType || node is GenericType) {
return "POINTER";
} else if (node is ErrorType) {
return "POINTER";
}
return new CCodeIdentifier (dup_function);
- } else if (type.type_parameter != null) {
+ } else if (type is GenericType) {
string func_name = "%s_dup_func".printf (type.type_parameter.name.down ());
if (type.type_parameter.parent_symbol is Interface) {
return new CCodeConstant ("NULL");
}
return new CCodeIdentifier (unref_function);
- } else if (type.type_parameter != null) {
+ } else if (type is GenericType) {
string func_name = "%s_destroy_func".printf (type.type_parameter.name.down ());
if (type.type_parameter.parent_symbol is Interface) {
*/
var cisnull = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, cvar, new CCodeConstant ("NULL"));
- if (type.type_parameter != null) {
+ if (type is GenericType) {
var parent = type.type_parameter.parent_symbol;
var cl = parent as Class;
if ((!(parent is Method) && !(parent is ObjectTypeSymbol)) || (cl != null && cl.is_compact)) {
return false;
}
- if (type.type_parameter != null) {
+ if (type is GenericType) {
if (is_limited_generic_type (type)) {
return false;
}
return false;
}
- if (type.type_parameter != null) {
+ if (type is GenericType) {
if (is_limited_generic_type (type)) {
return false;
}
return store_temp_value (new GLibValue (type, ccall), node);
} else {
var cnotnull = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, cexpr, new CCodeConstant ("NULL"));
- if (type.type_parameter != null) {
+ if (type is GenericType) {
// dup functions are optional for type parameters
var cdupnotnull = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, get_dup_func_expression (type, node.source_reference), new CCodeConstant ("NULL"));
cnotnull = new CCodeBinaryExpression (CCodeBinaryOperator.AND, cnotnull, cdupnotnull);
}
- if (type.type_parameter != null) {
+ if (type is GenericType) {
// cast from gconstpointer to gpointer as GBoxedCopyFunc expects gpointer
ccall.add_argument (new CCodeCastExpression (cexpr, "gpointer"));
} else {
|| type is PointerType || type is DelegateType
|| (array_type != null && !array_type.fixed_length)) {
return new CCodeConstant ("NULL");
- } else if (type.type_parameter != null) {
+ } else if (type is GenericType) {
return new CCodeConstant ("NULL");
} else if (type is ErrorType) {
return new CCodeConstant ("NULL");
}
private string? get_value_type_name_from_type_reference (DataType t) {
- if (t is PointerType || t.type_parameter != null) {
+ if (t is PointerType || t is GenericType) {
return "gpointer";
} else if (t is VoidType) {
return "void";
} else {
get_value_function = "g_value_get_pointer";
}
- } else if (p.variable_type is PointerType || p.variable_type.type_parameter != null) {
+ } else if (p.variable_type is PointerType || p.variable_type is GenericType) {
get_value_function = "g_value_get_pointer";
} else if (p.variable_type is ErrorType) {
get_value_function = "g_value_get_pointer";
} else {
set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_set_pointer"));
}
- } else if (return_type.type_parameter != null) {
+ } else if (return_type is GenericType) {
set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_set_pointer"));
} else if (return_type is ErrorType) {
set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_set_pointer"));
csignew.add_argument (marshal_arg);
var params = sig.get_parameters ();
- if (sig.return_type is PointerType || sig.return_type.type_parameter != null) {
+ if (sig.return_type is PointerType || sig.return_type is GenericType) {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
} else if (sig.return_type is ErrorType) {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
for (var i = 0; i < ((ArrayType) param.variable_type).rank; i++) {
csignew.add_argument (new CCodeConstant ("G_TYPE_INT"));
}
- } else if (param.variable_type is PointerType || param.variable_type.type_parameter != null || param.direction != ParameterDirection.IN) {
+ } else if (param.variable_type is PointerType || param.variable_type is GenericType || param.direction != ParameterDirection.IN) {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
} else if (param.variable_type is ErrorType) {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
}
/* temporarily ignore type parameters */
- if (target_type.type_parameter != null) {
+ if (target_type is GenericType) {
return true;
}
public override bool compatible (DataType target_type) {
/* temporarily ignore type parameters */
- if (target_type.type_parameter != null) {
+ if (target_type is GenericType) {
return true;
}
return target_type.nullable;
}
- if (!(target_type is PointerType) && (target_type is NullType || (target_type.data_type == null && target_type.type_parameter == null))) {
+ if (!(target_type is PointerType) && (target_type is NullType || (target_type.data_type == null && !(target_type is GenericType)))) {
return true;
}
/* null can be cast to any reference or array type or pointer type */
- if (target_type.type_parameter != null ||
+ if (target_type is GenericType ||
target_type is PointerType ||
target_type.nullable ||
target_type.data_type.get_attribute ("PointerType") != null) {
}
/* temporarily ignore type parameters */
- if (target_type.type_parameter != null) {
+ if (target_type is GenericType) {
return true;
}