Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
743a5fce
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
743a5fce
编写于
9月 26, 2016
作者:
C
CyrusNajmabadi
提交者:
GitHub
9月 26, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14049 from CyrusNajmabadi/poolArrayBuilders
Pool array builders so we produce less garbage.
上级
42738393
e2f815d5
变更
99
隐藏空白更改
内联
并排
Showing
99 changed file
with
214 addition
and
196 deletion
+214
-196
src/EditorFeatures/CSharpTest/CodeActions/MoveType/CSharpMoveTypeTestsBase.cs
...SharpTest/CodeActions/MoveType/CSharpMoveTypeTestsBase.cs
+1
-3
src/EditorFeatures/Core/Implementation/CodeFixes/CodeFixService.ProjectCodeFixProvider.cs
...tation/CodeFixes/CodeFixService.ProjectCodeFixProvider.cs
+2
-3
src/EditorFeatures/Core/Implementation/Diagnostics/AbstractDiagnosticsTaggerProvider.AggregatingTagger.cs
...cs/AbstractDiagnosticsTaggerProvider.AggregatingTagger.cs
+2
-2
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/FileSystem/FileSystemCompletionHelper.cs
...Sense/Completion/FileSystem/FileSystemCompletionHelper.cs
+2
-2
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Model.cs
...ures/Core/Implementation/IntelliSense/Completion/Model.cs
+2
-2
src/EditorFeatures/Core/Implementation/NavigateTo/NavigateToSearchResultProvider.cs
...plementation/NavigateTo/NavigateToSearchResultProvider.cs
+2
-2
src/EditorFeatures/Core/Implementation/Structure/AbstractStructureTaggerProvider.cs
...plementation/Structure/AbstractStructureTaggerProvider.cs
+2
-2
src/EditorFeatures/Core/Implementation/Suggestions/CodeFixSuggestedAction.cs
...Core/Implementation/Suggestions/CodeFixSuggestedAction.cs
+4
-2
src/EditorFeatures/Core/Implementation/Suggestions/SuggestedActionWithFlavors.cs
.../Implementation/Suggestions/SuggestedActionWithFlavors.cs
+2
-2
src/EditorFeatures/Core/Implementation/Suggestions/SuggestedActionsSourceProvider.cs
...lementation/Suggestions/SuggestedActionsSourceProvider.cs
+12
-8
src/EditorFeatures/Core/Implementation/Suggestions/SuppressionSuggestedAction.cs
.../Implementation/Suggestions/SuppressionSuggestedAction.cs
+2
-2
src/EditorFeatures/Core/Implementation/TodoComment/AbstractTodoCommentIncrementalAnalyzer.cs
...ion/TodoComment/AbstractTodoCommentIncrementalAnalyzer.cs
+2
-2
src/EditorFeatures/Test/Structure/AbstractSyntaxNodeStructureProviderTests.cs
...est/Structure/AbstractSyntaxNodeStructureProviderTests.cs
+1
-1
src/EditorFeatures/Test/Structure/AbstractSyntaxTriviaStructureProviderTests.cs
...t/Structure/AbstractSyntaxTriviaStructureProviderTests.cs
+1
-1
src/Features/CSharp/Portable/Structure/CSharpStructureHelpers.cs
...tures/CSharp/Portable/Structure/CSharpStructureHelpers.cs
+4
-4
src/Features/CSharp/Portable/Structure/Providers/AccessorDeclarationStructureProvider.cs
...ructure/Providers/AccessorDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/AnonymousMethodExpressionStructureProvider.cs
...e/Providers/AnonymousMethodExpressionStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/CompilationUnitStructureProvider.cs
...e/Structure/Providers/CompilationUnitStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/ConstructorDeclarationStructureProvider.cs
...ture/Providers/ConstructorDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/ConversionOperatorDeclarationStructureProvider.cs
...oviders/ConversionOperatorDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/DelegateDeclarationStructureProvider.cs
...ructure/Providers/DelegateDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/DestructorDeclarationStructureProvider.cs
...cture/Providers/DestructorDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/DisabledTextTriviaStructureProvider.cs
...tructure/Providers/DisabledTextTriviaStructureProvider.cs
+4
-2
src/Features/CSharp/Portable/Structure/Providers/DocumentationCommentStructureProvider.cs
...ucture/Providers/DocumentationCommentStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/EnumDeclarationStructureProvider.cs
...e/Structure/Providers/EnumDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/EventDeclarationStructureProvider.cs
.../Structure/Providers/EventDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/EventFieldDeclarationStructureProvider.cs
...cture/Providers/EventFieldDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/FieldDeclarationStructureProvider.cs
.../Structure/Providers/FieldDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/IndexerDeclarationStructureProvider.cs
...tructure/Providers/IndexerDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/MetadataAsSource/AbstractMetadataAsSourceStructureProvider.cs
...dataAsSource/AbstractMetadataAsSourceStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/MetadataAsSource/RegionDirectiveStructureProvider.cs
...ders/MetadataAsSource/RegionDirectiveStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/MethodDeclarationStructureProvider.cs
...Structure/Providers/MethodDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/NamespaceDeclarationStructureProvider.cs
...ucture/Providers/NamespaceDeclarationStructureProvider.cs
+3
-2
src/Features/CSharp/Portable/Structure/Providers/OperatorDeclarationStructureProvider.cs
...ructure/Providers/OperatorDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/ParenthesizedLambdaExpressionStructureProvider.cs
...oviders/ParenthesizedLambdaExpressionStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/PropertyDeclarationStructureProvider.cs
...ructure/Providers/PropertyDeclarationStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/RegionDirectiveStructureProvider.cs
...e/Structure/Providers/RegionDirectiveStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/SimpleLambdaExpressionStructureProvider.cs
...ture/Providers/SimpleLambdaExpressionStructureProvider.cs
+1
-1
src/Features/CSharp/Portable/Structure/Providers/TypeDeclarationStructureProvider.cs
...e/Structure/Providers/TypeDeclarationStructureProvider.cs
+1
-1
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs
...nCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs
+2
-2
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.PragmaWarningBatchFixAllProvider.cs
...essionCodeFixProvider.PragmaWarningBatchFixAllProvider.cs
+4
-3
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs
...CodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs
+7
-5
src/Features/Core/Portable/CodeRefactorings/ConvertToInterpolatedString/AbstractConvertToInterpolatedStringRefactoringProvider.cs
...AbstractConvertToInterpolatedStringRefactoringProvider.cs
+2
-2
src/Features/Core/Portable/Completion/CompletionService.cs
src/Features/Core/Portable/Completion/CompletionService.cs
+2
-2
src/Features/Core/Portable/FindReferences/IDefinitionsAndReferencesFactory.cs
...rtable/FindReferences/IDefinitionsAndReferencesFactory.cs
+9
-8
src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.DocCommentFormatter.cs
...ce/AbstractMetadataAsSourceService.DocCommentFormatter.cs
+6
-5
src/Features/Core/Portable/Structure/Syntax/AbstractBlockStructureProvider.cs
...rtable/Structure/Syntax/AbstractBlockStructureProvider.cs
+3
-1
src/Features/Core/Portable/Structure/Syntax/AbstractSyntaxNodeStructureProvider.cs
...e/Structure/Syntax/AbstractSyntaxNodeStructureProvider.cs
+5
-5
src/Features/Core/Portable/Structure/Syntax/AbstractSyntaxStructureProvider.cs
...table/Structure/Syntax/AbstractSyntaxStructureProvider.cs
+2
-2
src/Features/Core/Portable/Structure/Syntax/AbstractSyntaxTriviaStructureProvider.cs
...Structure/Syntax/AbstractSyntaxTriviaStructureProvider.cs
+1
-1
src/Features/Core/Portable/Structure/Syntax/BlockSpanCollector.cs
...ures/Core/Portable/Structure/Syntax/BlockSpanCollector.cs
+3
-3
src/Features/VisualBasic/Portable/Structure/Providers/AccessorDeclarationStructureProvider.vb
...ructure/Providers/AccessorDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/CompilationUnitStructureProvider.vb
...e/Structure/Providers/CompilationUnitStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/ConstructorDeclarationStructureProvider.vb
...ture/Providers/ConstructorDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/DelegateDeclarationStructureProvider.vb
...ructure/Providers/DelegateDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/DisabledTextTriviaStructureProvider.vb
...tructure/Providers/DisabledTextTriviaStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/DocumentationCommentStructureProvider.vb
...ucture/Providers/DocumentationCommentStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/EnumDeclarationStructureProvider.vb
...e/Structure/Providers/EnumDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/EventDeclarationStructureProvider.vb
.../Structure/Providers/EventDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/ExternalMethodDeclarationStructureProvider.vb
...e/Providers/ExternalMethodDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/FieldDeclarationStructureProvider.vb
.../Structure/Providers/FieldDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/MetadataAsSource/AbstractMetadataAsSourceStructureProvider.vb
...dataAsSource/AbstractMetadataAsSourceStructureProvider.vb
+2
-2
src/Features/VisualBasic/Portable/Structure/Providers/MetadataAsSource/MetadataRegionDirectiveStructureProvider.vb
...adataAsSource/MetadataRegionDirectiveStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/MethodDeclarationStructureProvider.vb
...Structure/Providers/MethodDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/MultilineLambdaStructureProvider.vb
...e/Structure/Providers/MultilineLambdaStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/NamespaceDeclarationStructureProvider.vb
...ucture/Providers/NamespaceDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/OperatorDeclarationStructureProvider.vb
...ructure/Providers/OperatorDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/PropertyDeclarationStructureProvider.vb
...ructure/Providers/PropertyDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/RegionDirectiveStructureProvider.vb
...e/Structure/Providers/RegionDirectiveStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/TypeDeclarationStructureProvider.vb
...e/Structure/Providers/TypeDeclarationStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/Providers/XmlExpressionStructureProvider.vb
...ble/Structure/Providers/XmlExpressionStructureProvider.vb
+1
-1
src/Features/VisualBasic/Portable/Structure/VisualBasicStructureHelpers.vb
...alBasic/Portable/Structure/VisualBasicStructureHelpers.vb
+5
-4
src/Scripting/Core/ScriptState.cs
src/Scripting/Core/ScriptState.cs
+2
-2
src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs
.../Core/Def/Implementation/ProjectSystem/AbstractProject.cs
+2
-2
src/VisualStudio/Core/Def/Implementation/ProjectSystem/MetadataReferences/VisualStudioMetadataReferenceManager.RecoverableMetadataValueSource.cs
...etadataReferenceManager.RecoverableMetadataValueSource.cs
+2
-2
src/VisualStudio/Core/Def/Implementation/ProjectSystem/MetadataReferences/VisualStudioMetadataReferenceManager.cs
...etadataReferences/VisualStudioMetadataReferenceManager.cs
+4
-5
src/VisualStudio/Core/Def/Implementation/TableDataSource/Extensions.cs
...dio/Core/Def/Implementation/TableDataSource/Extensions.cs
+4
-4
src/VisualStudio/Core/Def/Implementation/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs
...sion/VisualStudioDiagnosticListSuppressionStateService.cs
+3
-2
src/VisualStudio/Core/Def/Implementation/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs
...taSource/Suppression/VisualStudioSuppressionFixService.cs
+3
-2
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentTrackingService.cs
...entation/Workspace/VisualStudioDocumentTrackingService.cs
+2
-2
src/VisualStudio/Core/Impl/CodeModel/Collections/CodeElementSnapshot.cs
...io/Core/Impl/CodeModel/Collections/CodeElementSnapshot.cs
+3
-2
src/VisualStudio/Core/Impl/CodeModel/Collections/ExternalMemberCollection.cs
...re/Impl/CodeModel/Collections/ExternalMemberCollection.cs
+2
-2
src/VisualStudio/Core/Impl/CodeModel/Collections/ExternalNamespaceCollection.cs
...Impl/CodeModel/Collections/ExternalNamespaceCollection.cs
+2
-2
src/VisualStudio/Core/Impl/CodeModel/Collections/ExternalOverloadsCollection.cs
...Impl/CodeModel/Collections/ExternalOverloadsCollection.cs
+2
-2
src/VisualStudio/Core/Impl/CodeModel/Collections/InheritsImplementsCollection.cs
...mpl/CodeModel/Collections/InheritsImplementsCollection.cs
+3
-2
src/VisualStudio/Core/Impl/CodeModel/Collections/NamespaceCollection.cs
...io/Core/Impl/CodeModel/Collections/NamespaceCollection.cs
+3
-2
src/VisualStudio/Core/Impl/CodeModel/Collections/OverloadsCollection.cs
...io/Core/Impl/CodeModel/Collections/OverloadsCollection.cs
+2
-2
src/VisualStudio/Core/Impl/CodeModel/Collections/PartialTypeCollection.cs
.../Core/Impl/CodeModel/Collections/PartialTypeCollection.cs
+3
-2
src/VisualStudio/Core/Impl/CodeModel/Collections/TypeCollection.cs
...lStudio/Core/Impl/CodeModel/Collections/TypeCollection.cs
+3
-2
src/VisualStudio/Core/Impl/CodeModel/ExternalElements/AbstractExternalCodeType.cs
...pl/CodeModel/ExternalElements/AbstractExternalCodeType.cs
+3
-2
src/VisualStudio/Core/Next/FindReferences/StreamingFindReferencesPresenter.TableDataSourceFindReferencesContext.cs
...ferencesPresenter.TableDataSourceFindReferencesContext.cs
+2
-2
src/VisualStudio/Core/SolutionExplorerShim/AnalyzerItem/AnalyzerItemSource.cs
...e/SolutionExplorerShim/AnalyzerItem/AnalyzerItemSource.cs
+2
-2
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
...arp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
+3
-3
src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/FixAllState.FixMultipleDiagnosticProvider.cs
...lOccurrences/FixAllState.FixMultipleDiagnosticProvider.cs
+2
-5
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs
...ortable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs
+3
-3
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Source.cs
.../Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Source.cs
+4
-4
src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs
...aces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs
+2
-2
src/Workspaces/Core/Portable/Shared/Extensions/SymbolInfoExtensions.cs
...s/Core/Portable/Shared/Extensions/SymbolInfoExtensions.cs
+2
-2
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
...ortable/LanguageServices/VisualBasicSyntaxFactsService.vb
+4
-4
未找到文件。
src/EditorFeatures/CSharpTest/CodeActions/MoveType/CSharpMoveTypeTestsBase.cs
浏览文件 @
743a5fce
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.CodeRefactorings
;
using
Microsoft.CodeAnalysis.CodeRefactorings.MoveType
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.MoveType
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
;
...
...
@@ -27,4 +25,4 @@ protected override string GetLanguage()
return
LanguageNames
.
CSharp
;
}
}
}
}
\ No newline at end of file
src/EditorFeatures/Core/Implementation/CodeFixes/CodeFixService.ProjectCodeFixProvider.cs
浏览文件 @
743a5fce
...
...
@@ -46,7 +46,7 @@ private ImmutableArray<CodeFixProvider> CreateFixers(string language)
}
IEnumerable
<
TypeInfo
>
typeInfos
=
null
;
ImmutableArray
<
CodeFixProvider
>.
Builder
builder
=
null
;
var
builder
=
ArrayBuilder
<
CodeFixProvider
>.
GetInstance
()
;
try
{
...
...
@@ -66,7 +66,6 @@ private ImmutableArray<CodeFixProvider> CreateFixers(string language)
attribute
.
Languages
.
Length
==
0
||
attribute
.
Languages
.
Contains
(
language
))
{
builder
=
builder
??
ImmutableArray
.
CreateBuilder
<
CodeFixProvider
>();
builder
.
Add
((
CodeFixProvider
)
Activator
.
CreateInstance
(
typeInfo
.
AsType
()));
}
}
...
...
@@ -83,7 +82,7 @@ private ImmutableArray<CodeFixProvider> CreateFixers(string language)
// NOTE: We could report "unable to load analyzer" exception here but it should have been already reported by DiagnosticService.
}
return
builder
!=
null
?
builder
.
ToImmutable
()
:
ImmutableArray
<
CodeFixProvider
>.
Empty
;
return
builder
.
ToImmutableAndFree
()
;
}
}
}
...
...
src/EditorFeatures/Core/Implementation/Diagnostics/AbstractDiagnosticsTaggerProvider.AggregatingTagger.cs
浏览文件 @
743a5fce
...
...
@@ -117,7 +117,7 @@ private class AggregatingTagger : ForegroundThreadAffinitizedObject, IAccurateTa
// GetDiagnostics returns whatever cached diagnostics in the service which can be stale ones. for example, build error will be most likely stale
// diagnostics. so here we make sure we filter out any diagnostics that is not in the text range.
var
builder
=
ImmutableArray
.
CreateBuilder
<
DiagnosticData
>
();
var
builder
=
ArrayBuilder
<
DiagnosticData
>.
GetInstance
();
var
fullSpan
=
new
TextSpan
(
0
,
text
.
Length
);
foreach
(
var
diagnostic
in
_owner
.
_diagnosticService
.
GetDiagnostics
(
args
.
Workspace
,
args
.
ProjectId
,
args
.
DocumentId
,
args
.
Id
,
includeSuppressedDiagnostics
:
false
,
cancellationToken
:
cancellationToken
))
...
...
@@ -128,7 +128,7 @@ private class AggregatingTagger : ForegroundThreadAffinitizedObject, IAccurateTa
}
}
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
}
public
void
OnTaggerCreated
()
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/FileSystem/FileSystemCompletionHelper.cs
浏览文件 @
743a5fce
...
...
@@ -86,7 +86,7 @@ private CompletionItem CreateNetworkRoot(TextSpan textChangeSpan)
private
ImmutableArray
<
CompletionItem
>
GetFilesAndDirectories
(
string
path
,
string
basePath
)
{
var
result
=
ImmutableArray
.
CreateBuilder
<
CompletionItem
>
();
var
result
=
ArrayBuilder
<
CompletionItem
>.
GetInstance
();
var
pathKind
=
PathUtilities
.
GetPathKind
(
path
);
switch
(
pathKind
)
{
...
...
@@ -164,7 +164,7 @@ private ImmutableArray<CompletionItem> GetFilesAndDirectories(string path, strin
throw
ExceptionUtilities
.
Unreachable
;
}
return
result
.
AsImmutabl
e
();
return
result
.
ToImmutableAndFre
e
();
}
private
static
bool
IsDriveRoot
(
string
fullPath
)
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Model.cs
浏览文件 @
743a5fce
...
...
@@ -138,13 +138,13 @@ internal class Model
// the description if necessary. We won't do this if the list was triggered to show
// snippet shortcuts.
var
totalItemsBuilder
=
ImmutableArray
.
CreateBuilder
<
PresentationItem
>
();
var
totalItemsBuilder
=
ArrayBuilder
<
PresentationItem
>.
GetInstance
();
foreach
(
var
item
in
originalList
.
Items
)
{
totalItemsBuilder
.
Add
(
new
DescriptionModifyingPresentationItem
(
item
,
completionService
));
}
totalItems
=
totalItemsBuilder
.
AsImmutabl
e
();
totalItems
=
totalItemsBuilder
.
ToImmutableAndFre
e
();
defaultSuggestionModePresentationItem
=
new
DescriptionModifyingPresentationItem
(
CreateDefaultSuggestionModeItem
(),
completionService
,
isSuggestionModeItem
:
true
);
suggestionModePresentationItem
=
suggestionModeItem
!=
null
?
new
DescriptionModifyingPresentationItem
(
suggestionModeItem
,
completionService
,
isSuggestionModeItem
:
true
)
:
null
;
...
...
src/EditorFeatures/Core/Implementation/NavigateTo/NavigateToSearchResultProvider.cs
浏览文件 @
743a5fce
...
...
@@ -47,7 +47,7 @@ internal sealed partial class NavigateToSearchResultProvider : INavigateToSearch
{
using
(
var
patternMatcher
=
new
PatternMatcher
(
pattern
,
allowFuzzyMatching
:
true
))
{
var
result
=
ImmutableArray
.
CreateBuilder
<
ValueTuple
<
DeclaredSymbolInfo
,
Document
,
IEnumerable
<
PatternMatch
>>>
();
var
result
=
ArrayBuilder
<
ValueTuple
<
DeclaredSymbolInfo
,
Document
,
IEnumerable
<
PatternMatch
>>>.
GetInstance
();
foreach
(
var
document
in
project
.
Documents
)
{
if
(
searchDocument
!=
null
&&
document
!=
searchDocument
)
...
...
@@ -73,7 +73,7 @@ internal sealed partial class NavigateToSearchResultProvider : INavigateToSearch
}
}
return
result
.
ToImmutable
();
return
result
.
ToImmutable
AndFree
();
}
}
...
...
src/EditorFeatures/Core/Implementation/Structure/AbstractStructureTaggerProvider.cs
浏览文件 @
743a5fce
...
...
@@ -213,7 +213,7 @@ protected sealed override ITaggerEventSource CreateEventSource(ITextView textVie
ImmutableArray
<
BlockSpan
>
regions
,
ITextSnapshot
snapshot
)
{
// Remove any spans that aren't multiline.
var
multiLineRegions
=
ImmutableArray
.
CreateBuilder
<
BlockSpan
>
();
var
multiLineRegions
=
ArrayBuilder
<
BlockSpan
>.
GetInstance
();
foreach
(
var
region
in
regions
)
{
if
(
region
!=
null
&&
region
.
TextSpan
.
Length
>
0
)
...
...
@@ -254,7 +254,7 @@ protected sealed override ITaggerEventSource CreateEventSource(ITextView textVie
// Note we pass a IComparer instead of a Comparison to work around this
// issue in ImmutableArray.Builder: https://github.com/dotnet/corefx/issues/11173
multiLineRegions
.
Sort
(
s_blockSpanComparer
);
return
multiLineRegions
.
ToImmutable
();
return
multiLineRegions
.
ToImmutable
AndFree
();
}
}
}
\ No newline at end of file
src/EditorFeatures/Core/Implementation/Suggestions/CodeFixSuggestedAction.cs
浏览文件 @
743a5fce
...
...
@@ -64,7 +64,7 @@ internal class CodeFixSuggestedAction : SuggestedActionWithFlavors, ITelemetryDi
return
null
;
}
var
fixAllSuggestedActions
=
ImmutableArray
.
CreateBuilder
<
FixAllSuggestedAction
>
();
var
fixAllSuggestedActions
=
ArrayBuilder
<
FixAllSuggestedAction
>.
GetInstance
();
foreach
(
var
scope
in
supportedScopes
)
{
var
fixAllStateForScope
=
fixAllState
.
WithScopeAndEquivalenceKey
(
scope
,
action
.
EquivalenceKey
);
...
...
@@ -75,7 +75,9 @@ internal class CodeFixSuggestedAction : SuggestedActionWithFlavors, ITelemetryDi
fixAllSuggestedActions
.
Add
(
fixAllSuggestedAction
);
}
return
new
SuggestedActionSet
(
fixAllSuggestedActions
.
ToImmutable
(),
title
:
EditorFeaturesResources
.
Fix_all_occurrences_in
);
return
new
SuggestedActionSet
(
fixAllSuggestedActions
.
ToImmutableAndFree
(),
title
:
EditorFeaturesResources
.
Fix_all_occurrences_in
);
}
public
string
GetDiagnosticID
()
...
...
src/EditorFeatures/Core/Implementation/Suggestions/SuggestedActionWithFlavors.cs
浏览文件 @
743a5fce
...
...
@@ -61,7 +61,7 @@ public async override Task<IEnumerable<SuggestedActionSet>> GetActionSetsAsync(C
_actionSets
=
await
extensionManager
.
PerformFunctionAsync
(
Provider
,
async
()
=>
{
var
builder
=
ImmutableArray
.
CreateBuilder
<
SuggestedActionSet
>
();
var
builder
=
ArrayBuilder
<
SuggestedActionSet
>.
GetInstance
();
// We use ConfigureAwait(true) to stay on the UI thread.
var
previewChangesSuggestedActionSet
=
await
GetPreviewChangesSuggestedActionSetAsync
(
cancellationToken
).
ConfigureAwait
(
true
);
...
...
@@ -78,7 +78,7 @@ public async override Task<IEnumerable<SuggestedActionSet>> GetActionSetsAsync(C
builder
.
Add
(
fixAllSuggestedActionSet
);
}
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
// We use ConfigureAwait(true) to stay on the UI thread.
},
defaultValue
:
ImmutableArray
<
SuggestedActionSet
>.
Empty
).
ConfigureAwait
(
true
);
}
...
...
src/EditorFeatures/Core/Implementation/Suggestions/SuggestedActionsSourceProvider.cs
浏览文件 @
743a5fce
...
...
@@ -324,13 +324,13 @@ private CodeRefactoring FilterOnUIThread(CodeRefactoring refactoring, Workspace
private
IEnumerable
<
SuggestedActionSet
>
OrganizeFixes
(
Workspace
workspace
,
IEnumerable
<
CodeFixCollection
>
fixCollections
,
bool
hasSuppressionFixes
)
{
var
map
=
ImmutableDictionary
.
CreateBuilder
<
CodeFixGroupKey
,
IList
<
SuggestedAction
>>();
var
order
=
ImmutableArray
.
CreateBuilder
<
CodeFixGroupKey
>
();
var
order
=
ArrayBuilder
<
CodeFixGroupKey
>.
GetInstance
();
// First group fixes by diagnostic and priority.
GroupFixes
(
workspace
,
fixCollections
,
map
,
order
,
hasSuppressionFixes
);
// Then prioritize between the groups.
return
PrioritizeFixGroups
(
map
.
ToImmutable
(),
order
.
ToImmutable
());
return
PrioritizeFixGroups
(
map
.
ToImmutable
(),
order
.
ToImmutable
AndFree
());
}
/// <summary>
...
...
@@ -340,7 +340,7 @@ private IEnumerable<SuggestedActionSet> OrganizeFixes(Workspace workspace, IEnum
Workspace
workspace
,
IEnumerable
<
CodeFixCollection
>
fixCollections
,
IDictionary
<
CodeFixGroupKey
,
IList
<
SuggestedAction
>>
map
,
IList
<
CodeFixGroupKey
>
order
,
ArrayBuilder
<
CodeFixGroupKey
>
order
,
bool
hasSuppressionFixes
)
{
foreach
(
var
fixCollection
in
fixCollections
)
...
...
@@ -417,7 +417,10 @@ private IEnumerable<SuggestedActionSet> OrganizeFixes(Workspace workspace, IEnum
}
}
private
static
void
AddFix
(
CodeFix
fix
,
SuggestedAction
suggestedAction
,
IDictionary
<
CodeFixGroupKey
,
IList
<
SuggestedAction
>>
map
,
IList
<
CodeFixGroupKey
>
order
)
private
static
void
AddFix
(
CodeFix
fix
,
SuggestedAction
suggestedAction
,
IDictionary
<
CodeFixGroupKey
,
IList
<
SuggestedAction
>>
map
,
ArrayBuilder
<
CodeFixGroupKey
>
order
)
{
var
diag
=
fix
.
GetPrimaryDiagnosticData
();
...
...
@@ -443,7 +446,7 @@ private static void AddFix(CodeFix fix, SuggestedAction suggestedAction, IDictio
/// </remarks>
private
static
IEnumerable
<
SuggestedActionSet
>
PrioritizeFixGroups
(
IDictionary
<
CodeFixGroupKey
,
IList
<
SuggestedAction
>>
map
,
IList
<
CodeFixGroupKey
>
order
)
{
var
sets
=
ImmutableArray
.
CreateBuilder
<
SuggestedActionSet
>
();
var
sets
=
ArrayBuilder
<
SuggestedActionSet
>.
GetInstance
();
foreach
(
var
diag
in
order
)
{
...
...
@@ -459,7 +462,7 @@ private static IEnumerable<SuggestedActionSet> PrioritizeFixGroups(IDictionary<C
}
}
return
sets
.
ToImmutable
();
return
sets
.
ToImmutable
AndFree
();
}
private
static
SuggestedActionSetPriority
GetSuggestedActionSetPriority
(
CodeActionPriority
key
)
...
...
@@ -527,7 +530,7 @@ private static SuggestedActionSetPriority GetSuggestedActionSetPriority(CodeActi
/// </remarks>
private
SuggestedActionSet
OrganizeRefactorings
(
Workspace
workspace
,
CodeRefactoring
refactoring
)
{
var
refactoringSuggestedActions
=
ImmutableArray
.
CreateBuilder
<
SuggestedAction
>
();
var
refactoringSuggestedActions
=
ArrayBuilder
<
SuggestedAction
>.
GetInstance
();
foreach
(
var
a
in
refactoring
.
Actions
)
{
...
...
@@ -536,7 +539,8 @@ private SuggestedActionSet OrganizeRefactorings(Workspace workspace, CodeRefacto
a
,
refactoring
.
Provider
,
_owner
.
_listener
));
}
return
new
SuggestedActionSet
(
refactoringSuggestedActions
.
ToImmutable
(),
SuggestedActionSetPriority
.
Low
);
return
new
SuggestedActionSet
(
refactoringSuggestedActions
.
ToImmutableAndFree
(),
SuggestedActionSetPriority
.
Low
);
}
public
async
Task
<
bool
>
HasSuggestedActionsAsync
(
ISuggestedActionCategorySet
requestedActionCategories
,
SnapshotSpan
range
,
CancellationToken
cancellationToken
)
...
...
src/EditorFeatures/Core/Implementation/Suggestions/SuppressionSuggestedAction.cs
浏览文件 @
743a5fce
...
...
@@ -66,7 +66,7 @@ public override Task<IEnumerable<SuggestedActionSet>> GetActionSetsAsync(Cancell
if
(
this
.
CodeAction
.
GetCodeActions
().
Any
())
{
var
nestedSuggestedActions
=
ImmutableArray
.
CreateBuilder
<
SuggestedAction
>
();
var
nestedSuggestedActions
=
ArrayBuilder
<
SuggestedAction
>.
GetInstance
();
var
fixCount
=
this
.
CodeAction
.
GetCodeActions
().
Length
;
foreach
(
var
c
in
this
.
CodeAction
.
GetCodeActions
())
...
...
@@ -80,7 +80,7 @@ public override Task<IEnumerable<SuggestedActionSet>> GetActionSetsAsync(Cancell
}
_actionSets
=
ImmutableArray
.
Create
(
new
SuggestedActionSet
(
nestedSuggestedActions
.
ToImmutable
()));
new
SuggestedActionSet
(
nestedSuggestedActions
.
ToImmutable
AndFree
()));
return
Task
.
FromResult
(
_actionSets
);
}
...
...
src/EditorFeatures/Core/Implementation/TodoComment/AbstractTodoCommentIncrementalAnalyzer.cs
浏览文件 @
743a5fce
...
...
@@ -95,7 +95,7 @@ public async Task AnalyzeSyntaxAsync(Document document, InvocationReasons reason
private
async
Task
<
ImmutableArray
<
TodoItem
>>
CreateItemsAsync
(
Document
document
,
IList
<
TodoComment
>
comments
,
CancellationToken
cancellationToken
)
{
var
items
=
ImmutableArray
.
CreateBuilder
<
TodoItem
>
();
var
items
=
ArrayBuilder
<
TodoItem
>.
GetInstance
();
if
(
comments
!=
null
)
{
var
text
=
await
document
.
GetTextAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
...
...
@@ -107,7 +107,7 @@ private async Task<ImmutableArray<TodoItem>> CreateItemsAsync(Document document,
}
}
return
items
.
ToImmutable
();
return
items
.
ToImmutable
AndFree
();
}
private
TodoItem
CreateItem
(
Document
document
,
SourceText
text
,
SyntaxTree
tree
,
TodoComment
comment
)
...
...
src/EditorFeatures/Test/Structure/AbstractSyntaxNodeStructureProviderTests.cs
浏览文件 @
743a5fce
...
...
@@ -37,7 +37,7 @@ internal sealed override async Task<BlockSpan[]> GetBlockSpansAsync(Document doc
}
var
outliner
=
CreateProvider
();
var
actualRegions
=
ImmutableArray
.
CreateBuilder
<
BlockSpan
>
();
var
actualRegions
=
ArrayBuilder
<
BlockSpan
>.
GetInstance
();
outliner
.
CollectBlockSpans
(
document
,
node
,
actualRegions
,
CancellationToken
.
None
);
// TODO: Determine why we get null outlining spans.
...
...
src/EditorFeatures/Test/Structure/AbstractSyntaxTriviaStructureProviderTests.cs
浏览文件 @
743a5fce
...
...
@@ -19,7 +19,7 @@ internal sealed override async Task<BlockSpan[]> GetBlockSpansAsync(Document doc
var
trivia
=
root
.
FindTrivia
(
position
,
findInsideTrivia
:
true
);
var
outliner
=
CreateProvider
();
var
actualRegions
=
ImmutableArray
.
CreateBuilder
<
BlockSpan
>
();
var
actualRegions
=
ArrayBuilder
<
BlockSpan
>.
GetInstance
();
outliner
.
CollectBlockSpans
(
document
,
trivia
,
actualRegions
,
CancellationToken
.
None
);
// TODO: Determine why we get null outlining spans.
...
...
src/Features/CSharp/Portable/Structure/CSharpStructureHelpers.cs
浏览文件 @
743a5fce
...
...
@@ -151,13 +151,13 @@ private static string GetCommentBannerText(SyntaxTrivia comment)
internal
static
ImmutableArray
<
BlockSpan
>
CreateCommentBlockSpan
(
SyntaxTriviaList
triviaList
)
{
var
result
=
ImmutableArray
.
CreateBuilder
<
BlockSpan
>
();
var
result
=
ArrayBuilder
<
BlockSpan
>.
GetInstance
();
CollectCommentBlockSpans
(
triviaList
,
result
);
return
result
.
ToImmutable
();
return
result
.
ToImmutable
AndFree
();
}
public
static
void
CollectCommentBlockSpans
(
SyntaxTriviaList
triviaList
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
)
SyntaxTriviaList
triviaList
,
ArrayBuilder
<
BlockSpan
>
spans
)
{
if
(
triviaList
.
Count
>
0
)
{
...
...
@@ -205,7 +205,7 @@ private static string GetCommentBannerText(SyntaxTrivia comment)
}
public
static
void
CollectCommentBlockSpans
(
SyntaxNode
node
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
)
SyntaxNode
node
,
ArrayBuilder
<
BlockSpan
>
spans
)
{
if
(
node
==
null
)
{
...
...
src/Features/CSharp/Portable/Structure/Providers/AccessorDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class AccessorDeclarationStructureProvider : AbstractSyntaxNodeStructur
{
protected
override
void
CollectBlockSpans
(
AccessorDeclarationSyntax
accessorDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
accessorDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/AnonymousMethodExpressionStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class AnonymousMethodExpressionStructureProvider : AbstractSyntaxNodeSt
{
protected
override
void
CollectBlockSpans
(
AnonymousMethodExpressionSyntax
anonymousMethod
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
// fault tolerance
...
...
src/Features/CSharp/Portable/Structure/Providers/CompilationUnitStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -12,7 +12,7 @@ internal class CompilationUnitStructureProvider : AbstractSyntaxNodeStructurePro
{
protected
override
void
CollectBlockSpans
(
CompilationUnitSyntax
compilationUnit
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
compilationUnit
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/ConstructorDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class ConstructorDeclarationStructureProvider : AbstractSyntaxNodeStruc
{
protected
override
void
CollectBlockSpans
(
ConstructorDeclarationSyntax
constructorDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
constructorDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/ConversionOperatorDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class ConversionOperatorDeclarationStructureProvider : AbstractSyntaxNo
{
protected
override
void
CollectBlockSpans
(
ConversionOperatorDeclarationSyntax
operatorDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
operatorDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/DelegateDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class DelegateDeclarationStructureProvider : AbstractSyntaxNodeStructur
{
protected
override
void
CollectBlockSpans
(
DelegateDeclarationSyntax
delegateDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
delegateDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/DestructorDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class DestructorDeclarationStructureProvider : AbstractSyntaxNodeStruct
{
protected
override
void
CollectBlockSpans
(
DestructorDeclarationSyntax
destructorDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
destructorDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/DisabledTextTriviaStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -12,13 +12,15 @@ internal class DisabledTextTriviaStructureProvider : AbstractSyntaxTriviaStructu
public
override
void
CollectBlockSpans
(
Document
document
,
SyntaxTrivia
trivia
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CollectBlockSpans
(
trivia
.
SyntaxTree
,
trivia
,
spans
,
cancellationToken
);
}
public
void
CollectBlockSpans
(
SyntaxTree
syntaxTree
,
SyntaxTrivia
trivia
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
CancellationToken
cancellationToken
)
public
void
CollectBlockSpans
(
SyntaxTree
syntaxTree
,
SyntaxTrivia
trivia
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
// We'll always be leading trivia of some token.
var
startPos
=
trivia
.
FullSpan
.
Start
;
...
...
src/Features/CSharp/Portable/Structure/Providers/DocumentationCommentStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -107,7 +107,7 @@ private static void AppendTextTokens(StringBuilder sb, SyntaxTokenList textToken
protected
override
void
CollectBlockSpans
(
DocumentationCommentTriviaSyntax
documentationComment
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
var
startPos
=
documentationComment
.
FullSpan
.
Start
;
...
...
src/Features/CSharp/Portable/Structure/Providers/EnumDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class EnumDeclarationStructureProvider : AbstractSyntaxNodeStructurePro
{
protected
override
void
CollectBlockSpans
(
EnumDeclarationSyntax
enumDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
enumDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/EventDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class EventDeclarationStructureProvider : AbstractSyntaxNodeStructurePr
{
protected
override
void
CollectBlockSpans
(
EventDeclarationSyntax
eventDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
eventDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/EventFieldDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class EventFieldDeclarationStructureProvider : AbstractSyntaxNodeStruct
{
protected
override
void
CollectBlockSpans
(
EventFieldDeclarationSyntax
eventFieldDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
eventFieldDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/FieldDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class FieldDeclarationStructureProvider : AbstractSyntaxNodeStructurePr
{
protected
override
void
CollectBlockSpans
(
FieldDeclarationSyntax
fieldDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
fieldDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/IndexerDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class IndexerDeclarationStructureProvider : AbstractSyntaxNodeStructure
{
protected
override
void
CollectBlockSpans
(
IndexerDeclarationSyntax
indexerDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
indexerDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/MetadataAsSource/AbstractMetadataAsSourceStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -12,7 +12,7 @@ internal abstract class AbstractMetadataAsSourceStructureProvider<TSyntaxNode> :
where
TSyntaxNode
:
SyntaxNode
{
protected
override
void
CollectBlockSpans
(
TSyntaxNode
node
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
CancellationToken
cancellationToken
)
TSyntaxNode
node
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
var
startToken
=
node
.
GetFirstToken
();
var
endToken
=
GetEndToken
(
node
);
...
...
src/Features/CSharp/Portable/Structure/Providers/MetadataAsSource/RegionDirectiveStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -29,7 +29,7 @@ private static string GetBannerText(DirectiveTriviaSyntax simpleDirective)
protected
override
void
CollectBlockSpans
(
RegionDirectiveTriviaSyntax
regionDirective
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
var
match
=
regionDirective
.
GetMatchingDirective
(
cancellationToken
);
...
...
src/Features/CSharp/Portable/Structure/Providers/MethodDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class MethodDeclarationStructureProvider : AbstractSyntaxNodeStructureP
{
protected
override
void
CollectBlockSpans
(
MethodDeclarationSyntax
methodDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
methodDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/NamespaceDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -12,7 +12,7 @@ internal class NamespaceDeclarationStructureProvider : AbstractSyntaxNodeStructu
{
protected
override
void
CollectBlockSpans
(
NamespaceDeclarationSyntax
namespaceDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
// add leading comments
...
...
@@ -47,7 +47,8 @@ internal class NamespaceDeclarationStructureProvider : AbstractSyntaxNodeStructu
// finally, add any leading comments before the end of the namespace block
if
(!
namespaceDeclaration
.
CloseBraceToken
.
IsMissing
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
namespaceDeclaration
.
CloseBraceToken
.
LeadingTrivia
,
spans
);
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
namespaceDeclaration
.
CloseBraceToken
.
LeadingTrivia
,
spans
);
}
}
...
...
src/Features/CSharp/Portable/Structure/Providers/OperatorDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class OperatorDeclarationStructureProvider : AbstractSyntaxNodeStructur
{
protected
override
void
CollectBlockSpans
(
OperatorDeclarationSyntax
operatorDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
operatorDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/ParenthesizedLambdaExpressionStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class ParenthesizedLambdaExpressionStructureProvider : AbstractSyntaxNo
{
protected
override
void
CollectBlockSpans
(
ParenthesizedLambdaExpressionSyntax
lambdaExpression
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
// fault tolerance
...
...
src/Features/CSharp/Portable/Structure/Providers/PropertyDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class PropertyDeclarationStructureProvider : AbstractSyntaxNodeStructur
{
protected
override
void
CollectBlockSpans
(
PropertyDeclarationSyntax
propertyDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
propertyDeclaration
,
spans
);
...
...
src/Features/CSharp/Portable/Structure/Providers/RegionDirectiveStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -29,7 +29,7 @@ private static string GetBannerText(DirectiveTriviaSyntax simpleDirective)
protected
override
void
CollectBlockSpans
(
RegionDirectiveTriviaSyntax
regionDirective
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
var
match
=
regionDirective
.
GetMatchingDirective
(
cancellationToken
);
...
...
src/Features/CSharp/Portable/Structure/Providers/SimpleLambdaExpressionStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class SimpleLambdaExpressionStructureProvider : AbstractSyntaxNodeStruc
{
protected
override
void
CollectBlockSpans
(
SimpleLambdaExpressionSyntax
lambdaExpression
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
// fault tolerance
...
...
src/Features/CSharp/Portable/Structure/Providers/TypeDeclarationStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal class TypeDeclarationStructureProvider : AbstractSyntaxNodeStructurePro
{
protected
override
void
CollectBlockSpans
(
TypeDeclarationSyntax
typeDeclaration
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
CSharpStructureHelpers
.
CollectCommentBlockSpans
(
typeDeclaration
,
spans
);
...
...
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs
浏览文件 @
743a5fce
...
...
@@ -189,7 +189,7 @@ private static void AddDiagnosticForSymbolIfNeeded(ISymbol targetSymbol, Diagnos
private
static
ImmutableArray
<
Diagnostic
>
GetUniqueDiagnostics
(
List
<
Diagnostic
>
diagnostics
)
{
var
uniqueIds
=
new
HashSet
<
string
>();
var
uniqueDiagnostics
=
ImmutableArray
.
CreateBuilder
<
Diagnostic
>
();
var
uniqueDiagnostics
=
ArrayBuilder
<
Diagnostic
>.
GetInstance
();
foreach
(
var
diagnostic
in
diagnostics
)
{
if
(
uniqueIds
.
Add
(
diagnostic
.
Id
))
...
...
@@ -198,7 +198,7 @@ private static ImmutableArray<Diagnostic> GetUniqueDiagnostics(List<Diagnostic>
}
}
return
uniqueDiagnostics
.
ToImmutable
();
return
uniqueDiagnostics
.
ToImmutable
AndFree
();
}
}
}
...
...
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.PragmaWarningBatchFixAllProvider.cs
浏览文件 @
743a5fce
...
...
@@ -28,8 +28,8 @@ public PragmaWarningBatchFixAllProvider(AbstractSuppressionCodeFixProvider suppr
Document
document
,
ImmutableArray
<
Diagnostic
>
diagnostics
,
Action
<
CodeAction
>
addFix
,
FixAllState
fixAllState
,
CancellationToken
cancellationToken
)
{
var
pragmaActionsBuilder
=
ImmutableArray
.
CreateBuilder
<
IPragmaBasedCodeAction
>
();
var
pragmaDiagnosticsBuilder
=
ImmutableArray
.
CreateBuilder
<
Diagnostic
>
();
var
pragmaActionsBuilder
=
ArrayBuilder
<
IPragmaBasedCodeAction
>.
GetInstance
();
var
pragmaDiagnosticsBuilder
=
ArrayBuilder
<
Diagnostic
>.
GetInstance
();
foreach
(
var
diagnostic
in
diagnostics
.
Where
(
d
=>
d
.
Location
.
IsInSource
&&
!
d
.
IsSuppressed
))
{
...
...
@@ -54,7 +54,8 @@ public PragmaWarningBatchFixAllProvider(AbstractSuppressionCodeFixProvider suppr
{
var
pragmaBatchFix
=
PragmaBatchFixHelpers
.
CreateBatchPragmaFix
(
_suppressionFixProvider
,
document
,
pragmaActionsBuilder
.
ToImmutable
(),
pragmaDiagnosticsBuilder
.
ToImmutable
(),
pragmaActionsBuilder
.
ToImmutableAndFree
(),
pragmaDiagnosticsBuilder
.
ToImmutableAndFree
(),
fixAllState
,
cancellationToken
);
addFix
(
pragmaBatchFix
);
...
...
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs
浏览文件 @
743a5fce
...
...
@@ -37,8 +37,9 @@ public BatchFixer(AbstractSuppressionCodeFixProvider suppressionFixProvider)
FixAllState
fixAllState
,
CancellationToken
cancellationToken
)
{
// Batch all the pragma remove suppression fixes by executing them sequentially for the document.
var
pragmaActionsBuilder
=
ImmutableArray
.
CreateBuilder
<
IPragmaBasedCodeAction
>();
var
pragmaDiagnosticsBuilder
=
ImmutableArray
.
CreateBuilder
<
Diagnostic
>();
var
pragmaActionsBuilder
=
ArrayBuilder
<
IPragmaBasedCodeAction
>.
GetInstance
();
var
pragmaDiagnosticsBuilder
=
ArrayBuilder
<
Diagnostic
>.
GetInstance
();
foreach
(
var
diagnostic
in
diagnostics
.
Where
(
d
=>
d
.
Location
.
IsInSource
&&
d
.
IsSuppressed
))
{
var
span
=
diagnostic
.
Location
.
SourceSpan
;
...
...
@@ -74,7 +75,8 @@ public BatchFixer(AbstractSuppressionCodeFixProvider suppressionFixProvider)
{
var
pragmaBatchFix
=
PragmaBatchFixHelpers
.
CreateBatchPragmaFix
(
_suppressionFixProvider
,
document
,
pragmaActionsBuilder
.
ToImmutable
(),
pragmaDiagnosticsBuilder
.
ToImmutable
(),
pragmaActionsBuilder
.
ToImmutableAndFree
(),
pragmaDiagnosticsBuilder
.
ToImmutableAndFree
(),
fixAllState
,
cancellationToken
);
addFix
(
pragmaBatchFix
);
...
...
@@ -158,14 +160,14 @@ public BatchFixer(AbstractSuppressionCodeFixProvider suppressionFixProvider)
private
static
async
Task
<
ImmutableArray
<
SyntaxNode
>>
GetAttributeNodesToFixAsync
(
ImmutableArray
<
AttributeRemoveAction
>
attributeRemoveFixes
,
CancellationToken
cancellationToken
)
{
var
builder
=
ImmutableArray
.
CreateBuilder
<
SyntaxNode
>
(
attributeRemoveFixes
.
Length
);
var
builder
=
ArrayBuilder
<
SyntaxNode
>.
GetInstance
(
attributeRemoveFixes
.
Length
);
foreach
(
var
attributeRemoveFix
in
attributeRemoveFixes
)
{
var
attributeToRemove
=
await
attributeRemoveFix
.
GetAttributeToRemoveAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
builder
.
Add
(
attributeToRemove
);
}
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
}
}
}
...
...
src/Features/Core/Portable/CodeRefactorings/ConvertToInterpolatedString/AbstractConvertToInterpolatedStringRefactoringProvider.cs
浏览文件 @
743a5fce
...
...
@@ -150,7 +150,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
SyntaxGenerator
syntaxGenerator
,
ISyntaxFactsService
syntaxFactsService
)
{
var
builder
=
ImmutableArray
.
CreateBuilder
<
TExpressionSyntax
>
();
var
builder
=
ArrayBuilder
<
TExpressionSyntax
>.
GetInstance
();
for
(
int
i
=
1
;
i
<
arguments
.
Count
;
i
++)
{
var
argumentExpression
=
syntaxFactsService
.
GetExpressionOfArgument
(
arguments
[
i
]);
...
...
@@ -166,7 +166,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
}
}
var
expandedArguments
=
builder
.
ToImmutable
();
var
expandedArguments
=
builder
.
ToImmutable
AndFree
();
return
expandedArguments
;
}
...
...
src/Features/Core/Portable/Completion/CompletionService.cs
浏览文件 @
743a5fce
...
...
@@ -142,7 +142,7 @@ public virtual TextSpan GetDefaultCompletionListSpan(SourceText text, int caretP
{
var
helper
=
CompletionHelper
.
GetHelper
(
document
);
var
bestItems
=
ImmutableArray
.
CreateBuilder
<
CompletionItem
>
();
var
bestItems
=
ArrayBuilder
<
CompletionItem
>.
GetInstance
();
foreach
(
var
item
in
items
)
{
if
(
bestItems
.
Count
==
0
)
...
...
@@ -171,7 +171,7 @@ public virtual TextSpan GetDefaultCompletionListSpan(SourceText text, int caretP
}
}
return
bestItems
.
ToImmutable
();
return
bestItems
.
ToImmutable
AndFree
();
}
}
}
\ No newline at end of file
src/Features/Core/Portable/FindReferences/IDefinitionsAndReferencesFactory.cs
浏览文件 @
743a5fce
...
...
@@ -28,8 +28,8 @@ internal class DefaultDefinitionsAndReferencesFactory : IDefinitionsAndReference
public
DefinitionsAndReferences
CreateDefinitionsAndReferences
(
Solution
solution
,
IEnumerable
<
ReferencedSymbol
>
referencedSymbols
)
{
var
definitions
=
ImmutableArray
.
CreateBuilder
<
DefinitionItem
>
();
var
references
=
ImmutableArray
.
CreateBuilder
<
SourceReferenceItem
>
();
var
definitions
=
ArrayBuilder
<
DefinitionItem
>.
GetInstance
();
var
references
=
ArrayBuilder
<
SourceReferenceItem
>.
GetInstance
();
var
uniqueLocations
=
new
HashSet
<
DocumentSpan
>();
...
...
@@ -42,7 +42,8 @@ internal class DefaultDefinitionsAndReferencesFactory : IDefinitionsAndReference
solution
,
referencedSymbol
,
definitions
,
references
,
uniqueLocations
);
}
return
new
DefinitionsAndReferences
(
definitions
.
ToImmutable
(),
references
.
ToImmutable
());
return
new
DefinitionsAndReferences
(
definitions
.
ToImmutableAndFree
(),
references
.
ToImmutableAndFree
());
}
/// <summary>
...
...
@@ -83,8 +84,8 @@ private static int GetPrecedence(ReferencedSymbol referencedSymbol)
private
void
ProcessReferencedSymbol
(
Solution
solution
,
ReferencedSymbol
referencedSymbol
,
ImmutableArray
<
DefinitionItem
>.
Builder
definitions
,
ImmutableArray
<
SourceReferenceItem
>.
Builder
references
,
ArrayBuilder
<
DefinitionItem
>
definitions
,
ArrayBuilder
<
SourceReferenceItem
>
references
,
HashSet
<
DocumentSpan
>
uniqueSpans
)
{
// See if this is a symbol we even want to present to the user. If not,
...
...
@@ -122,7 +123,7 @@ private static int GetPrecedence(ReferencedSymbol referencedSymbol)
private
static
void
CreateReferences
(
ReferencedSymbol
referencedSymbol
,
ImmutableArray
<
SourceReferenceItem
>.
Builder
references
,
ArrayBuilder
<
SourceReferenceItem
>
references
,
DefinitionItem
definitionItem
,
HashSet
<
DocumentSpan
>
uniqueSpans
)
{
...
...
@@ -155,7 +156,7 @@ internal static class DefinitionItemExtensions
var
displayIfNoReferences
=
definition
.
ShouldShowWithNoReferenceLocations
(
showMetadataSymbolsWithoutReferences
:
false
);
var
sourceLocations
=
ImmutableArray
.
CreateBuilder
<
DocumentSpan
>
();
var
sourceLocations
=
ArrayBuilder
<
DocumentSpan
>.
GetInstance
();
// If it's a namespace, don't create any normal lcoation. Namespaces
// come from many different sources, but we'll only show a single
...
...
@@ -203,7 +204,7 @@ internal static class DefinitionItemExtensions
}
return
DefinitionItem
.
Create
(
tags
,
displayParts
,
sourceLocations
.
ToImmutable
(),
displayIfNoReferences
);
tags
,
displayParts
,
sourceLocations
.
ToImmutable
AndFree
(),
displayIfNoReferences
);
}
public
static
SourceReferenceItem
TryCreateSourceReferenceItem
(
...
...
src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.DocCommentFormatter.cs
浏览文件 @
743a5fce
...
...
@@ -24,7 +24,7 @@ internal class DocCommentFormatter
internal
static
ImmutableArray
<
string
>
Format
(
IDocumentationCommentFormattingService
docCommentFormattingService
,
DocumentationComment
docComment
)
{
var
formattedCommentLinesBuilder
=
ImmutableArray
.
CreateBuilder
<
string
>
();
var
formattedCommentLinesBuilder
=
ArrayBuilder
<
string
>.
GetInstance
();
var
lineBuilder
=
new
StringBuilder
();
var
formattedSummaryText
=
docCommentFormattingService
.
Format
(
docComment
.
SummaryText
);
...
...
@@ -149,12 +149,12 @@ internal static ImmutableArray<string> Format(IDocumentationCommentFormattingSer
formattedCommentLinesBuilder
.
RemoveAt
(
formattedCommentLinesBuilder
.
Count
-
1
);
}
return
formattedCommentLinesBuilder
.
ToImmutable
();
return
formattedCommentLinesBuilder
.
ToImmutable
AndFree
();
}
private
static
ImmutableArray
<
string
>
CreateWrappedTextFromRawText
(
string
rawText
)
{
var
lines
=
ImmutableArray
.
CreateBuilder
<
string
>
();
var
lines
=
ArrayBuilder
<
string
>.
GetInstance
();
// First split the string into constituent lines.
var
split
=
rawText
.
Split
(
new
[]
{
"\r\n"
},
System
.
StringSplitOptions
.
None
);
...
...
@@ -165,10 +165,11 @@ private static ImmutableArray<string> CreateWrappedTextFromRawText(string rawTex
SplitRawLineIntoFormattedLines
(
item
,
lines
);
}
return
lines
.
ToImmutable
();
return
lines
.
ToImmutable
AndFree
();
}
private
static
void
SplitRawLineIntoFormattedLines
(
string
line
,
ImmutableArray
<
string
>.
Builder
lines
)
private
static
void
SplitRawLineIntoFormattedLines
(
string
line
,
ArrayBuilder
<
string
>
lines
)
{
var
indent
=
new
StringBuilder
().
Append
(
' '
,
s_indentSize
*
2
).
ToString
();
...
...
src/Features/Core/Portable/Structure/Syntax/AbstractBlockStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -45,7 +45,7 @@ public override void ProvideBlockStructure(BlockStructureContext context)
private
void
ProvideBlockStructureWorker
(
BlockStructureContext
context
,
SyntaxNode
syntaxRoot
)
{
var
spans
=
ImmutableArray
.
CreateBuilder
<
BlockSpan
>
();
var
spans
=
ArrayBuilder
<
BlockSpan
>.
GetInstance
();
BlockSpanCollector
.
CollectBlockSpans
(
context
.
Document
,
syntaxRoot
,
_nodeProviderMap
,
_triviaProviderMap
,
spans
,
context
.
CancellationToken
);
...
...
@@ -53,6 +53,8 @@ public override void ProvideBlockStructure(BlockStructureContext context)
{
context
.
AddBlockSpan
(
region
);
}
spans
.
Free
();
}
/// <summary>
...
...
src/Features/Core/Portable/Structure/Syntax/AbstractSyntaxNodeStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -12,7 +12,7 @@ internal abstract class AbstractSyntaxNodeStructureProvider<TSyntaxNode> : Abstr
public
override
void
CollectBlockSpans
(
Document
document
,
SyntaxNode
node
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
if
(!
SupportedInWorkspaceKind
(
document
.
Project
.
Solution
.
Workspace
.
Kind
))
...
...
@@ -26,15 +26,15 @@ internal abstract class AbstractSyntaxNodeStructureProvider<TSyntaxNode> : Abstr
public
sealed
override
void
CollectBlockSpans
(
Document
document
,
SyntaxTrivia
trivia
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
throw
new
NotSupportedException
();
}
private
void
CollectBlockSpans
(
SyntaxNode
node
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
SyntaxNode
node
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
if
(
node
is
TSyntaxNode
)
...
...
@@ -50,6 +50,6 @@ protected virtual bool SupportedInWorkspaceKind(string kind)
}
protected
abstract
void
CollectBlockSpans
(
TSyntaxNode
node
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
CancellationToken
cancellationToken
);
TSyntaxNode
node
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
);
}
}
\ No newline at end of file
src/Features/Core/Portable/Structure/Syntax/AbstractSyntaxStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -10,13 +10,13 @@ internal abstract class AbstractSyntaxStructureProvider
public
abstract
void
CollectBlockSpans
(
Document
document
,
SyntaxNode
node
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
);
public
abstract
void
CollectBlockSpans
(
Document
document
,
SyntaxTrivia
trivia
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
);
}
}
\ No newline at end of file
src/Features/Core/Portable/Structure/Syntax/AbstractSyntaxTriviaStructureProvider.cs
浏览文件 @
743a5fce
...
...
@@ -11,7 +11,7 @@ internal abstract class AbstractSyntaxTriviaStructureProvider : AbstractSyntaxSt
public
sealed
override
void
CollectBlockSpans
(
Document
document
,
SyntaxNode
node
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
throw
new
NotSupportedException
();
...
...
src/Features/Core/Portable/Structure/Syntax/BlockSpanCollector.cs
浏览文件 @
743a5fce
...
...
@@ -11,14 +11,14 @@ internal class BlockSpanCollector
private
readonly
Document
_document
;
private
readonly
ImmutableDictionary
<
Type
,
ImmutableArray
<
AbstractSyntaxStructureProvider
>>
_nodeProviderMap
;
private
readonly
ImmutableDictionary
<
int
,
ImmutableArray
<
AbstractSyntaxStructureProvider
>>
_triviaProviderMap
;
private
readonly
ImmutableArray
<
BlockSpan
>.
Builder
_spans
;
private
readonly
ArrayBuilder
<
BlockSpan
>
_spans
;
private
readonly
CancellationToken
_cancellationToken
;
private
BlockSpanCollector
(
Document
document
,
ImmutableDictionary
<
Type
,
ImmutableArray
<
AbstractSyntaxStructureProvider
>>
nodeOutlinerMap
,
ImmutableDictionary
<
int
,
ImmutableArray
<
AbstractSyntaxStructureProvider
>>
triviaOutlinerMap
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
_document
=
document
;
...
...
@@ -33,7 +33,7 @@ internal class BlockSpanCollector
SyntaxNode
syntaxRoot
,
ImmutableDictionary
<
Type
,
ImmutableArray
<
AbstractSyntaxStructureProvider
>>
nodeOutlinerMap
,
ImmutableDictionary
<
int
,
ImmutableArray
<
AbstractSyntaxStructureProvider
>>
triviaOutlinerMap
,
ImmutableArray
<
BlockSpan
>.
Builder
spans
,
ArrayBuilder
<
BlockSpan
>
spans
,
CancellationToken
cancellationToken
)
{
var
collector
=
new
BlockSpanCollector
(
document
,
nodeOutlinerMap
,
triviaOutlinerMap
,
spans
,
cancellationToken
);
...
...
src/Features/VisualBasic/Portable/Structure/Providers/AccessorDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
AccessorStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
accessorDeclaration
As
AccessorStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
accessorDeclaration
,
spans
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/CompilationUnitStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
CompilationUnitSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
compilationUnit
As
CompilationUnitSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
Dim
regions
As
New
List
(
Of
BlockSpan
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/ConstructorDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
SubNewStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
constructorDeclaration
As
SubNewStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
Dim
regions
As
New
List
(
Of
BlockSpan
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/DelegateDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
DelegateStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
delegateDeclaration
As
DelegateStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
delegateDeclaration
,
spans
)
End
Sub
...
...
src/Features/VisualBasic/Portable/Structure/Providers/DisabledTextTriviaStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxTriviaStructureProvider
Public
Overrides
Sub
CollectBlockSpans
(
document
As
Document
,
trivia
As
SyntaxTrivia
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
If
trivia
.
Kind
=
SyntaxKind
.
DisabledTextTrivia
Then
' Don't include trailing line breaks in spanToCollapse
...
...
src/Features/VisualBasic/Portable/Structure/Providers/DocumentationCommentStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -71,7 +71,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
End
Sub
Protected
Overrides
Sub
CollectBlockSpans
(
documentationComment
As
DocumentationCommentTriviaSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
Dim
firstCommentToken
=
documentationComment
.
ChildNodesAndTokens
().
FirstOrNullable
()
Dim
lastCommentToken
=
documentationComment
.
ChildNodesAndTokens
().
LastOrNullable
()
...
...
src/Features/VisualBasic/Portable/Structure/Providers/EnumDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
EnumStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
enumDeclaration
As
EnumStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
enumDeclaration
,
spans
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/EventDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
EventStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
eventDeclaration
As
EventStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
eventDeclaration
,
spans
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/ExternalMethodDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
DeclareStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
externalMethodDeclaration
As
DeclareStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
externalMethodDeclaration
,
spans
)
End
Sub
...
...
src/Features/VisualBasic/Portable/Structure/Providers/FieldDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
FieldDeclarationSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
fieldDeclaration
As
FieldDeclarationSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
fieldDeclaration
,
spans
)
End
Sub
...
...
src/Features/VisualBasic/Portable/Structure/Providers/MetadataAsSource/AbstractMetadataAsSourceStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -11,8 +11,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure.MetadataAsSource
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
TSyntaxNode
)
Protected
Overrides
Sub
CollectBlockSpans
(
node
As
TSyntaxNode
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
cancellationToken
As
CancellationToken
)
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
Dim
startToken
=
node
.
GetFirstToken
()
Dim
endToken
=
GetEndToken
(
node
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/MetadataAsSource/MetadataRegionDirectiveStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -21,7 +21,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure.MetadataAsSource
End
Function
Protected
Overrides
Sub
CollectBlockSpans
(
regionDirective
As
RegionDirectiveTriviaSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
Dim
match
=
regionDirective
.
GetMatchingStartOrEndDirective
(
cancellationToken
)
If
match
IsNot
Nothing
Then
...
...
src/Features/VisualBasic/Portable/Structure/Providers/MethodDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
MethodStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
methodDeclaration
As
MethodStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
methodDeclaration
,
spans
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/MultilineLambdaStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
MultiLineLambdaExpressionSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
lambdaExpression
As
MultiLineLambdaExpressionSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
If
Not
lambdaExpression
.
EndSubOrFunctionStatement
.
IsMissing
Then
spans
.
Add
(
CreateRegionFromBlock
(
...
...
src/Features/VisualBasic/Portable/Structure/Providers/NamespaceDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
NamespaceStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
namespaceDeclaration
As
NamespaceStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
namespaceDeclaration
,
spans
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/OperatorDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
OperatorStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
operatorDeclaration
As
OperatorStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
operatorDeclaration
,
spans
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/PropertyDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
PropertyStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
propertyDeclaration
As
PropertyStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
propertyDeclaration
,
spans
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/RegionDirectiveStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -21,7 +21,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
End
Function
Protected
Overrides
Sub
CollectBlockSpans
(
regionDirective
As
RegionDirectiveTriviaSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
Dim
matchingDirective
=
regionDirective
.
GetMatchingStartOrEndDirective
(
cancellationToken
)
If
matchingDirective
IsNot
Nothing
Then
...
...
src/Features/VisualBasic/Portable/Structure/Providers/TypeDeclarationStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
TypeStatementSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
typeDeclaration
As
TypeStatementSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
CollectCommentsRegions
(
typeDeclaration
,
spans
)
...
...
src/Features/VisualBasic/Portable/Structure/Providers/XmlExpressionStructureProvider.vb
浏览文件 @
743a5fce
...
...
@@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
Inherits
AbstractSyntaxNodeStructureProvider
(
Of
XmlNodeSyntax
)
Protected
Overrides
Sub
CollectBlockSpans
(
xmlExpression
As
XmlNodeSyntax
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
,
spans
As
ArrayBuilder
(
Of
BlockSpan
)
,
cancellationToken
As
CancellationToken
)
' If this XML expression is inside structured trivia (i.e. an XML doc comment), don't outline.
If
xmlExpression
.
HasAncestor
(
Of
DocumentationCommentTriviaSyntax
)()
Then
...
...
src/Features/VisualBasic/Portable/Structure/VisualBasicStructureHelpers.vb
浏览文件 @
743a5fce
...
...
@@ -29,12 +29,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
' For testing purposes
Friend
Function
CreateCommentsRegions
(
triviaList
As
SyntaxTriviaList
)
As
ImmutableArray
(
Of
BlockSpan
)
Dim
spans
=
ImmutableArray
.
CreateBuilder
(
Of
BlockSpan
)
Dim
spans
=
ArrayBuilder
(
Of
BlockSpan
).
GetInstance
(
)
CollectCommentsRegions
(
triviaList
,
spans
)
Return
spans
.
ToImmutable
()
Return
spans
.
ToImmutable
AndFree
()
End
Function
Friend
Sub
CollectCommentsRegions
(
triviaList
As
SyntaxTriviaList
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
)
Friend
Sub
CollectCommentsRegions
(
triviaList
As
SyntaxTriviaList
,
spans
As
ArrayBuilder
(
Of
BlockSpan
))
If
triviaList
.
Count
>
0
Then
Dim
startComment
As
SyntaxTrivia
?
=
Nothing
Dim
endComment
As
SyntaxTrivia
?
=
Nothing
...
...
@@ -64,7 +65,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Structure
End
Sub
Friend
Sub
CollectCommentsRegions
(
node
As
SyntaxNode
,
spans
As
ImmutableArray
(
Of
BlockSpan
).
Builder
)
spans
As
ArrayBuilder
(
Of
BlockSpan
)
)
If
node
Is
Nothing
Then
Throw
New
ArgumentNullException
(
NameOf
(
node
))
End
If
...
...
src/Scripting/Core/ScriptState.cs
浏览文件 @
743a5fce
...
...
@@ -88,7 +88,7 @@ public ScriptVariable GetVariable(string name)
private
ImmutableArray
<
ScriptVariable
>
CreateVariables
()
{
var
result
=
ImmutableArray
.
CreateBuilder
<
ScriptVariable
>
();
var
result
=
ArrayBuilder
<
ScriptVariable
>.
GetInstance
();
var
executionState
=
ExecutionState
;
...
...
@@ -108,7 +108,7 @@ private ImmutableArray<ScriptVariable> CreateVariables()
}
}
return
result
.
ToImmutable
();
return
result
.
ToImmutable
AndFree
();
}
private
IReadOnlyDictionary
<
string
,
int
>
GetVariableMap
()
...
...
src/VisualStudio/Core/Def/Implementation/ProjectSystem/AbstractProject.cs
浏览文件 @
743a5fce
...
...
@@ -305,7 +305,7 @@ protected ImmutableArray<string> GetStrongNameKeyPaths()
return
ImmutableArray
<
string
>.
Empty
;
}
var
builder
=
ImmutableArray
.
CreateBuilder
<
string
>
();
var
builder
=
ArrayBuilder
<
string
>.
GetInstance
();
if
(
this
.
ContainingDirectoryPathOpt
!=
null
)
{
builder
.
Add
(
this
.
ContainingDirectoryPathOpt
);
...
...
@@ -316,7 +316,7 @@ protected ImmutableArray<string> GetStrongNameKeyPaths()
builder
.
Add
(
Path
.
GetDirectoryName
(
outputPath
));
}
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
}
public
ImmutableArray
<
ProjectReference
>
GetCurrentProjectReferences
()
...
...
src/VisualStudio/Core/Def/Implementation/ProjectSystem/MetadataReferences/VisualStudioMetadataReferenceManager.RecoverableMetadataValueSource.cs
浏览文件 @
743a5fce
...
...
@@ -47,14 +47,14 @@ public override AssemblyMetadata GetValue(CancellationToken cancellationToken)
private
AssemblyMetadata
RecoverMetadata
()
{
var
moduleBuilder
=
ImmutableArray
.
CreateBuilder
<
ModuleMetadata
>
(
_storages
.
Count
);
var
moduleBuilder
=
ArrayBuilder
<
ModuleMetadata
>.
GetInstance
(
_storages
.
Count
);
foreach
(
var
storage
in
_storages
)
{
moduleBuilder
.
Add
(
GetModuleMetadata
(
storage
));
}
var
metadata
=
AssemblyMetadata
.
Create
(
moduleBuilder
.
ToImmutable
());
var
metadata
=
AssemblyMetadata
.
Create
(
moduleBuilder
.
ToImmutable
AndFree
());
_weakValue
.
SetTarget
(
metadata
);
return
metadata
;
...
...
src/VisualStudio/Core/Def/Implementation/ProjectSystem/MetadataReferences/VisualStudioMetadataReferenceManager.cs
浏览文件 @
743a5fce
...
...
@@ -318,14 +318,13 @@ private bool TryGetFileMappingFromMetadataImporter(FileKey fileKey, out IMetaDat
FileKey
fileKey
,
ModuleMetadata
manifestModule
,
List
<
ITemporaryStreamStorage
>
storages
,
Func
<
FileKey
,
List
<
ITemporaryStreamStorage
>,
ModuleMetadata
>
moduleMetadataFactory
)
{
ImmutableArray
<
ModuleMetadata
>.
Builder
moduleBuilder
=
null
;
var
moduleBuilder
=
ArrayBuilder
<
ModuleMetadata
>.
GetInstance
()
;
string
assemblyDir
=
null
;
foreach
(
string
moduleName
in
manifestModule
.
GetModuleNames
())
{
if
(
moduleBuilder
==
null
)
if
(
moduleBuilder
.
Count
==
0
)
{
moduleBuilder
=
ImmutableArray
.
CreateBuilder
<
ModuleMetadata
>();
moduleBuilder
.
Add
(
manifestModule
);
assemblyDir
=
Path
.
GetDirectoryName
(
fileKey
.
FullPath
);
}
...
...
@@ -336,8 +335,8 @@ private bool TryGetFileMappingFromMetadataImporter(FileKey fileKey, out IMetaDat
moduleBuilder
.
Add
(
metadata
);
}
var
modules
=
(
moduleBuilder
!=
null
)
?
moduleBuilder
.
ToImmutable
()
:
ImmutableArray
.
Create
(
manifestModule
);
var
modules
=
moduleBuilder
.
ToImmutableAndFree
(
);
return
AssemblyMetadata
.
Create
(
modules
);
}
}
}
}
\ No newline at end of file
src/VisualStudio/Core/Def/Implementation/TableDataSource/Extensions.cs
浏览文件 @
743a5fce
...
...
@@ -19,24 +19,24 @@ internal static class Extensions
{
public
static
ImmutableArray
<
TResult
>
ToImmutableArray
<
TSource
,
TResult
>(
this
IList
<
TSource
>
list
,
Func
<
TSource
,
TResult
>
selector
)
{
var
builder
=
ImmutableArray
.
CreateBuilder
<
TResult
>
(
list
.
Count
);
var
builder
=
ArrayBuilder
<
TResult
>.
GetInstance
(
list
.
Count
);
for
(
var
i
=
0
;
i
<
list
.
Count
;
i
++)
{
builder
.
Add
(
selector
(
list
[
i
]));
}
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
}
public
static
ImmutableArray
<
TableItem
<
T
>>
MergeDuplicatesOrderedBy
<
T
>(
this
IEnumerable
<
IList
<
TableItem
<
T
>>>
groupedItems
,
Func
<
IEnumerable
<
TableItem
<
T
>>,
IEnumerable
<
TableItem
<
T
>>>
orderer
)
{
var
builder
=
ImmutableArray
.
CreateBuilder
<
TableItem
<
T
>>
();
var
builder
=
ArrayBuilder
<
TableItem
<
T
>>.
GetInstance
();
foreach
(
var
item
in
orderer
(
groupedItems
.
Select
(
g
=>
g
.
Deduplicate
())))
{
builder
.
Add
(
item
);
}
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
}
private
static
TableItem
<
T
>
Deduplicate
<
T
>(
this
IList
<
TableItem
<
T
>>
duplicatedItems
)
...
...
src/VisualStudio/Core/Def/Implementation/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs
浏览文件 @
743a5fce
...
...
@@ -215,7 +215,8 @@ private static AbstractTableEntriesSnapshot<DiagnosticData> GetEntriesSnapshot(I
/// </summary>
public
async
Task
<
ImmutableArray
<
DiagnosticData
>>
GetSelectedItemsAsync
(
bool
isAddSuppression
,
CancellationToken
cancellationToken
)
{
var
builder
=
ImmutableArray
.
CreateBuilder
<
DiagnosticData
>();
var
builder
=
ArrayBuilder
<
DiagnosticData
>.
GetInstance
();
Dictionary
<
string
,
Project
>
projectNameToProjectMapOpt
=
null
;
Dictionary
<
Project
,
ImmutableDictionary
<
string
,
Document
>>
filePathToDocumentMapOpt
=
null
;
...
...
@@ -331,7 +332,7 @@ public async Task<ImmutableArray<DiagnosticData>> GetSelectedItemsAsync(bool isA
}
}
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
}
private
static
async
Task
<
ImmutableDictionary
<
string
,
Document
>>
GetFilePathToDocumentMapAsync
(
Project
project
,
CancellationToken
cancellationToken
)
...
...
src/VisualStudio/Core/Def/Implementation/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs
浏览文件 @
743a5fce
...
...
@@ -128,7 +128,8 @@ public bool RemoveSuppressions(bool selectedErrorListEntriesOnly, IVsHierarchy p
private
async
Task
<
ImmutableArray
<
DiagnosticData
>>
GetAllBuildDiagnosticsAsync
(
Func
<
Project
,
bool
>
shouldFixInProject
,
CancellationToken
cancellationToken
)
{
var
builder
=
ImmutableArray
.
CreateBuilder
<
DiagnosticData
>();
var
builder
=
ArrayBuilder
<
DiagnosticData
>.
GetInstance
();
var
buildDiagnostics
=
_buildErrorDiagnosticService
.
GetBuildErrors
().
Where
(
d
=>
d
.
ProjectId
!=
null
&&
d
.
Severity
!=
DiagnosticSeverity
.
Hidden
);
var
solution
=
_workspace
.
CurrentSolution
;
foreach
(
var
diagnosticsByProject
in
buildDiagnostics
.
GroupBy
(
d
=>
d
.
ProjectId
))
...
...
@@ -171,7 +172,7 @@ private async Task<ImmutableArray<DiagnosticData>> GetAllBuildDiagnosticsAsync(F
}
}
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
}
private
static
string
GetFixTitle
(
bool
isAddSuppression
)
...
...
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentTrackingService.cs
浏览文件 @
743a5fce
...
...
@@ -72,13 +72,13 @@ public ImmutableArray<DocumentId> GetVisibleDocuments()
return
ImmutableArray
.
Create
<
DocumentId
>();
}
ImmutableArray
<
DocumentId
>.
Builder
ids
=
ImmutableArray
.
CreateBuilder
<
DocumentId
>
(
snapshot
.
Count
);
var
ids
=
ArrayBuilder
<
DocumentId
>.
GetInstance
(
snapshot
.
Count
);
foreach
(
var
frame
in
snapshot
)
{
ids
.
Add
(
frame
.
Id
);
}
return
ids
.
ToImmutable
();
return
ids
.
ToImmutable
AndFree
();
}
/// <summary>
...
...
src/VisualStudio/Core/Impl/CodeModel/Collections/CodeElementSnapshot.cs
浏览文件 @
743a5fce
...
...
@@ -2,6 +2,7 @@
using
System
;
using
System.Collections.Immutable
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.VisualStudio
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Interop
;
...
...
@@ -14,7 +15,7 @@ internal class CodeElementSnapshot : Snapshot
public
CodeElementSnapshot
(
ICodeElements
codeElements
)
{
var
count
=
codeElements
.
Count
;
var
elementsBuilder
=
ImmutableArray
.
CreateBuilder
<
EnvDTE
.
CodeElement
>
(
count
);
var
elementsBuilder
=
ArrayBuilder
<
EnvDTE
.
CodeElement
>.
GetInstance
(
count
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
...
...
@@ -26,7 +27,7 @@ public CodeElementSnapshot(ICodeElements codeElements)
}
}
_elements
=
elementsBuilder
.
ToImmutable
();
_elements
=
elementsBuilder
.
ToImmutable
AndFree
();
}
public
CodeElementSnapshot
(
ImmutableArray
<
EnvDTE
.
CodeElement
>
elements
)
...
...
src/VisualStudio/Core/Impl/CodeModel/Collections/ExternalMemberCollection.cs
浏览文件 @
743a5fce
...
...
@@ -51,7 +51,7 @@ private ImmutableArray<EnvDTE.CodeElement> GetChildren()
throw
Exceptions
.
ThrowEFail
();
}
var
childrenBuilder
=
ImmutableArray
.
CreateBuilder
<
EnvDTE
.
CodeElement
>
();
var
childrenBuilder
=
ArrayBuilder
<
EnvDTE
.
CodeElement
>.
GetInstance
();
foreach
(
var
member
in
typeSymbol
.
GetMembers
())
{
...
...
@@ -66,7 +66,7 @@ private ImmutableArray<EnvDTE.CodeElement> GetChildren()
childrenBuilder
.
Add
(
this
.
State
.
CodeModelService
.
CreateExternalCodeElement
(
this
.
State
,
_projectId
,
typeMember
));
}
_children
=
childrenBuilder
.
ToImmutable
();
_children
=
childrenBuilder
.
ToImmutable
AndFree
();
}
return
_children
;
...
...
src/VisualStudio/Core/Impl/CodeModel/Collections/ExternalNamespaceCollection.cs
浏览文件 @
743a5fce
...
...
@@ -39,14 +39,14 @@ private ImmutableArray<EnvDTE.CodeElement> GetChildren()
{
if
(
_children
==
null
)
{
var
childrenBuilder
=
ImmutableArray
.
CreateBuilder
<
EnvDTE
.
CodeElement
>
();
var
childrenBuilder
=
ArrayBuilder
<
EnvDTE
.
CodeElement
>.
GetInstance
();
foreach
(
var
child
in
ExternalNamespaceEnumerator
.
ChildrenOfNamespace
(
this
.
State
,
_projectId
,
_namespaceSymbolId
))
{
childrenBuilder
.
Add
(
child
);
}
_children
=
childrenBuilder
.
ToImmutable
();
_children
=
childrenBuilder
.
ToImmutable
AndFree
();
}
return
_children
;
...
...
src/VisualStudio/Core/Impl/CodeModel/Collections/ExternalOverloadsCollection.cs
浏览文件 @
743a5fce
...
...
@@ -51,7 +51,7 @@ private ImmutableArray<EnvDTE.CodeElement> EnumerateOverloads()
return
ImmutableArray
.
Create
((
EnvDTE
.
CodeElement
)
Parent
);
}
var
overloadsBuilder
=
ImmutableArray
.
CreateBuilder
<
EnvDTE
.
CodeElement
>
();
var
overloadsBuilder
=
ArrayBuilder
<
EnvDTE
.
CodeElement
>.
GetInstance
();
foreach
(
var
method
in
symbol
.
ContainingType
.
GetMembers
(
symbol
.
Name
))
{
if
(
method
.
Kind
!=
SymbolKind
.
Method
)
...
...
@@ -66,7 +66,7 @@ private ImmutableArray<EnvDTE.CodeElement> EnumerateOverloads()
}
}
return
overloadsBuilder
.
ToImmutable
();
return
overloadsBuilder
.
ToImmutable
AndFree
();
}
public
override
int
Count
...
...
src/VisualStudio/Core/Impl/CodeModel/Collections/InheritsImplementsCollection.cs
浏览文件 @
743a5fce
...
...
@@ -56,11 +56,12 @@ internal override Snapshot CreateSnapshot()
var
node
=
LookupNode
();
var
parentElement
=
(
AbstractCodeElement
)
this
.
Parent
;
var
nodesBuilder
=
ImmutableArray
.
CreateBuilder
<
SyntaxNode
>
();
var
nodesBuilder
=
ArrayBuilder
<
SyntaxNode
>.
GetInstance
();
nodesBuilder
.
AddRange
(
CodeModelService
.
GetInheritsNodes
(
node
));
nodesBuilder
.
AddRange
(
CodeModelService
.
GetImplementsNodes
(
node
));
return
new
NodeSnapshot
(
this
.
State
,
_fileCodeModel
,
node
,
parentElement
,
nodesBuilder
.
ToImmutable
());
return
new
NodeSnapshot
(
this
.
State
,
_fileCodeModel
,
node
,
parentElement
,
nodesBuilder
.
ToImmutableAndFree
());
}
protected
override
bool
TryGetItemByIndex
(
int
index
,
out
EnvDTE
.
CodeElement
element
)
...
...
src/VisualStudio/Core/Impl/CodeModel/Collections/NamespaceCollection.cs
浏览文件 @
743a5fce
...
...
@@ -95,13 +95,14 @@ internal override Snapshot CreateSnapshot()
?
(
AbstractCodeElement
)
this
.
Parent
:
null
;
var
nodesBuilder
=
ImmutableArray
.
CreateBuilder
<
SyntaxNode
>
();
var
nodesBuilder
=
ArrayBuilder
<
SyntaxNode
>.
GetInstance
();
nodesBuilder
.
AddRange
(
CodeModelService
.
GetOptionNodes
(
node
));
nodesBuilder
.
AddRange
(
CodeModelService
.
GetImportNodes
(
node
));
nodesBuilder
.
AddRange
(
CodeModelService
.
GetAttributeNodes
(
node
));
nodesBuilder
.
AddRange
(
CodeModelService
.
GetLogicalSupportedMemberNodes
(
node
));
return
new
NodeSnapshot
(
this
.
State
,
_fileCodeModel
,
node
,
parentElement
,
nodesBuilder
.
ToImmutable
());
return
new
NodeSnapshot
(
this
.
State
,
_fileCodeModel
,
node
,
parentElement
,
nodesBuilder
.
ToImmutableAndFree
());
}
protected
override
bool
TryGetItemByIndex
(
int
index
,
out
EnvDTE
.
CodeElement
element
)
...
...
src/VisualStudio/Core/Impl/CodeModel/Collections/OverloadsCollection.cs
浏览文件 @
743a5fce
...
...
@@ -55,7 +55,7 @@ private ImmutableArray<EnvDTE.CodeElement> GetOverloads()
var
solution
=
this
.
Workspace
.
CurrentSolution
;
var
overloadsBuilder
=
ImmutableArray
.
CreateBuilder
<
EnvDTE
.
CodeElement
>
();
var
overloadsBuilder
=
ArrayBuilder
<
EnvDTE
.
CodeElement
>.
GetInstance
();
foreach
(
var
method
in
symbol
.
ContainingType
.
GetMembers
(
symbol
.
Name
))
{
if
(
method
.
Kind
!=
SymbolKind
.
Method
)
...
...
@@ -84,7 +84,7 @@ private ImmutableArray<EnvDTE.CodeElement> GetOverloads()
}
}
_overloads
=
overloadsBuilder
.
ToImmutable
();
_overloads
=
overloadsBuilder
.
ToImmutable
AndFree
();
}
return
_overloads
;
...
...
src/VisualStudio/Core/Impl/CodeModel/Collections/PartialTypeCollection.cs
浏览文件 @
743a5fce
...
...
@@ -3,6 +3,7 @@
using
System.Collections.Immutable
;
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.InternalElements
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Interop
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.Interop
;
...
...
@@ -43,7 +44,7 @@ private ImmutableArray<EnvDTE.CodeElement> GetParts()
// property is accessed on CodeClass, CodeStruct or CodeInterface, consumers would hit this behavior rarely.
if
(
_parts
==
null
)
{
var
partsBuilder
=
ImmutableArray
.
CreateBuilder
<
EnvDTE
.
CodeElement
>
();
var
partsBuilder
=
ArrayBuilder
<
EnvDTE
.
CodeElement
>.
GetInstance
();
var
solution
=
this
.
Workspace
.
CurrentSolution
;
var
symbol
=
ParentType
.
LookupSymbol
();
...
...
@@ -67,7 +68,7 @@ private ImmutableArray<EnvDTE.CodeElement> GetParts()
}
}
_parts
=
partsBuilder
.
ToImmutable
();
_parts
=
partsBuilder
.
ToImmutable
AndFree
();
}
return
_parts
;
...
...
src/VisualStudio/Core/Impl/CodeModel/Collections/TypeCollection.cs
浏览文件 @
743a5fce
...
...
@@ -57,10 +57,11 @@ internal override Snapshot CreateSnapshot()
var
node
=
LookupNode
();
var
parentElement
=
(
AbstractCodeElement
)
this
.
Parent
;
var
nodesBuilder
=
ImmutableArray
.
CreateBuilder
<
SyntaxNode
>
();
var
nodesBuilder
=
ArrayBuilder
<
SyntaxNode
>.
GetInstance
();
nodesBuilder
.
AddRange
(
CodeModelService
.
GetLogicalSupportedMemberNodes
(
node
));
return
new
NodeSnapshot
(
this
.
State
,
_fileCodeModel
,
node
,
parentElement
,
nodesBuilder
.
ToImmutable
());
return
new
NodeSnapshot
(
this
.
State
,
_fileCodeModel
,
node
,
parentElement
,
nodesBuilder
.
ToImmutableAndFree
());
}
protected
override
bool
TryGetItemByIndex
(
int
index
,
out
EnvDTE
.
CodeElement
element
)
...
...
src/VisualStudio/Core/Impl/CodeModel/ExternalElements/AbstractExternalCodeType.cs
浏览文件 @
743a5fce
...
...
@@ -55,7 +55,7 @@ public EnvDTE.CodeElements Bases
{
get
{
var
builder
=
ImmutableArray
.
CreateBuilder
<
INamedTypeSymbol
>
();
var
builder
=
ArrayBuilder
<
INamedTypeSymbol
>.
GetInstance
();
var
typeSymbol
=
TypeSymbol
;
if
(
typeSymbol
.
TypeKind
==
TypeKind
.
Interface
)
...
...
@@ -67,7 +67,8 @@ public EnvDTE.CodeElements Bases
builder
.
Add
(
typeSymbol
.
BaseType
);
}
return
ExternalTypeCollection
.
Create
(
this
.
State
,
this
,
this
.
ProjectId
,
builder
.
ToImmutable
());
return
ExternalTypeCollection
.
Create
(
this
.
State
,
this
,
this
.
ProjectId
,
builder
.
ToImmutableAndFree
());
}
}
...
...
src/VisualStudio/Core/Next/FindReferences/StreamingFindReferencesPresenter.TableDataSourceFindReferencesContext.cs
浏览文件 @
743a5fce
...
...
@@ -426,7 +426,7 @@ private void Order(List<ClassifiedSpan> syntaxSpans)
// Take all the syntax parts. However, if any have been overridden by a
// semantic part, then choose that one.
var
finalParts
=
ImmutableArray
.
CreateBuilder
<
ClassifiedSpan
>
();
var
finalParts
=
ArrayBuilder
<
ClassifiedSpan
>.
GetInstance
();
var
lastReplacementIndex
=
0
;
for
(
int
i
=
0
,
n
=
syntaxParts
.
Count
;
i
<
n
;
i
++)
{
...
...
@@ -453,7 +453,7 @@ private void Order(List<ClassifiedSpan> syntaxSpans)
}
}
return
finalParts
.
ToImmutable
();
return
finalParts
.
ToImmutable
AndFree
();
}
private
bool
IsClassifiedAsText
(
ClassifiedSpan
partAndSpan
)
...
...
src/VisualStudio/Core/SolutionExplorerShim/AnalyzerItem/AnalyzerItemSource.cs
浏览文件 @
743a5fce
...
...
@@ -201,7 +201,7 @@ private ImmutableArray<AnalyzerReference> GetFilteredAnalyzers(IEnumerable<Analy
var
analyzersWithLoadErrors
=
GetAnalyzersWithLoadErrors
();
// Filter out analyzer dependencies which have no diagnostic analyzers, but still retain the unresolved analyzers and analyzers with load errors.
var
builder
=
ImmutableArray
.
CreateBuilder
<
AnalyzerReference
>
();
var
builder
=
ArrayBuilder
<
AnalyzerReference
>.
GetInstance
();
foreach
(
var
analyzerReference
in
analyzerReferences
)
{
// Analyzer dependency:
...
...
@@ -220,7 +220,7 @@ private ImmutableArray<AnalyzerReference> GetFilteredAnalyzers(IEnumerable<Analy
builder
.
Add
(
analyzerReference
);
}
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
}
}
}
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
浏览文件 @
743a5fce
...
...
@@ -907,7 +907,7 @@ private ImmutableArray<string> GetInheritanceNames(BaseListSyntax baseList)
return
ImmutableArray
<
string
>.
Empty
;
}
var
builder
=
ImmutableArray
.
CreateBuilder
<
string
>
(
baseList
.
Types
.
Count
);
var
builder
=
ArrayBuilder
<
string
>.
GetInstance
(
baseList
.
Types
.
Count
);
// It's not sufficient to just store the textual names we see in the inheritance list
// of a type. For example if we have:
...
...
@@ -937,7 +937,7 @@ private ImmutableArray<string> GetInheritanceNames(BaseListSyntax baseList)
AddInheritanceName
(
builder
,
baseType
.
Type
,
aliasMaps
);
}
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
}
finally
{
...
...
@@ -988,7 +988,7 @@ private void ProcessUsings(List<Dictionary<string, string>> aliasMaps, SyntaxLis
}
private
void
AddInheritanceName
(
ImmutableArray
<
string
>.
Builder
builder
,
TypeSyntax
type
,
ArrayBuilder
<
string
>
builder
,
TypeSyntax
type
,
List
<
Dictionary
<
string
,
string
>>
aliasMaps
)
{
var
name
=
GetTypeName
(
type
);
...
...
src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/FixAllState.FixMultipleDiagnosticProvider.cs
浏览文件 @
743a5fce
...
...
@@ -46,7 +46,7 @@ public FixMultipleDiagnosticProvider(ImmutableDictionary<Project, ImmutableArray
public
override
Task
<
IEnumerable
<
Diagnostic
>>
GetAllDiagnosticsAsync
(
Project
project
,
CancellationToken
cancellationToken
)
{
ImmutableArray
<
Diagnostic
>.
Builder
allDiagnosticsBuilder
=
null
;
var
allDiagnosticsBuilder
=
ArrayBuilder
<
Diagnostic
>.
GetInstance
()
;
ImmutableArray
<
Diagnostic
>
diagnostics
;
if
(!
_documentDiagnosticsMap
.
IsEmpty
)
{
...
...
@@ -54,7 +54,6 @@ public override Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Project pro
{
if
(
_documentDiagnosticsMap
.
TryGetValue
(
document
,
out
diagnostics
))
{
allDiagnosticsBuilder
=
allDiagnosticsBuilder
??
ImmutableArray
.
CreateBuilder
<
Diagnostic
>(
diagnostics
.
Length
);
allDiagnosticsBuilder
.
AddRange
(
diagnostics
);
}
}
...
...
@@ -62,12 +61,10 @@ public override Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Project pro
if
(
_projectDiagnosticsMap
.
TryGetValue
(
project
,
out
diagnostics
))
{
allDiagnosticsBuilder
=
allDiagnosticsBuilder
??
ImmutableArray
.
CreateBuilder
<
Diagnostic
>(
diagnostics
.
Length
);
allDiagnosticsBuilder
.
AddRange
(
diagnostics
);
}
IEnumerable
<
Diagnostic
>
allDiagnostics
=
allDiagnosticsBuilder
!=
null
?
allDiagnosticsBuilder
.
ToImmutable
()
:
ImmutableArray
<
Diagnostic
>.
Empty
;
return
Task
.
FromResult
(
allDiagnostics
);
return
Task
.
FromResult
<
IEnumerable
<
Diagnostic
>>(
allDiagnosticsBuilder
.
ToImmutableAndFree
());
}
public
override
Task
<
IEnumerable
<
Diagnostic
>>
GetDocumentDiagnosticsAsync
(
Document
document
,
CancellationToken
cancellationToken
)
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs
浏览文件 @
743a5fce
...
...
@@ -583,16 +583,16 @@ private void EnsureParentsAndChildren(List<string> simpleNames)
private
ImmutableArray
<
BuilderNode
>
GenerateUnsortedNodes
()
{
var
unsortedNodes
=
ImmutableArray
.
CreateBuilder
<
BuilderNode
>
();
var
unsortedNodes
=
ArrayBuilder
<
BuilderNode
>.
GetInstance
();
unsortedNodes
.
Add
(
new
BuilderNode
(
name
:
""
,
parentIndex
:
RootNodeParentIndex
));
AddUnsortedNodes
(
unsortedNodes
,
parentNode
:
_rootNode
,
parentIndex
:
0
);
return
unsortedNodes
.
ToImmutable
();
return
unsortedNodes
.
ToImmutable
AndFree
();
}
private
void
AddUnsortedNodes
(
ImmutableArray
<
BuilderNode
>.
Builder
unsortedNodes
,
MetadataNode
parentNode
,
int
parentIndex
)
ArrayBuilder
<
BuilderNode
>
unsortedNodes
,
MetadataNode
parentNode
,
int
parentIndex
)
{
foreach
(
var
child
in
_parentToChildren
[
parentNode
])
{
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Source.cs
浏览文件 @
743a5fce
...
...
@@ -43,20 +43,20 @@ private static void FreeSymbolMap(MultiDictionary<string, ISymbol> symbolMap)
return
null
;
}
var
unsortedNodes
=
ImmutableArray
.
CreateBuilder
<
BuilderNode
>
();
var
unsortedNodes
=
ArrayBuilder
<
BuilderNode
>.
GetInstance
();
unsortedNodes
.
Add
(
new
BuilderNode
(
assembly
.
GlobalNamespace
.
Name
,
RootNodeParentIndex
));
GenerateSourceNodes
(
assembly
.
GlobalNamespace
,
unsortedNodes
,
s_getMembersNoPrivate
);
return
CreateSymbolTreeInfo
(
solution
,
version
,
filePath
,
unsortedNodes
.
ToImmutable
(),
solution
,
version
,
filePath
,
unsortedNodes
.
ToImmutable
AndFree
(),
inheritanceMap
:
new
OrderPreservingMultiDictionary
<
string
,
string
>());
}
// generate nodes for the global namespace an all descendants
private
static
void
GenerateSourceNodes
(
INamespaceSymbol
globalNamespace
,
ImmutableArray
<
BuilderNode
>.
Builder
list
,
ArrayBuilder
<
BuilderNode
>
list
,
Action
<
ISymbol
,
MultiDictionary
<
string
,
ISymbol
>>
lookup
)
{
// Add all child members
...
...
@@ -89,7 +89,7 @@ private static void FreeSymbolMap(MultiDictionary<string, ISymbol> symbolMap)
string
name
,
int
parentIndex
,
MultiDictionary
<
string
,
ISymbol
>.
ValueSet
symbolsWithSameName
,
ImmutableArray
<
BuilderNode
>.
Builder
list
,
ArrayBuilder
<
BuilderNode
>
list
,
Action
<
ISymbol
,
MultiDictionary
<
string
,
ISymbol
>>
lookup
)
{
var
node
=
new
BuilderNode
(
name
,
parentIndex
);
...
...
src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs
浏览文件 @
743a5fce
...
...
@@ -416,7 +416,7 @@ public static ImmutableArray<ITypeSymbol> GetTypeArguments(this ISymbol symbol)
public
static
ImmutableArray
<
ITypeSymbol
>
GetAllTypeArguments
(
this
ISymbol
symbol
)
{
var
results
=
ImmutableArray
.
CreateBuilder
<
ITypeSymbol
>
();
var
results
=
ArrayBuilder
<
ITypeSymbol
>.
GetInstance
();
results
.
AddRange
(
symbol
.
GetTypeArguments
());
var
containingType
=
symbol
.
ContainingType
;
...
...
@@ -426,7 +426,7 @@ public static ImmutableArray<ITypeSymbol> GetAllTypeArguments(this ISymbol symbo
containingType
=
containingType
.
ContainingType
;
}
return
results
.
AsImmutabl
e
();
return
results
.
ToImmutableAndFre
e
();
}
public
static
bool
IsAttribute
(
this
ISymbol
symbol
)
...
...
src/Workspaces/Core/Portable/Shared/Extensions/SymbolInfoExtensions.cs
浏览文件 @
743a5fce
...
...
@@ -21,10 +21,10 @@ private static ImmutableArray<ISymbol> GetAllSymbolsWorker(this SymbolInfo info)
}
else
{
var
builder
=
ImmutableArray
.
CreateBuilder
<
ISymbol
>
(
info
.
CandidateSymbols
.
Length
+
1
);
var
builder
=
ArrayBuilder
<
ISymbol
>.
GetInstance
(
info
.
CandidateSymbols
.
Length
+
1
);
builder
.
Add
(
info
.
Symbol
);
builder
.
AddRange
(
info
.
CandidateSymbols
);
return
builder
.
ToImmutable
();
return
builder
.
ToImmutable
AndFree
();
}
}
...
...
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
浏览文件 @
743a5fce
...
...
@@ -925,7 +925,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Function
Private
Function
GetInheritanceNames
(
typeBlock
As
TypeBlockSyntax
)
As
ImmutableArray
(
Of
String
)
Dim
builder
=
ImmutableArray
.
CreateBuilder
(
Of
String
)
Dim
builder
=
ArrayBuilder
(
Of
String
).
GetInstance
(
)
Dim
aliasMap
=
GetAliasMap
(
typeBlock
)
Try
...
...
@@ -937,7 +937,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
AddInheritanceNames
(
builder
,
implementsStatement
.
Types
,
aliasMap
)
Next
Return
builder
.
ToImmutable
()
Return
builder
.
ToImmutable
AndFree
()
Finally
FreeAliasMap
(
aliasMap
)
End
Try
...
...
@@ -966,7 +966,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Function
Private
Sub
AddInheritanceNames
(
builder
As
ImmutableArray
(
Of
String
).
Builder
,
builder
As
ArrayBuilder
(
Of
String
)
,
types
As
SeparatedSyntaxList
(
Of
TypeSyntax
),
aliasMap
As
Dictionary
(
Of
String
,
String
))
...
...
@@ -976,7 +976,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Sub
Private
Sub
AddInheritanceName
(
builder
As
ImmutableArray
(
Of
String
).
Builder
,
builder
As
ArrayBuilder
(
Of
String
)
,
typeSyntax
As
TypeSyntax
,
aliasMap
As
Dictionary
(
Of
String
,
String
))
Dim
name
=
GetTypeName
(
typeSyntax
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录