[vala] Do not support use of generics in static methods of generic types
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vala] Do not support use of generics in static methods of generic types
- Date: Mon, 14 Sep 2009 18:33:56 +0000 (UTC)
commit db1b554d4e85afcef86232e368d3381aee4cc96e
Author: Jürg Billeter <j bitron ch>
Date: Mon Sep 14 20:29:41 2009 +0200
Do not support use of generics in static methods of generic types
Fixes bug 589071.
codegen/valaccodemethodcallmodule.vala | 15 +++------------
codegen/valaccodemethodmodule.vala | 15 ---------------
vala/valasemanticanalyzer.vala | 15 ---------------
3 files changed, 3 insertions(+), 42 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index ddde56d..1d1e87b 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -112,18 +112,9 @@ internal class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
break;
}
}
- } else if (m != null) {
- if (m.binding != MemberBinding.INSTANCE && m.parent_symbol is ObjectTypeSymbol) {
- // support static methods in generic types
- var type_symbol = (ObjectTypeSymbol) m.parent_symbol;
- if (type_symbol.get_type_parameters ().size > 0 && ma.inner is MemberAccess) {
- var type_ma = (MemberAccess) ma.inner;
- add_generic_type_arguments (ccall, type_ma.get_type_arguments (), expr);
- }
- }
- if (m.get_type_parameters ().size > 0) {
- add_generic_type_arguments (ccall, ma.get_type_arguments (), expr);
- }
+ } else if (m != null && m.get_type_parameters ().size > 0) {
+ // generic method
+ add_generic_type_arguments (ccall, ma.get_type_arguments (), expr);
}
// the complete call expression, might include casts, comma expressions, and/or assignments
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 281c44a..8d625d7 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -768,21 +768,6 @@ internal class Vala.CCodeMethodModule : CCodeStructModule {
}
} else {
int type_param_index = 0;
- if (m.binding != MemberBinding.INSTANCE && m.parent_symbol is ObjectTypeSymbol) {
- // support static methods in generic types
- var type_symbol = (ObjectTypeSymbol) m.parent_symbol;
- foreach (var type_param in type_symbol.get_type_parameters ()) {
- cparam_map.set (get_param_pos (0.1 * type_param_index + 0.01), new CCodeFormalParameter ("%s_type".printf (type_param.name.down ()), "GType"));
- cparam_map.set (get_param_pos (0.1 * type_param_index + 0.02), new CCodeFormalParameter ("%s_dup_func".printf (type_param.name.down ()), "GBoxedCopyFunc"));
- cparam_map.set (get_param_pos (0.1 * type_param_index + 0.03), new CCodeFormalParameter ("%s_destroy_func".printf (type_param.name.down ()), "GDestroyNotify"));
- if (carg_map != null) {
- carg_map.set (get_param_pos (0.1 * type_param_index + 0.01), new CCodeIdentifier ("%s_type".printf (type_param.name.down ())));
- carg_map.set (get_param_pos (0.1 * type_param_index + 0.02), new CCodeIdentifier ("%s_dup_func".printf (type_param.name.down ())));
- carg_map.set (get_param_pos (0.1 * type_param_index + 0.03), new CCodeIdentifier ("%s_destroy_func".printf (type_param.name.down ())));
- }
- type_param_index++;
- }
- }
foreach (var type_param in m.get_type_parameters ()) {
cparam_map.set (get_param_pos (0.1 * type_param_index + 0.01), new CCodeFormalParameter ("%s_type".printf (type_param.name.down ()), "GType"));
cparam_map.set (get_param_pos (0.1 * type_param_index + 0.02), new CCodeFormalParameter ("%s_dup_func".printf (type_param.name.down ()), "GBoxedCopyFunc"));
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 032cc4b..ff54fbc 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -641,21 +641,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
if (param_index < instance_type.get_type_arguments ().size) {
actual_type = (DataType) instance_type.get_type_arguments ().get (param_index);
}
- } else if (method_access != null && method_access.inner is MemberAccess) {
- // static method in generic type
- var type_symbol = (ObjectTypeSymbol) generic_type.type_parameter.parent_symbol;
-
- int param_index = type_symbol.get_type_parameter_index (generic_type.type_parameter.name);
- if (param_index == -1) {
- Report.error (node_reference.source_reference, "internal error: unknown type parameter %s".printf (generic_type.type_parameter.name));
- node_reference.error = true;
- return null;
- }
-
- var type_ma = (MemberAccess) method_access.inner;
- if (param_index < type_ma.get_type_arguments ().size) {
- actual_type = (DataType) type_ma.get_type_arguments ().get (param_index);
- }
}
} else {
// generic method
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]