[Mono.Debugger.Soft] Implement IsGenericType/Method for protocol < 2.12
authorJeffrey Stedfast <jeff@xamarin.com>
Mon, 30 Jan 2012 16:59:43 +0000 (11:59 -0500)
committerJeffrey Stedfast <jeff@xamarin.com>
Mon, 30 Jan 2012 16:59:43 +0000 (11:59 -0500)
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs

index 2fbebe2ef39273bc89c38e96fa5f29942349d428..d5fbe8c80866f0d6724c6c04d53dd62916794393 100644 (file)
@@ -30,7 +30,7 @@ namespace Mono.Debugger.Soft
                                        name = vm.conn.Method_GetName (id);
                                return name;
                        }
-           }
+               }
 
                public TypeMirror DeclaringType {
                        get {
@@ -38,7 +38,7 @@ namespace Mono.Debugger.Soft
                                        declaring_type = vm.GetType (vm.conn.Method_GetDeclaringType (id));
                                return declaring_type;
                        }
-           }
+               }
 
                public TypeMirror ReturnType {
                        get {
@@ -69,7 +69,7 @@ namespace Mono.Debugger.Soft
                                sb.Append(")");
                                return sb.ToString ();
                        }
-           }
+               }
 
                void GetInfo () {
                        if (info == null)
@@ -159,6 +159,7 @@ namespace Mono.Debugger.Soft
                        }
                }
 
+               // Since protocol version 2.12
                public bool IsGenericMethodDefinition {
                        get {
                                vm.CheckProtocolVersion (2, 12);
@@ -169,13 +170,15 @@ namespace Mono.Debugger.Soft
 
                public bool IsGenericMethod {
                        get {
-                               vm.CheckProtocolVersion (2, 12);
-                               GetInfo ();
-                               return info.is_generic_method;
+                               if (vm.Version.AtLeast (2, 12)) {
+                                       return GetInfo ().is_generic_method;
+                               } else {
+                                       return Name.IndexOf ('`') != -1;
+                               }
                        }
                }
 
-           public ParameterInfoMirror[] GetParameters () {
+               public ParameterInfoMirror[] GetParameters () {
                        if (param_info == null) {
                                var pi = vm.conn.Method_GetParamInfo (id);
                                param_info = new ParameterInfoMirror [pi.param_count];
@@ -191,7 +194,7 @@ namespace Mono.Debugger.Soft
                        return param_info;
                }
 
-           public ParameterInfoMirror ReturnParameter {
+               public ParameterInfoMirror ReturnParameter {
                        get {
                                if (ret_param == null)
                                        GetParameters ();
@@ -259,7 +262,7 @@ namespace Mono.Debugger.Soft
                                        debug_info = vm.conn.Method_GetDebugInfo (id);
                                return Array.AsReadOnly (debug_info.il_offsets);
                        }
-           }
+               }
 
                public IList<int> LineNumbers {
                        get {
@@ -267,7 +270,7 @@ namespace Mono.Debugger.Soft
                                        debug_info = vm.conn.Method_GetDebugInfo (id);
                                return Array.AsReadOnly (debug_info.line_numbers);
                        }
-           }
+               }
 
                public string SourceFile {
                        get {
@@ -275,7 +278,7 @@ namespace Mono.Debugger.Soft
                                        debug_info = vm.conn.Method_GetDebugInfo (id);
                                return debug_info.filename;
                        }
-           }
+               }
 
                public IList<Location> Locations {
                        get {
@@ -301,7 +304,7 @@ namespace Mono.Debugger.Soft
                                        return debug_info.line_numbers [i];
                        }
                        return -1;
-           }
+               }
 
                public Location LocationAtILOffset (int il_offset) {
                        IList<Location> locs = Locations;
@@ -322,5 +325,5 @@ namespace Mono.Debugger.Soft
                                return meta;
                        }
                }
-    }
+       }
 }
index 5ac18d0297a39d6d995964af61472b848a18d872..c7733a9761d3feaa10f88a520b32c550eb02625c 100644 (file)
@@ -36,13 +36,13 @@ namespace Mono.Debugger.Soft
                        get {
                                return GetInfo ().name;
                        }
-           }
+               }
 
                public string Namespace {
                        get {
                                return GetInfo ().ns;
                        }
-           }
+               }
 
                public AssemblyMirror Assembly {
                        get {
@@ -295,12 +295,13 @@ namespace Mono.Debugger.Soft
                        }
                }
 
-               // Since protocol version 2.12
                public bool IsGenericType {
                        get {
-                               vm.CheckProtocolVersion (2, 12);
-                               GetInfo ();
-                               return info.is_generic_type;
+                               if (vm.Version.AtLeast (2, 12)) {
+                                       return GetInfo ().is_generic_type;
+                               } else {
+                                       return Name.IndexOf ('`') != -1;
+                               }
                        }
                }