[vala/wip/attributes: 36/121] codegen: Add get_ccode_simple_generics
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes: 36/121] codegen: Add get_ccode_simple_generics
- Date: Mon, 4 Jul 2011 17:11:47 +0000 (UTC)
commit 81c1ef0b48381e71b4a8829fe32c37aec5830574
Author: Luca Bruno <lucabru src gnome org>
Date: Tue Jun 28 19:42:30 2011 +0200
codegen: Add get_ccode_simple_generics
codegen/valaccodebasemodule.vala | 7 ++++++-
codegen/valaccodemethodcallmodule.vala | 4 ++--
2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 9d47982..217e898 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4119,7 +4119,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
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) {
+ } else if (cl != null && get_ccode_simple_generics (m)) {
int type_param_index = 0;
foreach (var type_arg in expr.type_reference.get_type_arguments ()) {
if (requires_copy (type_arg)) {
@@ -5776,6 +5776,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return null;
}
+ public static bool get_ccode_simple_generics (Method m) {
+ var a = node.get_attribute ("CCode");
+ return a != null && a.get_bool ("simple_generics");
+ }
+
public override void visit_class (Class cl) {
}
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 2c6e4ef..58f5b6b 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -151,7 +151,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
}
} else if (m is CreationMethod && m.parent_symbol is Struct) {
ccall.add_argument (new CCodeIdentifier ("self"));
- } else if (m != null && m.get_type_parameters ().size > 0 && !m.has_generic_type_parameter && !m.simple_generics) {
+ } else if (m != null && m.get_type_parameters ().size > 0 && !m.has_generic_type_parameter && !get_ccode_simple_generics (m)) {
// generic method
add_generic_type_arguments (in_arg_map, ma.get_type_arguments (), expr);
}
@@ -371,7 +371,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
CCodeExpression delegate_target_destroy_notify;
carg_map.set (get_param_pos (get_ccode_delegate_target_pos (param)), get_delegate_target_cexpression (arg, out delegate_target_destroy_notify));
} else if (param.variable_type is GenericType) {
- if (m != null && m.simple_generics) {
+ if (m != null && get_ccode_simple_generics (m)) {
var generic_type = (GenericType) param.variable_type;
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]