AstBuilder.CompileDefaultNodeCreator with LINQ

Jun 18, 2013 at 11:01 AM
CompileDefaultNodeCreator can be simplified from using an ILGenerator to unsing LINQ expressions
using System.Linq.Expressions;
DefaultAstNodeCreator CompileDefaultNodeCreator(Type nodeType)
{
    var ctor = Expression.New(nodeType);
    var lamda = Expression.Lambda<DefaultAstNodeCreator>(ctor);
    return lamda.Compile();
}
I tested this within GrammerExplorer with MiniPython and all appeared to be as it should be.
Coordinator
Jun 21, 2013 at 3:17 AM
Not sure it is simplification, the current version is simple enough already. You just invoke code in expression engine - which in the end does the same, but the expression stuff itself is a bit foreign here