public override void VisitExpressionStatement(ExpressionStatementSyntax node) { if (this.InsideAutoIncludeMethodBlock) { var line = node.SyntaxTree.GetLineSpan(node.Span).StartLinePosition.Line; var allchildren = node.DescendantNodesAndTokens(descendIntoTrivia: true); if (allchildren.Any(a => a.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia)) { var walker = new CodeWithDocumentationWalker(ClassDepth, line); walker.Visit(node.WithAdditionalAnnotations()); this.Blocks.AddRange(walker.Blocks); return; } base.VisitExpressionStatement(node); this.Blocks.Add(new CodeBlock(node.WithoutLeadingTrivia().ToFullString(), line)); } else base.VisitExpressionStatement(node); }
public override void VisitExpressionStatement(ExpressionStatementSyntax node) { if (node.ShouldBeHidden()) return; if (this.InsideAutoIncludeMethodBlock) { var line = node.SyntaxTree.GetLineSpan(node.Span).StartLinePosition.Line; // this lambda has already been included so skip it if (IncludeMethodBlockContainsLambda && this.EndLine >= line) { return; } var allchildren = node.DescendantNodesAndTokens(descendIntoTrivia: true); if (allchildren.Any(a => a.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia)) { var walker = new CodeWithDocumentationWalker(ClassDepth, line, _propertyOrMethodName); walker.Visit(node.WithAdditionalAnnotations()); this.Blocks.AddRange(walker.Blocks); return; } base.VisitExpressionStatement(node); var code = node.WithoutLeadingTrivia().ToFullString(); code = code.RemoveNumberOfLeadingTabsAfterNewline(ClassDepth + 2); this.Blocks.Add(new CodeBlock(code, line, Language.CSharp, _propertyOrMethodName)); } else base.VisitExpressionStatement(node); }