diff --git a/ICSharpCode.Decompiler/CSharp/CallBuilder.cs b/ICSharpCode.Decompiler/CSharp/CallBuilder.cs index 23f0add1a..519eb2ae2 100644 --- a/ICSharpCode.Decompiler/CSharp/CallBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/CallBuilder.cs @@ -323,7 +323,8 @@ namespace ICSharpCode.Decompiler.CSharp break; case OpCode.ILFunction: method = ((ILFunction)func).Method; - return expressionBuilder.TranslateFunction(inst.Method.DeclaringType, (ILFunction)func); + return expressionBuilder.TranslateFunction(inst.Method.DeclaringType, (ILFunction)func) + .WithILInstruction(inst); default: throw new ArgumentException($"Unknown instruction type: {func.OpCode}"); } diff --git a/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs b/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs index 25ed0ddb3..f2f252d4b 100644 --- a/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs @@ -1026,7 +1026,7 @@ namespace ICSharpCode.Decompiler.CSharp return new CallBuilder(this, typeSystem, settings).Build(inst); } - internal TranslatedExpression TranslateFunction(IType delegateType, ILFunction function) + internal ExpressionWithResolveResult TranslateFunction(IType delegateType, ILFunction function) { var method = function.Method.MemberDefinition as IMethod; Debug.Assert(method != null); @@ -1098,7 +1098,7 @@ namespace ICSharpCode.Decompiler.CSharp TranslatedExpression translatedLambda = replacement.WithILInstruction(function).WithRR(rr); return new CastExpression(ConvertType(delegateType), translatedLambda) - .WithoutILInstruction().WithRR(new ConversionResolveResult(delegateType, rr, LambdaConversion.Instance)); + .WithRR(new ConversionResolveResult(delegateType, rr, LambdaConversion.Instance)); } IType InferReturnType(BlockStatement body)