Browse Source

Implement sequence points for using statement.

pull/923/head
Siegfried Pammer 8 years ago
parent
commit
2169d44c81
  1. 9
      ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs
  2. 2
      ICSharpCode.Decompiler/IL/Transforms/UsingTransform.cs

9
ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs

@ -126,6 +126,15 @@ namespace ICSharpCode.Decompiler.CSharp
VisitAsSequencePoint(lambdaExpression.Body); VisitAsSequencePoint(lambdaExpression.Body);
} }
public override void VisitUsingStatement(UsingStatement usingStatement)
{
StartSequencePoint(usingStatement);
usingStatement.ResourceAcquisition.AcceptVisitor(this);
VisitAsSequencePoint(usingStatement.EmbeddedStatement);
AddToSequencePoint(usingStatement);
EndSequencePoint(usingStatement.StartLocation, usingStatement.RParToken.EndLocation);
}
/// <summary> /// <summary>
/// Start a new C# statement = new sequence point. /// Start a new C# statement = new sequence point.
/// </summary> /// </summary>

2
ICSharpCode.Decompiler/IL/Transforms/UsingTransform.cs

@ -87,7 +87,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
context.Step("UsingTransform", tryFinally); context.Step("UsingTransform", tryFinally);
storeInst.Variable.Kind = VariableKind.UsingLocal; storeInst.Variable.Kind = VariableKind.UsingLocal;
block.Instructions.RemoveAt(i); block.Instructions.RemoveAt(i);
block.Instructions[i - 1] = new UsingInstruction(storeInst.Variable, storeInst.Value, tryFinally.TryBlock); block.Instructions[i - 1] = new UsingInstruction(storeInst.Variable, storeInst.Value, tryFinally.TryBlock) { ILRange = storeInst.ILRange };
return true; return true;
} }

Loading…
Cancel
Save