Browse Source

SequencePointBuilder: add support for if-statement, while-statement and do-while-statement

pull/923/head
Siegfried Pammer 8 years ago
parent
commit
a0ed791567
  1. 29
      ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs

29
ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs

@ -67,6 +67,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -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 @@ -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);
}
/// <summary>
/// Start a new C# statement = new sequence point.
/// </summary>

Loading…
Cancel
Save