Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
76e58709
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,发现更多精彩内容 >>
提交
76e58709
编写于
5月 21, 2019
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use compound assignment
上级
a79ccc93
变更
42
隐藏空白更改
内联
并排
Showing
42 changed file
with
70 addition
and
70 deletion
+70
-70
src/Compilers/Core/Portable/Collections/OrderPreservingMultiDictionary.cs
...re/Portable/Collections/OrderPreservingMultiDictionary.cs
+1
-1
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerAssemblyLoader.cs
...ore/Portable/DiagnosticAnalyzer/AnalyzerAssemblyLoader.cs
+1
-1
src/Compilers/Core/Portable/FileSystem/PathUtilities.cs
src/Compilers/Core/Portable/FileSystem/PathUtilities.cs
+1
-1
src/Compilers/Core/Portable/InternalUtilities/BitArithmeticUtilities.cs
...Core/Portable/InternalUtilities/BitArithmeticUtilities.cs
+1
-1
src/Workspaces/Core/Portable/AddImports/AbstractAddImportsService.cs
...ces/Core/Portable/AddImports/AbstractAddImportsService.cs
+3
-3
src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService.cs
.../Portable/CodeGeneration/AbstractCodeGenerationService.cs
+2
-2
src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs
...neration/AbstractCodeGenerationService_FindDeclaration.cs
+1
-1
src/Workspaces/Core/Portable/CodeGeneration/AbstractImportsAdder.cs
...aces/Core/Portable/CodeGeneration/AbstractImportsAdder.cs
+1
-1
src/Workspaces/Core/Portable/CodeStyle/CodeStyleHelpers.cs
src/Workspaces/Core/Portable/CodeStyle/CodeStyleHelpers.cs
+1
-1
src/Workspaces/Core/Portable/CodeStyle/CodeStyleOptions.cs
src/Workspaces/Core/Portable/CodeStyle/CodeStyleOptions.cs
+1
-1
src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResult.cs
...ces/Core/Portable/Diagnostics/DiagnosticAnalysisResult.cs
+1
-1
src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResultBuilder.cs
...e/Portable/Diagnostics/DiagnosticAnalysisResultBuilder.cs
+6
-6
src/Workspaces/Core/Portable/Editing/ImportAdderService.cs
src/Workspaces/Core/Portable/Editing/ImportAdderService.cs
+1
-1
src/Workspaces/Core/Portable/Editing/SyntaxEditor.cs
src/Workspaces/Core/Portable/Editing/SyntaxEditor.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs
...ortable/FindSymbols/FindReferences/DependentTypeFinder.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs
...Symbols/FindReferences/Finders/AbstractReferenceFinder.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_FindReferences_Current.cs
...rtable/FindSymbols/SymbolFinder_FindReferences_Current.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_FindReferences_Legacy.cs
...ortable/FindSymbols/SymbolFinder_FindReferences_Legacy.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Hierarchy.cs
...paces/Core/Portable/FindSymbols/SymbolFinder_Hierarchy.cs
+3
-3
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.cs
...es/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.cs
+1
-1
src/Workspaces/Core/Portable/FlowAnalysis/LValueFlowCaptureProvider.cs
...s/Core/Portable/FlowAnalysis/LValueFlowCaptureProvider.cs
+1
-1
src/Workspaces/Core/Portable/Formatting/AbstractSyntaxFormattingService.cs
...re/Portable/Formatting/AbstractSyntaxFormattingService.cs
+1
-1
src/Workspaces/Core/Portable/Formatting/Formatter.cs
src/Workspaces/Core/Portable/Formatting/Formatter.cs
+3
-3
src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs
...ble/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs
+1
-1
src/Workspaces/Core/Portable/PatternMatching/PatternMatcher.cs
...orkspaces/Core/Portable/PatternMatching/PatternMatcher.cs
+3
-3
src/Workspaces/Core/Portable/Recommendations/Recommender.cs
src/Workspaces/Core/Portable/Recommendations/Recommender.cs
+1
-1
src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs
...ortable/Rename/ConflictEngine/ConflictResolver.Session.cs
+1
-1
src/Workspaces/Core/Portable/Rename/Renamer.cs
src/Workspaces/Core/Portable/Rename/Renamer.cs
+2
-2
src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs
...ces/Core/Portable/Shared/Extensions/DocumentExtensions.cs
+1
-1
src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs
...aces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs
+2
-2
src/Workspaces/Core/Portable/Shared/Extensions/ITypeSymbolExtensions.cs
.../Core/Portable/Shared/Extensions/ITypeSymbolExtensions.cs
+3
-3
src/Workspaces/Core/Portable/Shared/Utilities/BloomFilter.cs
src/Workspaces/Core/Portable/Shared/Utilities/BloomFilter.cs
+2
-2
src/Workspaces/Core/Portable/Shared/Utilities/NameGenerator.cs
...orkspaces/Core/Portable/Shared/Utilities/NameGenerator.cs
+1
-1
src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs
.../Portable/Simplification/AbstractSimplificationService.cs
+1
-1
src/Workspaces/Core/Portable/Utilities/BKTree.cs
src/Workspaces/Core/Portable/Utilities/BKTree.cs
+1
-1
src/Workspaces/Core/Portable/Utilities/CompilerUtilities/ImmutableHashMap.cs
.../Portable/Utilities/CompilerUtilities/ImmutableHashMap.cs
+1
-1
src/Workspaces/Core/Portable/Utilities/Contract.cs
src/Workspaces/Core/Portable/Utilities/Contract.cs
+3
-3
src/Workspaces/Core/Portable/Utilities/SerializableBytes.cs
src/Workspaces/Core/Portable/Utilities/SerializableBytes.cs
+1
-1
src/Workspaces/Core/Portable/Workspace/Host/TaskScheduler/WorkspaceTaskSchedulerFactory.WorkspaceTaskQueue.cs
...duler/WorkspaceTaskSchedulerFactory.WorkspaceTaskQueue.cs
+1
-1
src/Workspaces/Core/Portable/Workspace/Host/TaskScheduler/WorkspaceTaskSchedulerFactory.WorkspaceTaskScheduler.cs
...r/WorkspaceTaskSchedulerFactory.WorkspaceTaskScheduler.cs
+1
-1
src/Workspaces/Core/Portable/Workspace/Solution/SolutionId.cs
...Workspaces/Core/Portable/Workspace/Solution/SolutionId.cs
+1
-1
src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs
...kspaces/Core/Portable/Workspace/Solution/SolutionState.cs
+8
-8
未找到文件。
src/Compilers/Core/Portable/Collections/OrderPreservingMultiDictionary.cs
浏览文件 @
76e58709
...
...
@@ -79,7 +79,7 @@ public OrderPreservingMultiDictionary()
private
void
EnsureDictionary
()
{
_dictionary
=
_dictionary
??
PooledDictionary
<
K
,
ValueSet
>.
GetInstance
();
_dictionary
??=
PooledDictionary
<
K
,
ValueSet
>.
GetInstance
();
}
public
bool
IsEmpty
=>
_dictionary
==
null
;
...
...
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerAssemblyLoader.cs
浏览文件 @
76e58709
...
...
@@ -69,7 +69,7 @@ private Assembly LoadFromPathUncheckedCore(string fullPath, AssemblyIdentity ide
}
else
{
identity
=
identity
??
GetOrAddAssemblyIdentity
(
fullPath
);
identity
??=
GetOrAddAssemblyIdentity
(
fullPath
);
if
(
identity
!=
null
&&
_loadedAssembliesByIdentity
.
TryGetValue
(
identity
,
out
existingAssembly
))
{
loadedAssembly
=
existingAssembly
;
...
...
src/Compilers/Core/Portable/FileSystem/PathUtilities.cs
浏览文件 @
76e58709
...
...
@@ -46,7 +46,7 @@ public static string TrimTrailingSeparators(string s)
int
lastSeparator
=
s
.
Length
;
while
(
lastSeparator
>
0
&&
IsDirectorySeparator
(
s
[
lastSeparator
-
1
]))
{
lastSeparator
=
lastSeparator
-
1
;
lastSeparator
-=
1
;
}
if
(
lastSeparator
!=
s
.
Length
)
...
...
src/Compilers/Core/Portable/InternalUtilities/BitArithmeticUtilities.cs
浏览文件 @
76e58709
...
...
@@ -15,7 +15,7 @@ public static int CountBits(uint v)
{
unchecked
{
v
=
v
-
((
v
>>
1
)
&
0x55555555u
);
v
-=
((
v
>>
1
)
&
0x55555555u
);
v
=
(
v
&
0x33333333u
)
+
((
v
>>
2
)
&
0x33333333u
);
return
(
int
)((
v
+
(
v
>>
4
)
&
0xF0F0F0Fu
)
*
0x1010101u
)
>>
24
;
}
...
...
src/Workspaces/Core/Portable/AddImports/AbstractAddImportsService.cs
浏览文件 @
76e58709
...
...
@@ -44,7 +44,7 @@ protected AbstractAddImportsService()
private
static
ImmutableArray
<
SyntaxNode
>
GetAllContainers
(
SyntaxNode
root
,
SyntaxNode
contextLocation
)
{
contextLocation
=
contextLocation
??
root
;
contextLocation
??=
root
;
var
applicableContainer
=
GetFirstApplicableContainer
(
contextLocation
);
return
applicableContainer
.
GetAncestorsOrThis
<
SyntaxNode
>().
ToImmutableArray
();
...
...
@@ -79,7 +79,7 @@ private static ImmutableArray<SyntaxNode> GetAllContainers(SyntaxNode root, Synt
public
SyntaxNode
GetImportContainer
(
SyntaxNode
root
,
SyntaxNode
contextLocation
,
SyntaxNode
import
)
{
contextLocation
=
contextLocation
??
root
;
contextLocation
??=
root
;
GetContainers
(
root
,
contextLocation
,
out
var
externContainer
,
out
var
usingContainer
,
out
var
staticUsingContainer
,
out
var
aliasContainer
);
...
...
@@ -110,7 +110,7 @@ public SyntaxNode GetImportContainer(SyntaxNode root, SyntaxNode contextLocation
IEnumerable
<
SyntaxNode
>
newImports
,
bool
placeSystemNamespaceFirst
)
{
contextLocation
=
contextLocation
??
root
;
contextLocation
??=
root
;
var
globalImports
=
GetGlobalImports
(
compilation
);
var
containers
=
GetAllContainers
(
root
,
contextLocation
);
...
...
src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService.cs
浏览文件 @
76e58709
...
...
@@ -176,7 +176,7 @@ protected static T Cast<T>(object value)
IEnumerable
<
ISymbol
>
members
,
CancellationToken
cancellationToken
)
{
options
=
options
??
CodeGenerationOptions
.
Default
;
options
??=
CodeGenerationOptions
.
Default
;
var
(
destinationDeclaration
,
availableIndices
)
=
await
this
.
FindMostRelevantDeclarationAsync
(
solution
,
destination
,
options
,
cancellationToken
).
ConfigureAwait
(
false
);
...
...
@@ -207,7 +207,7 @@ protected static T Cast<T>(object value)
public
async
Task
<
Document
>
AddImportsAsync
(
Document
document
,
CodeGenerationOptions
options
,
CancellationToken
cancellationToken
)
{
options
=
options
??
CodeGenerationOptions
.
Default
;
options
??=
CodeGenerationOptions
.
Default
;
var
adder
=
this
.
CreateImportsAdder
(
document
);
var
newDocument
=
await
adder
.
AddAsync
(
options
.
PlaceSystemNamespaceFirst
,
options
,
cancellationToken
).
ConfigureAwait
(
false
);
return
newDocument
;
...
...
src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs
浏览文件 @
76e58709
...
...
@@ -179,7 +179,7 @@ class NestedType
// Then, prefer a declaration from the same file.
declaration
=
await
SelectFirstOrDefaultAsync
(
declarations
.
Where
(
r
=>
r
.
SyntaxTree
==
locationOpt
.
SourceTree
),
node
=>
true
,
cancellationToken
).
ConfigureAwait
(
false
);
fallbackDeclaration
=
fallbackDeclaration
??
declaration
;
fallbackDeclaration
??=
declaration
;
if
(
CanAddTo
(
declaration
,
solution
,
cancellationToken
,
out
availableIndices
))
{
return
(
declaration
,
availableIndices
);
...
...
src/Workspaces/Core/Portable/CodeGeneration/AbstractImportsAdder.cs
浏览文件 @
76e58709
...
...
@@ -57,7 +57,7 @@ protected AbstractImportsAdder(Document document)
cancellationToken
.
ThrowIfCancellationRequested
();
if
(!
IsBuiltIn
(
namedType
))
{
namespaceScope
=
namespaceScope
??
this
.
GetInnermostNamespaceScope
(
annotatedNode
);
namespaceScope
??=
this
.
GetInnermostNamespaceScope
(
annotatedNode
);
var
referencedDefinitions
=
namespaceScopeToReferencedDefinitions
.
GetOrAdd
(
namespaceScope
,
createSet
);
referencedDefinitions
.
Add
(
namedType
);
...
...
src/Workspaces/Core/Portable/CodeStyle/CodeStyleHelpers.cs
浏览文件 @
76e58709
...
...
@@ -34,7 +34,7 @@ public static bool TryParseBoolEditorConfigCodeStyleOption(string arg, out CodeS
// 'true' must always be provided with a notification option.
if
(
isEnabled
==
false
)
{
notificationOpt
=
notificationOpt
??
NotificationOption
.
Silent
;
notificationOpt
??=
NotificationOption
.
Silent
;
option
=
new
CodeStyleOption
<
bool
>(
false
,
notificationOpt
);
return
true
;
}
...
...
src/Workspaces/Core/Portable/CodeStyle/CodeStyleOptions.cs
浏览文件 @
76e58709
...
...
@@ -274,7 +274,7 @@ private static CodeStyleOption<AccessibilityModifiersRequired> ParseAccessibilit
if
(
value
==
"never"
)
{
// If they provide 'never', they don't need a notification level.
notificationOpt
=
notificationOpt
??
NotificationOption
.
Silent
;
notificationOpt
??=
NotificationOption
.
Silent
;
}
if
(
notificationOpt
!=
null
)
...
...
src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResult.cs
浏览文件 @
76e58709
...
...
@@ -69,7 +69,7 @@ internal struct DiagnosticAnalysisResult
IsEmpty
=
false
;
// do after all fields are assigned.
DocumentIds
=
DocumentIds
??
CreateDocumentIds
();
DocumentIds
??=
CreateDocumentIds
();
IsEmpty
=
DocumentIds
.
IsEmpty
&&
_others
.
IsEmpty
;
}
...
...
src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResultBuilder.cs
浏览文件 @
76e58709
...
...
@@ -83,7 +83,7 @@ public void AddExternalSemanticDiagnostics(DocumentId documentId, IEnumerable<Di
else
{
// non local diagnostics without location
_lazyOthers
=
_lazyOthers
??
new
List
<
DiagnosticData
>();
_lazyOthers
??=
new
List
<
DiagnosticData
>();
_lazyOthers
.
Add
(
DiagnosticData
.
Create
(
Project
,
diagnostic
));
}
...
...
@@ -91,7 +91,7 @@ public void AddExternalSemanticDiagnostics(DocumentId documentId, IEnumerable<Di
}
case
LocationKind
.
None
:
{
_lazyOthers
=
_lazyOthers
??
new
List
<
DiagnosticData
>();
_lazyOthers
??=
new
List
<
DiagnosticData
>();
_lazyOthers
.
Add
(
DiagnosticData
.
Create
(
Project
,
diagnostic
));
break
;
}
...
...
@@ -123,7 +123,7 @@ private void AppendDiagnostics(ref Dictionary<DocumentId, List<DiagnosticData>>
return
;
}
map
=
map
??
new
Dictionary
<
DocumentId
,
List
<
DiagnosticData
>>();
map
??=
new
Dictionary
<
DocumentId
,
List
<
DiagnosticData
>>();
map
.
GetOrAdd
(
documentOpt
.
Id
,
_
=>
new
List
<
DiagnosticData
>()).
Add
(
DiagnosticData
.
Create
(
documentOpt
,
diagnostic
));
AddDocumentToSet
(
documentOpt
);
...
...
@@ -163,7 +163,7 @@ public void AddCompilationDiagnostics(IEnumerable<Diagnostic> diagnostics)
}
case
LocationKind
.
None
:
{
_lazyOthers
=
_lazyOthers
??
new
List
<
DiagnosticData
>();
_lazyOthers
??=
new
List
<
DiagnosticData
>();
_lazyOthers
.
Add
(
DiagnosticData
.
Create
(
Project
,
diagnostic
));
break
;
}
...
...
@@ -182,7 +182,7 @@ public void AddCompilationDiagnostics(IEnumerable<Diagnostic> diagnostics)
else
{
// non local diagnostics without location
_lazyOthers
=
_lazyOthers
??
new
List
<
DiagnosticData
>();
_lazyOthers
??=
new
List
<
DiagnosticData
>();
_lazyOthers
.
Add
(
DiagnosticData
.
Create
(
Project
,
diagnostic
));
}
...
...
@@ -205,7 +205,7 @@ public void AddCompilationDiagnostics(IEnumerable<Diagnostic> diagnostics)
private
void
AddDocumentToSet
(
Document
document
)
{
_lazySet
=
_lazySet
??
new
HashSet
<
DocumentId
>();
_lazySet
??=
new
HashSet
<
DocumentId
>();
_lazySet
.
Add
(
document
.
Id
);
}
...
...
src/Workspaces/Core/Portable/Editing/ImportAdderService.cs
浏览文件 @
76e58709
...
...
@@ -22,7 +22,7 @@ internal abstract class ImportAdderService : ILanguageService
Document
document
,
IEnumerable
<
TextSpan
>
spans
,
OptionSet
options
,
CancellationToken
cancellationToken
)
{
options
=
options
??
await
document
.
GetOptionsAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
options
??=
await
document
.
GetOptionsAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
model
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
root
=
await
model
.
SyntaxTree
.
GetRootAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
...
...
src/Workspaces/Core/Portable/Editing/SyntaxEditor.cs
浏览文件 @
76e58709
...
...
@@ -45,7 +45,7 @@ private SyntaxNode ApplyTrackingToNewNode(SyntaxNode node)
return
null
;
}
_lazyTrackedNewNodesOpt
=
_lazyTrackedNewNodesOpt
??
new
HashSet
<
SyntaxNode
>();
_lazyTrackedNewNodesOpt
??=
new
HashSet
<
SyntaxNode
>();
foreach
(
var
descendant
in
node
.
DescendantNodesAndSelf
())
{
_lazyTrackedNewNodesOpt
.
Add
(
descendant
);
...
...
src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs
浏览文件 @
76e58709
...
...
@@ -282,7 +282,7 @@ bool metadataTypeMatches(SymbolAndProjectIdSet s, INamedTypeSymbol t)
CancellationToken
cancellationToken
)
{
type
=
type
.
WithSymbol
(
type
.
Symbol
.
OriginalDefinition
);
projects
=
projects
??
ImmutableHashSet
.
Create
(
solution
.
Projects
.
ToArray
());
projects
??=
ImmutableHashSet
.
Create
(
solution
.
Projects
.
ToArray
());
var
searchInMetadata
=
type
.
Symbol
.
Locations
.
Any
(
s_isInMetadata
);
// Note: it is not sufficient to just walk the list of projects passed in,
...
...
src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs
浏览文件 @
76e58709
...
...
@@ -182,7 +182,7 @@ protected static bool IdentifiersMatch(ISyntaxFactsService syntaxFacts, string n
ISymbol
symbol
,
Func
<
SyntaxToken
,
SyntaxNode
>
findParentNode
,
Solution
solution
,
CancellationToken
cancellationToken
)
{
var
nodeMatch
=
GetStandardSymbolsNodeMatchFunction
(
symbol
,
solution
,
cancellationToken
);
findParentNode
=
findParentNode
??
(
t
=>
t
.
Parent
);
findParentNode
??=
(
t
=>
t
.
Parent
);
(
bool
matched
,
CandidateReason
reason
)
symbolsMatch
(
SyntaxToken
token
,
SemanticModel
model
)
=>
nodeMatch
(
findParentNode
(
token
),
model
);
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_FindReferences_Current.cs
浏览文件 @
76e58709
...
...
@@ -48,7 +48,7 @@ public static partial class SymbolFinder
FindReferencesSearchOptions
options
,
CancellationToken
cancellationToken
)
{
var
finders
=
ReferenceFinders
.
DefaultReferenceFinders
;
progress
=
progress
??
StreamingFindReferencesProgress
.
Instance
;
progress
??=
StreamingFindReferencesProgress
.
Instance
;
var
engine
=
new
FindReferencesSearchEngine
(
solution
,
documents
,
finders
,
progress
,
options
,
cancellationToken
);
return
engine
.
FindReferencesAsync
(
symbolAndProjectId
);
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_FindReferences_Legacy.cs
浏览文件 @
76e58709
...
...
@@ -79,7 +79,7 @@ public static partial class SymbolFinder
FindReferencesSearchOptions
options
,
CancellationToken
cancellationToken
)
{
progress
=
progress
??
FindReferencesProgress
.
Instance
;
progress
??=
FindReferencesProgress
.
Instance
;
var
streamingProgress
=
new
StreamingProgressCollector
(
new
StreamingFindReferencesProgressAdapter
(
progress
));
await
FindReferencesAsync
(
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Hierarchy.cs
浏览文件 @
76e58709
...
...
@@ -256,7 +256,7 @@ public static partial class SymbolFinder
var
bestDef
=
sourceDef
.
Symbol
!=
null
?
sourceDef
:
implementation
;
if
(
IsAccessible
(
bestDef
))
{
results
=
results
??
ImmutableArray
.
CreateBuilder
<
SymbolAndProjectId
>();
results
??=
ImmutableArray
.
CreateBuilder
<
SymbolAndProjectId
>();
results
.
Add
(
bestDef
.
WithSymbol
(
bestDef
.
Symbol
.
OriginalDefinition
));
}
}
...
...
@@ -317,7 +317,7 @@ public static async Task<IEnumerable<SymbolCallerInfo>> FindCallersAsync(ISymbol
{
foreach
(
var
kvp
in
await
directReferences
.
Locations
.
FindReferencingSymbolsAsync
(
cancellationToken
).
ConfigureAwait
(
false
))
{
results
=
results
??
new
List
<
SymbolCallerInfo
>();
results
??=
new
List
<
SymbolCallerInfo
>();
results
.
Add
(
new
SymbolCallerInfo
(
kvp
.
Key
,
symbol
,
kvp
.
Value
,
isDirect
:
true
));
}
}
...
...
@@ -326,7 +326,7 @@ public static async Task<IEnumerable<SymbolCallerInfo>> FindCallersAsync(ISymbol
var
indirectLocations
=
indirectReferences
.
SelectMany
(
r
=>
r
.
Locations
);
foreach
(
var
kvp
in
await
indirectLocations
.
FindReferencingSymbolsAsync
(
cancellationToken
).
ConfigureAwait
(
false
))
{
results
=
results
??
new
List
<
SymbolCallerInfo
>();
results
??=
new
List
<
SymbolCallerInfo
>();
results
.
Add
(
new
SymbolCallerInfo
(
kvp
.
Key
,
symbol
,
kvp
.
Value
,
isDirect
:
false
));
}
}
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.cs
浏览文件 @
76e58709
...
...
@@ -211,7 +211,7 @@ public SymbolTreeInfo WithChecksum(Checksum checksum)
foreach
(
var
node
in
FindNodeIndices
(
name
,
comparer
))
{
cancellationToken
.
ThrowIfCancellationRequested
();
assemblySymbol
=
assemblySymbol
??
await
lazyAssembly
.
GetValueAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
assemblySymbol
??=
await
lazyAssembly
.
GetValueAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
Bind
(
node
,
assemblySymbol
.
GlobalNamespace
,
results
,
cancellationToken
);
}
...
...
src/Workspaces/Core/Portable/FlowAnalysis/LValueFlowCaptureProvider.cs
浏览文件 @
76e58709
...
...
@@ -50,7 +50,7 @@ internal static class LValueFlowCapturesProvider
assignment
.
Target
==
flowCaptureReference
||
flowCaptureReference
.
IsInLeftOfDeconstructionAssignment
(
out
_
))
{
lvalueFlowCaptureIdBuilder
=
lvalueFlowCaptureIdBuilder
??
ImmutableDictionary
.
CreateBuilder
<
CaptureId
,
FlowCaptureKind
>();
lvalueFlowCaptureIdBuilder
??=
ImmutableDictionary
.
CreateBuilder
<
CaptureId
,
FlowCaptureKind
>();
var
captureKind
=
flowCaptureReference
.
Parent
.
IsAnyCompoundAssignment
()
||
rvalueFlowCaptureIds
.
Contains
(
flowCaptureReference
.
Id
)
?
FlowCaptureKind
.
LValueAndRValueCapture
:
FlowCaptureKind
.
LValueCapture
;
...
...
src/Workspaces/Core/Portable/Formatting/AbstractSyntaxFormattingService.cs
浏览文件 @
76e58709
...
...
@@ -76,7 +76,7 @@ public IFormattingResult Format(SyntaxNode node, IEnumerable<TextSpan> spans, Op
continue
;
}
results
=
results
??
new
List
<
AbstractFormattingResult
>();
results
??=
new
List
<
AbstractFormattingResult
>();
results
.
Add
(
Format
(
node
,
options
,
rules
,
pair
.
Item1
,
pair
.
Item2
,
cancellationToken
));
}
...
...
src/Workspaces/Core/Portable/Formatting/Formatter.cs
浏览文件 @
76e58709
...
...
@@ -243,9 +243,9 @@ internal static IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerab
return
null
;
}
options
=
options
??
workspace
.
Options
;
rules
=
rules
??
GetDefaultFormattingRules
(
workspace
,
node
.
Language
);
spans
=
spans
??
SpecializedCollections
.
SingletonEnumerable
(
node
.
FullSpan
);
options
??=
workspace
.
Options
;
rules
??=
GetDefaultFormattingRules
(
workspace
,
node
.
Language
);
spans
??=
SpecializedCollections
.
SingletonEnumerable
(
node
.
FullSpan
);
return
languageFormatter
.
Format
(
node
,
spans
,
options
,
rules
,
cancellationToken
);
}
...
...
src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs
浏览文件 @
76e58709
...
...
@@ -112,7 +112,7 @@ internal async Task<LinkedFileMergeSessionResult> MergeDiffsAsync(IMergeConflict
if
(
unmergedChanges
.
Any
())
{
mergeConflictHandler
=
mergeConflictHandler
??
_oldSolution
.
GetDocument
(
linkedDocumentGroup
.
First
()).
GetLanguageService
<
ILinkedFileMergeConflictCommentAdditionService
>();
mergeConflictHandler
??=
_oldSolution
.
GetDocument
(
linkedDocumentGroup
.
First
()).
GetLanguageService
<
ILinkedFileMergeConflictCommentAdditionService
>();
var
mergeConflictTextEdits
=
mergeConflictHandler
.
CreateEdits
(
originalSourceText
,
unmergedChanges
);
allChanges
=
MergeChangesWithMergeFailComments
(
appliedChanges
,
mergeConflictTextEdits
,
mergeConflictResolutionSpan
,
groupSessionInfo
);
...
...
src/Workspaces/Core/Portable/PatternMatching/PatternMatcher.cs
浏览文件 @
76e58709
...
...
@@ -48,7 +48,7 @@ internal abstract partial class PatternMatcher : IDisposable
CultureInfo
culture
,
bool
allowFuzzyMatching
=
false
)
{
culture
=
culture
??
CultureInfo
.
CurrentCulture
;
culture
??=
CultureInfo
.
CurrentCulture
;
_compareInfo
=
culture
.
CompareInfo
;
_textInfo
=
culture
.
TextInfo
;
...
...
@@ -534,12 +534,12 @@ private bool PartStartsWith(string candidate, TextSpan candidatePart, string pat
matchSpans
.
Add
(
new
TextSpan
(
candidateHump
.
Start
,
patternChunkCharacterSpan
.
Length
));
gotOneMatchThisCandidate
=
true
;
firstMatch
=
firstMatch
??
currentCandidateHump
;
firstMatch
??=
currentCandidateHump
;
// If we were contiguous, then keep that value. If we weren't, then keep that
// value. If we don't know, then set the value to 'true' as an initial match is
// obviously contiguous.
contiguous
=
contiguous
??
true
;
contiguous
??=
true
;
candidateHump
=
new
TextSpan
(
candidateHump
.
Start
+
patternChunkCharacterSpan
.
Length
,
candidateHump
.
Length
-
patternChunkCharacterSpan
.
Length
);
}
...
...
src/Workspaces/Core/Portable/Recommendations/Recommender.cs
浏览文件 @
76e58709
...
...
@@ -44,7 +44,7 @@ public static class Recommender
OptionSet
options
=
null
,
CancellationToken
cancellationToken
=
default
)
{
options
=
options
??
workspace
.
Options
;
options
??=
workspace
.
Options
;
var
languageRecommender
=
workspace
.
Services
.
GetLanguageServices
(
semanticModel
.
Language
).
GetService
<
IRecommendationService
>();
return
await
languageRecommender
.
GetRecommendedSymbolsAtPositionAsync
(
...
...
src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs
浏览文件 @
76e58709
...
...
@@ -345,7 +345,7 @@ private async Task DebugVerifyNoErrorsAsync(ConflictResolution conflictResolutio
var
hasConflict
=
_renameAnnotations
.
HasAnnotation
(
tokenOrNode
,
RenameInvalidIdentifierAnnotation
.
Instance
);
if
(!
hasConflict
)
{
newDocumentSemanticModel
=
newDocumentSemanticModel
??
await
newDocument
.
GetSemanticModelAsync
(
_cancellationToken
).
ConfigureAwait
(
false
);
newDocumentSemanticModel
??=
await
newDocument
.
GetSemanticModelAsync
(
_cancellationToken
).
ConfigureAwait
(
false
);
newReferencedSymbols
=
GetSymbolsInNewSolution
(
newDocument
,
newDocumentSemanticModel
,
conflictAnnotation
,
tokenOrNode
);
// The semantic correctness, after rename, for each token of interest in the
...
...
src/Workspaces/Core/Portable/Rename/Renamer.cs
浏览文件 @
76e58709
...
...
@@ -44,7 +44,7 @@ public static class Renamer
cancellationToken
.
ThrowIfCancellationRequested
();
options
=
options
??
solution
.
Options
;
options
??=
solution
.
Options
;
return
RenameLocations
.
FindAsync
(
symbolAndProjectId
,
solution
,
options
,
cancellationToken
);
}
...
...
@@ -100,7 +100,7 @@ public static class Renamer
cancellationToken
.
ThrowIfCancellationRequested
();
options
=
options
??
solution
.
Workspace
.
Options
;
options
??=
solution
.
Workspace
.
Options
;
var
renameLocations
=
await
GetRenameLocationsAsync
(
solution
,
symbolAndProjectId
,
options
,
cancellationToken
).
ConfigureAwait
(
false
);
return
await
RenameAsync
(
renameLocations
,
newName
,
filter
,
hasConflict
,
cancellationToken
).
ConfigureAwait
(
false
);
}
...
...
src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs
浏览文件 @
76e58709
...
...
@@ -122,7 +122,7 @@ public static async Task<ImmutableArray<Diagnostic>> GetErrorsAsync(this Documen
return
ImmutableArray
<
Diagnostic
>.
Empty
;
}
ignoreErrorCode
=
ignoreErrorCode
??
SpecializedCollections
.
EmptyList
<
string
>();
ignoreErrorCode
??=
SpecializedCollections
.
EmptyList
<
string
>();
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
return
semanticModel
.
GetDiagnostics
(
cancellationToken
:
cancellationToken
).
WhereAsArray
(
diag
=>
diag
.
Severity
==
DiagnosticSeverity
.
Error
&&
!
ignoreErrorCode
.
Contains
(
diag
.
Id
));
...
...
src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs
浏览文件 @
76e58709
...
...
@@ -711,7 +711,7 @@ public static bool IsInaccessibleLocal(this ISymbol symbol, int position)
}
attributes
=
attributes
.
IsDefault
?
symbol
.
GetAttributes
()
:
attributes
;
hideModuleNameAttribute
=
hideModuleNameAttribute
??
compilation
.
HideModuleNameAttribute
();
hideModuleNameAttribute
??=
compilation
.
HideModuleNameAttribute
();
foreach
(
var
attribute
in
attributes
)
{
if
(
Equals
(
attribute
.
AttributeClass
,
hideModuleNameAttribute
))
...
...
@@ -726,7 +726,7 @@ public static bool IsInaccessibleLocal(this ISymbol symbol, int position)
private
static
bool
IsBrowsingProhibitedByEditorBrowsableAttribute
(
ISymbol
symbol
,
ImmutableArray
<
AttributeData
>
attributes
,
bool
hideAdvancedMembers
,
Compilation
compilation
,
IMethodSymbol
constructor
)
{
constructor
=
constructor
??
EditorBrowsableHelpers
.
GetSpecialEditorBrowsableAttributeConstructor
(
compilation
);
constructor
??=
EditorBrowsableHelpers
.
GetSpecialEditorBrowsableAttributeConstructor
(
compilation
);
if
(
constructor
==
null
)
{
return
false
;
...
...
src/Workspaces/Core/Portable/Shared/Extensions/ITypeSymbolExtensions.cs
浏览文件 @
76e58709
...
...
@@ -217,7 +217,7 @@ public static ITypeSymbol RemoveNullableIfPresent(this ITypeSymbol symbol)
this
ITypeSymbol
type
,
HashSet
<
INamedTypeSymbol
>
symbols
=
null
)
{
symbols
=
symbols
??
new
HashSet
<
INamedTypeSymbol
>(
SymbolEquivalenceComparer
.
Instance
);
symbols
??=
new
HashSet
<
INamedTypeSymbol
>(
SymbolEquivalenceComparer
.
Instance
);
foreach
(
var
interfaceType
in
type
.
Interfaces
)
{
...
...
@@ -467,7 +467,7 @@ public static bool IsFormattableString(this ITypeSymbol symbol)
public
static
IList
<
ITypeParameterSymbol
>
GetReferencedMethodTypeParameters
(
this
ITypeSymbol
type
,
IList
<
ITypeParameterSymbol
>
result
=
null
)
{
result
=
result
??
new
List
<
ITypeParameterSymbol
>();
result
??=
new
List
<
ITypeParameterSymbol
>();
type
?.
Accept
(
new
CollectTypeParameterSymbolsVisitor
(
result
,
onlyMethodTypeParameters
:
true
));
return
result
;
}
...
...
@@ -475,7 +475,7 @@ public static bool IsFormattableString(this ITypeSymbol symbol)
public
static
IList
<
ITypeParameterSymbol
>
GetReferencedTypeParameters
(
this
ITypeSymbol
type
,
IList
<
ITypeParameterSymbol
>
result
=
null
)
{
result
=
result
??
new
List
<
ITypeParameterSymbol
>();
result
??=
new
List
<
ITypeParameterSymbol
>();
type
?.
Accept
(
new
CollectTypeParameterSymbolsVisitor
(
result
,
onlyMethodTypeParameters
:
false
));
return
result
;
}
...
...
src/Workspaces/Core/Portable/Shared/Utilities/BloomFilter.cs
浏览文件 @
76e58709
...
...
@@ -324,7 +324,7 @@ public void Add(string value)
private
int
GetBitArrayIndex
(
string
value
,
int
i
)
{
var
hash
=
ComputeHash
(
value
,
i
);
hash
=
hash
%
_bitArray
.
Length
;
hash
%=
_bitArray
.
Length
;
return
Math
.
Abs
(
hash
);
}
...
...
@@ -339,7 +339,7 @@ public void Add(long value)
private
int
GetBitArrayIndex
(
long
value
,
int
i
)
{
var
hash
=
ComputeHash
(
value
,
i
);
hash
=
hash
%
_bitArray
.
Length
;
hash
%=
_bitArray
.
Length
;
return
Math
.
Abs
(
hash
);
}
...
...
src/Workspaces/Core/Portable/Shared/Utilities/NameGenerator.cs
浏览文件 @
76e58709
...
...
@@ -61,7 +61,7 @@ internal static IList<string> EnsureUniqueness(IList<string> names, bool isCaseS
Func
<
string
,
bool
>
canUse
,
bool
isCaseSensitive
=
true
)
{
canUse
=
canUse
??
(
s
=>
true
);
canUse
??=
(
s
=>
true
);
// Don't enumerate as we will be modifying the collection in place.
for
(
var
i
=
0
;
i
<
names
.
Count
;
i
++)
...
...
src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs
浏览文件 @
76e58709
...
...
@@ -59,7 +59,7 @@ protected virtual SyntaxNode TransformReducedNode(SyntaxNode reducedNode, Syntax
return
document
;
}
optionSet
=
optionSet
??
await
document
.
GetOptionsAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
optionSet
??=
await
document
.
GetOptionsAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
...
...
src/Workspaces/Core/Portable/Utilities/BKTree.cs
浏览文件 @
76e58709
...
...
@@ -85,7 +85,7 @@ public IList<string> Find(string value, int? threshold = null)
lowerCaseCharacters
[
i
]
=
CaseInsensitiveComparison
.
ToLower
(
value
[
i
]);
}
threshold
=
threshold
??
WordSimilarityChecker
.
GetThreshold
(
value
);
threshold
??=
WordSimilarityChecker
.
GetThreshold
(
value
);
var
result
=
new
List
<
string
>();
Lookup
(
_nodes
[
0
],
lowerCaseCharacters
,
value
.
Length
,
threshold
.
Value
,
result
,
recursionCount
:
0
);
return
result
;
...
...
src/Workspaces/Core/Portable/Utilities/CompilerUtilities/ImmutableHashMap.cs
浏览文件 @
76e58709
...
...
@@ -1003,7 +1003,7 @@ private static int CountBits(uint v)
{
unchecked
{
v
=
v
-
((
v
>>
1
)
&
0x55555555u
);
v
-=
((
v
>>
1
)
&
0x55555555u
);
v
=
(
v
&
0x33333333u
)
+
((
v
>>
2
)
&
0x33333333u
);
return
(
int
)((
v
+
(
v
>>
4
)
&
0xF0F0F0Fu
)
*
0x1010101u
)
>>
24
;
}
...
...
src/Workspaces/Core/Portable/Utilities/Contract.cs
浏览文件 @
76e58709
...
...
@@ -15,7 +15,7 @@ internal static class Contract
{
if
(
value
==
null
)
{
message
=
message
??
"Unexpected Null"
;
message
??=
"Unexpected Null"
;
Fail
(
message
);
}
}
...
...
@@ -28,7 +28,7 @@ public static void ThrowIfFalse(bool condition, string message = null)
{
if
(!
condition
)
{
message
=
message
??
"Unexpected false"
;
message
??=
"Unexpected false"
;
Fail
(
message
);
}
}
...
...
@@ -41,7 +41,7 @@ public static void ThrowIfTrue(bool condition, string message = null)
{
if
(
condition
)
{
message
=
message
??
"Unexpected true"
;
message
??=
"Unexpected true"
;
Fail
(
message
);
}
}
...
...
src/Workspaces/Core/Portable/Utilities/SerializableBytes.cs
浏览文件 @
76e58709
...
...
@@ -49,7 +49,7 @@ internal async static Task<PooledStream> CreateReadableStreamAsync(Stream stream
var
bytesRead
=
await
stream
.
ReadAsync
(
chunk
,
chunkOffset
,
count
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
bytesRead
>
0
)
{
count
=
count
-
bytesRead
;
count
-=
bytesRead
;
chunkOffset
+=
bytesRead
;
}
else
...
...
src/Workspaces/Core/Portable/Workspace/Host/TaskScheduler/WorkspaceTaskSchedulerFactory.WorkspaceTaskQueue.cs
浏览文件 @
76e58709
...
...
@@ -22,7 +22,7 @@ public WorkspaceTaskQueue(WorkspaceTaskSchedulerFactory factory, TaskScheduler t
private
T3
ScheduleTask
<
T1
,
T2
,
T3
>(
Func
<
T1
,
T2
,
T3
>
taskScheduler
,
string
taskName
,
T1
arg1
,
T2
arg2
)
where
T3
:
Task
{
taskName
=
taskName
??
GetType
().
Name
+
".Task"
;
taskName
??=
GetType
().
Name
+
".Task"
;
var
asyncToken
=
_factory
.
BeginAsyncOperation
(
taskName
);
var
task
=
taskScheduler
(
arg1
,
arg2
);
...
...
src/Workspaces/Core/Portable/Workspace/Host/TaskScheduler/WorkspaceTaskSchedulerFactory.WorkspaceTaskScheduler.cs
浏览文件 @
76e58709
...
...
@@ -24,7 +24,7 @@ public WorkspaceTaskScheduler(WorkspaceTaskSchedulerFactory factory, TaskSchedul
string
taskName
,
Func
<
TTask
>
taskCreator
)
where
TTask
:
Task
{
taskName
=
taskName
??
GetType
().
Name
+
".ScheduleTask"
;
taskName
??=
GetType
().
Name
+
".ScheduleTask"
;
var
asyncToken
=
_factory
.
BeginAsyncOperation
(
taskName
);
var
task
=
taskCreator
();
...
...
src/Workspaces/Core/Portable/Workspace/Solution/SolutionId.cs
浏览文件 @
76e58709
...
...
@@ -42,7 +42,7 @@ public static SolutionId CreateFromSerialized(Guid id, string debugName = null)
throw
new
ArgumentException
(
nameof
(
id
));
}
debugName
=
debugName
??
"unsaved"
;
debugName
??=
"unsaved"
;
return
new
SolutionId
(
id
,
debugName
);
}
...
...
src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs
浏览文件 @
76e58709
...
...
@@ -185,13 +185,13 @@ private void CheckInvariants()
{
var
branchId
=
GetBranchId
();
solutionAttributes
=
solutionAttributes
??
_solutionAttributes
;
projectIds
=
projectIds
??
_projectIds
;
idToProjectStateMap
=
idToProjectStateMap
??
_projectIdToProjectStateMap
;
projectIdToTrackerMap
=
projectIdToTrackerMap
??
_projectIdToTrackerMap
;
filePathToDocumentIdsMap
=
filePathToDocumentIdsMap
??
_filePathToDocumentIdsMap
;
dependencyGraph
=
dependencyGraph
??
_dependencyGraph
;
lazyLatestProjectVersion
=
lazyLatestProjectVersion
??
_lazyLatestProjectVersion
;
solutionAttributes
??=
_solutionAttributes
;
projectIds
??=
_projectIds
;
idToProjectStateMap
??=
_projectIdToProjectStateMap
;
projectIdToTrackerMap
??=
_projectIdToTrackerMap
;
filePathToDocumentIdsMap
??=
_filePathToDocumentIdsMap
;
dependencyGraph
??=
_dependencyGraph
;
lazyLatestProjectVersion
??=
_lazyLatestProjectVersion
;
if
(
branchId
==
_branchId
&&
solutionAttributes
==
_solutionAttributes
&&
...
...
@@ -1670,7 +1670,7 @@ private SolutionState WithAnalyzerConfigDocumentState(AnalyzerConfigDocumentStat
var
projectId
=
newProjectState
.
Id
;
var
newStateMap
=
_projectIdToProjectStateMap
.
SetItem
(
projectId
,
newProjectState
);
newDependencyGraph
=
newDependencyGraph
??
_dependencyGraph
;
newDependencyGraph
??=
_dependencyGraph
;
var
newTrackerMap
=
CreateCompilationTrackerMap
(
projectId
,
newDependencyGraph
);
// If we have a tracker for this project, then fork it as well (along with the
// translation action and store it in the tracker map.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录