Skip to content

Commit 9b5d333

Browse files
committed
Move private member under public ones
1 parent 3ddb52c commit 9b5d333

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff/MemoryOutputDiffGenerator.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -82,34 +82,6 @@ internal MemoryOutputDiffGenerator(
8282
_endOfLineTrivia = Environment.NewLine == "\r\n" ? SyntaxFactory.CarriageReturnLineFeed : SyntaxFactory.LineFeed;
8383
}
8484

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-
11385
/// <inheritdoc/>
11486
public IReadOnlyDictionary<string, string> Results => _results.AsReadOnly();
11587

@@ -202,6 +174,34 @@ public async Task RunAsync()
202174
swRun.Stop();
203175
}
204176

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+
205205
private static string GetFinalAssemblyDiff(string assemblyName, string diffText)
206206
{
207207
StringBuilder sbAssembly = new();

0 commit comments

Comments
 (0)