public static Delegate CompileLambda(Node n)
 {
     var compiler = new CSharpFunctionCompiler();
     var expr = compiler.ToExpr(n) as LambdaExpression;
     if (expr == null) return null;
     return expr.Compile();
 }
Exemplo n.º 2
0
        public static Delegate CompileLambda(Node n)
        {
            var compiler = new CSharpFunctionCompiler();
            var expr     = compiler.ToExpr(n) as LambdaExpression;

            if (expr == null)
            {
                return(null);
            }
            return(expr.Compile());
        }
Exemplo n.º 3
0
 public static void Test(string s, params object[] args)
 {
     Console.WriteLine("Testing {0} with args ({1})", s, String.Join(", ", args));
     try
     {
         var f = CSharpFunctionCompiler.CompileLambda(s);
         var r = f.DynamicInvoke(args);
         Console.WriteLine("Result is {0}", r);
     }
     catch (Exception e)
     {
         Console.WriteLine("error occured " + e.Message);
     }
 }