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

github.com/mono/debugger-libs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <jestedfa@microsoft.com>2019-09-24 22:42:56 +0300
committerJeffrey Stedfast <jestedfa@microsoft.com>2019-09-24 22:42:56 +0300
commite61361844a7d2ea5c2e43acdd94629a3c6c12629 (patch)
tree1ec22fe7f99a3abc9ee3fb1b176c62dc730d0b6d
parentec2a85155d6223f70f1117336b56a40806855654 (diff)
minor code cleanup
-rw-r--r--Mono.Debugging.Soft/SoftDebuggerBacktrace.cs4
-rw-r--r--Mono.Debugging.Win32/CorDebuggerBacktrace.cs2
-rw-r--r--Mono.Debugging/Mono.Debugging.Evaluation/BaseBacktrace.cs3
-rw-r--r--Mono.Debugging/Mono.Debugging.Evaluation/EvaluationContext.cs2
-rw-r--r--Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluator.cs24
-rw-r--r--Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionResolverVisitor.cs2
6 files changed, 20 insertions, 17 deletions
diff --git a/Mono.Debugging.Soft/SoftDebuggerBacktrace.cs b/Mono.Debugging.Soft/SoftDebuggerBacktrace.cs
index 583373f..4cdda11 100644
--- a/Mono.Debugging.Soft/SoftDebuggerBacktrace.cs
+++ b/Mono.Debugging.Soft/SoftDebuggerBacktrace.cs
@@ -213,10 +213,12 @@ namespace Mono.Debugging.Soft
protected override EvaluationContext GetEvaluationContext (int frameIndex, EvaluationOptions options)
{
ValidateStack ();
+
if (frameIndex >= frames.Length)
return null;
- MDB.StackFrame frame = frames [frameIndex];
+ var frame = frames[frameIndex];
+
return new SoftEvaluationContext (session, frame, options);
}
diff --git a/Mono.Debugging.Win32/CorDebuggerBacktrace.cs b/Mono.Debugging.Win32/CorDebuggerBacktrace.cs
index ea3d64e..1dac761 100644
--- a/Mono.Debugging.Win32/CorDebuggerBacktrace.cs
+++ b/Mono.Debugging.Win32/CorDebuggerBacktrace.cs
@@ -66,7 +66,7 @@ namespace Mono.Debugging.Win32
protected override EvaluationContext GetEvaluationContext (int frameIndex, EvaluationOptions options)
{
- CorEvaluationContext ctx = new CorEvaluationContext (session, this, frameIndex, options);
+ var ctx = new CorEvaluationContext (session, this, frameIndex, options);
ctx.Thread = thread;
return ctx;
}
diff --git a/Mono.Debugging/Mono.Debugging.Evaluation/BaseBacktrace.cs b/Mono.Debugging/Mono.Debugging.Evaluation/BaseBacktrace.cs
index ba28180..67828cb 100644
--- a/Mono.Debugging/Mono.Debugging.Evaluation/BaseBacktrace.cs
+++ b/Mono.Debugging/Mono.Debugging.Evaluation/BaseBacktrace.cs
@@ -26,6 +26,7 @@
using System;
using System.Collections.Generic;
+
using Mono.Debugging.Client;
using Mono.Debugging.Backend;
@@ -70,7 +71,7 @@ namespace Mono.Debugging.Evaluation
return new [] { val };
}
- foreach (ValueReference local in frame.LocalVariables)
+ foreach (var local in frame.LocalVariables)
list.Add (local.CreateObjectValue (true, options));
return list.ToArray ();
diff --git a/Mono.Debugging/Mono.Debugging.Evaluation/EvaluationContext.cs b/Mono.Debugging/Mono.Debugging.Evaluation/EvaluationContext.cs
index 62cd672..2b5a806 100644
--- a/Mono.Debugging/Mono.Debugging.Evaluation/EvaluationContext.cs
+++ b/Mono.Debugging/Mono.Debugging.Evaluation/EvaluationContext.cs
@@ -79,7 +79,7 @@ namespace Mono.Debugging.Evaluation
if (options == null || Options == options)
return this;
- EvaluationContext clone = Clone ();
+ var clone = Clone ();
clone.Options = options;
return clone;
}
diff --git a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluator.cs b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluator.cs
index 0f18cf4..26d3b28 100644
--- a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluator.cs
+++ b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluator.cs
@@ -41,19 +41,19 @@ namespace Mono.Debugging.Evaluation
public override ValueReference Evaluate (EvaluationContext ctx, string expression, object expectedType)
{
- expression = expression.TrimStart ();
+ expression = expression.Trim ();
if (expression.Length > 0 && expression[0] == '?')
- expression = expression.Substring (1).Trim ();
+ expression = expression.Substring (1).TrimStart ();
if (expression.Length > 3 && expression.StartsWith ("var", StringComparison.Ordinal) && char.IsWhiteSpace (expression[3])) {
- expression = expression.Substring (4).Trim (' ', '\t');
+ expression = expression.Substring (4).TrimStart ();
string variable = null;
for (int n = 0; n < expression.Length; n++) {
if (!char.IsLetterOrDigit (expression[n]) && expression[n] != '_') {
variable = expression.Substring (0, n);
- if (!expression.Substring (n).Trim (' ', '\t').StartsWith ("=", StringComparison.Ordinal))
+ if (!expression.Substring (n).TrimStart ().StartsWith ("=", StringComparison.Ordinal))
variable = null;
break;
}
@@ -79,7 +79,8 @@ namespace Mono.Debugging.Evaluation
throw new EvaluatorException ("Could not parse expression '{0}'", expression);
var evaluator = new NRefactoryExpressionEvaluatorVisitor (ctx, expression, expectedType, userVariables);
- return expr.AcceptVisitor<ValueReference> (evaluator);
+
+ return expr.AcceptVisitor (evaluator);
}
public override string Resolve (DebuggerSession session, SourceLocation location, string exp)
@@ -89,7 +90,7 @@ namespace Mono.Debugging.Evaluation
string Resolve (DebuggerSession session, SourceLocation location, string expression, bool tryTypeOf)
{
- expression = expression.TrimStart ();
+ expression = expression.Trim ();
if (expression.Length > 0 && expression[0] == '?')
return "?" + Resolve (session, location, expression.Substring (1).Trim ());
@@ -99,7 +100,7 @@ namespace Mono.Debugging.Evaluation
expression = ReplaceExceptionTag (expression, session.Options.EvaluationOptions.CurrentExceptionTag);
- Expression expr = new CSharpParser ().ParseExpression (expression);
+ var expr = new CSharpParser ().ParseExpression (expression);
if (expr == null)
return expression;
@@ -120,13 +121,13 @@ namespace Mono.Debugging.Evaluation
public override ValidationResult ValidateExpression (EvaluationContext ctx, string expression)
{
- expression = expression.TrimStart ();
+ expression = expression.Trim ();
if (expression.Length > 0 && expression[0] == '?')
- expression = expression.Substring (1).Trim ();
+ expression = expression.Substring (1).TrimStart ();
if (expression.Length > 3 && expression.StartsWith ("var", StringComparison.Ordinal) && char.IsWhiteSpace (expression[3]))
- expression = expression.Substring (4).Trim ();
+ expression = expression.Substring (4).TrimStart ();
expression = ReplaceExceptionTag (expression, ctx.Options.CurrentExceptionTag);
@@ -197,8 +198,7 @@ namespace Mono.Debugging.Evaluation
return true;
pos++;
- }
- while (true);
+ } while (true);
}
bool ParseGenericArgs (string name, ref int pos)
diff --git a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionResolverVisitor.cs b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionResolverVisitor.cs
index d7d885a..7d9d61e 100644
--- a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionResolverVisitor.cs
+++ b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionResolverVisitor.cs
@@ -92,7 +92,7 @@ namespace Mono.Debugging.Evaluation
void ReplaceType (string name, int genericArgs, int offset, int length, bool memberType = false)
{
- string type = null;
+ string type;
if (genericArgs == 0)
type = session.ResolveIdentifierAsType (name, location);