[vala] Support simple generics for creation methods



commit 9712fd59d05a636575303cecb4aaac62e2134f4d
Author: Evan Nemerson <evan coeus-group com>
Date:   Thu Jun 10 22:56:51 2010 -0700

    Support simple generics for creation methods

 codegen/valaccodebasemodule.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 48d859f..2cfc9bb 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4173,6 +4173,16 @@ public class Vala.CCodeBaseModule : CCodeModule {
 
 			if (cl != null && !cl.is_compact) {
 				add_generic_type_arguments (carg_map, expr.type_reference.get_type_arguments (), expr);
+			} else if (cl != null && m.simple_generics) {
+				int type_param_index = 0;
+				foreach (var type_arg in expr.type_reference.get_type_arguments ()) {
+					if (requires_copy (type_arg)) {
+						carg_map.set (get_param_pos (-1 + 0.1 * type_param_index + 0.03), get_destroy_func_expression (type_arg));
+					} else {
+						carg_map.set (get_param_pos (-1 + 0.1 * type_param_index + 0.03), new CCodeConstant ("NULL"));
+					}
+					type_param_index++;
+				}
 			}
 
 			bool ellipsis = false;



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