Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <jeff@xamarin.com>2012-05-03 23:49:57 +0400
committerJeffrey Stedfast <jeff@xamarin.com>2012-05-03 23:51:39 +0400
commitfa585de145212ddcbf1a004e596f3103438dbe46 (patch)
treeb5bfe2b4c9b07d46cef518c80d4d8f7964e0ba2b
parent35a0d7e5a3b87f1f3f30755c51932a0d7a3e94ca (diff)
[Debugger] Make equality work for structs in the immediate window
Fixes bug #4789
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs1
-rw-r--r--main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryEvaluator.cs20
2 files changed, 18 insertions, 3 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs b/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs
index 2dda3eb3a2..c026016b96 100644
--- a/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs
@@ -129,7 +129,6 @@ namespace Mono.Debugging.Soft
if (!String.IsNullOrEmpty (dsi.LogMessage))
LogWriter (false, dsi.LogMessage + "\n");
-
AsyncCallback callback = null;
int attemptNumber = 0;
int maxAttempts = startArgs.MaxConnectionAttempts;
diff --git a/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryEvaluator.cs b/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryEvaluator.cs
index 00bd2062d4..5dbd08798d 100644
--- a/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryEvaluator.cs
+++ b/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryEvaluator.cs
@@ -721,6 +721,22 @@ namespace Mono.Debugging.Evaluation
throw CreateParseError ("Invalid operands in binary operator");
}
}
+
+ bool CheckEquality (object v1, object v2)
+ {
+ object targetType = ctx.Adapter.GetValueType (ctx, v1);
+ object[] argTypes = new object[] {
+ ctx.Adapter.GetType (ctx, "System.Object")
+ };
+ object[] args = new object[] {
+ v2
+ };
+
+ object result = ctx.Adapter.RuntimeInvoke (ctx, targetType, v1, "Equals", argTypes, args);
+ var literal = LiteralValueReference.CreateTargetObjectLiteral (ctx, "result", result);
+
+ return (bool) literal.ObjectValue;
+ }
object EvaluateBinaryOperatorExpression (ValueReference left, ICSharpCode.OldNRefactory.Ast.Expression rightExp, BinaryOperatorType oper, object data)
{
@@ -775,11 +791,11 @@ namespace Mono.Debugging.Evaluation
case BinaryOperatorType.Equality:
if (val1 == null || val2 == null)
return LiteralValueReference.CreateObjectLiteral (ctx, name, val1 == val2);
- return LiteralValueReference.CreateObjectLiteral (ctx, name, val1.Equals (val2));
+ return LiteralValueReference.CreateObjectLiteral (ctx, name, CheckEquality (targetVal1, targetVal2));
case BinaryOperatorType.InEquality:
if (val1 == null || val2 == null)
return LiteralValueReference.CreateObjectLiteral (ctx, name, val1 != val2);
- return LiteralValueReference.CreateObjectLiteral (ctx, name, !val1.Equals (val2));
+ return LiteralValueReference.CreateObjectLiteral (ctx, name, !CheckEquality (targetVal1, targetVal2));
case BinaryOperatorType.ReferenceEquality:
return LiteralValueReference.CreateObjectLiteral (ctx, name, val1 == val2);
case BinaryOperatorType.ReferenceInequality: