protected override bool EmitInternal(LambdaExpression node, EmittingContext context, GroboIL.Label returnDefaultValueLabel, ResultType whatReturn, bool extend, out Type resultType)
        {
            var parameterTypes = node.Parameters.Select(parameter => parameter.Type).ToArray();

            Type[] constantTypes;
            var    compiledLambda = CompileAndLoadConstants(node, context, out constantTypes);

            var  il = context.Il;
            Type rawSubLambdaType;

            if (!Extensions.IsMono)
            {
                context.LoadCompiledLambdaPointer(compiledLambda);
                rawSubLambdaType = typeof(IntPtr);
            }
            else
            {
                rawSubLambdaType = Extensions.GetDelegateType(constantTypes.Concat(parameterTypes).ToArray(), node.ReturnType);
                context.LoadCompiledLambda(compiledLambda);
                il.Castclass(rawSubLambdaType);
            }

            resultType = Extensions.GetDelegateType(parameterTypes, node.ReturnType);
            var types            = constantTypes.Concat(new[] { rawSubLambdaType }).ToArray();
            var module           = (ModuleBuilder)(context.TypeBuilder == null ? null : context.TypeBuilder.Module);
            var subLambdaInvoker = DynamicMethodInvokerBuilder.BuildDynamicMethodInvoker(module, constantTypes, node.ReturnType, parameterTypes);

            il.Newobj(subLambdaInvoker.GetConstructor(types));
            il.Ldftn(subLambdaInvoker.GetMethod("Invoke"));
            il.Newobj(resultType.GetConstructor(new[] { typeof(object), typeof(IntPtr) }));
            return(false);
        }