vala r858 - in trunk: . gobject vala



Author: juergbi
Date: Fri Jan 18 21:17:18 2008
New Revision: 858
URL: http://svn.gnome.org/viewvc/vala?rev=858&view=rev

Log:
2008-01-18  Juerg Billeter  <j bitron ch>

	* vala/valavoidtype.vala: implement get_cname method

	* gobject/valaccodegenerator.vala: cast function pointers to callback
	  type, fixes bug 510262


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegenerator.vala
   trunk/vala/valavoidtype.vala

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Fri Jan 18 21:17:18 2008
@@ -2880,7 +2880,7 @@
 			return cexpr;
 		}
 
-		if (expression_type.data_type == target_type.data_type) {
+		if (expression_type.data_type != null && expression_type.data_type == target_type.data_type) {
 			// same type, no cast required
 			return cexpr;
 		}
@@ -2891,7 +2891,7 @@
 			return convert_to_generic_pointer (cexpr, expression_type);
 		}
 
-		if (expression_type.data_type == null && expression_type.type_parameter == null) {
+		if (expression_type is NullType) {
 			// null literal, no cast required when not converting to generic type pointer
 			return cexpr;
 		}
@@ -2900,6 +2900,8 @@
 			return new InstanceCast (cexpr, target_type.data_type);
 		} else if (target_type.data_type != null && target_type.data_type.is_reference_type () && expression_type.get_cname () != target_type.get_cname ()) {
 			return new CCodeCastExpression (cexpr, target_type.get_cname ());
+		} else if (target_type is DelegateType && expression_type is MethodType) {
+			return new CCodeCastExpression (cexpr, target_type.get_cname ());
 		} else {
 			return cexpr;
 		}

Modified: trunk/vala/valavoidtype.vala
==============================================================================
--- trunk/vala/valavoidtype.vala	(original)
+++ trunk/vala/valavoidtype.vala	Fri Jan 18 21:17:18 2008
@@ -1,6 +1,6 @@
 /* valavoidtype.vala
  *
- * Copyright (C) 2007  JÃrg Billeter
+ * Copyright (C) 2007-2008  JÃrg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -36,4 +36,8 @@
 	public override string! to_string () {
 		return "void";
 	}
+
+	public override string get_cname (bool var_type = false, bool const_type = false) {
+		return "void";
+	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]