diff --git a/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs b/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs index 24aa6e164..3e3e66e2e 100644 --- a/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs @@ -67,6 +67,7 @@ namespace ICSharpCode.Decompiler.CSharp void VisitAsSequencePoint(AstNode node) { + if (node.IsNull) return; StartSequencePoint(node); node.AcceptVisitor(this); EndSequencePoint(node.StartLocation, node.EndLocation); @@ -165,6 +166,34 @@ namespace ICSharpCode.Decompiler.CSharp EndSequencePoint(lockStatement.StartLocation, lockStatement.RParToken.EndLocation); } + public override void VisitIfElseStatement(IfElseStatement ifElseStatement) + { + StartSequencePoint(ifElseStatement); + ifElseStatement.Condition.AcceptVisitor(this); + VisitAsSequencePoint(ifElseStatement.TrueStatement); + VisitAsSequencePoint(ifElseStatement.FalseStatement); + AddToSequencePoint(ifElseStatement); + EndSequencePoint(ifElseStatement.StartLocation, ifElseStatement.RParToken.EndLocation); + } + + public override void VisitWhileStatement(WhileStatement whileStatement) + { + StartSequencePoint(whileStatement); + whileStatement.Condition.AcceptVisitor(this); + VisitAsSequencePoint(whileStatement.EmbeddedStatement); + AddToSequencePoint(whileStatement); + EndSequencePoint(whileStatement.StartLocation, whileStatement.RParToken.EndLocation); + } + + public override void VisitDoWhileStatement(DoWhileStatement doWhileStatement) + { + StartSequencePoint(doWhileStatement); + VisitAsSequencePoint(doWhileStatement.EmbeddedStatement); + doWhileStatement.Condition.AcceptVisitor(this); + AddToSequencePoint(doWhileStatement); + EndSequencePoint(doWhileStatement.WhileToken.StartLocation, doWhileStatement.RParToken.EndLocation); + } + /// /// Start a new C# statement = new sequence point. ///