|
|
|
@ -118,7 +118,19 @@ namespace ICSharpCode.Decompiler.IL
@@ -118,7 +118,19 @@ namespace ICSharpCode.Decompiler.IL
|
|
|
|
|
|
|
|
|
|
internal override void TransformStackIntoVariables(TransformStackIntoVariablesState state) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
TryBlock = TryBlock.Inline(InstructionFlags.None, state); |
|
|
|
|
TryBlock.TransformStackIntoVariables(state); |
|
|
|
|
Stack<ILVariable> variablesAfter = TryBlock.HasFlag(InstructionFlags.EndPointUnreachable) ? null : state.Variables.Clone(); |
|
|
|
|
for (int i = 0; i < Handlers.Count; i++) { |
|
|
|
|
Handlers[i].TransformStackIntoVariables(state); |
|
|
|
|
if (!Handlers[i].HasFlag(InstructionFlags.EndPointUnreachable)) { |
|
|
|
|
if (variablesAfter == null) |
|
|
|
|
variablesAfter = state.Variables.Clone(); |
|
|
|
|
else |
|
|
|
|
state.MergeVariables(variablesAfter, state.Variables); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
state.Variables = variablesAfter ?? new Stack<ILVariable>(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -160,6 +172,12 @@ namespace ICSharpCode.Decompiler.IL
@@ -160,6 +172,12 @@ namespace ICSharpCode.Decompiler.IL
|
|
|
|
|
|
|
|
|
|
internal override void TransformStackIntoVariables(TransformStackIntoVariablesState state) |
|
|
|
|
{ |
|
|
|
|
state.Variables.Clear(); |
|
|
|
|
Filter = Filter.Inline(InstructionFlags.None, state); |
|
|
|
|
Filter.TransformStackIntoVariables(state); |
|
|
|
|
state.Variables.Clear(); |
|
|
|
|
Body = Body.Inline(InstructionFlags.None, state); |
|
|
|
|
Body.TransformStackIntoVariables(state); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void WriteTo(ITextOutput output) |
|
|
|
@ -266,7 +284,13 @@ namespace ICSharpCode.Decompiler.IL
@@ -266,7 +284,13 @@ namespace ICSharpCode.Decompiler.IL
|
|
|
|
|
|
|
|
|
|
internal override void TransformStackIntoVariables(TransformStackIntoVariablesState state) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
TryBlock = TryBlock.Inline(InstructionFlags.None, state); |
|
|
|
|
TryBlock.TransformStackIntoVariables(state); |
|
|
|
|
var variablesAfterTry = state.Variables; |
|
|
|
|
state.Variables = new Stack<ILVariable>(); |
|
|
|
|
FinallyBlock = FinallyBlock.Inline(InstructionFlags.None, state); |
|
|
|
|
FinallyBlock.TransformStackIntoVariables(state); |
|
|
|
|
state.Variables = variablesAfterTry; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -344,7 +368,21 @@ namespace ICSharpCode.Decompiler.IL
@@ -344,7 +368,21 @@ namespace ICSharpCode.Decompiler.IL
|
|
|
|
|
|
|
|
|
|
internal override void TransformStackIntoVariables(TransformStackIntoVariablesState state) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
TryBlock = TryBlock.Inline(InstructionFlags.None, state); |
|
|
|
|
TryBlock.TransformStackIntoVariables(state); |
|
|
|
|
var variablesAfterTry = state.Variables; |
|
|
|
|
state.Variables = new Stack<ILVariable>(); |
|
|
|
|
FaultBlock = FaultBlock.Inline(InstructionFlags.None, state); |
|
|
|
|
FaultBlock.TransformStackIntoVariables(state); |
|
|
|
|
if (!TryBlock.HasFlag(InstructionFlags.EndPointUnreachable) && !FaultBlock.HasFlag(InstructionFlags.EndPointUnreachable)) { |
|
|
|
|
// If end-points of both instructions are reachable, merge their states
|
|
|
|
|
state.MergeVariables(state.Variables, variablesAfterTry); |
|
|
|
|
} |
|
|
|
|
if (FaultBlock.HasFlag(InstructionFlags.EndPointUnreachable)) { |
|
|
|
|
// If the end-point of FaultBlock is unreachable, continue with the end-state of TryBlock instead
|
|
|
|
|
// (if both are unreachable, it doesn't matter what we continue with)
|
|
|
|
|
state.Variables = variablesAfterTry; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|