[vala] Add [CCode (destroy_notify_pos = ...)] attribute for simple generics



commit 4b905528f64f58f41e58fe44cbaf89f39d7d00d7
Author: Jürg Billeter <j bitron ch>
Date:   Sun Mar 28 18:10:53 2010 +0200

    Add [CCode (destroy_notify_pos = ...)] attribute for simple generics

 codegen/valaccodemethodcallmodule.vala |    4 ++--
 vala/valadelegate.vala                 |    3 ++-
 vala/valaformalparameter.vala          |    7 ++++++-
 vala/valamethod.vala                   |    1 +
 vala/valasignal.vala                   |    3 ++-
 5 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 9545c4e..7b91e79 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -376,9 +376,9 @@ internal class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
 							int type_param_index = m.get_type_parameter_index (generic_type.type_parameter.name);
 							var type_arg = ma.get_type_arguments ().get (type_param_index);
 							if (requires_copy (type_arg)) {
-								carg_map.set (get_param_pos (param.cparameter_position + 0.1), get_destroy_func_expression (type_arg));
+								carg_map.set (get_param_pos (param.cdestroy_notify_parameter_position), get_destroy_func_expression (type_arg));
 							} else {
-								carg_map.set (get_param_pos (param.cparameter_position + 0.1), new CCodeConstant ("NULL"));
+								carg_map.set (get_param_pos (param.cdestroy_notify_parameter_position), new CCodeConstant ("NULL"));
 							}
 						}
 					}
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index d152714..afedd3b 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -1,6 +1,6 @@
 /* valadelegate.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  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
@@ -119,6 +119,7 @@ public class Vala.Delegate : TypeSymbol {
 		param.cparameter_position = parameters.size + 1;
 		param.carray_length_parameter_position = param.cparameter_position + 0.1;
 		param.cdelegate_target_parameter_position = param.cparameter_position + 0.1;
+		param.cdestroy_notify_parameter_position = param.cparameter_position + 0.1;
 
 		parameters.add (param);
 		scope.add (param.name, param);
diff --git a/vala/valaformalparameter.vala b/vala/valaformalparameter.vala
index 2dfa557..5c7ca21 100644
--- a/vala/valaformalparameter.vala
+++ b/vala/valaformalparameter.vala
@@ -1,6 +1,6 @@
 /* valaformalparameter.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
@@ -95,6 +95,8 @@ public class Vala.FormalParameter : Symbol {
 	 */
 	public double cdelegate_target_parameter_position { get; set; }
 
+	public double cdestroy_notify_parameter_position { get; set; }
+
 	/**
 	 * Specifies the type of the parameter in the C function.
 	 */
@@ -176,6 +178,9 @@ public class Vala.FormalParameter : Symbol {
 		if (a.has_argument ("delegate_target_pos")) {
 			cdelegate_target_parameter_position = a.get_double ("delegate_target_pos");
 		}
+		if (a.has_argument ("destroy_notify_pos")) {
+			cdestroy_notify_parameter_position = a.get_double ("destroy_notify_pos");
+		}
 	}
 
 	/**
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 979dcad..4b35a47 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -275,6 +275,7 @@ public class Vala.Method : Member {
 		param.cparameter_position = parameters.size + 1;
 		param.carray_length_parameter_position = param.cparameter_position + 0.1;
 		param.cdelegate_target_parameter_position = param.cparameter_position + 0.1;
+		param.cdestroy_notify_parameter_position = param.cparameter_position + 0.1;
 
 		parameters.add (param);
 		if (!param.ellipsis) {
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index 9212389..f4859d5 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -1,6 +1,6 @@
 /* valasignal.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  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
@@ -107,6 +107,7 @@ public class Vala.Signal : Member, Lockable {
 		param.cparameter_position = parameters.size + 1;
 		param.carray_length_parameter_position = param.cparameter_position + 0.1;
 		param.cdelegate_target_parameter_position = param.cparameter_position + 0.1;
+		param.cdestroy_notify_parameter_position = param.cparameter_position + 0.1;
 
 		parameters.add (param);
 		scope.add (param.name, param);



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