Skip to content

Commit b1416c2

Browse files
committed
Moving InvokeResult to InvocationsAPI.cs and extracting immutable interface from it.
1 parent 2ba67bc commit b1416c2

File tree

7 files changed

+39
-27
lines changed

7 files changed

+39
-27
lines changed

Mono.Debugger.Soft/Mono.Debugger.Soft/IInvocableMethodOwnerMirror.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ public interface IInvocableMethodOwnerMirror : IMirror
1515
/// Make some additional processing of invocation result. See implementation in <see cref="StructMirror"/>
1616
/// </summary>
1717
/// <param name="result"></param>
18-
void ProcessResult (InvokeResult result);
18+
void ProcessResult (IInvokeResult result);
1919
}
2020
}

Mono.Debugger.Soft/Mono.Debugger.Soft/InvocationsAPI.cs

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@
55

66
namespace Mono.Debugger.Soft
77
{
8+
public interface IInvokeResult
9+
{
10+
/// <summary>
11+
/// Return value of invoked method
12+
/// </summary>
13+
Value Result { get; }
14+
15+
/// <summary>
16+
/// The value of the receiver after the call for calls to valuetype methods or null.
17+
/// Only set when using the InvokeOptions.ReturnOutThis flag.
18+
/// Since protocol version 2.35
19+
/// </summary>
20+
Value OutThis { get; }
21+
22+
/// <summary>
23+
/// The value of the arguments after the call
24+
/// Only set when using the InvokeOptions.ReturnOutArgs flag.
25+
/// Since protocol version 2.35
26+
/// </summary>
27+
Value[] OutArgs { get; }
28+
}
29+
830
/// <summary>
931
/// A bunch of extension methods to <see cref="IInvocableMethodOwnerMirror"/> to perform invocations on objects
1032
/// </summary>
@@ -27,7 +49,7 @@ public static Value EndInvokeMethod (this IInvocableMethodOwnerMirror mirror, IA
2749
return EndInvokeMethodInternal (mirror, asyncResult);
2850
}
2951

30-
public static InvokeResult EndInvokeMethodWithResult (this IInvocableMethodOwnerMirror mirror, IAsyncResult asyncResult) {
52+
public static IInvokeResult EndInvokeMethodWithResult (this IInvocableMethodOwnerMirror mirror, IAsyncResult asyncResult) {
3153
return EndInvokeMethodInternalWithResult (mirror, asyncResult);
3254
}
3355

@@ -46,8 +68,8 @@ public static Task<Value> InvokeMethodAsync (this IInvocableMethodOwnerMirror mi
4668
return tcs.Task;
4769
}
4870

49-
public static Task<InvokeResult> InvokeMethodAsyncWithResult (this IInvocableMethodOwnerMirror mirror, ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options = InvokeOptions.None) {
50-
var tcs = new TaskCompletionSource<InvokeResult> ();
71+
public static Task<IInvokeResult> InvokeMethodAsyncWithResult (this IInvocableMethodOwnerMirror mirror, ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options = InvokeOptions.None) {
72+
var tcs = new TaskCompletionSource<IInvokeResult> ();
5173
BeginInvokeMethod (mirror, thread, method, arguments, options, iar =>
5274
{
5375
try {
@@ -149,6 +171,14 @@ public void Abort ()
149171
}
150172
}
151173

174+
class InvokeResult : IInvokeResult
175+
{
176+
public Value Result { get; set; }
177+
public Value OutThis { get; set; }
178+
public Value[] OutArgs { get; set; }
179+
}
180+
181+
152182
static IInvokeAsyncResult BeginInvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, Value this_obj, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
153183
if (thread == null)
154184
throw new ArgumentNullException ("thread");

Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Threading;
4-
using System.Threading.Tasks;
53

64
namespace Mono.Debugger.Soft
75
{
8-
public class InvokeResult {
9-
public Value Result { get; set; }
10-
//
11-
// The value of the receiver after the call for calls to valuetype methods or null.
12-
// Only set when using the InvokeOptions.ReturnOutThis flag.
13-
// Since protocol version 2.35
14-
//
15-
public Value OutThis { get; set; }
16-
//
17-
// The value of the arguments after the call
18-
// Only set when using the InvokeOptions.ReturnOutArgs flag.
19-
// Since protocol version 2.35
20-
//
21-
public Value[] OutArgs { get; set; }
22-
}
23-
246
public class ObjectMirror : Value, IInvocableMethodOwnerMirror {
257
TypeMirror type;
268
AppDomainMirror domain;
@@ -145,7 +127,7 @@ Value IInvocableMethodOwnerMirror.GetThisObject () {
145127
return this;
146128
}
147129

148-
void IInvocableMethodOwnerMirror.ProcessResult (InvokeResult result)
130+
void IInvocableMethodOwnerMirror.ProcessResult (IInvokeResult result)
149131
{
150132
}
151133
}

Mono.Debugger.Soft/Mono.Debugger.Soft/PrimitiveValue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Value IInvocableMethodOwnerMirror.GetThisObject () {
3535
return this;
3636
}
3737

38-
void IInvocableMethodOwnerMirror.ProcessResult (InvokeResult result)
38+
void IInvocableMethodOwnerMirror.ProcessResult (IInvokeResult result)
3939
{
4040
}
4141

Mono.Debugger.Soft/Mono.Debugger.Soft/StructMirror.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Value IInvocableMethodOwnerMirror.GetThisObject () {
6868
return this;
6969
}
7070

71-
void IInvocableMethodOwnerMirror.ProcessResult (InvokeResult result)
71+
void IInvocableMethodOwnerMirror.ProcessResult (IInvokeResult result)
7272
{
7373
var outThis = result.OutThis as StructMirror;
7474
if (outThis != null) {

Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ Value IInvocableMethodOwnerMirror.GetThisObject () {
866866
return null;
867867
}
868868

869-
void IInvocableMethodOwnerMirror.ProcessResult (InvokeResult result)
869+
void IInvocableMethodOwnerMirror.ProcessResult (IInvokeResult result)
870870
{
871871
}
872872
}

Mono.Debugging.Soft/SoftDebuggerAdaptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2177,7 +2177,7 @@ class MethodCall: AsyncOperation
21772177
readonly object obj;
21782178
IAsyncResult handle;
21792179
Exception exception;
2180-
InvokeResult result;
2180+
IInvokeResult result;
21812181

21822182
public MethodCall (SoftEvaluationContext ctx, MethodMirror function, object obj, Value[] args, bool enableOutArgs)
21832183
{

0 commit comments

Comments
 (0)