Commit 78cb7e64 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

fix object creation for non-GObject classes without creation method

2007-08-30  Juerg Billeter  <j@bitron.ch>

	* gobject/valacodegenerator.vala: fix object creation for non-GObject
	  classes without creation method

svn path=/trunk/; revision=539
parent 24155cdb
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,
......
......@@ -2347,7 +2347,11 @@ public class Vala.CodeGenerator : CodeVisitor {
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 ()));
......@@ -2355,10 +2359,6 @@ public class Vala.CodeGenerator : CodeVisitor {
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"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment