Browse Source

Add value parameter to Leave ctor.

pull/863/head
Siegfried Pammer 8 years ago
parent
commit
2d1692c72f
  1. 3
      ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs
  2. 4
      ICSharpCode.Decompiler/IL/ILReader.cs
  3. 4
      ICSharpCode.Decompiler/IL/Instructions/Leave.cs

3
ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs

@ -447,8 +447,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow @@ -447,8 +447,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
moveNextFunction.ReleaseRef();
foreach (var branch in function.Descendants.OfType<Branch>()) {
if (branch.TargetBlock == setResultAndExitBlock) {
branch.ReplaceWith(new Leave((BlockContainer)function.Body) {
Value = resultVar == null ? (ILInstruction)new Nop() : new LdLoc(resultVar),
branch.ReplaceWith(new Leave((BlockContainer)function.Body, resultVar == null ? null : new LdLoc(resultVar)) {
ILRange = branch.ILRange
});
}

4
ICSharpCode.Decompiler/IL/ILReader.cs

@ -526,7 +526,7 @@ namespace ICSharpCode.Decompiler.IL @@ -526,7 +526,7 @@ namespace ICSharpCode.Decompiler.IL
case Cil.Code.Dup:
return Push(Peek());
case Cil.Code.Endfilter:
return new Leave(null) { Value = Pop() };
return new Leave(null, Pop());
case Cil.Code.Endfinally:
return new Leave(null);
case Cil.Code.Initblk:
@ -943,7 +943,7 @@ namespace ICSharpCode.Decompiler.IL @@ -943,7 +943,7 @@ namespace ICSharpCode.Decompiler.IL
if (methodReturnStackType == StackType.Void)
return new IL.Leave(mainContainer);
else
return new IL.Leave(mainContainer) { Value = Pop(methodReturnStackType) };
return new IL.Leave(mainContainer, Pop(methodReturnStackType));
}
private ILInstruction DecodeLdstr()

4
ICSharpCode.Decompiler/IL/Instructions/Leave.cs

@ -34,12 +34,12 @@ namespace ICSharpCode.Decompiler.IL @@ -34,12 +34,12 @@ namespace ICSharpCode.Decompiler.IL
{
BlockContainer targetContainer;
public Leave(BlockContainer targetContainer) : base(OpCode.Leave)
public Leave(BlockContainer targetContainer, ILInstruction value = null) : base(OpCode.Leave)
{
// Note: ILReader will create Leave instructions with targetContainer==null to represent 'endfinally',
// the targetContainer will then be filled in by BlockBuilder
this.targetContainer = targetContainer;
this.Value = new Nop();
this.Value = value ?? new Nop();
}
protected override InstructionFlags ComputeFlags()

Loading…
Cancel
Save