示例#1
0
		public static RuntimeExpression CreateCompiled(ExpressionNode expressionNode)
		{
			string expressionSource = expressionNode.GenerateSource();
			ILEmitContext ilEmitContext = new ILEmitContext(expressionSource);
			
			ILParameterRegisterer ilParameterRegisterer = new ILParameterRegisterer(ilEmitContext);
			ilParameterRegisterer.Visit(expressionNode);

			ILTranslator ilTranslator = new ILTranslator(ilEmitContext);
			ilTranslator.Visit(expressionNode);

			CompiledExpressionDelegate compiledExpressionDelegate = ilEmitContext.CreateDelegate();
			object[] arguments = ilEmitContext.GetArguments();

			return new CompiledRuntimeExpression(expressionSource, expressionNode.ExpressionType, compiledExpressionDelegate, arguments);
		}
示例#2
0
        public static RuntimeExpression CreateCompiled(ExpressionNode expressionNode)
        {
            string        expressionSource = expressionNode.GenerateSource();
            ILEmitContext ilEmitContext    = new ILEmitContext(expressionSource);

            ILParameterRegisterer ilParameterRegisterer = new ILParameterRegisterer(ilEmitContext);

            ilParameterRegisterer.Visit(expressionNode);

            ILTranslator ilTranslator = new ILTranslator(ilEmitContext);

            ilTranslator.Visit(expressionNode);

            CompiledExpressionDelegate compiledExpressionDelegate = ilEmitContext.CreateDelegate();

            object[] arguments = ilEmitContext.GetArguments();

            return(new CompiledRuntimeExpression(expressionSource, expressionNode.ExpressionType, compiledExpressionDelegate, arguments));
        }
 public ILParameterRegisterer(ILEmitContext ilEmitContext)
 {
     _ilEmitContext = ilEmitContext;
 }
示例#4
0
		public ILParameterRegisterer(ILEmitContext ilEmitContext)
		{
			_ilEmitContext = ilEmitContext;
		}
示例#5
0
		public ILTranslator(ILEmitContext ilEmitContext)
		{
			_ilEmitContext = ilEmitContext;
			_ilEmitContext.CreateDynamicMethod();
		}
示例#6
0
 public ILTranslator(ILEmitContext ilEmitContext)
 {
     _ilEmitContext = ilEmitContext;
     _ilEmitContext.CreateDynamicMethod();
 }