Browse Source

Fix SequencePointBuilder.VisitCatchClause: do not create a sequence point from the catch-token to the closing brace.

pull/1920/head
Siegfried Pammer 5 years ago
parent
commit
794be9a5b4
  1. 7
      ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs

7
ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs

@ -262,12 +262,15 @@ namespace ICSharpCode.Decompiler.CSharp
foreachStatement.InExpression.AcceptVisitor(this); foreachStatement.InExpression.AcceptVisitor(this);
AddToSequencePoint(foreachInfo.GetEnumeratorCall); AddToSequencePoint(foreachInfo.GetEnumeratorCall);
EndSequencePoint(foreachStatement.InExpression.StartLocation, foreachStatement.InExpression.EndLocation); EndSequencePoint(foreachStatement.InExpression.StartLocation, foreachStatement.InExpression.EndLocation);
StartSequencePoint(foreachStatement); StartSequencePoint(foreachStatement);
AddToSequencePoint(foreachInfo.MoveNextCall); AddToSequencePoint(foreachInfo.MoveNextCall);
EndSequencePoint(foreachStatement.InToken.StartLocation, foreachStatement.InToken.EndLocation); EndSequencePoint(foreachStatement.InToken.StartLocation, foreachStatement.InToken.EndLocation);
StartSequencePoint(foreachStatement); StartSequencePoint(foreachStatement);
AddToSequencePoint(foreachInfo.GetCurrentCall); AddToSequencePoint(foreachInfo.GetCurrentCall);
EndSequencePoint(foreachStatement.VariableType.StartLocation, foreachStatement.VariableNameToken.EndLocation); EndSequencePoint(foreachStatement.VariableType.StartLocation, foreachStatement.VariableNameToken.EndLocation);
VisitAsSequencePoint(foreachStatement.EmbeddedStatement); VisitAsSequencePoint(foreachStatement.EmbeddedStatement);
} }
@ -327,7 +330,6 @@ namespace ICSharpCode.Decompiler.CSharp
public override void VisitCatchClause(CatchClause catchClause) public override void VisitCatchClause(CatchClause catchClause)
{ {
StartSequencePoint(catchClause);
if (catchClause.Condition.IsNull) { if (catchClause.Condition.IsNull) {
var tryCatchHandler = catchClause.Annotation<TryCatchHandler>(); var tryCatchHandler = catchClause.Annotation<TryCatchHandler>();
if (!tryCatchHandler.ExceptionSpecifierILRange.IsEmpty) { if (!tryCatchHandler.ExceptionSpecifierILRange.IsEmpty) {
@ -341,8 +343,7 @@ namespace ICSharpCode.Decompiler.CSharp
AddToSequencePoint(catchClause.Condition); AddToSequencePoint(catchClause.Condition);
EndSequencePoint(catchClause.WhenToken.StartLocation, catchClause.CondRParToken.EndLocation); EndSequencePoint(catchClause.WhenToken.StartLocation, catchClause.CondRParToken.EndLocation);
} }
catchClause.Body.AcceptVisitor(this); VisitAsSequencePoint(catchClause.Body);
EndSequencePoint(catchClause.StartLocation, catchClause.EndLocation);
} }
/// <summary> /// <summary>

Loading…
Cancel
Save