[Mono.Debugger.Soft] Added TypeMirror.IsNested
[mono.git] / mcs / class / Mono.Debugger.Soft / Mono.Debugger.Soft / TypeMirror.cs
index e7baa44fae09943942b1353621458bebe76374b9..437689163ec93171b5fee5fdd4525562fdb88520 100644 (file)
@@ -192,6 +192,14 @@ namespace Mono.Debugger.Soft
                        }
                }
 
+               public bool IsNested {
+                       get {
+                               var masked = (Attributes & TypeAttributes.VisibilityMask);
+
+                               return masked >= TypeAttributes.NestedPublic && masked <= TypeAttributes.NestedFamORAssem;
+                       }
+               }
+
                public bool IsNestedAssembly {
                        get {
                                return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedAssembly;
@@ -816,13 +824,24 @@ namespace Mono.Debugger.Soft
 #endif
 
                public Value NewInstance (ThreadMirror thread, MethodMirror method, IList<Value> arguments) {
-                       return ObjectMirror.InvokeMethod (vm, thread, method, null, arguments, InvokeOptions.None);
+                       return NewInstance (thread, method, arguments, InvokeOptions.None);
                }                       
 
                public Value NewInstance (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options) {
+                       if (method == null)
+                               throw new ArgumentNullException ("method");
+
+                       if (!method.IsConstructor)
+                               throw new ArgumentException ("The method must be a constructor.", "method");
+
                        return ObjectMirror.InvokeMethod (vm, thread, method, null, arguments, options);
                }
 
+               // Since protocol version 2.31
+               public Value NewInstance () {
+                       return vm.GetObject (vm.conn.Type_CreateInstance (id));
+               }
+
                // Since protocol version 2.11
                public TypeMirror[] GetInterfaces () {
                        if (ifaces == null)