/// <summary>
/// Compiles the lambda into a method definition.
/// </summary>
/// <param name="method">A <see cref="Emit.MethodBuilder"/> which will be used to hold the lambda's IL.</param>
public void CompileToMethod(System.Reflection.Emit.MethodBuilder method)
{
ContractUtils.RequiresNotNull(method, nameof(method));
ContractUtils.Requires(method.IsStatic, nameof(method));
var type = method.DeclaringType.GetTypeInfo() as System.Reflection.Emit.TypeBuilder;
if (type == null)
{
throw Error.MethodBuilderDoesNotHaveTypeBuilder();
}
Compiler.LambdaCompiler.Compile(this, method);
}