From: Jürg Billeter Date: Sat, 29 Nov 2008 19:06:56 +0000 (+0000) Subject: Use G_TYPE_POINTER for pointers and G_TYPE_INVALID for unsupported types X-Git-Tag: VALA_0_5_2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8db3c3207d52183babe4e61c81f8c76bd7e49dd;p=thirdparty%2Fvala.git Use G_TYPE_POINTER for pointers and G_TYPE_INVALID for unsupported types 2008-11-29 Jürg Billeter * vala/valavoidtype.vala: * gobject/valaccodebasemodule.vala: Use G_TYPE_POINTER for pointers and G_TYPE_INVALID for unsupported types in typeof expressions svn path=/trunk/; revision=2087 --- diff --git a/ChangeLog b/ChangeLog index ec27dc9ab..c0f22bde9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-11-29 Jürg Billeter + + * vala/valavoidtype.vala: + * gobject/valaccodebasemodule.vala: + + Use G_TYPE_POINTER for pointers and G_TYPE_INVALID for + unsupported types in typeof expressions + 2008-11-29 Jürg Billeter * vala/valamethodcall.vala: diff --git a/gobject/valaccodebasemodule.vala b/gobject/valaccodebasemodule.vala index a7ac3d63d..5c398296f 100644 --- a/gobject/valaccodebasemodule.vala +++ b/gobject/valaccodebasemodule.vala @@ -1450,13 +1450,15 @@ public class Vala.CCodeBaseModule : CCodeModule { } private CCodeExpression get_type_id_expression (DataType type) { - if (type.data_type != null) { - return new CCodeIdentifier (type.data_type.get_type_id ()); - } else if (type.type_parameter != null) { + if (type is GenericType) { string var_name = "%s_type".printf (type.type_parameter.name.down ()); return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), var_name); } else { - return new CCodeIdentifier ("G_TYPE_NONE"); + string type_id = type.get_type_id (); + if (type_id == null) { + type_id = "G_TYPE_INVALID"; + } + return new CCodeIdentifier (type_id); } } diff --git a/vala/valavoidtype.vala b/vala/valavoidtype.vala index 6a9af5c4a..252993d03 100644 --- a/vala/valavoidtype.vala +++ b/vala/valavoidtype.vala @@ -44,4 +44,8 @@ public class Vala.VoidType : DataType { public override DataType copy () { return new VoidType (); } + + public override string? get_type_id () { + return "G_TYPE_NONE"; + } }