@@ -82,34 +82,6 @@ internal MemoryOutputDiffGenerator(
82
82
_endOfLineTrivia = Environment . NewLine == "\r \n " ? SyntaxFactory . CarriageReturnLineFeed : SyntaxFactory . LineFeed ;
83
83
}
84
84
85
- private async Task < ( SyntaxNode rootNode , SemanticModel model ) > GetAssemblyRootNodeAndModelAsync ( IAssemblySymbolLoader loader , IAssemblySymbol assemblySymbol )
86
- {
87
- CSharpAssemblyDocumentGeneratorOptions options = new ( loader , _symbolFilter , _attributeSymbolFilter )
88
- {
89
- HideImplicitDefaultConstructors = _hideImplicitDefaultConstructors ,
90
- ShouldFormat = true ,
91
- ShouldReduce = false ,
92
- MetadataReferences = loader . MetadataReferences ,
93
- DiagnosticOptions = _diagnosticOptions ,
94
- SyntaxRewriters = [
95
- new TypeDeclarationCSharpSyntaxRewriter ( _addPartialModifier ) , // This must be visited BEFORE GlobalPrefixRemover as it depends on the 'global::' prefix to be found
96
- GlobalPrefixRemover . Singleton , // And then call this ASAP afterwards so there are fewer identifiers to visit
97
- PrimitiveSimplificationRewriter . Singleton ,
98
- RemoveBodyCSharpSyntaxRewriter . Singleton ,
99
- SingleLineStatementCSharpSyntaxRewriter . Singleton ,
100
- ] ,
101
- AdditionalAnnotations = [ Formatter . Annotation ] // Formatter is needed to fix some spacing
102
- } ;
103
-
104
- CSharpAssemblyDocumentGenerator docGenerator = new ( _log , options ) ;
105
-
106
- Document document = await docGenerator . GetDocumentForAssemblyAsync ( assemblySymbol ) . ConfigureAwait ( false ) ; // Super hot and resource-intensive path
107
- SyntaxNode root = await document . GetSyntaxRootAsync ( ) . ConfigureAwait ( false ) ?? throw new InvalidOperationException ( string . Format ( Resources . RootNodeNotFound , assemblySymbol . Name ) ) ;
108
- SemanticModel model = await document . GetSemanticModelAsync ( ) . ConfigureAwait ( false ) ?? throw new InvalidOperationException ( string . Format ( Resources . SemanticModelNotFound , assemblySymbol . Name ) ) ;
109
-
110
- return ( root , model ) ;
111
- }
112
-
113
85
/// <inheritdoc/>
114
86
public IReadOnlyDictionary < string , string > Results => _results . AsReadOnly ( ) ;
115
87
@@ -202,6 +174,34 @@ public async Task RunAsync()
202
174
swRun . Stop ( ) ;
203
175
}
204
176
177
+ private async Task < ( SyntaxNode rootNode , SemanticModel model ) > GetAssemblyRootNodeAndModelAsync ( IAssemblySymbolLoader loader , IAssemblySymbol assemblySymbol )
178
+ {
179
+ CSharpAssemblyDocumentGeneratorOptions options = new ( loader , _symbolFilter , _attributeSymbolFilter )
180
+ {
181
+ HideImplicitDefaultConstructors = _hideImplicitDefaultConstructors ,
182
+ ShouldFormat = true ,
183
+ ShouldReduce = false ,
184
+ MetadataReferences = loader . MetadataReferences ,
185
+ DiagnosticOptions = _diagnosticOptions ,
186
+ SyntaxRewriters = [
187
+ new TypeDeclarationCSharpSyntaxRewriter ( _addPartialModifier ) , // This must be visited BEFORE GlobalPrefixRemover as it depends on the 'global::' prefix to be found
188
+ GlobalPrefixRemover . Singleton , // And then call this ASAP afterwards so there are fewer identifiers to visit
189
+ PrimitiveSimplificationRewriter . Singleton ,
190
+ RemoveBodyCSharpSyntaxRewriter . Singleton ,
191
+ SingleLineStatementCSharpSyntaxRewriter . Singleton ,
192
+ ] ,
193
+ AdditionalAnnotations = [ Formatter . Annotation ] // Formatter is needed to fix some spacing
194
+ } ;
195
+
196
+ CSharpAssemblyDocumentGenerator docGenerator = new ( _log , options ) ;
197
+
198
+ Document document = await docGenerator . GetDocumentForAssemblyAsync ( assemblySymbol ) . ConfigureAwait ( false ) ; // Super hot and resource-intensive path
199
+ SyntaxNode root = await document . GetSyntaxRootAsync ( ) . ConfigureAwait ( false ) ?? throw new InvalidOperationException ( string . Format ( Resources . RootNodeNotFound , assemblySymbol . Name ) ) ;
200
+ SemanticModel model = await document . GetSemanticModelAsync ( ) . ConfigureAwait ( false ) ?? throw new InvalidOperationException ( string . Format ( Resources . SemanticModelNotFound , assemblySymbol . Name ) ) ;
201
+
202
+ return ( root , model ) ;
203
+ }
204
+
205
205
private static string GetFinalAssemblyDiff ( string assemblyName , string diffText )
206
206
{
207
207
StringBuilder sbAssembly = new ( ) ;
0 commit comments