Browse Source

DelegateConstruction: only remove copies of parameter values that are part of the outer function.

pull/892/merge
Siegfried Pammer 8 years ago
parent
commit
4636c0b038
  1. 2
      ICSharpCode.Decompiler/IL/Transforms/DelegateConstruction.cs

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

@ -271,7 +271,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -271,7 +271,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
if (initValues.TryGetValue(field, out info)) {
inst.ReplaceWith(new StLoc(info.variable, inst.Value));
} else {
if (inst.Value.MatchLdLoc(out var v) && v.Kind == VariableKind.Parameter) {
if (inst.Value.MatchLdLoc(out var v) && v.Kind == VariableKind.Parameter && currentFunction == v.Function) {
// special case for parameters: remove copies of parameter values.
orphanedVariableInits.Add(inst);
value = inst.Value;

Loading…
Cancel
Save