本文整理汇总了C#中System.Linq.Expressions.Compiler.LambdaCompiler.EmitLambdaBody方法的典型用法代码示例。如果您正苦于以下问题:C# LambdaCompiler.EmitLambdaBody方法的具体用法?C# LambdaCompiler.EmitLambdaBody怎么用?C# LambdaCompiler.EmitLambdaBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq.Expressions.Compiler.LambdaCompiler
的用法示例。
在下文中一共展示了LambdaCompiler.EmitLambdaBody方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitInlinedInvoke
private void EmitInlinedInvoke(InvocationExpression invoke, CompilationFlags flags)
{
var lambda = invoke.LambdaOperand;
// This is tricky: we need to emit the arguments outside of the
// scope, but set them inside the scope. Fortunately, using the IL
// stack it is entirely doable.
// 1. Emit invoke arguments
List<WriteBack> wb = EmitArguments(lambda.Type.GetMethod("Invoke"), invoke);
// 2. Create the nested LambdaCompiler
var inner = new LambdaCompiler(this, lambda, invoke);
// 3. Emit the body
// if the inlined lambda is the last expression of the whole lambda,
// tail call can be applied.
if (wb.Count != 0)
{
flags = UpdateEmitAsTailCallFlag(flags, CompilationFlags.EmitAsNoTail);
}
inner.EmitLambdaBody(_scope, true, flags);
// 4. Emit write-backs if needed
EmitWriteBack(wb);
}
示例2: EmitInlinedInvoke
private void EmitInlinedInvoke(InvocationExpression invoke) {
var lambda = invoke.LambdaOperand;
// This is tricky: we need to emit the arguments outside of the
// scope, but set them inside the scope. Fortunately, using the IL
// stack it is entirely doable.
// 1. Emit invoke arguments
List<WriteBack> wb = EmitArguments(lambda.Type.GetMethod("Invoke"), invoke);
// 2. Create the nested LambdaCompiler
var inner = new LambdaCompiler(this, lambda);
// 3. Emit the body
inner.EmitLambdaBody(_scope, true);
// 4. Emit writebacks if needed
EmitWriteBack(wb);
}