diff --git a/Debugger/ILSpy.Debugger/AvalonEdit/TextMarkerService.cs b/Debugger/ILSpy.Debugger/AvalonEdit/TextMarkerService.cs
index 7d956ab89..0d7536206 100644
--- a/Debugger/ILSpy.Debugger/AvalonEdit/TextMarkerService.cs
+++ b/Debugger/ILSpy.Debugger/AvalonEdit/TextMarkerService.cs
@@ -126,7 +126,7 @@ namespace ILSpy.Debugger.AvalonEdit
return;
int lineStart = line.Offset;
int lineEnd = lineStart + line.Length;
- foreach (TextMarker marker in markers.FindOverlappingSegments(lineStart, line.Length)) {
+ foreach (TextMarker marker in markers.FindOverlappingSegments(lineStart, line.Length).Reverse()) {
Brush foregroundBrush = null;
if (marker.ForegroundColor != null) {
foregroundBrush = new SolidColorBrush(marker.ForegroundColor.Value);
@@ -166,7 +166,7 @@ namespace ILSpy.Debugger.AvalonEdit
return;
int viewStart = visualLines.First().FirstDocumentLine.Offset;
int viewEnd = visualLines.Last().LastDocumentLine.Offset + visualLines.Last().LastDocumentLine.Length;
- foreach (TextMarker marker in markers.FindOverlappingSegments(viewStart, viewEnd - viewStart)) {
+ foreach (TextMarker marker in markers.FindOverlappingSegments(viewStart, viewEnd - viewStart).Reverse()) {
if (marker.BackgroundColor != null) {
BackgroundGeometryBuilder geoBuilder = new BackgroundGeometryBuilder();
geoBuilder.AlignToWholePixels = true;
diff --git a/Debugger/ILSpy.Debugger/Bookmarks/CurrentLineBookmark.cs b/Debugger/ILSpy.Debugger/Bookmarks/CurrentLineBookmark.cs
index 47caa0418..3c59d1d21 100644
--- a/Debugger/ILSpy.Debugger/Bookmarks/CurrentLineBookmark.cs
+++ b/Debugger/ILSpy.Debugger/Bookmarks/CurrentLineBookmark.cs
@@ -92,7 +92,7 @@ namespace ILSpy.Debugger.Bookmarks
public override ITextMarker CreateMarker(ITextMarkerService markerService, int offset, int length)
{
- ITextMarker marker = markerService.Create(offset + startColumn - 1, Math.Max(endColumn - startColumn, 1));
+ ITextMarker marker = markerService.Create(offset + startColumn - 1, length);
marker.BackgroundColor = Colors.Yellow;
marker.ForegroundColor = Colors.Blue;
return marker;
diff --git a/Debugger/ILSpy.Debugger/Bookmarks/MarkerBookmark.cs b/Debugger/ILSpy.Debugger/Bookmarks/MarkerBookmark.cs
index aebc3d461..194aac4e4 100644
--- a/Debugger/ILSpy.Debugger/Bookmarks/MarkerBookmark.cs
+++ b/Debugger/ILSpy.Debugger/Bookmarks/MarkerBookmark.cs
@@ -22,9 +22,6 @@ using ILSpy.Debugger.AvalonEdit;
namespace ILSpy.Debugger.Bookmarks
{
- ///
- /// Description of MarkerBookmark.
- ///
public abstract class MarkerBookmark : BookmarkBase
{
public MarkerBookmark(string typeName, AstLocation location) : base(typeName, location)
diff --git a/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs b/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
index f54007484..7e4e23e3d 100644
--- a/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
+++ b/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
@@ -110,21 +110,18 @@ namespace Decompiler
}
} else if (node is ILWhileLoop) {
ILWhileLoop ilLoop = (ILWhileLoop)node;
- if (ilLoop.PreLoopLabel != null)
- yield return TransformNode(ilLoop.PreLoopLabel).Single();
WhileStatement whileStmt = new WhileStatement() {
Condition = ilLoop.Condition != null ? MakeBranchCondition(ilLoop.Condition) : new PrimitiveExpression(true),
EmbeddedStatement = TransformBlock(ilLoop.BodyBlock)
};
yield return whileStmt;
- if (ilLoop.PostLoopGoto != null)
- yield return (Statement)TransformExpression(ilLoop.PostLoopGoto);
} else if (node is ILCondition) {
ILCondition conditionalNode = (ILCondition)node;
+ bool hasFalseBlock = conditionalNode.FalseBlock.EntryGoto != null || conditionalNode.FalseBlock.Body.Count > 0;
yield return new Ast.IfElseStatement {
Condition = MakeBranchCondition(conditionalNode.Condition),
TrueStatement = TransformBlock(conditionalNode.TrueBlock),
- FalseStatement = TransformBlock(conditionalNode.FalseBlock)
+ FalseStatement = hasFalseBlock ? TransformBlock(conditionalNode.FalseBlock) : null
};
} else if (node is ILSwitch) {
ILSwitch ilSwitch = (ILSwitch)node;
@@ -296,6 +293,10 @@ namespace Decompiler
TrueExpression = (Expression)TransformExpression(byteCode.Arguments[1]),
FalseExpression = (Expression)TransformExpression(byteCode.Arguments[2]),
};
+ case ILCode.LoopBreak:
+ return new Ast.BreakStatement();
+ case ILCode.LoopContinue:
+ return new Ast.ContinueStatement();
}
List args = TransformExpressionArguments(byteCode);
@@ -573,7 +574,7 @@ namespace Decompiler
} else {
return InlineAssembly(byteCode, args);
}
- case Code.Leave: return null;
+ case Code.Leave: return new GotoStatement() { Label = ((ILLabel)operand).Name };
case Code.Localloc: return InlineAssembly(byteCode, args);
case Code.Mkrefany: return InlineAssembly(byteCode, args);
case Code.Newobj:
diff --git a/ICSharpCode.Decompiler/Ast/Transforms/PatternStatementTransform.cs b/ICSharpCode.Decompiler/Ast/Transforms/PatternStatementTransform.cs
index 15dc59905..78a9d3596 100644
--- a/ICSharpCode.Decompiler/Ast/Transforms/PatternStatementTransform.cs
+++ b/ICSharpCode.Decompiler/Ast/Transforms/PatternStatementTransform.cs
@@ -204,8 +204,7 @@ namespace Decompiler.Transforms
Left = new Backreference("ident").ToExpression(),
Operator = AssignmentOperatorType.Any,
Right = new AnyNode().ToExpression()
- })).ToStatement(),
- new ContinueStatement()
+ })).ToStatement()
}
};
diff --git a/ICSharpCode.Decompiler/Ast/Transforms/RemoveDeadLabels.cs b/ICSharpCode.Decompiler/Ast/Transforms/RemoveDeadLabels.cs
deleted file mode 100644
index b8f65771a..000000000
--- a/ICSharpCode.Decompiler/Ast/Transforms/RemoveDeadLabels.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.CSharp;
-
-namespace Decompiler.Transforms.Ast
-{
- public class RemoveDeadLabels : DepthFirstAstVisitor