public override void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) { if (node.ShouldBeHidden()) return; if (this.InsideAutoIncludeMethodBlock) { var allchildren = node.DescendantNodesAndTokens(descendIntoTrivia: true); var linePositionSpan = node.SyntaxTree.GetLineSpan(node.Span); var line = linePositionSpan.StartLinePosition.Line; 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; } var code = node.WithoutLeadingTrivia().ToFullString(); code = code.RemoveNumberOfLeadingTabsAfterNewline(ClassDepth + 2); this.Blocks.Add(new CodeBlock(code, line, Language.CSharp, _propertyOrMethodName)); if (allchildren.Any(a => a.Kind() == SyntaxKind.SimpleLambdaExpression)) { // nested lambda inside this local declaration this.IncludeMethodBlockContainsLambda = true; this.EndLine = linePositionSpan.EndLinePosition.Line; } } base.VisitLocalDeclarationStatement(node); }
public override void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) { if (this.InsideAutoIncludeMethodBlock) { var allchildren = node.DescendantNodesAndTokens(descendIntoTrivia: true); var line = node.SyntaxTree.GetLineSpan(node.Span).StartLinePosition.Line; if (allchildren.Any(a => a.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia)) { var walker = new CodeWithDocumentationWalker(ClassDepth, line); walker.Visit(node.WithAdditionalAnnotations()); this.Blocks.AddRange(walker.Blocks); return; } this.Blocks.Add(new CodeBlock(node.WithoutLeadingTrivia().ToFullString(), line)); } base.VisitLocalDeclarationStatement(node); }