Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couple of uses of a PooledHashSet(Of Symbol) #48978

Merged
merged 1 commit into from
Nov 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,7 @@ _Default:
results As ArrayBuilder(Of Symbol))
Debug.Assert(results IsNot Nothing)

Dim uniqueSymbols = New HashSet(Of Symbol)()
Dim uniqueSymbols = PooledHashSet(Of Symbol).GetInstance()
Dim tempResults = ArrayBuilder(Of Symbol).GetInstance(arities.Count)

For Each knownArity In arities
Expand All @@ -1949,6 +1949,7 @@ _Default:
tempResults.Free()

results.AddRange(uniqueSymbols)
uniqueSymbols.Free()
End Sub

Private Shadows Sub LookupSymbols(binder As Binder,
Expand Down Expand Up @@ -1981,15 +1982,15 @@ _Default:
If result.HasDiagnostic Then
' In the ambiguous symbol case, we have a good symbol with a diagnostics that
' mentions the other symbols. Union everything together with a set to prevent dups.
Dim symbolSet As New HashSet(Of Symbol)
Dim symbolSet = PooledHashSet(Of Symbol).GetInstance()
Dim symBuilder = ArrayBuilder(Of Symbol).GetInstance()
AddSymbolsFromDiagnosticInfo(symBuilder, result.Diagnostic)
symbolSet.UnionWith(symBuilder)
symbolSet.UnionWith(result.Symbols)
symBuilder.Free()

results.AddRange(symbolSet)

symbolSet.Free()
ElseIf result.HasSingleSymbol AndAlso result.SingleSymbol.Kind = SymbolKind.Namespace AndAlso
DirectCast(result.SingleSymbol, NamespaceSymbol).NamespaceKind = NamespaceKindNamespaceGroup Then
results.AddRange(DirectCast(result.SingleSymbol, NamespaceSymbol).ConstituentNamespaces)
Expand Down