Beispiel #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);
		}
Beispiel #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));
        }
Beispiel #3
0
 void IErrorReporter.WhenMustEvaluateToBoolIfCaseInputIsOmitted(ExpressionNode whenExpression)
 {
     string message = String.Format(CultureInfo.CurrentCulture, Resources.WhenMustEvaluateToBoolIfCaseInputIsOmitted, whenExpression.GenerateSource(), FormattingHelpers.FormatType(typeof(bool)));
     HandleError(ErrorId.WhenMustEvaluateToBoolIfCaseInputIsOmitted, message);
 }
Beispiel #4
0
 void IErrorReporter.AggregateContainsColumnsFromDifferentQueries(ExpressionNode aggregateArgument)
 {
     string message = String.Format(CultureInfo.CurrentCulture, Resources.AggregateContainsColumnsFromDifferentQueries, aggregateArgument.GenerateSource());
     HandleError(ErrorId.AggregateContainsColumnsFromDifferentQueries, message);
 }
Beispiel #5
0
 void IErrorReporter.CannotCast(ExpressionNode expression, Type targetType)
 {
     string message = String.Format(CultureInfo.CurrentCulture, Resources.CannotCast, expression.GenerateSource(), FormattingHelpers.FormatType(expression.ExpressionType), FormattingHelpers.FormatType(targetType));
     HandleError(ErrorId.CannotCast, message);
 }
Beispiel #6
0
 void IErrorReporter.AsteriskModifierNotAllowed(SourceRange sourceRange, ExpressionNode functionInvocation)
 {
     string message = String.Format(CultureInfo.CurrentCulture, Resources.AsteriskModifierNotAllowed, functionInvocation.GenerateSource());
     HandleError(sourceRange, ErrorId.AsteriskModifierNotAllowed, message);
 }