From f3679e7df099837114c6b52e265dce95ec332029 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 7 Oct 2017 23:20:16 +0200 Subject: [PATCH] Fix #778: Errors about decompiling local variables and default for switch-cases --- .../IL/Transforms/DelegateConstruction.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/ICSharpCode.Decompiler/IL/Transforms/DelegateConstruction.cs b/ICSharpCode.Decompiler/IL/Transforms/DelegateConstruction.cs index 130349971..f90a57aff 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/DelegateConstruction.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/DelegateConstruction.cs @@ -228,6 +228,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms public TransformDisplayClassUsages(IInstructionWithVariableOperand targetLoad, BlockContainer captureScope, List orphanedVariableInits) { + this.currentFunction = captureScope.Ancestors.OfType().First(); this.targetLoad = targetLoad; this.captureScope = captureScope; this.orphanedVariableInits = orphanedVariableInits; @@ -241,17 +242,6 @@ namespace ICSharpCode.Decompiler.IL.Transforms } } - protected internal override void VisitILFunction(ILFunction function) - { - var old = currentFunction; - currentFunction = function; - try { - base.VisitILFunction(function); - } finally { - currentFunction = old; - } - } - protected internal override void VisitStLoc(StLoc inst) { base.VisitStLoc(inst);