Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,28 @@ public override void VisitBlockStatement(BlockStatement blockStatement)
}
}

public override void VisitFieldDeclaration(FieldDeclaration fieldDeclaration)
{
foreach (var variable in fieldDeclaration.Variables)
{
if (!variable.AssignToken.IsNull || !variable.Initializer.IsNull)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that there can be an initializer without an assign token?

Suggested change
if (!variable.AssignToken.IsNull || !variable.Initializer.IsNull)
if (!variable.Initializer.IsNull)

{
VisitAsSequencePoint(variable);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VisitAsSequencePoint(variable);
VisitAsSequencePoint(variable.Initializer);

is it on purpose that you pass the VariableInitializer instead of just the Expression?

}
}
base.VisitFieldDeclaration(fieldDeclaration);
}

public override void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration)
{
if (!propertyDeclaration.ExpressionBody.IsNull)
{
VisitAsSequencePoint(propertyDeclaration.ExpressionBody);
}
else if (!propertyDeclaration.Initializer.IsNull)
{
VisitAsSequencePoint(propertyDeclaration.Initializer);
}
else
{
base.VisitPropertyDeclaration(propertyDeclaration);
Expand Down Expand Up @@ -202,6 +218,18 @@ public override void VisitForStatement(ForStatement forStatement)
VisitAsSequencePoint(forStatement.EmbeddedStatement);
}

public override void VisitEventDeclaration(EventDeclaration eventDeclaration)
{
foreach (var variable in eventDeclaration.Variables)
{
if (!variable.AssignToken.IsNull || !variable.Initializer.IsNull)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!variable.AssignToken.IsNull || !variable.Initializer.IsNull)
if (!variable.Initializer.IsNull)

{
VisitAsSequencePoint(variable);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VisitAsSequencePoint(variable);
VisitAsSequencePoint(variable.Initializer);

}
}
base.VisitEventDeclaration(eventDeclaration);
}

public override void VisitSwitchStatement(SwitchStatement switchStatement)
{
StartSequencePoint(switchStatement);
Expand Down
Loading