]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Use G_TYPE_POINTER for pointers and G_TYPE_INVALID for unsupported types
authorJürg Billeter <j@bitron.ch>
Sat, 29 Nov 2008 19:06:56 +0000 (19:06 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sat, 29 Nov 2008 19:06:56 +0000 (19:06 +0000)
2008-11-29  Jürg Billeter  <j@bitron.ch>

* 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

ChangeLog
gobject/valaccodebasemodule.vala
vala/valavoidtype.vala

index ec27dc9ab176ae2a5d2ef94a45c60ad27ebd3c03..c0f22bde98ac2f437b5fc9dd9e5447641d6ec3da 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-11-29  Jürg Billeter  <j@bitron.ch>
+
+       * 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  <j@bitron.ch>
 
        * vala/valamethodcall.vala:
index a7ac3d63d74ba157c43bbdeda93f6d90382d4d40..5c398296ffa961b18f3c3be7c07bd67b7450eff9 100644 (file)
@@ -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);
                }
        }
 
index 6a9af5c4a996d4b57f57ec95902c651cb66353c5..252993d03548abf2118e2b33f82f3935462ce873 100644 (file)
@@ -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";
+       }
 }