Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
3d47c50d
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,发现更多精彩内容 >>
提交
3d47c50d
编写于
1月 29, 2015
作者:
J
jasonmalinowski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass CancellationTokens when we have one. (changeset 1407253)
上级
ebc795d4
变更
81
隐藏空白更改
内联
并排
Showing
81 changed file
with
128 addition
and
126 deletion
+128
-126
src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs
.../CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs
+1
-1
src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs
...rs/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs
+1
-1
src/Compilers/CSharp/Portable/Compiler/UnprocessedDocumentationCommentFinder.cs
...ortable/Compiler/UnprocessedDocumentationCommentFinder.cs
+1
-1
src/Compilers/CSharp/Portable/Syntax/NamespaceDeclarationSyntaxReference.cs
...rp/Portable/Syntax/NamespaceDeclarationSyntaxReference.cs
+1
-1
src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs
src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs
+2
-2
src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA1309CSharpCodeFixProvider.cs
...rp/Globalization/CodeFixes/CA1309CSharpCodeFixProvider.cs
+1
-1
src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA2101CSharpCodeFixProvider.cs
...rp/Globalization/CodeFixes/CA2101CSharpCodeFixProvider.cs
+1
-1
src/Diagnostics/FxCop/CSharp/Usage/CodeFixes/CA2213CSharpCodeFixProvider.cs
...Cop/CSharp/Usage/CodeFixes/CA2213CSharpCodeFixProvider.cs
+1
-1
src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1008CodeFixProviderBase.cs
.../FxCop/Core/Design/CodeFixes/CA1008CodeFixProviderBase.cs
+3
-3
src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1012CodeFixProvider.cs
...tics/FxCop/Core/Design/CodeFixes/CA1012CodeFixProvider.cs
+1
-1
src/Diagnostics/FxCop/Core/Design/CodeFixes/EnumWithFlagsCodeFixProviderBase.cs
...Core/Design/CodeFixes/EnumWithFlagsCodeFixProviderBase.cs
+2
-2
src/Diagnostics/FxCop/Core/Design/EnumWithFlagsDiagnosticAnalyzer.cs
...tics/FxCop/Core/Design/EnumWithFlagsDiagnosticAnalyzer.cs
+2
-2
src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2229CodeFixProvider.cs
...stics/FxCop/Core/Usage/CodeFixes/CA2229CodeFixProvider.cs
+1
-1
src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2235CodeFixProviderBase.cs
...s/FxCop/Core/Usage/CodeFixes/CA2235CodeFixProviderBase.cs
+2
-2
src/Diagnostics/Roslyn/CSharp/ApiDesign/CancellationTokenMustBeLastCodeFixProvider.cs
...p/ApiDesign/CancellationTokenMustBeLastCodeFixProvider.cs
+2
-2
src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/CurlyBraceCompletionSession.cs
...tomaticCompletion/Sessions/CurlyBraceCompletionSession.cs
+1
-1
src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/LessAndGreaterThanCompletionSession.cs
...ompletion/Sessions/LessAndGreaterThanCompletionSession.cs
+1
-1
src/EditorFeatures/CSharp/Completion/CompletionProviders/XmlDocCommentCompletion/XmlDocCommentCompletionProvider.cs
...mlDocCommentCompletion/XmlDocCommentCompletionProvider.cs
+1
-1
src/EditorFeatures/CSharp/NavigationBar/CSharpNavigationBarItemService.cs
...es/CSharp/NavigationBar/CSharpNavigationBarItemService.cs
+1
-1
src/EditorFeatures/CSharp/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs
...atureHelp/ElementAccessExpressionSignatureHelpProvider.cs
+1
-1
src/EditorFeatures/CSharpTest/CodeActions/Preview/PreviewTests.cs
...orFeatures/CSharpTest/CodeActions/Preview/PreviewTests.cs
+1
-1
src/EditorFeatures/Core/Extensibility/NavigationBar/AbstractNavigationBarItemService.cs
...ibility/NavigationBar/AbstractNavigationBarItemService.cs
+1
-1
src/EditorFeatures/Core/Implementation/CallHierarchy/CallHierarchyProvider.cs
...ore/Implementation/CallHierarchy/CallHierarchyProvider.cs
+1
-1
src/EditorFeatures/Core/Implementation/CallHierarchy/Finders/AbstractCallFinder.cs
...mplementation/CallHierarchy/Finders/AbstractCallFinder.cs
+1
-1
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/CompletionProviders/AbstractMemberInsertingCompletionProvider.cs
...ionProviders/AbstractMemberInsertingCompletionProvider.cs
+4
-4
src/EditorFeatures/Core/Implementation/MetadataAsSource/MetadataAsSourceFileService.cs
...mentation/MetadataAsSource/MetadataAsSourceFileService.cs
+1
-1
src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs
.../RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs
+1
-1
src/EditorFeatures/Core/SymbolMapping/SymbolMappingServiceFactory.cs
...eatures/Core/SymbolMapping/SymbolMappingServiceFactory.cs
+1
-1
src/Features/CSharp/ChangeSignature/CSharpChangeSignatureService.cs
...es/CSharp/ChangeSignature/CSharpChangeSignatureService.cs
+7
-7
src/Features/CSharp/CodeFixes/Async/CSharpConvertToAsyncMethodCodeFixProvider.cs
...eFixes/Async/CSharpConvertToAsyncMethodCodeFixProvider.cs
+1
-1
src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.ReferenceRewriter.cs
...lineTemporaryCodeRefactoringProvider.ReferenceRewriter.cs
+1
-1
src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs
...InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs
+1
-1
src/Features/CSharp/CodeRefactorings/InvertIf/InvertIfCodeRefactoringProvider.cs
...eRefactorings/InvertIf/InvertIfCodeRefactoringProvider.cs
+1
-1
src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.State.cs
...eDeclarationNearReferenceCodeRefactoringProvider.State.cs
+1
-1
src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.cs
...ce/MoveDeclarationNearReferenceCodeRefactoringProvider.cs
+1
-1
src/Features/CSharp/Completion/CompletionProviders/CrefCompletionProvider.cs
.../Completion/CompletionProviders/CrefCompletionProvider.cs
+2
-2
src/Features/CSharp/Completion/CompletionProviders/ObjectCreationCompletionProvider.cs
...n/CompletionProviders/ObjectCreationCompletionProvider.cs
+1
-1
src/Features/CSharp/Completion/KeywordRecommenders/EnumKeywordRecommender.cs
.../Completion/KeywordRecommenders/EnumKeywordRecommender.cs
+2
-1
src/Features/CSharp/EncapsulateField/CSharpEncapsulateFieldService.cs
.../CSharp/EncapsulateField/CSharpEncapsulateFieldService.cs
+2
-2
src/Features/CSharp/GenerateType/CSharpGenerateTypeService.cs
...Features/CSharp/GenerateType/CSharpGenerateTypeService.cs
+3
-3
src/Features/CSharp/IntroduceVariable/CSharpIntroduceVariableService_IntroduceLocal.cs
...Variable/CSharpIntroduceVariableService_IntroduceLocal.cs
+1
-1
src/Features/Core/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs
...re/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs
+1
-1
src/Features/Core/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs
...e/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs
+1
-1
src/Features/Core/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.cs
...deFixes/Suppression/AbstractSuppressionCodeFixProvider.cs
+1
-1
src/Features/Core/EncapsulateField/AbstractEncapsulateFieldService.cs
.../Core/EncapsulateField/AbstractEncapsulateFieldService.cs
+5
-5
src/Features/Core/ExtractInterface/AbstractExtractInterfaceService.cs
.../Core/ExtractInterface/AbstractExtractInterfaceService.cs
+1
-1
src/Features/Core/GenerateFromMembers/AddConstructorParameters/AbstractAddConstructorParametersService.CodeAction.cs
...ers/AbstractAddConstructorParametersService.CodeAction.cs
+1
-1
src/Features/Core/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.State.cs
...rateEnumMember/AbstractGenerateEnumMemberService.State.cs
+1
-1
src/Features/Core/GenerateMember/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs
...arameterizedMember/AbstractGenerateMethodService.State.cs
+1
-1
src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.GenerateLocalCodeAction.cs
...bstractGenerateVariableService.GenerateLocalCodeAction.cs
+2
-1
src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.State.cs
...GenerateVariable/AbstractGenerateVariableService.State.cs
+1
-1
src/Features/Core/GenerateType/AbstractGenerateTypeService.State.cs
...es/Core/GenerateType/AbstractGenerateTypeService.State.cs
+1
-1
src/Features/Core/GenerateType/AbstractGenerateTypeService.cs
...Features/Core/GenerateType/AbstractGenerateTypeService.cs
+1
-1
src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State.cs
...troduceVariable/AbstractIntroduceVariableService.State.cs
+1
-1
src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_ConstructorInitializer.cs
...tIntroduceVariableService.State_ConstructorInitializer.cs
+1
-1
src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Field.cs
...eVariable/AbstractIntroduceVariableService.State_Field.cs
+1
-1
src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Query.cs
...eVariable/AbstractIntroduceVariableService.State_Query.cs
+1
-1
src/Features/Core/MetadataAsSource/MetadataAsSourceHelpers.cs
...Features/Core/MetadataAsSource/MetadataAsSourceHelpers.cs
+1
-1
src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs
src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs
+4
-4
src/Workspaces/CSharp/Portable/Extensions/ArgumentSyntaxExtensions.cs
...es/CSharp/Portable/Extensions/ArgumentSyntaxExtensions.cs
+1
-1
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
.../Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
+2
-2
src/Workspaces/CSharp/Portable/Extensions/CrefSyntaxExtensions.cs
...spaces/CSharp/Portable/Extensions/CrefSyntaxExtensions.cs
+1
-1
src/Workspaces/CSharp/Portable/Extensions/ExpressionSyntaxExtensions.cs
.../CSharp/Portable/Extensions/ExpressionSyntaxExtensions.cs
+9
-9
src/Workspaces/CSharp/Portable/Extensions/TypeDeclarationSyntaxExtensions.cs
...rp/Portable/Extensions/TypeDeclarationSyntaxExtensions.cs
+1
-1
src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs
...p/Portable/Recommendations/CSharpRecommendationService.cs
+2
-2
src/Workspaces/Core/Desktop/Workspace/MSBuild/MSBuildWorkspace.cs
...spaces/Core/Desktop/Workspace/MSBuild/MSBuildWorkspace.cs
+2
-2
src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs
...rtable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs
+2
-2
src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs
...neration/AbstractCodeGenerationService_FindDeclaration.cs
+1
-1
src/Workspaces/Core/Portable/Editing/SymbolEditor.cs
src/Workspaces/Core/Portable/Editing/SymbolEditor.cs
+3
-3
src/Workspaces/Core/Portable/Editing/SymbolEditorExtensions.cs
...orkspaces/Core/Portable/Editing/SymbolEditorExtensions.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentProjectsFinder.cs
...ble/FindSymbols/FindReferences/DependentProjectsFinder.cs
+2
-2
src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs
...ortable/FindSymbols/FindReferences/DependentTypeFinder.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMemberScopedReferenceFinder.cs
...References/Finders/AbstractMemberScopedReferenceFinder.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ParameterSymbolReferenceFinder.cs
.../FindReferences/Finders/ParameterSymbolReferenceFinder.cs
+4
-4
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder.cs
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Declarations.cs
...es/Core/Portable/FindSymbols/SymbolFinder_Declarations.cs
+1
-1
src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs
...ble/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs
+1
-1
src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs
...ble/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs
+1
-1
src/Workspaces/Core/Portable/SymbolId/SymbolKey.BodyLevelSymbolKey.cs
...es/Core/Portable/SymbolId/SymbolKey.BodyLevelSymbolKey.cs
+1
-1
src/Workspaces/Core/Portable/SymbolId/SymbolKey.MethodSymbolKey.cs
...paces/Core/Portable/SymbolId/SymbolKey.MethodSymbolKey.cs
+1
-1
src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs
src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs
+1
-1
未找到文件。
src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs
浏览文件 @
3d47c50d
...
...
@@ -15,7 +15,7 @@ internal class CSharpDeclarationComputer : DeclarationComputer
public
static
ImmutableArray
<
DeclarationInfo
>
GetDeclarationsInSpan
(
SemanticModel
model
,
TextSpan
span
,
bool
getSymbol
,
CancellationToken
cancellationToken
)
{
var
builder
=
ArrayBuilder
<
DeclarationInfo
>.
GetInstance
();
ComputeDeclarations
(
model
,
model
.
SyntaxTree
.
GetRoot
(),
ComputeDeclarations
(
model
,
model
.
SyntaxTree
.
GetRoot
(
cancellationToken
),
(
node
,
level
)
=>
!
node
.
Span
.
OverlapsWith
(
span
)
||
InvalidLevel
(
level
),
getSymbol
,
builder
,
null
,
cancellationToken
);
return
builder
.
ToImmutable
();
...
...
src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs
浏览文件 @
3d47c50d
...
...
@@ -1896,7 +1896,7 @@ public override IParameterSymbol GetDeclaredSymbol(ParameterSyntax declarationSy
if
(
memberModel
!=
null
)
{
// Could be parameter of lambda.
return
memberModel
.
GetDeclaredSymbol
(
declarationSyntax
);
return
memberModel
.
GetDeclaredSymbol
(
declarationSyntax
,
cancellationToken
);
}
return
GetDeclaredNonLambdaParameterSymbol
(
declarationSyntax
,
cancellationToken
);
...
...
src/Compilers/CSharp/Portable/Compiler/UnprocessedDocumentationCommentFinder.cs
浏览文件 @
3d47c50d
...
...
@@ -27,7 +27,7 @@ public static void ReportUnprocessed(SyntaxTree tree, TextSpan? filterSpanWithin
if
(
tree
.
ReportDocumentationCommentDiagnostics
())
{
UnprocessedDocumentationCommentFinder
finder
=
new
UnprocessedDocumentationCommentFinder
(
diagnostics
,
filterSpanWithinTree
,
cancellationToken
);
finder
.
Visit
(
tree
.
GetRoot
());
finder
.
Visit
(
tree
.
GetRoot
(
cancellationToken
));
}
}
...
...
src/Compilers/CSharp/Portable/Syntax/NamespaceDeclarationSyntaxReference.cs
浏览文件 @
3d47c50d
...
...
@@ -20,7 +20,7 @@ public NamespaceDeclarationSyntaxReference(SyntaxReference reference)
protected
override
SyntaxNode
Translate
(
SyntaxReference
reference
,
CancellationToken
cancellationToken
)
{
var
node
=
(
CSharpSyntaxNode
)
reference
.
GetSyntax
();
var
node
=
(
CSharpSyntaxNode
)
reference
.
GetSyntax
(
cancellationToken
);
// If the node is a name syntax, it's something like "X" or "X.Y" in :
// namespace X.Y.Z
...
...
src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs
浏览文件 @
3d47c50d
...
...
@@ -344,10 +344,10 @@ public override SyntaxNode GetSyntax(CancellationToken cancellationToken)
// Note: It's important for us to maintain identity of nodes/trees, so we find
// the equivalent node in our CountedSyntaxTree.
countedSyntaxTree
.
AccessCount
++;
var
nodeInUnderlying
=
underlyingSyntaxReference
.
GetSyntax
();
var
nodeInUnderlying
=
underlyingSyntaxReference
.
GetSyntax
(
cancellationToken
);
var
token
=
countedSyntaxTree
.
GetCompilationUnitRoot
().
FindToken
(
nodeInUnderlying
.
SpanStart
);
var
token
=
countedSyntaxTree
.
GetCompilationUnitRoot
(
cancellationToken
).
FindToken
(
nodeInUnderlying
.
SpanStart
);
for
(
var
node
=
token
.
Parent
;
node
!=
null
;
node
=
node
.
Parent
)
{
if
(
node
.
Span
==
nodeInUnderlying
.
Span
&&
node
.
RawKind
==
nodeInUnderlying
.
RawKind
)
...
...
src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA1309CSharpCodeFixProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -47,7 +47,7 @@ internal override Task<Document> GetUpdatedDocumentAsync(Document document, Sema
var
invokeParent
=
identifier
.
GetAncestor
<
InvocationExpressionSyntax
>();
if
(
invokeParent
!=
null
)
{
var
methodSymbol
=
model
.
GetSymbolInfo
(
identifier
).
Symbol
as
IMethodSymbol
;
var
methodSymbol
=
model
.
GetSymbolInfo
(
identifier
,
cancellationToken
).
Symbol
as
IMethodSymbol
;
if
(
methodSymbol
!=
null
&&
CanAddStringComparison
(
methodSymbol
))
{
// append a new StringComparison.Ordinal argument
...
...
src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA2101CSharpCodeFixProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -39,7 +39,7 @@ internal override Task<Document> GetUpdatedDocumentAsync(Document document, Sema
{
// could be either a [DllImport] or [MarshalAs] attribute
var
attribute
=
(
AttributeSyntax
)
nodeToFix
;
var
attributeType
=
model
.
GetSymbolInfo
(
attribute
).
Symbol
;
var
attributeType
=
model
.
GetSymbolInfo
(
attribute
,
cancellationToken
).
Symbol
;
var
arguments
=
attribute
.
ArgumentList
.
Arguments
;
if
(
dllImportType
.
Equals
(
attributeType
.
ContainingType
))
{
...
...
src/Diagnostics/FxCop/CSharp/Usage/CodeFixes/CA2213CSharpCodeFixProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -46,7 +46,7 @@ internal override Task<Document> GetUpdatedDocumentAsync(Document document, Sema
}
var
factory
=
document
.
GetLanguageService
<
SyntaxGenerator
>();
var
symbol
=
model
.
GetDeclaredSymbol
(
syntaxNode
);
var
symbol
=
model
.
GetDeclaredSymbol
(
syntaxNode
,
cancellationToken
);
// handle a case where a local in the Dipose method with the same name by generating this (or ClassName) and simplifying it
var
path
=
symbol
.
IsStatic
...
...
src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1008CodeFixProviderBase.cs
浏览文件 @
3d47c50d
...
...
@@ -60,7 +60,7 @@ private SyntaxNode GetExplicitlyAssignedField(IFieldSymbol originalField, Syntax
private
async
Task
<
Document
>
GetUpdatedDocumentForRuleNameRenameAsync
(
Document
document
,
IFieldSymbol
field
,
CancellationToken
cancellationToken
)
{
var
newSolution
=
await
Rename
.
Renamer
.
RenameSymbolAsync
(
document
.
Project
.
Solution
,
field
,
"None"
,
null
).
ConfigureAwait
(
false
);
var
newSolution
=
await
Rename
.
Renamer
.
RenameSymbolAsync
(
document
.
Project
.
Solution
,
field
,
"None"
,
null
,
cancellationToken
).
ConfigureAwait
(
false
);
return
newSolution
.
GetDocument
(
document
.
Id
);
}
...
...
@@ -93,7 +93,7 @@ private async Task ApplyRuleNameMultipleZeroAsync(SymbolEditor editor, INamedTyp
}
else
{
await
editor
.
EditOneDeclarationAsync
(
field
,
(
e
,
d
)
=>
e
.
RemoveNode
(
d
));
// removes the field declaration
await
editor
.
EditOneDeclarationAsync
(
field
,
(
e
,
d
)
=>
e
.
RemoveNode
(
d
)
,
cancellationToken
);
// removes the field declaration
makeNextFieldExplicit
=
true
;
}
}
...
...
@@ -111,7 +111,7 @@ private async Task ApplyRuleNameNoZeroValueAsync(SymbolEditor editor, INamedType
{
if
(
CA1008DiagnosticAnalyzer
.
IsMemberNamedNone
(
field
))
{
await
editor
.
EditOneDeclarationAsync
(
field
,
(
e
,
d
)
=>
e
.
RemoveNode
(
d
));
await
editor
.
EditOneDeclarationAsync
(
field
,
(
e
,
d
)
=>
e
.
RemoveNode
(
d
)
,
cancellationToken
);
}
}
...
...
src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1012CodeFixProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -37,7 +37,7 @@ private static SyntaxNode GetDeclaration(ISymbol symbol)
internal
override
Task
<
Document
>
GetUpdatedDocumentAsync
(
Document
document
,
SemanticModel
model
,
SyntaxNode
root
,
SyntaxNode
nodeToFix
,
Diagnostic
diagnostic
,
CancellationToken
cancellationToken
)
{
var
classSymbol
=
(
INamedTypeSymbol
)
model
.
GetDeclaredSymbol
(
nodeToFix
);
var
classSymbol
=
(
INamedTypeSymbol
)
model
.
GetDeclaredSymbol
(
nodeToFix
,
cancellationToken
);
var
instanceConstructors
=
classSymbol
.
InstanceConstructors
.
Where
(
t
=>
t
.
DeclaredAccessibility
==
Accessibility
.
Public
).
Select
(
t
=>
GetDeclaration
(
t
)).
Where
(
d
=>
d
!=
null
).
ToList
();
var
generator
=
SyntaxGenerator
.
GetGenerator
(
document
);
var
newRoot
=
root
.
ReplaceNodes
(
instanceConstructors
,
(
original
,
rewritten
)
=>
generator
.
WithAccessibility
(
original
,
Accessibility
.
Protected
));
...
...
src/Diagnostics/FxCop/Core/Design/CodeFixes/EnumWithFlagsCodeFixProviderBase.cs
浏览文件 @
3d47c50d
...
...
@@ -61,11 +61,11 @@ private static SyntaxNode AddFlagsAttribute(Workspace workspace, SyntaxNode enum
private
static
SyntaxNode
RemoveFlagsAttribute
(
Workspace
workspace
,
SemanticModel
model
,
SyntaxNode
enumTypeSyntax
,
INamedTypeSymbol
flagsAttributeType
,
CancellationToken
cancellationToken
)
{
var
enumType
=
model
.
GetDeclaredSymbol
(
enumTypeSyntax
)
as
INamedTypeSymbol
;
var
enumType
=
model
.
GetDeclaredSymbol
(
enumTypeSyntax
,
cancellationToken
)
as
INamedTypeSymbol
;
Contract
.
ThrowIfNull
(
enumType
);
var
flagsAttribute
=
enumType
.
GetAttributes
().
First
(
a
=>
a
.
AttributeClass
==
flagsAttributeType
);
var
attributeNode
=
flagsAttribute
.
ApplicationSyntaxReference
.
GetSyntax
();
var
attributeNode
=
flagsAttribute
.
ApplicationSyntaxReference
.
GetSyntax
(
cancellationToken
);
var
generator
=
SyntaxGenerator
.
GetGenerator
(
workspace
,
enumTypeSyntax
.
Language
);
return
generator
.
RemoveNode
(
enumTypeSyntax
,
attributeNode
);
...
...
src/Diagnostics/FxCop/Core/Design/EnumWithFlagsDiagnosticAnalyzer.cs
浏览文件 @
3d47c50d
...
...
@@ -94,7 +94,7 @@ protected override void AnalyzeSymbol(INamedTypeSymbol symbol, Compilation compi
Contract
.
ThrowIfNull
(
missingValues
);
var
missingValuesString
=
missingValues
.
Select
(
v
=>
v
.
ToString
()).
Aggregate
((
i
,
j
)
=>
i
+
", "
+
j
);
var
location
=
GetDiagnosticLocation
(
symbol
.
DeclaringSyntaxReferences
[
0
].
GetSyntax
());
var
location
=
GetDiagnosticLocation
(
symbol
.
DeclaringSyntaxReferences
[
0
].
GetSyntax
(
cancellationToken
));
addDiagnostic
(
location
.
CreateDiagnostic
(
Rule2217
,
symbol
.
Name
,
missingValuesString
));
}
}
...
...
@@ -104,7 +104,7 @@ protected override void AnalyzeSymbol(INamedTypeSymbol symbol, Compilation compi
// Ignore continguous value enums to reduce noise.
if
(!
IsContiguous
(
memberValues
)
&&
ShouldBeFlags
(
memberValues
))
{
var
location
=
GetDiagnosticLocation
(
symbol
.
DeclaringSyntaxReferences
[
0
].
GetSyntax
());
var
location
=
GetDiagnosticLocation
(
symbol
.
DeclaringSyntaxReferences
[
0
].
GetSyntax
(
cancellationToken
));
addDiagnostic
(
location
.
CreateDiagnostic
(
Rule1027
,
symbol
.
Name
));
}
}
...
...
src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2229CodeFixProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -31,7 +31,7 @@ protected sealed override string GetCodeFixDescription(Diagnostic diagnostic)
internal
async
override
Task
<
Document
>
GetUpdatedDocumentAsync
(
Document
document
,
SemanticModel
model
,
SyntaxNode
root
,
SyntaxNode
nodeToFix
,
Diagnostic
diagnostic
,
CancellationToken
cancellationToken
)
{
var
symbol
=
model
.
GetDeclaredSymbol
(
nodeToFix
);
var
symbol
=
model
.
GetDeclaredSymbol
(
nodeToFix
,
cancellationToken
);
var
generator
=
SyntaxGenerator
.
GetGenerator
(
document
);
// There was no constructor and so the diagnostic was on the type. Generate a serlialization ctor.
...
...
src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2235CodeFixProviderBase.cs
浏览文件 @
3d47c50d
...
...
@@ -37,11 +37,11 @@ internal async override Task<IEnumerable<CodeAction>> GetFixesAsync(Document doc
actions
=
SpecializedCollections
.
SingletonEnumerable
(
codeAction
);
// Fix 2: If the type of the field is defined in source, then add the serializable attribute to the type.
var
fieldSymbol
=
model
.
GetDeclaredSymbol
(
nodeToFix
)
as
IFieldSymbol
;
var
fieldSymbol
=
model
.
GetDeclaredSymbol
(
nodeToFix
,
cancellationToken
)
as
IFieldSymbol
;
var
type
=
fieldSymbol
.
Type
;
if
(
type
.
Locations
.
Any
(
l
=>
l
.
IsInSource
))
{
var
typeDeclNode
=
type
.
DeclaringSyntaxReferences
.
First
().
GetSyntax
();
var
typeDeclNode
=
type
.
DeclaringSyntaxReferences
.
First
().
GetSyntax
(
cancellationToken
);
var
serializableAttr
=
generator
.
Attribute
(
generator
.
TypeExpression
(
WellKnownTypes
.
SerializableAttribute
(
model
.
Compilation
)));
var
newTypeDeclNode
=
generator
.
AddAttributes
(
typeDeclNode
,
serializableAttr
);
...
...
src/Diagnostics/Roslyn/CSharp/ApiDesign/CancellationTokenMustBeLastCodeFixProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -67,7 +67,7 @@ public override string Title
protected
override
async
Task
<
Document
>
GetChangedDocumentAsync
(
CancellationToken
cancellationToken
)
{
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
methodSymbol
=
semanticModel
.
GetDeclaredSymbol
(
declaration
);
var
methodSymbol
=
semanticModel
.
GetDeclaredSymbol
(
declaration
,
cancellationToken
);
var
compilation
=
await
document
.
Project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
cancellationTokenType
=
compilation
.
GetTypeByMetadataName
(
"System.Threading.CancellationToken"
);
...
...
@@ -75,7 +75,7 @@ protected override async Task<Document> GetChangedDocumentAsync(CancellationToke
var
nonCancellationTokenParameters
=
new
List
<
ParameterSyntax
>();
foreach
(
var
param
in
declaration
.
ParameterList
.
Parameters
)
{
var
paramSymbol
=
semanticModel
.
GetDeclaredSymbol
(
param
);
var
paramSymbol
=
semanticModel
.
GetDeclaredSymbol
(
param
,
cancellationToken
);
if
(
paramSymbol
.
Type
.
Equals
(
cancellationTokenType
))
{
cancellationTokenParameters
.
Add
(
param
);
...
...
src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/CurlyBraceCompletionSession.cs
浏览文件 @
3d47c50d
...
...
@@ -67,7 +67,7 @@ public override void AfterReturn(IBraceCompletionSession session, CancellationTo
// first add one line in between, and format braces
if
(
session
.
SubjectBuffer
.
GetOption
(
FeatureOnOffOptions
.
AutoFormattingOnCloseBrace
))
{
document
.
InsertText
(
session
.
ClosingPoint
.
GetPosition
(
session
.
SubjectBuffer
.
CurrentSnapshot
)
-
1
,
Environment
.
NewLine
);
document
.
InsertText
(
session
.
ClosingPoint
.
GetPosition
(
session
.
SubjectBuffer
.
CurrentSnapshot
)
-
1
,
Environment
.
NewLine
,
cancellationToken
);
FormatTrackingSpan
(
session
,
GetFormattingRules
(
document
));
}
...
...
src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/LessAndGreaterThanCompletionSession.cs
浏览文件 @
3d47c50d
...
...
@@ -58,7 +58,7 @@ private bool PossibleTypeArgument(ITextSnapshot snapshot, SyntaxToken token, Can
}
var
model
=
document
.
GetSemanticModelAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
var
info
=
model
.
GetSymbolInfo
(
node
.
Left
);
var
info
=
model
.
GetSymbolInfo
(
node
.
Left
,
cancellationToken
);
return
info
.
CandidateSymbols
.
Any
(
IsGenericTypeOrMethod
);
}
...
...
src/EditorFeatures/CSharp/Completion/CompletionProviders/XmlDocCommentCompletion/XmlDocCommentCompletionProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -81,7 +81,7 @@ protected override async Task<IEnumerable<CompletionItem>> GetItemsWorkerAsync(D
var
typeDeclaration
=
attachedToken
.
GetAncestor
<
TypeDeclarationSyntax
>();
if
(
typeDeclaration
!=
null
)
{
declaredSymbol
=
semanticModel
.
GetDeclaredSymbol
(
typeDeclaration
);
declaredSymbol
=
semanticModel
.
GetDeclaredSymbol
(
typeDeclaration
,
cancellationToken
);
}
}
...
...
src/EditorFeatures/CSharp/NavigationBar/CSharpNavigationBarItemService.cs
浏览文件 @
3d47c50d
...
...
@@ -307,7 +307,7 @@ private static void AddEnumMemberSpan(ISymbol symbol, SyntaxTree tree, List<Text
protected
internal
override
VirtualTreePoint
?
GetSymbolItemNavigationPoint
(
Document
document
,
NavigationBarSymbolItem
item
,
CancellationToken
cancellationToken
)
{
var
compilation
=
document
.
Project
.
GetCompilationAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
var
symbols
=
item
.
NavigationSymbolId
.
Resolve
(
compilation
);
var
symbols
=
item
.
NavigationSymbolId
.
Resolve
(
compilation
,
cancellationToken
:
cancellationToken
);
var
symbol
=
symbols
.
Symbol
;
...
...
src/EditorFeatures/CSharp/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -160,7 +160,7 @@ private bool TryGetComIndexers(SemanticModel semanticModel, ExpressionSyntax exp
if
(
indexers
.
Any
()
&&
expression
is
MemberAccessExpressionSyntax
)
{
expressionType
=
semanticModel
.
GetTypeInfo
(((
MemberAccessExpressionSyntax
)
expression
).
Expression
).
Type
;
expressionType
=
semanticModel
.
GetTypeInfo
(((
MemberAccessExpressionSyntax
)
expression
).
Expression
,
cancellationToken
).
Type
;
return
true
;
}
...
...
src/EditorFeatures/CSharpTest/CodeActions/Preview/PreviewTests.cs
浏览文件 @
3d47c50d
...
...
@@ -71,7 +71,7 @@ protected override Task<Solution> GetChangedSolutionAsync(CancellationToken canc
solution
=
solution
.
AddProject
(
ProjectInfo
.
Create
(
s_addedProjectId
,
VersionStamp
.
Create
(),
AddedProjectName
,
AddedProjectName
,
LanguageNames
.
CSharp
));
// Change a document - This will result in IWpfTextView previews.
solution
=
solution
.
WithDocumentSyntaxRoot
(
_oldDocument
.
Id
,
CSharpSyntaxTree
.
ParseText
(
ChangedDocumentText
).
GetRoot
(
));
solution
=
solution
.
WithDocumentSyntaxRoot
(
_oldDocument
.
Id
,
CSharpSyntaxTree
.
ParseText
(
ChangedDocumentText
,
cancellationToken
:
cancellationToken
).
GetRoot
(
cancellationToken
));
return
Task
.
FromResult
(
solution
);
}
...
...
src/EditorFeatures/Core/Extensibility/NavigationBar/AbstractNavigationBarItemService.cs
浏览文件 @
3d47c50d
...
...
@@ -28,7 +28,7 @@ public void NavigateToSymbolItem(Document document, NavigationBarSymbolItem item
{
var
symbolNavigationService
=
document
.
Project
.
Solution
.
Workspace
.
Services
.
GetService
<
ISymbolNavigationService
>();
var
symbolInfo
=
item
.
NavigationSymbolId
.
Resolve
(
document
.
Project
.
GetCompilationAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
),
ignoreAssemblyKey
:
true
);
var
symbolInfo
=
item
.
NavigationSymbolId
.
Resolve
(
document
.
Project
.
GetCompilationAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
),
ignoreAssemblyKey
:
true
,
cancellationToken
:
cancellationToken
);
var
symbol
=
symbolInfo
.
GetAnySymbol
();
// Do not allow third party navigation to types or constructors
...
...
src/EditorFeatures/Core/Implementation/CallHierarchy/CallHierarchyProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -131,7 +131,7 @@ public async Task<IEnumerable<AbstractCallFinder>> CreateFinders(ISymbol symbol,
public
void
NavigateTo
(
SymbolKey
id
,
Project
project
,
CancellationToken
cancellationToken
)
{
var
compilation
=
project
.
GetCompilationAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
var
resolution
=
id
.
Resolve
(
compilation
);
var
resolution
=
id
.
Resolve
(
compilation
,
cancellationToken
:
cancellationToken
);
project
.
Solution
.
Workspace
.
Services
.
GetService
<
ISymbolNavigationService
>().
TryNavigateToSymbol
(
resolution
.
Symbol
,
project
,
usePreviewTab
:
true
);
}
}
...
...
src/EditorFeatures/Core/Implementation/CallHierarchy/Finders/AbstractCallFinder.cs
浏览文件 @
3d47c50d
...
...
@@ -73,7 +73,7 @@ private async Task SearchAsync(ICallHierarchySearchCallback callback, CallHierar
var
workspace
=
_project
.
Solution
.
Workspace
;
var
currentProject
=
workspace
.
CurrentSolution
.
GetProject
(
_project
.
Id
);
var
compilation
=
await
currentProject
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
resolution
=
_symbol
.
Resolve
(
compilation
);
var
resolution
=
_symbol
.
Resolve
(
compilation
,
cancellationToken
:
cancellationToken
);
var
documents
=
this
.
Documents
??
IncludeDocuments
(
scope
,
currentProject
);
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/CompletionProviders/AbstractMemberInsertingCompletionProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -143,7 +143,7 @@ private Document DetermineNewDocument(MemberInsertionCompletionItem completionIt
// Resolve member and type in our new, forked, solution
var
semanticModel
=
document
.
GetSemanticModelAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
var
containingType
=
semanticModel
.
GetEnclosingSymbol
<
INamedTypeSymbol
>(
line
.
Start
,
cancellationToken
);
var
resolution
=
completionItem
.
SymbolId
.
Resolve
(
semanticModel
.
Compilation
);
var
resolution
=
completionItem
.
SymbolId
.
Resolve
(
semanticModel
.
Compilation
,
cancellationToken
:
cancellationToken
);
var
overriddenMember
=
GetResolvedSymbol
(
resolution
,
line
.
Extent
.
Span
.
ToTextSpan
());
// CodeGenerationOptions containing before and after
...
...
@@ -155,15 +155,15 @@ private Document DetermineNewDocument(MemberInsertionCompletionItem completionIt
Document
memberContainingDocument
=
null
;
if
(
generatedMember
.
Kind
==
SymbolKind
.
Method
)
{
memberContainingDocument
=
codeGenService
.
AddMethodAsync
(
document
.
Project
.
Solution
,
containingType
,
(
IMethodSymbol
)
generatedMember
,
options
).
WaitAndGetResult
(
cancellationToken
);
memberContainingDocument
=
codeGenService
.
AddMethodAsync
(
document
.
Project
.
Solution
,
containingType
,
(
IMethodSymbol
)
generatedMember
,
options
,
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
}
else
if
(
generatedMember
.
Kind
==
SymbolKind
.
Property
)
{
memberContainingDocument
=
codeGenService
.
AddPropertyAsync
(
document
.
Project
.
Solution
,
containingType
,
(
IPropertySymbol
)
generatedMember
,
options
).
WaitAndGetResult
(
cancellationToken
);
memberContainingDocument
=
codeGenService
.
AddPropertyAsync
(
document
.
Project
.
Solution
,
containingType
,
(
IPropertySymbol
)
generatedMember
,
options
,
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
}
else
if
(
generatedMember
.
Kind
==
SymbolKind
.
Event
)
{
memberContainingDocument
=
codeGenService
.
AddEventAsync
(
document
.
Project
.
Solution
,
containingType
,
(
IEventSymbol
)
generatedMember
,
options
).
WaitAndGetResult
(
cancellationToken
);
memberContainingDocument
=
codeGenService
.
AddEventAsync
(
document
.
Project
.
Solution
,
containingType
,
(
IEventSymbol
)
generatedMember
,
options
,
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
}
return
memberContainingDocument
;
...
...
src/EditorFeatures/Core/Implementation/MetadataAsSource/MetadataAsSourceFileService.cs
浏览文件 @
3d47c50d
...
...
@@ -282,7 +282,7 @@ internal async Task<SymbolMappingResult> MapSymbolAsync(Document document, Symbo
}
var
compilation
=
await
project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
resolutionResult
=
symbolId
.
Resolve
(
compilation
,
ignoreAssemblyKey
:
true
);
var
resolutionResult
=
symbolId
.
Resolve
(
compilation
,
ignoreAssemblyKey
:
true
,
cancellationToken
:
cancellationToken
);
if
(
resolutionResult
.
Symbol
==
null
)
{
return
null
;
...
...
src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs
浏览文件 @
3d47c50d
...
...
@@ -52,7 +52,7 @@ protected override Task<IEnumerable<CodeActionOperation>> ComputeOperationsAsync
if
(
textBuffer
.
Properties
.
TryGetProperty
(
typeof
(
StateMachine
),
out
stateMachine
))
{
TrackingSession
trackingSession
;
if
(
stateMachine
.
CanInvokeRename
(
out
trackingSession
))
if
(
stateMachine
.
CanInvokeRename
(
out
trackingSession
,
cancellationToken
:
cancellationToken
))
{
var
snapshotSpan
=
stateMachine
.
TrackingSession
.
TrackingSpan
.
GetSpan
(
stateMachine
.
Buffer
.
CurrentSnapshot
);
var
str
=
string
.
Format
(
EditorFeaturesResources
.
RenameTo
,
stateMachine
.
TrackingSession
.
OriginalName
,
snapshotSpan
.
GetText
());
...
...
src/EditorFeatures/Core/SymbolMapping/SymbolMappingServiceFactory.cs
浏览文件 @
3d47c50d
...
...
@@ -21,7 +21,7 @@ private sealed class SymbolMappingService : ISymbolMappingService
public
async
Task
<
SymbolMappingResult
>
MapSymbolAsync
(
Document
document
,
SymbolKey
symbolId
,
CancellationToken
cancellationToken
)
{
var
compilation
=
await
document
.
Project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
symbol
=
symbolId
.
Resolve
(
compilation
).
Symbol
;
var
symbol
=
symbolId
.
Resolve
(
compilation
,
cancellationToken
:
cancellationToken
).
Symbol
;
if
(
symbol
!=
null
)
{
return
new
SymbolMappingResult
(
document
.
Project
,
symbol
);
...
...
src/Features/CSharp/ChangeSignature/CSharpChangeSignatureService.cs
浏览文件 @
3d47c50d
...
...
@@ -26,7 +26,7 @@ internal sealed class CSharpChangeSignatureService : AbstractChangeSignatureServ
public
override
ISymbol
GetInvocationSymbol
(
Document
document
,
int
position
,
bool
restrictToDeclarations
,
CancellationToken
cancellationToken
)
{
var
tree
=
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
var
token
=
tree
.
GetRoot
().
FindToken
(
position
!=
tree
.
Length
?
position
:
Math
.
Max
(
0
,
position
-
1
));
var
token
=
tree
.
GetRoot
(
cancellationToken
).
FindToken
(
position
!=
tree
.
Length
?
position
:
Math
.
Max
(
0
,
position
-
1
));
var
ancestorDeclarationKinds
=
restrictToDeclarations
?
invokableAncestorKinds
.
Add
(
SyntaxKind
.
Block
)
:
invokableAncestorKinds
;
SyntaxNode
matchingNode
=
token
.
Parent
.
AncestorsAndSelf
().
FirstOrDefault
(
n
=>
ancestorDeclarationKinds
.
Contains
(
n
.
Kind
()));
...
...
@@ -49,7 +49,7 @@ public override ISymbol GetInvocationSymbol(Document document, int position, boo
if
(
token
.
Parent
.
AncestorsAndSelf
().
Any
(
a
=>
a
==
objectCreation
.
Type
))
{
var
typeSymbol
=
semanticModel
.
GetSymbolInfo
(
objectCreation
.
Type
).
Symbol
;
var
typeSymbol
=
semanticModel
.
GetSymbolInfo
(
objectCreation
.
Type
,
cancellationToken
).
Symbol
;
if
(
typeSymbol
!=
null
&&
typeSymbol
.
IsKind
(
SymbolKind
.
NamedType
)
&&
(
typeSymbol
as
ITypeSymbol
).
TypeKind
==
TypeKind
.
Delegate
)
{
return
typeSymbol
;
...
...
@@ -264,7 +264,7 @@ private SyntaxNode GetNodeContainingTargetNode(SyntaxNode matchingNode)
var
invocation
=
updatedNode
as
InvocationExpressionSyntax
;
var
semanticModel
=
document
.
GetSemanticModelAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
var
symbolInfo
=
semanticModel
.
GetSymbolInfo
(
originalNode
as
InvocationExpressionSyntax
);
var
symbolInfo
=
semanticModel
.
GetSymbolInfo
(
originalNode
as
InvocationExpressionSyntax
,
cancellationToken
);
var
methodSymbol
=
symbolInfo
.
Symbol
as
IMethodSymbol
;
var
isReducedExtensionMethod
=
false
;
...
...
@@ -516,12 +516,12 @@ public override async Task<IEnumerable<ISymbol>> DetermineCascadedSymbolsFromDel
n
=>
{
if
(!
n
.
IsKind
(
SyntaxKind
.
IdentifierName
)
||
!
semanticModel
.
GetMemberGroup
(
n
).
Any
())
!
semanticModel
.
GetMemberGroup
(
n
,
cancellationToken
).
Any
())
{
return
false
;
}
ISymbol
convertedType
=
semanticModel
.
GetTypeInfo
(
n
).
ConvertedType
;
ISymbol
convertedType
=
semanticModel
.
GetTypeInfo
(
n
,
cancellationToken
).
ConvertedType
;
if
(
convertedType
!=
null
)
{
...
...
@@ -530,12 +530,12 @@ public override async Task<IEnumerable<ISymbol>> DetermineCascadedSymbolsFromDel
if
(
convertedType
!=
null
)
{
convertedType
=
SymbolFinder
.
FindSourceDefinitionAsync
(
convertedType
,
document
.
Project
.
Solution
).
WaitAndGetResult
(
cancellationToken
)
??
convertedType
;
convertedType
=
SymbolFinder
.
FindSourceDefinitionAsync
(
convertedType
,
document
.
Project
.
Solution
,
cancellationToken
).
WaitAndGetResult
(
cancellationToken
)
??
convertedType
;
}
return
convertedType
==
symbol
.
ContainingType
;
})
.
Select
(
n
=>
semanticModel
.
GetSymbolInfo
(
n
).
Symbol
);
.
Select
(
n
=>
semanticModel
.
GetSymbolInfo
(
n
,
cancellationToken
).
Symbol
);
return
convertedMethodGroups
;
}
...
...
src/Features/CSharp/CodeFixes/Async/CSharpConvertToAsyncMethodCodeFixProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -59,7 +59,7 @@ public override ImmutableArray<string> FixableDiagnosticIds
CancellationToken
cancellationToken
)
{
var
invocationExpression
=
node
.
ChildNodes
().
FirstOrDefault
(
n
=>
n
.
IsKind
(
SyntaxKind
.
InvocationExpression
));
var
methodSymbol
=
semanticModel
.
GetSymbolInfo
(
invocationExpression
).
Symbol
as
IMethodSymbol
;
var
methodSymbol
=
semanticModel
.
GetSymbolInfo
(
invocationExpression
,
cancellationToken
).
Symbol
as
IMethodSymbol
;
if
(
methodSymbol
==
null
)
{
return
null
;
...
...
src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.ReferenceRewriter.cs
浏览文件 @
3d47c50d
...
...
@@ -28,7 +28,7 @@ private class ReferenceRewriter : CSharpSyntaxRewriter
CancellationToken
cancellationToken
)
{
this
.
semanticModel
=
semanticModel
;
this
.
localSymbol
=
(
ILocalSymbol
)
semanticModel
.
GetDeclaredSymbol
(
variableDeclarator
);
this
.
localSymbol
=
(
ILocalSymbol
)
semanticModel
.
GetDeclaredSymbol
(
variableDeclarator
,
cancellationToken
);
this
.
variableDeclarator
=
variableDeclarator
;
this
.
expressionToInline
=
expressionToInline
;
this
.
cancellationToken
=
cancellationToken
;
...
...
src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -199,7 +199,7 @@ private async Task<Document> InlineTemporaryAsync(Document document, VariableDec
.
Select
(
ident
=>
GetTopMostParentingExpression
(
ident
))
.
Distinct
();
var
originalInitializerSymbolInfo
=
semanticModel
.
GetSymbolInfo
(
variableDeclarator
.
Initializer
.
Value
);
var
originalInitializerSymbolInfo
=
semanticModel
.
GetSymbolInfo
(
variableDeclarator
.
Initializer
.
Value
,
cancellationToken
);
// Make each topmost parenting statement or Equals Clause Expressions semantically explicit.
updatedDocument
=
await
updatedDocument
.
ReplaceNodesAsync
(
topmostParentingExpressions
,
(
o
,
n
)
=>
Simplifier
.
Expand
(
n
,
semanticModel
,
workspace
,
cancellationToken
:
cancellationToken
),
cancellationToken
).
ConfigureAwait
(
false
);
...
...
src/Features/CSharp/CodeRefactorings/InvertIf/InvertIfCodeRefactoringProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -143,7 +143,7 @@ private bool IsComparisonOfZeroAndSomethingNeverLessThanZero(BinaryExpressionSyn
SemanticModel
semanticModel
,
CancellationToken
cancellationToken
)
{
var
numericValue
=
semanticModel
.
GetConstantValue
(
numericLiteralExpression
);
var
numericValue
=
semanticModel
.
GetConstantValue
(
numericLiteralExpression
,
cancellationToken
);
if
(
numericValue
.
HasValue
&&
numericValue
.
Value
is
int
&&
(
int
)
numericValue
.
Value
==
0
)
{
var
symbol
=
semanticModel
.
GetSymbolInfo
(
variableExpression
,
cancellationToken
).
Symbol
;
...
...
src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.State.cs
浏览文件 @
3d47c50d
...
...
@@ -60,7 +60,7 @@ private class State
this
.
VariableDeclaration
=
this
.
DeclarationStatement
.
Declaration
;
this
.
VariableDeclarator
=
this
.
VariableDeclaration
.
Variables
[
0
];
this
.
OutermostBlock
=
(
BlockSyntax
)
this
.
DeclarationStatement
.
Parent
;
this
.
LocalSymbol
=
(
ILocalSymbol
)
document
.
SemanticModel
.
GetDeclaredSymbol
(
this
.
VariableDeclarator
);
this
.
LocalSymbol
=
(
ILocalSymbol
)
document
.
SemanticModel
.
GetDeclaredSymbol
(
this
.
VariableDeclarator
,
cancellationToken
);
if
(
this
.
LocalSymbol
==
null
)
{
// This can happen in broken code, for example: "{ object x; object }"
...
...
src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -174,7 +174,7 @@ private StatementSyntax CreateMergedDeclarationStatement(State state, StatementS
{
// Type inference. Only merge if types match.
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
rightType
=
semanticModel
.
GetTypeInfo
(
expression
.
Right
);
var
rightType
=
semanticModel
.
GetTypeInfo
(
expression
.
Right
,
cancellationToken
);
return
(
localSymbol
.
Type
==
null
&&
rightType
.
Type
==
null
)
||
localSymbol
.
Type
.
Equals
(
rightType
.
Type
);
}
else
...
...
src/Features/CSharp/Completion/CompletionProviders/CrefCompletionProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -95,8 +95,8 @@ protected override async Task<IEnumerable<CompletionItem>> GetItemsWorkerAsync(D
{
// cref "a.|"
var
parent
=
token
.
Parent
as
QualifiedCrefSyntax
;
var
leftType
=
semanticModel
.
GetTypeInfo
(
parent
.
Container
).
Type
;
var
leftSymbol
=
semanticModel
.
GetSymbolInfo
(
parent
.
Container
).
Symbol
;
var
leftType
=
semanticModel
.
GetTypeInfo
(
parent
.
Container
,
cancellationToken
).
Type
;
var
leftSymbol
=
semanticModel
.
GetSymbolInfo
(
parent
.
Container
,
cancellationToken
).
Symbol
;
var
container
=
leftSymbol
??
leftType
;
...
...
src/Features/CSharp/Completion/CompletionProviders/ObjectCreationCompletionProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -73,7 +73,7 @@ protected override SyntaxNode GetObjectCreationNewExpression(SyntaxTree tree, in
protected
override
async
Task
<
AbstractSyntaxContext
>
CreateContext
(
Document
document
,
int
position
,
CancellationToken
cancellationToken
)
{
var
semanticModel
=
await
document
.
GetCSharpSemanticModelForSpanAsync
(
new
TextSpan
(
position
,
0
)).
ConfigureAwait
(
false
);
var
semanticModel
=
await
document
.
GetCSharpSemanticModelForSpanAsync
(
new
TextSpan
(
position
,
0
)
,
cancellationToken
).
ConfigureAwait
(
false
);
return
CSharpSyntaxContext
.
CreateContext
(
document
.
Project
.
Solution
.
Workspace
,
semanticModel
,
position
,
cancellationToken
);
}
...
...
src/Features/CSharp/Completion/KeywordRecommenders/EnumKeywordRecommender.cs
浏览文件 @
3d47c50d
...
...
@@ -29,7 +29,8 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
context
.
IsTypeDeclarationContext
(
validModifiers
:
ValidModifiers
,
validTypeDeclarations
:
SyntaxKindSet
.
ClassStructTypeDeclarations
,
canBePartial
:
false
);
canBePartial
:
false
,
cancellationToken
:
cancellationToken
);
}
}
}
src/Features/CSharp/EncapsulateField/CSharpEncapsulateFieldService.cs
浏览文件 @
3d47c50d
...
...
@@ -78,7 +78,7 @@ protected async override Task<SyntaxNode> RewriteFieldNameAndAccessibility(strin
declarator
=
root
.
GetAnnotatedNodes
<
VariableDeclaratorSyntax
>(
tempAnnotation
).
First
();
declaration
=
declarator
.
Parent
as
VariableDeclarationSyntax
;
var
field
=
semanticModel
.
GetDeclaredSymbol
(
declarator
)
as
IFieldSymbol
;
var
field
=
semanticModel
.
GetDeclaredSymbol
(
declarator
,
cancellationToken
)
as
IFieldSymbol
;
var
fieldToAdd
=
declarationAnnotation
.
AddAnnotationToSymbol
(
CodeGenerationSymbolFactory
.
CreateFieldSymbol
(
field
.
GetAttributes
(),
...
...
@@ -125,7 +125,7 @@ protected override async Task<IEnumerable<IFieldSymbol>> GetFieldsAsync(Document
declarators
=
declarations
.
SelectMany
(
d
=>
d
.
Variables
.
Where
(
v
=>
v
.
Span
.
IntersectsWith
(
span
)));
}
return
declarators
.
Select
(
d
=>
semanticModel
.
GetDeclaredSymbol
(
d
)
as
IFieldSymbol
)
return
declarators
.
Select
(
d
=>
semanticModel
.
GetDeclaredSymbol
(
d
,
cancellationToken
)
as
IFieldSymbol
)
.
WhereNotNull
()
.
Where
(
f
=>
f
.
Name
.
Length
!=
0
);
}
...
...
src/Features/CSharp/GenerateType/CSharpGenerateTypeService.cs
浏览文件 @
3d47c50d
...
...
@@ -230,7 +230,7 @@ protected override bool TryGetNameParts(ExpressionSyntax expression, out IList<s
return
false
;
}
var
leftSymbol
=
semanticModel
.
GetSymbolInfo
(((
MemberAccessExpressionSyntax
)
nameOrMemberAccessExpression
).
Expression
).
Symbol
;
var
leftSymbol
=
semanticModel
.
GetSymbolInfo
(((
MemberAccessExpressionSyntax
)
nameOrMemberAccessExpression
).
Expression
,
cancellationToken
).
Symbol
;
var
token
=
simpleName
.
GetLastToken
().
GetNextToken
();
// We let only the Namespace to be left of the Dot
...
...
@@ -279,7 +279,7 @@ protected override bool TryGetNameParts(ExpressionSyntax expression, out IList<s
var
parent
=
simpleName
.
Parent
as
QualifiedNameSyntax
;
if
(
parent
!=
null
)
{
var
leftSymbol
=
semanticModel
.
GetSymbolInfo
(
parent
.
Left
).
Symbol
;
var
leftSymbol
=
semanticModel
.
GetSymbolInfo
(
parent
.
Left
,
cancellationToken
).
Symbol
;
if
(
leftSymbol
!=
null
&&
leftSymbol
.
IsKind
(
SymbolKind
.
Namespace
))
{
...
...
@@ -587,7 +587,7 @@ protected override bool IsConversionImplicit(Compilation compilation, ITypeSymbo
var
enclosingNamespace
=
GetDeclaringNamespace
(
containerList
,
0
,
compilationUnit
);
if
(
enclosingNamespace
!=
null
)
{
var
enclosingNamespaceSymbol
=
semanticModel
.
GetSymbolInfo
(
enclosingNamespace
.
Name
);
var
enclosingNamespaceSymbol
=
semanticModel
.
GetSymbolInfo
(
enclosingNamespace
.
Name
,
cancellationToken
);
if
(
enclosingNamespaceSymbol
.
Symbol
!=
null
)
{
return
Tuple
.
Create
((
INamespaceSymbol
)
enclosingNamespaceSymbol
.
Symbol
,
...
...
src/Features/CSharp/IntroduceVariable/CSharpIntroduceVariableService_IntroduceLocal.cs
浏览文件 @
3d47c50d
...
...
@@ -48,7 +48,7 @@ internal partial class CSharpIntroduceVariableService
SyntaxFactory
.
EqualsValueClause
(
expression
.
WithoutTrailingTrivia
().
WithoutLeadingTrivia
())))));
var
anonymousMethodParameters
=
GetAnonymousMethodParameters
(
document
,
expression
,
cancellationToken
);
var
lambdas
=
anonymousMethodParameters
.
SelectMany
(
p
=>
p
.
ContainingSymbol
.
DeclaringSyntaxReferences
.
Select
(
r
=>
r
.
GetSyntax
()).
AsEnumerable
())
var
lambdas
=
anonymousMethodParameters
.
SelectMany
(
p
=>
p
.
ContainingSymbol
.
DeclaringSyntaxReferences
.
Select
(
r
=>
r
.
GetSyntax
(
cancellationToken
)).
AsEnumerable
())
.
Where
(
n
=>
n
is
ParenthesizedLambdaExpressionSyntax
||
n
is
SimpleLambdaExpressionSyntax
)
.
ToSet
();
...
...
src/Features/Core/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs
浏览文件 @
3d47c50d
...
...
@@ -83,7 +83,7 @@ protected override bool CanFind(IMethodSymbol symbol)
var
convertedAnonymousFunctions
=
nodes
.
Where
(
n
=>
syntaxFactsService
.
IsAnonymousFunction
(
n
))
.
Where
(
n
=>
{
ISymbol
convertedType
=
semanticModel
.
GetTypeInfo
(
n
).
ConvertedType
;
ISymbol
convertedType
=
semanticModel
.
GetTypeInfo
(
n
,
cancellationToken
).
ConvertedType
;
if
(
convertedType
!=
null
)
{
...
...
src/Features/Core/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -370,7 +370,7 @@ protected bool ExpressionBinds(SyntaxNode expression, SemanticModel semanticMode
// See if the name binds to something other then the error type. If it does, there's nothing further we need to do.
// For extension methods, however, we will continue to search if there exists any better matched method.
cancellationToken
.
ThrowIfCancellationRequested
();
var
symbolInfo
=
semanticModel
.
GetSymbolInfo
(
expression
);
var
symbolInfo
=
semanticModel
.
GetSymbolInfo
(
expression
,
cancellationToken
);
if
(
symbolInfo
.
CandidateReason
==
CandidateReason
.
OverloadResolutionFailure
&&
!
checkForExtensionMethods
)
{
return
true
;
...
...
src/Features/Core/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -107,7 +107,7 @@ public async Task<IEnumerable<CodeFix>> GetSuppressionsAsync(Document document,
// Find the start token to attach leading pragma disable warning directive.
var
root
=
await
syntaxTree
.
GetRootAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
SyntaxTrivia
containingTrivia
=
root
.
FindTrivia
(
span
.
Start
);
var
lines
=
syntaxTree
.
GetText
().
Lines
;
var
lines
=
syntaxTree
.
GetText
(
cancellationToken
).
Lines
;
int
indexOfLine
;
if
(
containingTrivia
==
default
(
SyntaxTrivia
))
{
...
...
src/Features/Core/EncapsulateField/AbstractEncapsulateFieldService.cs
浏览文件 @
3d47c50d
...
...
@@ -116,7 +116,7 @@ private async Task<Result> EncapsulateFieldResultAsync(Document document, TextSp
{
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
compilation
=
semanticModel
.
Compilation
;
var
currentField
=
field
.
GetSymbolKey
().
Resolve
(
compilation
).
Symbol
as
IFieldSymbol
;
var
currentField
=
field
.
GetSymbolKey
().
Resolve
(
compilation
,
cancellationToken
:
cancellationToken
).
Symbol
as
IFieldSymbol
;
// We couldn't resolve this field. skip it
if
(
currentField
==
null
)
...
...
@@ -154,8 +154,8 @@ private async Task<Result> EncapsulateFieldAsync(IFieldSymbol field, Document do
// Annotate the field declarations so we can find it after rename.
var
fieldDeclaration
=
field
.
DeclaringSyntaxReferences
.
First
();
var
declarationAnnotation
=
new
SyntaxAnnotation
();
document
=
document
.
WithSyntaxRoot
(
fieldDeclaration
.
SyntaxTree
.
GetRoot
(
).
ReplaceNode
(
fieldDeclaration
.
GetSyntax
(
),
fieldDeclaration
.
GetSyntax
().
WithAdditionalAnnotations
(
declarationAnnotation
)));
document
=
document
.
WithSyntaxRoot
(
fieldDeclaration
.
SyntaxTree
.
GetRoot
(
cancellationToken
).
ReplaceNode
(
fieldDeclaration
.
GetSyntax
(
cancellationToken
),
fieldDeclaration
.
GetSyntax
(
cancellationToken
).
WithAdditionalAnnotations
(
declarationAnnotation
)));
var
solution
=
document
.
Project
.
Solution
;
...
...
@@ -179,7 +179,7 @@ private async Task<Result> EncapsulateFieldAsync(IFieldSymbol field, Document do
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
compilation
=
semanticModel
.
Compilation
;
field
=
field
.
GetSymbolKey
().
Resolve
(
compilation
).
Symbol
as
IFieldSymbol
;
field
=
field
.
GetSymbolKey
().
Resolve
(
compilation
,
cancellationToken
:
cancellationToken
).
Symbol
as
IFieldSymbol
;
Solution
solutionNeedingProperty
=
null
;
// We couldn't resolve field after annotating its declaration. Bail
...
...
@@ -209,7 +209,7 @@ private async Task<Result> EncapsulateFieldAsync(IFieldSymbol field, Document do
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
compilation
=
semanticModel
.
Compilation
;
field
=
field
.
GetSymbolKey
().
Resolve
(
compilation
).
Symbol
as
IFieldSymbol
;
field
=
field
.
GetSymbolKey
().
Resolve
(
compilation
,
cancellationToken
:
cancellationToken
).
Symbol
as
IFieldSymbol
;
}
}
...
...
src/Features/Core/ExtractInterface/AbstractExtractInterfaceService.cs
浏览文件 @
3d47c50d
...
...
@@ -276,7 +276,7 @@ public ExtractInterfaceResult ExtractInterfaceFromAnalyzedType(ExtractInterfaceT
private
static
Solution
GetSolutionWithFormattedInterfaceDocument
(
Document
unformattedInterfaceDocument
,
CancellationToken
cancellationToken
)
{
Solution
solutionWithInterfaceDocument
;
var
formattedRoot
=
Formatter
.
Format
(
unformattedInterfaceDocument
.
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
),
unformattedInterfaceDocument
.
Project
.
Solution
.
Workspace
);
var
formattedRoot
=
Formatter
.
Format
(
unformattedInterfaceDocument
.
GetSyntaxRootAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
),
unformattedInterfaceDocument
.
Project
.
Solution
.
Workspace
,
cancellationToken
:
cancellationToken
);
var
rootToSimplify
=
formattedRoot
.
WithAdditionalAnnotations
(
Simplifier
.
Annotation
);
var
finalInterfaceDocument
=
Simplifier
.
ReduceAsync
(
unformattedInterfaceDocument
.
WithSyntaxRoot
(
rootToSimplify
),
cancellationToken
:
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
...
...
src/Features/Core/GenerateFromMembers/AddConstructorParameters/AbstractAddConstructorParametersService.CodeAction.cs
浏览文件 @
3d47c50d
...
...
@@ -40,7 +40,7 @@ protected override Task<Document> GetChangedDocumentAsync(CancellationToken canc
{
var
workspace
=
document
.
Project
.
Solution
.
Workspace
;
var
declarationService
=
document
.
Project
.
LanguageServices
.
GetService
<
ISymbolDeclarationService
>();
var
constructor
=
declarationService
.
GetDeclarations
(
state
.
DelegatedConstructor
).
Select
(
r
=>
r
.
GetSyntax
()).
First
();
var
constructor
=
declarationService
.
GetDeclarations
(
state
.
DelegatedConstructor
).
Select
(
r
=>
r
.
GetSyntax
(
cancellationToken
)).
First
();
var
newConstructor
=
constructor
;
newConstructor
=
CodeGenerator
.
AddParameterDeclarations
(
newConstructor
,
parameters
.
Skip
(
state
.
DelegatedConstructor
.
Parameters
.
Length
),
workspace
);
...
...
src/Features/Core/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.State.cs
浏览文件 @
3d47c50d
...
...
@@ -116,7 +116,7 @@ private partial class State
return
false
;
}
var
semanticInfo
=
semanticModel
.
GetSymbolInfo
(
this
.
SimpleNameOrMemberAccessExpression
);
var
semanticInfo
=
semanticModel
.
GetSymbolInfo
(
this
.
SimpleNameOrMemberAccessExpression
,
cancellationToken
);
if
(
cancellationToken
.
IsCancellationRequested
)
{
return
false
;
...
...
src/Features/Core/GenerateMember/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs
浏览文件 @
3d47c50d
...
...
@@ -185,7 +185,7 @@ internal new class State : AbstractGenerateParameterizedMemberService<TService,
cancellationToken
.
ThrowIfCancellationRequested
();
// If the name bound with errors, then this is a candidate for generate method.
var
semanticInfo
=
semanticModel
.
GetSymbolInfo
(
this
.
SimpleNameOrMemberAccessExpression
);
var
semanticInfo
=
semanticModel
.
GetSymbolInfo
(
this
.
SimpleNameOrMemberAccessExpression
,
cancellationToken
);
if
(
semanticInfo
.
GetAllSymbols
().
Any
(
s
=>
s
.
Kind
==
SymbolKind
.
Local
||
s
.
Kind
==
SymbolKind
.
Parameter
)
&&
!
service
.
AreSpecialOptionsActive
(
semanticModel
))
{
...
...
src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.GenerateLocalCodeAction.cs
浏览文件 @
3d47c50d
...
...
@@ -70,7 +70,8 @@ private SyntaxNode GetNewRoot(CancellationToken cancellationToken)
return
codeGenService
.
AddStatements
(
root
,
SpecializedCollections
.
SingletonEnumerable
(
localStatement
),
options
:
new
CodeGenerationOptions
(
beforeThisLocation
:
state
.
IdentifierToken
.
GetLocation
()));
options
:
new
CodeGenerationOptions
(
beforeThisLocation
:
state
.
IdentifierToken
.
GetLocation
()),
cancellationToken
:
cancellationToken
);
}
}
}
...
...
src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.State.cs
浏览文件 @
3d47c50d
...
...
@@ -228,7 +228,7 @@ internal bool CanGenerateLocal()
// Now, try to bind the invocation and see if it succeeds or not. if it succeeds and
// binds uniquely, then we don't need to offer this quick fix.
cancellationToken
.
ThrowIfCancellationRequested
();
var
semanticInfo
=
semanticModel
.
GetSymbolInfo
(
this
.
SimpleNameOrMemberAccessExpressionOpt
);
var
semanticInfo
=
semanticModel
.
GetSymbolInfo
(
this
.
SimpleNameOrMemberAccessExpressionOpt
,
cancellationToken
);
cancellationToken
.
ThrowIfCancellationRequested
();
if
(
semanticInfo
.
Symbol
!=
null
)
...
...
src/Features/Core/GenerateType/AbstractGenerateTypeService.State.cs
浏览文件 @
3d47c50d
...
...
@@ -364,7 +364,7 @@ private bool GenerateStruct(TService service, SemanticModel semanticModel, Cance
TExpressionSyntax
leftSide
,
CancellationToken
cancellationToken
)
{
var
leftSideInfo
=
semanticModel
.
GetSymbolInfo
(
leftSide
);
var
leftSideInfo
=
semanticModel
.
GetSymbolInfo
(
leftSide
,
cancellationToken
);
if
(
leftSideInfo
.
Symbol
!=
null
)
{
...
...
src/Features/Core/GenerateType/AbstractGenerateTypeService.cs
浏览文件 @
3d47c50d
...
...
@@ -129,7 +129,7 @@ private bool CanGenerateIntoContainingNamespace(SemanticDocument document, Synta
var
declarationService
=
document
.
Project
.
LanguageServices
.
GetService
<
ISymbolDeclarationService
>();
var
decl
=
declarationService
.
GetDeclarations
(
containingNamespace
)
.
Where
(
r
=>
r
.
SyntaxTree
==
node
.
SyntaxTree
)
.
Select
(
r
=>
r
.
GetSyntax
())
.
Select
(
r
=>
r
.
GetSyntax
(
cancellationToken
))
.
FirstOrDefault
(
node
.
GetAncestorsOrThis
<
SyntaxNode
>().
Contains
);
return
...
...
src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State.cs
浏览文件 @
3d47c50d
...
...
@@ -86,7 +86,7 @@ public State(TService service, SemanticDocument document)
return
false
;
}
this
.
IsConstant
=
this
.
Document
.
SemanticModel
.
GetConstantValue
(
this
.
Expression
).
HasValue
;
this
.
IsConstant
=
this
.
Document
.
SemanticModel
.
GetConstantValue
(
this
.
Expression
,
cancellationToken
).
HasValue
;
// Note: the ordering of these clauses are important. They go, generally, from
// innermost to outermost order.
...
...
src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_ConstructorInitializer.cs
浏览文件 @
3d47c50d
...
...
@@ -30,7 +30,7 @@ private partial class State
}
// Can't extract out an anonymous type used in a constructor initializer.
var
info
=
this
.
Document
.
SemanticModel
.
GetTypeInfo
(
this
.
Expression
);
var
info
=
this
.
Document
.
SemanticModel
.
GetTypeInfo
(
this
.
Expression
,
cancellationToken
);
if
(
info
.
Type
.
ContainsAnonymousType
())
{
return
false
;
...
...
src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Field.cs
浏览文件 @
3d47c50d
...
...
@@ -37,7 +37,7 @@ private partial class State
}
// Can't extract out an anonymous type used in a field initializer.
var
info
=
this
.
Document
.
SemanticModel
.
GetTypeInfo
(
this
.
Expression
);
var
info
=
this
.
Document
.
SemanticModel
.
GetTypeInfo
(
this
.
Expression
,
cancellationToken
);
if
(
info
.
Type
.
ContainsAnonymousType
())
{
return
false
;
...
...
src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Query.cs
浏览文件 @
3d47c50d
...
...
@@ -24,7 +24,7 @@ private partial class State
return
false
;
}
var
info
=
this
.
Document
.
SemanticModel
.
GetTypeInfo
(
this
.
Expression
);
var
info
=
this
.
Document
.
SemanticModel
.
GetTypeInfo
(
this
.
Expression
,
cancellationToken
);
if
(
info
.
Type
==
null
||
info
.
Type
.
SpecialType
==
SpecialType
.
System_Void
)
{
return
false
;
...
...
src/Features/Core/MetadataAsSource/MetadataAsSourceHelpers.cs
浏览文件 @
3d47c50d
...
...
@@ -85,7 +85,7 @@ public static async Task<Location> GetLocationInGeneratedSourceAsync(SymbolKey s
{
var
location
=
symbolId
.
Resolve
(
await
generatedDocument
.
Project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
),
ignoreAssemblyKey
:
true
)
ignoreAssemblyKey
:
true
,
cancellationToken
:
cancellationToken
)
.
GetAllSymbols
()
.
Select
(
s
=>
s
.
Locations
.
Where
(
loc
=>
loc
.
IsInSource
).
FirstOrDefault
())
.
WhereNotNull
()
...
...
src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs
浏览文件 @
3d47c50d
...
...
@@ -173,11 +173,11 @@ public static IEnumerable<SymbolDisplayPart> GetDocumentationParts(this ISymbol
var
globalNamespace
=
semanticModel
.
Compilation
.
GlobalNamespace
;
var
documentation
=
symbol
.
TypeSwitch
(
(
IParameterSymbol
parameter
)
=>
parameter
.
ContainingSymbol
.
OriginalDefinition
.
GetDocumentationComment
().
GetParameterText
(
symbol
.
Name
),
(
ITypeParameterSymbol
typeParam
)
=>
typeParam
.
ContainingSymbol
.
GetDocumentationComment
().
GetTypeParameterText
(
symbol
.
Name
),
(
IParameterSymbol
parameter
)
=>
parameter
.
ContainingSymbol
.
OriginalDefinition
.
GetDocumentationComment
(
cancellationToken
:
cancellationToken
).
GetParameterText
(
symbol
.
Name
),
(
ITypeParameterSymbol
typeParam
)
=>
typeParam
.
ContainingSymbol
.
GetDocumentationComment
(
cancellationToken
:
cancellationToken
).
GetTypeParameterText
(
symbol
.
Name
),
(
IMethodSymbol
method
)
=>
GetMethodDocumentation
(
method
),
(
IAliasSymbol
alias
)
=>
alias
.
Target
.
GetDocumentationComment
().
SummaryText
,
_
=>
symbol
.
GetDocumentationComment
().
SummaryText
);
(
IAliasSymbol
alias
)
=>
alias
.
Target
.
GetDocumentationComment
(
cancellationToken
:
cancellationToken
).
SummaryText
,
_
=>
symbol
.
GetDocumentationComment
(
cancellationToken
:
cancellationToken
).
SummaryText
);
if
(
documentation
!=
null
)
{
...
...
src/Workspaces/CSharp/Portable/Extensions/ArgumentSyntaxExtensions.cs
浏览文件 @
3d47c50d
...
...
@@ -107,7 +107,7 @@ public static RefKind GetRefKind(this ArgumentSyntax argument)
{
// If a parameter appears to have a void return type, then just use 'object'
// instead.
var
typeInfo
=
semanticModel
.
GetTypeInfo
(
argument
.
Expression
);
var
typeInfo
=
semanticModel
.
GetTypeInfo
(
argument
.
Expression
,
cancellationToken
);
if
(
typeInfo
.
Type
!=
null
&&
typeInfo
.
Type
.
SpecialType
==
SpecialType
.
System_Void
)
{
return
semanticModel
.
Compilation
.
ObjectType
;
...
...
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
浏览文件 @
3d47c50d
...
...
@@ -2176,7 +2176,7 @@ public static bool IsNameOfContext(this SyntaxTree syntaxTree, int position, Sem
return
true
;
}
return
semanticModelOpt
.
GetSymbolInfo
(
parentExpression
).
Symbol
==
null
;
return
semanticModelOpt
.
GetSymbolInfo
(
parentExpression
,
cancellationToken
).
Symbol
==
null
;
}
return
false
;
...
...
@@ -2369,7 +2369,7 @@ public static bool IsEnumTypeMemberAccessContext(this SyntaxTree syntaxTree, Sem
}
var
memberAccess
=
(
MemberAccessExpressionSyntax
)
token
.
Parent
;
var
leftHandBinding
=
semanticModel
.
GetSymbolInfo
(
memberAccess
.
Expression
);
var
leftHandBinding
=
semanticModel
.
GetSymbolInfo
(
memberAccess
.
Expression
,
cancellationToken
);
var
symbol
=
leftHandBinding
.
GetBestOrAllSymbols
().
FirstOrDefault
();
if
(
symbol
==
null
)
...
...
src/Workspaces/CSharp/Portable/Extensions/CrefSyntaxExtensions.cs
浏览文件 @
3d47c50d
...
...
@@ -35,7 +35,7 @@ internal static class CrefSyntaxExtensions
(
memberCref
.
Kind
()
==
SyntaxKind
.
NameMemberCref
))
{
var
nameMemberCref
=
((
NameMemberCrefSyntax
)
memberCref
).
Name
;
var
symbolInfo
=
semanticModel
.
GetSymbolInfo
(
nameMemberCref
);
var
symbolInfo
=
semanticModel
.
GetSymbolInfo
(
nameMemberCref
,
cancellationToken
);
var
symbol
=
symbolInfo
.
Symbol
;
if
(
symbol
==
null
)
...
...
src/Workspaces/CSharp/Portable/Extensions/ExpressionSyntaxExtensions.cs
浏览文件 @
3d47c50d
...
...
@@ -821,7 +821,7 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode
return
false
;
}
var
symbol
=
semanticModel
.
GetSymbolInfo
(
node
).
Symbol
;
var
symbol
=
semanticModel
.
GetSymbolInfo
(
node
,
cancellationToken
).
Symbol
;
// If the Symbol is a contrcutor get its containing type
if
(
symbol
.
IsConstructor
())
...
...
@@ -869,7 +869,7 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode
}
if
(
node
.
Kind
()
==
SyntaxKind
.
IdentifierName
&&
semanticModel
.
GetAliasInfo
((
IdentifierNameSyntax
)
node
)
!=
null
)
semanticModel
.
GetAliasInfo
((
IdentifierNameSyntax
)
node
,
cancellationToken
)
!=
null
)
{
return
false
;
}
...
...
@@ -886,7 +886,7 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode
var
qualifiedName
=
(
QualifiedNameSyntax
)
node
;
if
(!
qualifiedName
.
Right
.
HasAnnotation
(
Simplifier
.
SpecialTypeAnnotation
))
{
var
type
=
semanticModel
.
GetTypeInfo
(
node
).
Type
;
var
type
=
semanticModel
.
GetTypeInfo
(
node
,
cancellationToken
).
Type
;
if
(
type
!=
null
)
{
var
keywordKind
=
GetPredefinedKeywordKind
(
type
.
SpecialType
);
...
...
@@ -903,7 +903,7 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode
var
aliasQualifiedNameSyntax
=
(
AliasQualifiedNameSyntax
)
node
;
if
(!
aliasQualifiedNameSyntax
.
Name
.
HasAnnotation
(
Simplifier
.
SpecialTypeAnnotation
))
{
var
type
=
semanticModel
.
GetTypeInfo
(
node
).
Type
;
var
type
=
semanticModel
.
GetTypeInfo
(
node
,
cancellationToken
).
Type
;
if
(
type
!=
null
)
{
var
keywordKind
=
GetPredefinedKeywordKind
(
type
.
SpecialType
);
...
...
@@ -1290,7 +1290,7 @@ private static int GetNamespaceId(SyntaxList<MemberDeclarationSyntax> members, N
if
(
PreferPredefinedTypeKeywordInDeclarations
(
name
,
optionSet
,
semanticModel
)
||
PreferPredefinedTypeKeywordInMemberAccess
(
name
,
optionSet
,
semanticModel
))
{
var
type
=
semanticModel
.
GetTypeInfo
(
name
).
Type
;
var
type
=
semanticModel
.
GetTypeInfo
(
name
,
cancellationToken
).
Type
;
if
(
type
!=
null
)
{
var
keywordKind
=
GetPredefinedKeywordKind
(
type
.
SpecialType
);
...
...
@@ -1700,7 +1700,7 @@ private static bool HidingTypeParameterSymbolExists(ISymbol candidateSymbol, Lis
if
(
memberAccess
.
Expression
.
Kind
()
==
SyntaxKind
.
BaseExpression
)
{
var
enclosingNamedType
=
semanticModel
.
GetEnclosingNamedType
(
memberAccess
.
SpanStart
,
cancellationToken
);
var
symbol
=
semanticModel
.
GetSymbolInfo
(
memberAccess
.
Name
).
Symbol
;
var
symbol
=
semanticModel
.
GetSymbolInfo
(
memberAccess
.
Name
,
cancellationToken
).
Symbol
;
if
(
enclosingNamedType
!=
null
&&
!
enclosingNamedType
.
IsSealed
&&
symbol
!=
null
&&
...
...
@@ -1985,7 +1985,7 @@ private static bool IsThisOrTypeOrNamespace(MemberAccessExpressionSyntax memberA
return
true
;
}
var
type
=
semanticModel
.
GetTypeInfo
(
simpleName
).
Type
;
var
type
=
semanticModel
.
GetTypeInfo
(
simpleName
,
cancellationToken
).
Type
;
// the variable cannot be initialized to a method group or an anonymous function
if
(
type
!=
null
&&
...
...
@@ -1994,7 +1994,7 @@ private static bool IsThisOrTypeOrNamespace(MemberAccessExpressionSyntax memberA
return
true
;
}
var
initializerType
=
semanticModel
.
GetTypeInfo
(
equalsValueClause
.
Value
).
Type
;
var
initializerType
=
semanticModel
.
GetTypeInfo
(
equalsValueClause
.
Value
,
cancellationToken
).
Type
;
if
(!
type
.
Equals
(
initializerType
))
{
...
...
@@ -2005,7 +2005,7 @@ private static bool IsThisOrTypeOrNamespace(MemberAccessExpressionSyntax memberA
var
possibleSameLocals
=
equalsValueClause
.
DescendantNodesAndSelf
().
Where
(
n
=>
n
.
Kind
()
==
SyntaxKind
.
IdentifierName
&&
((
IdentifierNameSyntax
)
n
).
Identifier
.
ValueText
.
Equals
(
identifier
.
ValueText
));
var
anyUse
=
possibleSameLocals
.
Any
(
n
=>
{
var
symbol
=
semanticModel
.
GetSymbolInfo
(
n
).
Symbol
;
var
symbol
=
semanticModel
.
GetSymbolInfo
(
n
,
cancellationToken
).
Symbol
;
if
(
symbol
!=
null
&&
symbol
.
Kind
==
SymbolKind
.
Local
)
{
return
true
;
...
...
src/Workspaces/CSharp/Portable/Extensions/TypeDeclarationSyntaxExtensions.cs
浏览文件 @
3d47c50d
...
...
@@ -234,7 +234,7 @@ public static IEnumerable<BaseTypeSyntax> GetAllBaseListTypes(this TypeDeclarati
var
isPartialType
=
typeNode
.
Modifiers
.
Any
(
m
=>
m
.
Kind
()
==
SyntaxKind
.
PartialKeyword
);
if
(
isPartialType
)
{
var
typeSymbol
=
model
.
GetDeclaredSymbol
(
typeNode
);
var
typeSymbol
=
model
.
GetDeclaredSymbol
(
typeNode
,
cancellationToken
);
if
(
typeSymbol
!=
null
)
{
foreach
(
var
syntaxRef
in
typeSymbol
.
DeclaringSyntaxReferences
)
...
...
src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs
浏览文件 @
3d47c50d
...
...
@@ -93,7 +93,7 @@ internal class CSharpRecommendationService : AbstractRecommendationService
}
else
if
(
context
.
IsDestructorTypeContext
)
{
return
SpecializedCollections
.
SingletonEnumerable
(
context
.
SemanticModel
.
GetDeclaredSymbol
(
context
.
ContainingTypeOrEnumDeclaration
));
return
SpecializedCollections
.
SingletonEnumerable
(
context
.
SemanticModel
.
GetDeclaredSymbol
(
context
.
ContainingTypeOrEnumDeclaration
,
cancellationToken
));
}
return
SpecializedCollections
.
EmptyEnumerable
<
ISymbol
>();
...
...
@@ -173,7 +173,7 @@ internal class CSharpRecommendationService : AbstractRecommendationService
{
var
enclosingSymbol
=
context
.
LeftToken
.
Parent
.
AncestorsAndSelf
()
.
Select
(
n
=>
context
.
SemanticModel
.
GetDeclaredSymbol
(
n
))
.
Select
(
n
=>
context
.
SemanticModel
.
GetDeclaredSymbol
(
n
,
cancellationToken
))
.
WhereNotNull
()
.
FirstOrDefault
();
...
...
src/Workspaces/Core/Desktop/Workspace/MSBuild/MSBuildWorkspace.cs
浏览文件 @
3d47c50d
...
...
@@ -366,7 +366,7 @@ public async Task<Solution> OpenSolutionAsync(string solutionFilePath, Cancellat
var
absoluteSolutionPath
=
this
.
GetAbsoluteSolutionPath
(
solutionFilePath
,
Environment
.
CurrentDirectory
);
using
(
this
.
dataGuard
.
DisposableWait
())
using
(
this
.
dataGuard
.
DisposableWait
(
cancellationToken
))
{
this
.
SetSolutionProperties
(
absoluteSolutionPath
);
}
...
...
@@ -379,7 +379,7 @@ public async Task<Solution> OpenSolutionAsync(string solutionFilePath, Cancellat
var
invalidProjects
=
new
List
<
ProjectInSolution
>();
// seed loaders from known project types
using
(
this
.
dataGuard
.
DisposableWait
())
using
(
this
.
dataGuard
.
DisposableWait
(
cancellationToken
))
{
foreach
(
var
project
in
solutionFile
.
ProjectsInOrder
)
{
...
...
src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs
浏览文件 @
3d47c50d
...
...
@@ -380,7 +380,7 @@ public virtual async Task<Solution> TryMergeFixesAsync(Solution oldSolution, IEn
mergeTasks
[
i
]
=
Task
.
Run
(
async
()
=>
{
var
appliedChanges
=
(
await
documentsToMerge
[
0
].
GetTextChangesAsync
(
oldDocument
).
ConfigureAwait
(
false
)).
ToList
();
var
appliedChanges
=
(
await
documentsToMerge
[
0
].
GetTextChangesAsync
(
oldDocument
,
cancellationToken
).
ConfigureAwait
(
false
)).
ToList
();
foreach
(
var
document
in
documentsToMerge
.
Skip
(
1
))
{
...
...
@@ -431,7 +431,7 @@ public virtual async Task<Solution> TryMergeFixesAsync(Solution oldSolution, IEn
var
successfullyMergedChanges
=
new
List
<
TextChange
>();
int
cumulativeChangeIndex
=
0
;
foreach
(
var
change
in
await
newDocument
.
GetTextChangesAsync
(
oldDocument
).
ConfigureAwait
(
false
))
foreach
(
var
change
in
await
newDocument
.
GetTextChangesAsync
(
oldDocument
,
cancellationToken
).
ConfigureAwait
(
false
))
{
while
(
cumulativeChangeIndex
<
cumulativeChanges
.
Count
&&
cumulativeChanges
[
cumulativeChangeIndex
].
Span
.
End
<
change
.
Span
.
Start
)
{
...
...
src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs
浏览文件 @
3d47c50d
...
...
@@ -24,7 +24,7 @@ internal abstract partial class AbstractCodeGenerationService
public
bool
CanAddTo
(
ISymbol
destination
,
Solution
solution
,
CancellationToken
cancellationToken
)
{
var
declarations
=
symbolDeclarationService
.
GetDeclarations
(
destination
);
return
declarations
.
Any
(
r
=>
CanAddTo
(
r
.
GetSyntax
(),
solution
,
cancellationToken
));
return
declarations
.
Any
(
r
=>
CanAddTo
(
r
.
GetSyntax
(
cancellationToken
),
solution
,
cancellationToken
));
}
protected
static
SyntaxToken
GetEndToken
(
SyntaxNode
node
)
...
...
src/Workspaces/Core/Portable/Editing/SymbolEditor.cs
浏览文件 @
3d47c50d
...
...
@@ -104,14 +104,14 @@ public async Task<ISymbol> GetCurrentSymbolAsync(ISymbol symbol, CancellationTok
var
symbolId
=
DocumentationCommentId
.
CreateDeclarationId
(
symbol
);
// check to see if symbol is from current solution
var
project
=
this
.
currentSolution
.
GetProject
(
symbol
.
ContainingAssembly
);
var
project
=
this
.
currentSolution
.
GetProject
(
symbol
.
ContainingAssembly
,
cancellationToken
);
if
(
project
!=
null
)
{
return
await
GetSymbolAsync
(
this
.
currentSolution
,
project
.
Id
,
symbolId
,
cancellationToken
).
ConfigureAwait
(
false
);
}
// check to see if it is from original solution
project
=
this
.
originalSolution
.
GetProject
(
symbol
.
ContainingAssembly
);
project
=
this
.
originalSolution
.
GetProject
(
symbol
.
ContainingAssembly
,
cancellationToken
);
if
(
project
!=
null
)
{
return
await
GetSymbolAsync
(
this
.
currentSolution
,
project
.
Id
,
symbolId
,
cancellationToken
).
ConfigureAwait
(
false
);
...
...
@@ -298,7 +298,7 @@ private void CheckSymbolArgument(ISymbol currentSymbol, ISymbol argSymbol)
// try to find new symbol by looking up via original declaration
var
model
=
await
newDoc
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
newDeclaration
=
model
.
SyntaxTree
.
GetRoot
().
GetCurrentNode
(
declaration
);
var
newDeclaration
=
model
.
SyntaxTree
.
GetRoot
(
cancellationToken
).
GetCurrentNode
(
declaration
);
if
(
newDeclaration
!=
null
)
{
var
newSymbol
=
model
.
GetDeclaredSymbol
(
newDeclaration
,
cancellationToken
);
...
...
src/Workspaces/Core/Portable/Editing/SymbolEditorExtensions.cs
浏览文件 @
3d47c50d
...
...
@@ -40,7 +40,7 @@ public static class SymbolEditorExtensions
var
model
=
await
doc
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
gen
=
SyntaxGenerator
.
GetGenerator
(
doc
);
var
typeRef
=
gen
.
GetBaseAndInterfaceTypes
(
decl
).
FirstOrDefault
(
r
=>
model
.
GetTypeInfo
(
r
).
Type
.
Equals
(
baseOrInterfaceType
));
var
typeRef
=
gen
.
GetBaseAndInterfaceTypes
(
decl
).
FirstOrDefault
(
r
=>
model
.
GetTypeInfo
(
r
,
cancellationToken
).
Type
.
Equals
(
baseOrInterfaceType
));
if
(
typeRef
!=
null
)
{
return
typeRef
;
...
...
src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentProjectsFinder.cs
浏览文件 @
3d47c50d
...
...
@@ -140,7 +140,7 @@ private static IEnumerable<Project> GetProjects(Solution solution, IEnumerable<P
// Find the projects that reference this assembly.
var
sourceProject
=
solution
.
GetProject
(
containingAssembly
);
var
sourceProject
=
solution
.
GetProject
(
containingAssembly
,
cancellationToken
);
cancellationToken
.
ThrowIfCancellationRequested
();
// 1) Compute all the dependent projects (submission + non-submission) and their InternalsVisibleTo semantics to the definition project.
...
...
@@ -240,7 +240,7 @@ private static async Task AddSubmissionDependentProjectsAsync(Solution solution,
var
compilation
=
await
project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
if
(
compilation
.
PreviousSubmission
!=
null
)
{
var
referencedProject
=
solution
.
GetProject
(
compilation
.
PreviousSubmission
.
Assembly
);
var
referencedProject
=
solution
.
GetProject
(
compilation
.
PreviousSubmission
.
Assembly
,
cancellationToken
);
List
<
ProjectId
>
referencingSubmissions
=
null
;
if
(!
projectIdsToReferencingSubmissionIds
.
TryGetValue
(
referencedProject
.
Id
,
out
referencingSubmissions
))
...
...
src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs
浏览文件 @
3d47c50d
...
...
@@ -249,7 +249,7 @@ internal static class DependentTypeFinder
{
cancellationToken
.
ThrowIfCancellationRequested
();
var
resolvedSymbols
=
id
.
Resolve
(
compilation
).
GetAllSymbols
();
var
resolvedSymbols
=
id
.
Resolve
(
compilation
,
cancellationToken
:
cancellationToken
).
GetAllSymbols
();
foreach
(
var
resolvedSymbol
in
resolvedSymbols
)
{
var
mappedSymbol
=
await
SymbolFinder
.
FindSourceDefinitionAsync
(
resolvedSymbol
,
solution
,
cancellationToken
).
ConfigureAwait
(
false
)
??
resolvedSymbol
;
...
...
src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMemberScopedReferenceFinder.cs
浏览文件 @
3d47c50d
...
...
@@ -117,7 +117,7 @@ private static ISymbol GetContainer(ISymbol symbol)
{
var
service
=
document
.
GetLanguageService
<
ISymbolDeclarationService
>();
var
declarations
=
service
.
GetDeclarations
(
container
);
var
tokens
=
declarations
.
SelectMany
(
r
=>
r
.
GetSyntax
().
DescendantTokens
());
var
tokens
=
declarations
.
SelectMany
(
r
=>
r
.
GetSyntax
(
cancellationToken
).
DescendantTokens
());
var
name
=
symbol
.
Name
;
var
syntaxFacts
=
document
.
GetLanguageService
<
ISyntaxFactsService
>();
...
...
src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ParameterSymbolReferenceFinder.cs
浏览文件 @
3d47c50d
...
...
@@ -70,7 +70,7 @@ protected override bool CanFind(IParameterSymbol symbol)
if
(
parameter
.
ContainingSymbol
.
IsAnonymousFunction
())
{
var
parameterNode
=
parameter
.
DeclaringSyntaxReferences
.
Select
(
r
=>
r
.
GetSyntax
()).
FirstOrDefault
();
var
parameterNode
=
parameter
.
DeclaringSyntaxReferences
.
Select
(
r
=>
r
.
GetSyntax
(
cancellationToken
)).
FirstOrDefault
();
if
(
parameterNode
!=
null
)
{
var
document
=
solution
.
GetDocument
(
parameterNode
.
SyntaxTree
);
...
...
@@ -81,7 +81,7 @@ protected override bool CanFind(IParameterSymbol symbol)
{
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
lambdaNode
=
parameter
.
ContainingSymbol
.
DeclaringSyntaxReferences
.
Select
(
r
=>
r
.
GetSyntax
()).
FirstOrDefault
();
var
lambdaNode
=
parameter
.
ContainingSymbol
.
DeclaringSyntaxReferences
.
Select
(
r
=>
r
.
GetSyntax
(
cancellationToken
)).
FirstOrDefault
();
var
convertedType
=
semanticModel
.
GetTypeInfo
(
lambdaNode
,
cancellationToken
).
ConvertedType
;
if
(
convertedType
!=
null
)
...
...
@@ -138,7 +138,7 @@ protected override bool CanFind(IParameterSymbol symbol)
SignatureComparer
.
Instance
.
HaveSameSignatureAndConstraintsAndReturnTypeAndAccessors
(
parameter
.
ContainingSymbol
,
symbol
.
ContainingSymbol
,
syntaxFacts
.
IsCaseSensitive
)
&&
ParameterNamesMatch
(
syntaxFacts
,
(
IMethodSymbol
)
parameter
.
ContainingSymbol
,
(
IMethodSymbol
)
symbol
.
ContainingSymbol
))
{
var
lambdaNode
=
symbol
.
ContainingSymbol
.
DeclaringSyntaxReferences
.
Select
(
r
=>
r
.
GetSyntax
()).
FirstOrDefault
();
var
lambdaNode
=
symbol
.
ContainingSymbol
.
DeclaringSyntaxReferences
.
Select
(
r
=>
r
.
GetSyntax
(
cancellationToken
)).
FirstOrDefault
();
var
convertedType2
=
semanticModel
.
GetTypeInfo
(
lambdaNode
,
cancellationToken
).
ConvertedType
;
if
(
convertedType1
.
Equals
(
convertedType2
))
...
...
@@ -203,7 +203,7 @@ private SyntaxNode GetContainer(SemanticModel semanticModel, SyntaxNode paramete
var
namedType
=
containingMethod
.
ContainingType
as
INamedTypeSymbol
;
if
(
namedType
!=
null
&&
namedType
.
IsDelegateType
()
&&
namedType
.
AssociatedSymbol
!=
null
)
{
var
eventNode
=
namedType
.
AssociatedSymbol
.
DeclaringSyntaxReferences
.
Select
(
r
=>
r
.
GetSyntax
()).
FirstOrDefault
();
var
eventNode
=
namedType
.
AssociatedSymbol
.
DeclaringSyntaxReferences
.
Select
(
r
=>
r
.
GetSyntax
(
cancellationToken
)).
FirstOrDefault
();
if
(
eventNode
!=
null
)
{
var
document
=
solution
.
GetDocument
(
eventNode
.
SyntaxTree
);
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder.cs
浏览文件 @
3d47c50d
...
...
@@ -106,7 +106,7 @@ public static partial class SymbolFinder
return
null
;
}
var
project
=
solution
.
GetProject
(
symbol
.
ContainingAssembly
);
var
project
=
solution
.
GetProject
(
symbol
.
ContainingAssembly
,
cancellationToken
);
if
(
project
!=
null
)
{
var
symbolId
=
symbol
.
GetSymbolKey
();
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Declarations.cs
浏览文件 @
3d47c50d
...
...
@@ -141,7 +141,7 @@ private static async Task AddDeclarationsAsync(Project project, Compilation star
// Return symbols from skeleton assembly in this case so that symbols have the same language as startingCompilation.
list
.
AddRange
(
FilterByCriteria
(
compilation
.
GetSymbolsWithName
(
predicate
,
filter
,
cancellationToken
),
filter
)
.
Select
(
s
=>
s
.
GetSymbolKey
().
Resolve
(
startingCompilation
).
Symbol
).
WhereNotNull
());
.
Select
(
s
=>
s
.
GetSymbolKey
().
Resolve
(
startingCompilation
,
cancellationToken
:
cancellationToken
).
Symbol
).
WhereNotNull
());
}
else
{
...
...
src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs
浏览文件 @
3d47c50d
...
...
@@ -102,7 +102,7 @@ internal async Task<LinkedFileMergeSessionResult> MergeDiffsAsync(IMergeConflict
}
var
originalDocument
=
oldSolution
.
GetDocument
(
linkedDocumentGroup
.
First
());
var
originalSourceText
=
await
originalDocument
.
GetTextAsync
().
ConfigureAwait
(
false
);
var
originalSourceText
=
await
originalDocument
.
GetTextAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
// Add comments in source explaining diffs that could not be merged
...
...
src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs
浏览文件 @
3d47c50d
...
...
@@ -247,7 +247,7 @@ private static bool TryGetValue(IDictionary<string, ISymbol> dictionary, string
{
// Call accessors directly if C# overriding VB
if
(
document
.
Project
.
Language
==
LanguageNames
.
CSharp
&&
SymbolFinder
.
FindSourceDefinitionAsync
(
overriddenProperty
,
document
.
Project
.
Solution
)
&&
SymbolFinder
.
FindSourceDefinitionAsync
(
overriddenProperty
,
document
.
Project
.
Solution
,
cancellationToken
)
.
WaitAndGetResult
(
CancellationToken
.
None
).
Language
==
LanguageNames
.
VisualBasic
)
{
var
getName
=
overriddenProperty
.
GetMethod
!=
null
?
overriddenProperty
.
GetMethod
.
Name
:
null
;
...
...
src/Workspaces/Core/Portable/SymbolId/SymbolKey.BodyLevelSymbolKey.cs
浏览文件 @
3d47c50d
...
...
@@ -76,7 +76,7 @@ public override SymbolKeyResolution Resolve(Compilation compilation, bool ignore
foreach
(
var
token
in
node
.
DescendantNodes
())
{
var
symbol
=
semanticModel
.
GetDeclaredSymbol
(
token
)
as
TSymbol
;
var
symbol
=
semanticModel
.
GetDeclaredSymbol
(
token
,
cancellationToken
)
as
TSymbol
;
if
(
symbol
!=
null
&&
Equals
(
compilation
.
IsCaseSensitive
,
symbol
.
Name
,
name
))
{
...
...
src/Workspaces/Core/Portable/SymbolId/SymbolKey.MethodSymbolKey.cs
浏览文件 @
3d47c50d
...
...
@@ -68,7 +68,7 @@ private IEnumerable<IMethodSymbol> Resolve(Compilation compilation, INamedTypeSy
if
(
typeArgumentKeysOpt
!=
null
)
{
typeArguments
=
typeArgumentKeysOpt
.
Select
(
a
=>
a
.
Resolve
(
compilation
).
Symbol
as
ITypeSymbol
).
ToArray
();
typeArguments
=
typeArgumentKeysOpt
.
Select
(
a
=>
a
.
Resolve
(
compilation
,
cancellationToken
:
cancellationToken
).
Symbol
as
ITypeSymbol
).
ToArray
();
if
(
typeArguments
.
Any
(
a
=>
a
==
null
))
{
...
...
src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs
浏览文件 @
3d47c50d
...
...
@@ -1876,7 +1876,7 @@ internal async Task<Solution> WithFrozenPartialCompilationIncludingSpecificDocum
var
doc
=
this
.
GetDocument
(
documentId
);
var
tree
=
await
doc
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
using
(
this
.
StateLock
.
DisposableWait
())
using
(
this
.
StateLock
.
DisposableWait
(
cancellationToken
))
{
// in progress solutions are disabled for some testing
Workspace
ws
=
this
.
Workspace
as
Workspace
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录