+2007-08-30 Jürg Billeter <j@bitron.ch>
+
+ * gobject/valacodegenerator.vala: fix object creation for non-GObject
+ classes without creation method
+
2007-08-30 Jürg Billeter <j@bitron.ch>
* vala/valaclass.vala, gobject/valacodegenerator.vala,
public override void visit_end_object_creation_expression (ObjectCreationExpression! expr) {
if (expr.symbol_reference == null) {
// no creation method
- if (expr.type_reference.data_type is Class) {
+ if (expr.type_reference.data_type == glist_type ||
+ expr.type_reference.data_type == gslist_type) {
+ // NULL is an empty list
+ expr.ccodenode = new CCodeConstant ("NULL");
+ } else if (expr.type_reference.data_type is Class && expr.type_reference.data_type.is_subtype_of (gobject_type)) {
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_new"));
ccall.add_argument (new CCodeConstant (expr.type_reference.data_type.get_type_id ()));
ccall.add_argument (new CCodeConstant ("NULL"));
expr.ccodenode = ccall;
- } else if (expr.type_reference.data_type == glist_type ||
- expr.type_reference.data_type == gslist_type) {
- // NULL is an empty list
- expr.ccodenode = new CCodeConstant ("NULL");
} else {
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));