示例#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));
        }