diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/ExpressionTrees.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/ExpressionTrees.cs index 94fc3ab38..09ef4a7cd 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/ExpressionTrees.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/ExpressionTrees.cs @@ -12,24 +12,22 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness static void Main() { Test(); + var twice = GetExpression(Expression.Constant(2)).Compile(); + Console.WriteLine(twice(21)); } - public Expression> GetExpression(int i) - { - return a => a + i; - } - - public Expression>> GetExpression2() - { - return a => b => a + b; - } - - public static void Test() + static void Test() { int i = 0; Expression> expression = () => i; i = 1; Console.WriteLine(expression.Compile()()); } + + static Expression> GetExpression(Expression factor) + { + ParameterExpression parameterExpression = Expression.Parameter(typeof(int), "x"); + return Expression.Lambda>(Expression.Multiply(parameterExpression, factor), parameterExpression); + } } }