private Lambda CompileLambdaBody(Source src, Parameter[] parameters, AstStatement body, DelegateType dt) { var result = new Lambda(src, parameters, dt, null); Lambdas.Push(result); if (body is AstExpression) { var compiledExpr = CompileExpression((AstExpression)body); var compiledBody = MakeLambdaStatementBody( dt.ReturnType.IsVoid ? compiledExpr : CompileImplicitCast(body.Source, dt.ReturnType, compiledExpr), dt.ReturnType.IsVoid); result.SetBody(compiledBody); } else { result.SetBody(CompileStatement(body)); } Lambdas.Pop(); return(result); }