diff options
author | Jürg Billeter <j@bitron.ch> | 2009-09-17 15:00:50 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2009-09-17 15:00:50 +0200 |
commit | a85486029c8040f293e38a0ebc13c74b86d67689 (patch) | |
tree | 8746bc5b5c2371dd2fca79e089c0cbc6babc0a38 /codegen | |
parent | 9655e9e6235f9274c2ed88486759f27a1b596dbf (diff) | |
download | vala-a85486029c8040f293e38a0ebc13c74b86d67689.tar.gz |
Fix methods returning nullable structs
Diffstat (limited to 'codegen')
-rw-r--r-- | codegen/valaccodebasemodule.vala | 12 | ||||
-rw-r--r-- | codegen/valaccodemethodcallmodule.vala | 2 | ||||
-rw-r--r-- | codegen/valaccodemethodmodule.vala | 8 | ||||
-rw-r--r-- | codegen/valagtypemodule.vala | 6 |
4 files changed, 14 insertions, 14 deletions
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index f0c40d8b8..e9071557c 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -1256,13 +1256,13 @@ internal class Vala.CCodeBaseModule : CCodeModule { var prop = (Property) acc.prop; - bool returns_real_struct = acc.readable && prop.property_type.is_real_struct_type (); + bool returns_real_struct = acc.readable && prop.property_type.is_real_non_null_struct_type (); CCodeFormalParameter cvalueparam; if (returns_real_struct) { cvalueparam = new CCodeFormalParameter ("result", acc.value_type.get_cname () + "*"); - } else if (!acc.readable && prop.property_type.is_real_struct_type ()) { + } else if (!acc.readable && prop.property_type.is_real_non_null_struct_type ()) { cvalueparam = new CCodeFormalParameter ("value", acc.value_type.get_cname () + "*"); } else { cvalueparam = new CCodeFormalParameter ("value", acc.value_type.get_cname ()); @@ -1320,7 +1320,7 @@ internal class Vala.CCodeBaseModule : CCodeModule { var prop = (Property) acc.prop; - bool returns_real_struct = acc.readable && prop.property_type.is_real_struct_type (); + bool returns_real_struct = acc.readable && prop.property_type.is_real_non_null_struct_type (); acc.accept_children (codegen); @@ -1358,7 +1358,7 @@ internal class Vala.CCodeBaseModule : CCodeModule { CCodeFormalParameter cvalueparam; if (returns_real_struct) { cvalueparam = new CCodeFormalParameter ("result", acc.value_type.get_cname () + "*"); - } else if (!acc.readable && prop.property_type.is_real_struct_type ()) { + } else if (!acc.readable && prop.property_type.is_real_non_null_struct_type ()) { cvalueparam = new CCodeFormalParameter ("value", acc.value_type.get_cname () + "*"); } else { cvalueparam = new CCodeFormalParameter ("value", acc.value_type.get_cname ()); @@ -2815,7 +2815,7 @@ internal class Vala.CCodeBaseModule : CCodeModule { // assign method result to `result' CCodeExpression result_lhs = get_result_cexpression (); - if (current_return_type.is_real_struct_type () && (current_method == null || !current_method.coroutine)) { + if (current_return_type.is_real_non_null_struct_type () && (current_method == null || !current_method.coroutine)) { result_lhs = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, result_lhs); } cfrag.append (new CCodeExpressionStatement (new CCodeAssignment (result_lhs, (CCodeExpression) stmt.return_expression.ccodenode))); @@ -2832,7 +2832,7 @@ internal class Vala.CCodeBaseModule : CCodeModule { if (current_method == null || !current_method.coroutine) { // structs are returned via out parameter - if (current_return_type.is_real_struct_type()) { + if (current_return_type.is_real_non_null_struct_type()) { cfrag.append (new CCodeReturnStatement ()); } else { cfrag.append (new CCodeReturnStatement (new CCodeIdentifier ("result"))); diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala index f0e118d4a..c47c4bc53 100644 --- a/codegen/valaccodemethodcallmodule.vala +++ b/codegen/valaccodemethodcallmodule.vala @@ -568,7 +568,7 @@ internal class Vala.CCodeMethodCallModule : CCodeAssignmentModule { } // structs are returned via out parameter - bool return_result_via_out_param = itype.get_return_type ().is_real_struct_type (); + bool return_result_via_out_param = itype.get_return_type ().is_real_non_null_struct_type (); // pass address for the return value of non-void signals without emitter functions if (itype is SignalType && !(itype.get_return_type () is VoidType)) { diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala index a270c2127..0a846b665 100644 --- a/codegen/valaccodemethodmodule.vala +++ b/codegen/valaccodemethodmodule.vala @@ -75,7 +75,7 @@ internal class Vala.CCodeMethodModule : CCodeStructModule { // in Vala they have no return type creturn_type = new ObjectType (cl); } - } else if (m.return_type.is_real_struct_type ()) { + } else if (m.return_type.is_real_non_null_struct_type ()) { // structs are returned via out parameter creturn_type = new VoidType (); } @@ -83,7 +83,7 @@ internal class Vala.CCodeMethodModule : CCodeStructModule { generate_type_declaration (m.return_type, decl_space); - if (m.return_type.is_real_struct_type ()) { + if (m.return_type.is_real_non_null_struct_type ()) { // structs are returned via out parameter var cparam = new CCodeFormalParameter ("result", m.return_type.get_cname () + "*"); cparam_map.set (get_param_pos (-3), cparam); @@ -233,7 +233,7 @@ internal class Vala.CCodeMethodModule : CCodeStructModule { } var creturn_type = m.return_type; - if (m.return_type.is_real_struct_type ()) { + if (m.return_type.is_real_non_null_struct_type ()) { // structs are returned via out parameter creturn_type = new VoidType (); } @@ -497,7 +497,7 @@ internal class Vala.CCodeMethodModule : CCodeStructModule { } } - if (!(m.return_type is VoidType) && !m.return_type.is_real_struct_type () && !m.coroutine) { + if (!(m.return_type is VoidType) && !m.return_type.is_real_non_null_struct_type () && !m.coroutine) { // do not declare result variable if exit block is known to be unreachable if (m.exit_block == null || m.exit_block.get_predecessors ().size > 0) { var cdecl = new CCodeDeclaration (m.return_type.get_cname ()); diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index 6af51c292..417d29af9 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -229,7 +229,7 @@ internal class Vala.GTypeModule : GErrorModule { var vdeclarator = new CCodeFunctionDeclarator ("get_%s".printf (prop.name)); vdeclarator.add_parameter (cselfparam); string creturn_type; - if (prop.property_type.is_real_struct_type ()) { + if (prop.property_type.is_real_non_null_struct_type ()) { var cvalueparam = new CCodeFormalParameter ("result", prop.property_type.get_cname () + "*"); vdeclarator.add_parameter (cvalueparam); creturn_type = "void"; @@ -250,7 +250,7 @@ internal class Vala.GTypeModule : GErrorModule { } if (prop.set_accessor != null) { CCodeFormalParameter cvalueparam; - if (prop.property_type.is_real_struct_type ()) { + if (prop.property_type.is_real_non_null_struct_type ()) { cvalueparam = new CCodeFormalParameter ("value", prop.property_type.get_cname () + "*"); } else { cvalueparam = new CCodeFormalParameter ("value", prop.property_type.get_cname ()); @@ -1720,7 +1720,7 @@ internal class Vala.GTypeModule : GErrorModule { var t = (ObjectTypeSymbol) prop.parent_symbol; - bool returns_real_struct = prop.property_type.is_real_struct_type (); + bool returns_real_struct = prop.property_type.is_real_non_null_struct_type (); var this_type = new ObjectType (t); var cselfparam = new CCodeFormalParameter ("self", this_type.get_cname ()); |