File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/Compiler/Microsoft.AspNetCore.Razor.Language/src Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,9 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument)
83
83
// 1. Prioritize non-imported usings over imported ones.
84
84
// 2. Don't import usings that already exist in primary document.
85
85
// 3. Allow duplicate usings in primary document (C# warning).
86
- var usingReferences = new List < UsingReference > ( visitor . Usings ) ;
86
+ using var _ = ListPool < UsingReference > . GetPooledObject ( out var usingReferences ) ;
87
+ usingReferences . AddRange ( visitor . Usings ) ;
88
+
87
89
for ( var j = importedUsings . Count - 1 ; j >= 0 ; j -- )
88
90
{
89
91
var importedUsing = importedUsings [ j ] ;
@@ -180,10 +182,10 @@ private static IReadOnlyList<UsingReference> ImportDirectives(
180
182
return importsVisitor . Usings ;
181
183
}
182
184
183
- private void PostProcessImportedDirectives ( DocumentIntermediateNode document )
185
+ private static void PostProcessImportedDirectives ( DocumentIntermediateNode document )
184
186
{
185
187
var directives = document . FindDescendantReferences < DirectiveIntermediateNode > ( ) ;
186
- var seenDirectives = new HashSet < DirectiveDescriptor > ( ) ;
188
+ using var _ = HashSetPool < DirectiveDescriptor > . GetPooledObject ( out var seenDirectives ) ;
187
189
for ( var i = directives . Count - 1 ; i >= 0 ; i -- )
188
190
{
189
191
var reference = directives [ i ] ;
You can’t perform that action at this time.
0 commit comments