Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
f5f980f0
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,发现更多精彩内容 >>
提交
f5f980f0
编写于
6月 28, 2019
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use pattern matching
上级
fcc69778
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
23 addition
and
36 deletion
+23
-36
src/EditorFeatures/Core.Wpf/Interactive/InteractiveDocumentNavigationService.cs
...e.Wpf/Interactive/InteractiveDocumentNavigationService.cs
+9
-7
src/EditorFeatures/Core/Extensibility/BraceMatching/AbstractDirectiveTriviaBraceMatcher.cs
...lity/BraceMatching/AbstractDirectiveTriviaBraceMatcher.cs
+1
-2
src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs
...table/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs
+1
-2
src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.CSharpCodeGenerator.cs
...xtractMethod/CSharpMethodExtractor.CSharpCodeGenerator.cs
+1
-2
src/Features/Core/Portable/ConvertAutoPropertyToFullProperty/AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs
...nvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs
+1
-2
src/Features/Core/Portable/Diagnostics/LiveDiagnosticUpdateArgsId.cs
...s/Core/Portable/Diagnostics/LiveDiagnosticUpdateArgsId.cs
+1
-2
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.CodeModelEventCollector.cs
...deModel/CSharpCodeModelService.CodeModelEventCollector.cs
+1
-2
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
...ualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
+1
-3
src/VisualStudio/CSharp/Impl/Debugging/CSharpProximityExpressionsService.Worker.cs
...mpl/Debugging/CSharpProximityExpressionsService.Worker.cs
+1
-2
src/VisualStudio/Core/Def/Implementation/ProjectSystem/Legacy/AbstractLegacyProject.cs
...lementation/ProjectSystem/Legacy/AbstractLegacyProject.cs
+1
-2
src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/NamingStyleOptionPageControl.xaml.cs
...le/NamingPreferences/NamingStyleOptionPageControl.xaml.cs
+1
-2
src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
...s/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
+2
-4
src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs
...Portable/Indentation/CSharpIndentationService.Indenter.cs
+1
-2
src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs
...rkspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs
+1
-2
未找到文件。
src/EditorFeatures/Core.Wpf/Interactive/InteractiveDocumentNavigationService.cs
浏览文件 @
f5f980f0
...
...
@@ -32,15 +32,17 @@ public bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, in
public
bool
TryNavigateToSpan
(
Workspace
workspace
,
DocumentId
documentId
,
TextSpan
textSpan
,
OptionSet
options
)
{
var
interactiveWorkspace
=
workspace
as
InteractiveWorkspace
;
if
(
interactiveWorkspace
==
null
)
using
(
var
interactiveWorkspace
=
workspace
as
InteractiveWorkspace
)
{
Debug
.
Fail
(
"InteractiveDocumentNavigationService called with incorrect workspace!"
);
return
false
;
}
if
(
interactiveWorkspace
==
null
)
{
Debug
.
Fail
(
"InteractiveDocumentNavigationService called with incorrect workspace!"
);
return
false
;
}
var
textView
=
interactiveWorkspace
.
Window
.
TextView
;
var
document
=
interactiveWorkspace
.
CurrentSolution
.
GetDocument
(
documentId
);
var
textView
=
interactiveWorkspace
.
Window
.
TextView
;
var
document
=
interactiveWorkspace
.
CurrentSolution
.
GetDocument
(
documentId
);
}
var
textSnapshot
=
document
.
GetTextSynchronously
(
CancellationToken
.
None
).
FindCorrespondingEditorTextSnapshot
();
if
(
textSnapshot
==
null
)
...
...
src/EditorFeatures/Core/Extensibility/BraceMatching/AbstractDirectiveTriviaBraceMatcher.cs
浏览文件 @
f5f980f0
...
...
@@ -28,8 +28,7 @@ internal abstract class AbstractDirectiveTriviaBraceMatcher<TDirectiveTriviaSynt
var
root
=
await
document
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
token
=
root
.
FindToken
(
position
,
findInsideTrivia
:
true
);
var
directive
=
token
.
Parent
as
TDirectiveTriviaSyntax
;
if
(
directive
==
null
)
if
(!(
token
.
Parent
is
TDirectiveTriviaSyntax
directive
))
{
return
null
;
}
...
...
src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs
浏览文件 @
f5f980f0
...
...
@@ -91,8 +91,7 @@ private bool TryGetMethodReturnType(SyntaxNode node, SemanticModel model, Cancel
{
methodReturnType
=
null
;
var
symbol
=
model
.
GetEnclosingSymbol
(
node
.
Span
.
Start
,
cancellationToken
);
var
method
=
symbol
as
IMethodSymbol
;
if
(
method
==
null
||
method
.
ReturnsVoid
)
if
(!(
symbol
is
IMethodSymbol
method
)
||
method
.
ReturnsVoid
)
{
return
false
;
}
...
...
src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.CSharpCodeGenerator.cs
浏览文件 @
f5f980f0
...
...
@@ -313,8 +313,7 @@ private OperationStatus CheckActiveStatements(IEnumerable<StatementSyntax> state
foreach
(
var
statement
in
statements
)
{
var
declarationStatement
=
statement
as
LocalDeclarationStatementSyntax
;
if
(
declarationStatement
==
null
)
if
(!(
statement
is
LocalDeclarationStatementSyntax
declarationStatement
))
{
// if given statement is not decl statement.
yield
return
statement
;
...
...
src/Features/Core/Portable/ConvertAutoPropertyToFullProperty/AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs
浏览文件 @
f5f980f0
...
...
@@ -41,8 +41,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
var
semanticModel
=
await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
propertySymbol
=
semanticModel
.
GetDeclaredSymbol
(
property
)
as
IPropertySymbol
;
if
(
propertySymbol
==
null
)
if
(!(
semanticModel
.
GetDeclaredSymbol
(
property
)
is
IPropertySymbol
propertySymbol
))
{
return
;
}
...
...
src/Features/Core/Portable/Diagnostics/LiveDiagnosticUpdateArgsId.cs
浏览文件 @
f5f980f0
...
...
@@ -26,8 +26,7 @@ public LiveDiagnosticUpdateArgsId(DiagnosticAnalyzer analyzer, object key, int k
public
override
bool
Equals
(
object
obj
)
{
var
other
=
obj
as
LiveDiagnosticUpdateArgsId
;
if
(
other
==
null
)
if
(!(
obj
is
LiveDiagnosticUpdateArgsId
other
))
{
return
false
;
}
...
...
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.CodeModelEventCollector.cs
浏览文件 @
f5f980f0
...
...
@@ -182,9 +182,8 @@ private bool CompareExpressions(ExpressionSyntax oldExpression, ExpressionSyntax
&&
CompareExpressions
(
oldBinaryExpression
.
Right
,
newBinaryExpression
.
Right
);
}
if
(
oldExpression
is
AssignmentExpressionSyntax
)
if
(
oldExpression
is
AssignmentExpressionSyntax
oldAssignmentExpression
)
{
var
oldAssignmentExpression
=
(
AssignmentExpressionSyntax
)
oldExpression
;
var
newAssignmentExpression
=
(
AssignmentExpressionSyntax
)
newExpression
;
return
CompareExpressions
(
oldAssignmentExpression
.
Left
,
newAssignmentExpression
.
Left
)
...
...
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
浏览文件 @
f5f980f0
...
...
@@ -1163,9 +1163,7 @@ private EnvDTE.vsCMAccess GetDefaultAccessibility(SyntaxNode node)
public
override
SyntaxNode
SetAccess
(
SyntaxNode
node
,
EnvDTE
.
vsCMAccess
newAccess
)
{
var
member
=
node
as
MemberDeclarationSyntax
;
if
(
member
==
null
)
if
(!(
node
is
MemberDeclarationSyntax
member
))
{
throw
Exceptions
.
ThrowEFail
();
}
...
...
src/VisualStudio/CSharp/Impl/Debugging/CSharpProximityExpressionsService.Worker.cs
浏览文件 @
f5f980f0
...
...
@@ -98,8 +98,7 @@ private BlockSyntax GetImmediatelyContainingBlock()
private
bool
IsFirstBlockStatement
()
{
var
parentBlockOpt
=
_parentStatement
.
Parent
as
BlockSyntax
;
return
parentBlockOpt
!=
null
&&
parentBlockOpt
.
Statements
.
FirstOrDefault
()
==
_parentStatement
;
return
_parentStatement
.
Parent
is
BlockSyntax
parentBlockOpt
&&
parentBlockOpt
.
Statements
.
FirstOrDefault
()
==
_parentStatement
;
}
private
void
AddCurrentDeclaration
()
...
...
src/VisualStudio/Core/Def/Implementation/ProjectSystem/Legacy/AbstractLegacyProject.cs
浏览文件 @
f5f980f0
...
...
@@ -207,8 +207,7 @@ protected void RemoveFile(string filename)
protected
void
RefreshBinOutputPath
()
{
var
storage
=
Hierarchy
as
IVsBuildPropertyStorage
;
if
(
storage
==
null
)
if
(!(
Hierarchy
is
IVsBuildPropertyStorage
storage
))
{
return
;
}
...
...
src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/NamingStyleOptionPageControl.xaml.cs
浏览文件 @
f5f980f0
...
...
@@ -121,8 +121,7 @@ private void SetFocusToSelectedRow()
{
if
(
CodeStyleMembers
.
SelectedIndex
>=
0
)
{
var
row
=
CodeStyleMembers
.
ItemContainerGenerator
.
ContainerFromIndex
(
CodeStyleMembers
.
SelectedIndex
)
as
DataGridRow
;
if
(
row
==
null
)
if
(!(
CodeStyleMembers
.
ItemContainerGenerator
.
ContainerFromIndex
(
CodeStyleMembers
.
SelectedIndex
)
is
DataGridRow
row
))
{
CodeStyleMembers
.
ScrollIntoView
(
CodeStyleMembers
.
SelectedItem
);
row
=
CodeStyleMembers
.
ItemContainerGenerator
.
ContainerFromIndex
(
CodeStyleMembers
.
SelectedIndex
)
as
DataGridRow
;
...
...
src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
浏览文件 @
f5f980f0
...
...
@@ -2201,8 +2201,7 @@ public override SyntaxNode GetType(SyntaxNode declaration)
private
static
TypeSyntax
NotVoid
(
TypeSyntax
type
)
{
var
pd
=
type
as
PredefinedTypeSyntax
;
return
pd
!=
null
&&
pd
.
Keyword
.
IsKind
(
SyntaxKind
.
VoidKeyword
)
?
null
:
type
;
return
type
is
PredefinedTypeSyntax
pd
&&
pd
.
Keyword
.
IsKind
(
SyntaxKind
.
VoidKeyword
)
?
null
:
type
;
}
public
override
SyntaxNode
WithType
(
SyntaxNode
declaration
,
SyntaxNode
type
)
...
...
@@ -2383,8 +2382,7 @@ public override IReadOnlyList<SyntaxNode> GetSwitchSections(SyntaxNode switchSta
public
override
SyntaxNode
InsertSwitchSections
(
SyntaxNode
switchStatement
,
int
index
,
IEnumerable
<
SyntaxNode
>
switchSections
)
{
var
statement
=
switchStatement
as
SwitchStatementSyntax
;
if
(
statement
==
null
)
if
(!(
switchStatement
is
SwitchStatementSyntax
statement
))
{
return
switchStatement
;
}
...
...
src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs
浏览文件 @
f5f980f0
...
...
@@ -344,8 +344,7 @@ private IndentationResult GetIndentationForQueryExpression(SyntaxToken token)
}
// find query body that has a token that is a first token on the line
var
queryBody
=
queryExpressionClause
.
Parent
as
QueryBodySyntax
;
if
(
queryBody
==
null
)
if
(!(
queryExpressionClause
.
Parent
is
QueryBodySyntax
queryBody
))
{
return
GetIndentationOfToken
(
firstToken
);
}
...
...
src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs
浏览文件 @
f5f980f0
...
...
@@ -114,9 +114,8 @@ public static SemanticModel CreateSpeculativeSemanticModelForNode(SyntaxNode nod
semanticModel
=
semanticModel
.
ParentModel
;
}
var
statementNode
=
nodeToSpeculate
as
StatementSyntax
;
SemanticModel
speculativeModel
;
if
(
statementNode
!=
null
)
if
(
nodeToSpeculate
is
StatementSyntax
statementNode
)
{
semanticModel
.
TryGetSpeculativeSemanticModel
(
position
,
statementNode
,
out
speculativeModel
);
return
speculativeModel
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录