private static BlockSyntax GenerateBlock(IMethodSymbol accessor) { return(SyntaxFactory.Block( StatementGenerator.GenerateStatements( CodeGenerationMethodInfo.GetStatements(accessor) ) )); }
internal static BlockSyntax GenerateBlock(IMethodSymbol method) { return(SyntaxFactory.Block( StatementGenerator.GenerateStatements( CodeGenerationMethodInfo.GetStatements(method) ) )); }
private static BlockSyntax GenerateBlock( IMethodSymbol constructor) { var statements = CodeGenerationDestructorInfo.GetStatements(constructor) == null ? default(SyntaxList <StatementSyntax>) : StatementGenerator.GenerateStatements(CodeGenerationDestructorInfo.GetStatements(constructor)); return(SyntaxFactory.Block(statements)); }
private static TDeclarationNode AddStatementsToMemberDeclaration <TDeclarationNode>(TDeclarationNode destinationMember, IEnumerable <SyntaxNode> statements, MemberDeclarationSyntax memberDeclaration) where TDeclarationNode : SyntaxNode { var body = memberDeclaration.GetBody(); if (body == null) { return(destinationMember); } var statementNodes = body.Statements.ToList(); statementNodes.AddRange(StatementGenerator.GenerateStatements(statements)); var finalBody = body.WithStatements(SyntaxFactory.List <StatementSyntax>(statementNodes)); var finalMember = memberDeclaration.WithBody(finalBody); return(Cast <TDeclarationNode>(finalMember)); }