Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
0905634a
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,发现更多精彩内容 >>
提交
0905634a
编写于
3月 10, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use patterns in more places.
上级
40f44bed
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
152 addition
and
194 deletion
+152
-194
src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs
...t/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs
+2
-2
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.CodeModelEventCollector.cs
...deModel/CSharpCodeModelService.CodeModelEventCollector.cs
+37
-40
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
...ualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
+75
-110
src/VisualStudio/CSharp/Impl/CodeModel/SyntaxNodeExtensions.cs
...isualStudio/CSharp/Impl/CodeModel/SyntaxNodeExtensions.cs
+16
-16
src/VisualStudio/CSharp/Impl/Debugging/CSharpProximityExpressionsService_ExpressionTermCollector.cs
...arpProximityExpressionsService_ExpressionTermCollector.cs
+11
-14
src/VisualStudio/IntegrationTest/TestUtilities/Input/SendKeys.cs
...ualStudio/IntegrationTest/TestUtilities/Input/SendKeys.cs
+9
-10
src/Workspaces/Remote/Core/Services/AssetStorage.cs
src/Workspaces/Remote/Core/Services/AssetStorage.cs
+2
-2
未找到文件。
src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs
浏览文件 @
0905634a
...
...
@@ -1155,9 +1155,9 @@ private static long IntegralValue(object value)
return
(
long
)
value
;
}
if
(
value
is
int
)
if
(
value
is
int
i
)
{
return
(
int
)
value
;
return
i
;
}
return
0
;
...
...
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.CodeModelEventCollector.cs
浏览文件 @
0905634a
...
...
@@ -254,17 +254,17 @@ private bool CompareParameters(ParameterSyntax oldParameter, ParameterSyntax new
{
return
CompareMethodDeclarations
((
BaseMethodDeclarationSyntax
)
oldMember
,
(
BaseMethodDeclarationSyntax
)
newMember
,
newNodeParent
,
eventQueue
);
}
else
if
(
oldMember
is
BaseFieldDeclarationSyntax
)
else
if
(
oldMember
is
BaseFieldDeclarationSyntax
baseField
)
{
return
CompareFieldDeclarations
(
(
BaseFieldDeclarationSyntax
)
oldMember
,
(
BaseFieldDeclarationSyntax
)
newMember
,
newNodeParent
,
eventQueue
);
return
CompareFieldDeclarations
(
baseField
,
(
BaseFieldDeclarationSyntax
)
newMember
,
newNodeParent
,
eventQueue
);
}
else
if
(
oldMember
is
BasePropertyDeclarationSyntax
)
else
if
(
oldMember
is
BasePropertyDeclarationSyntax
baseProperty
)
{
return
ComparePropertyDeclarations
(
(
BasePropertyDeclarationSyntax
)
oldMember
,
(
BasePropertyDeclarationSyntax
)
newMember
,
newNodeParent
,
eventQueue
);
return
ComparePropertyDeclarations
(
baseProperty
,
(
BasePropertyDeclarationSyntax
)
newMember
,
newNodeParent
,
eventQueue
);
}
else
if
(
oldMember
is
EnumMemberDeclarationSyntax
)
else
if
(
oldMember
is
EnumMemberDeclarationSyntax
enumMember
)
{
return
CompareEnumMemberDeclarations
(
(
EnumMemberDeclarationSyntax
)
old
Member
,
(
EnumMemberDeclarationSyntax
)
newMember
,
newNodeParent
,
eventQueue
);
return
CompareEnumMemberDeclarations
(
enum
Member
,
(
EnumMemberDeclarationSyntax
)
newMember
,
newNodeParent
,
eventQueue
);
}
throw
new
NotImplementedException
();
...
...
@@ -335,9 +335,8 @@ private bool CompareParameters(ParameterSyntax oldParameter, ParameterSyntax new
CodeModelEventType
.
Unknown
,
eventQueue
);
if
(
oldProperty
is
IndexerDeclarationSyntax
)
if
(
oldProperty
is
IndexerDeclarationSyntax
oldIndexer
)
{
var
oldIndexer
=
(
IndexerDeclarationSyntax
)
oldProperty
;
var
newIndexer
=
(
IndexerDeclarationSyntax
)
newProperty
;
same
&=
CompareChildren
(
CompareParameters
,
...
...
@@ -528,9 +527,8 @@ private bool CompareParameters(ParameterSyntax oldParameter, ParameterSyntax new
return
false
;
}
if
(
oldMember
is
BaseTypeDeclarationSyntax
)
if
(
oldMember
is
BaseTypeDeclarationSyntax
oldType
)
{
var
oldType
=
(
BaseTypeDeclarationSyntax
)
oldMember
;
var
newType
=
(
BaseTypeDeclarationSyntax
)
newMember
;
var
oldMembers
=
GetValidMembers
(
oldType
);
...
...
@@ -590,9 +588,8 @@ private bool CompareParameters(ParameterSyntax oldParameter, ParameterSyntax new
return
same
;
}
else
if
(
oldMember
is
DelegateDeclarationSyntax
)
else
if
(
oldMember
is
DelegateDeclarationSyntax
oldDelegate
)
{
var
oldDelegate
=
(
DelegateDeclarationSyntax
)
oldMember
;
var
newDelegate
=
(
DelegateDeclarationSyntax
)
newMember
;
bool
same
=
true
;
...
...
@@ -673,9 +670,9 @@ private bool CompareParameters(ParameterSyntax oldParameter, ParameterSyntax new
{
return
CompareTypeDeclarations
(
oldNamespaceOrType
,
newNamespaceOrType
,
newNodeParent
,
eventQueue
);
}
else
if
(
oldNamespaceOrType
is
NamespaceDeclarationSyntax
)
else
if
(
oldNamespaceOrType
is
NamespaceDeclarationSyntax
namespaceDecl
)
{
return
CompareNamespaceDeclarations
(
(
NamespaceDeclarationSyntax
)
oldNamespaceOrType
,
(
NamespaceDeclarationSyntax
)
newNamespaceOrType
,
newNodeParent
,
eventQueue
);
return
CompareNamespaceDeclarations
(
namespaceDecl
,
(
NamespaceDeclarationSyntax
)
newNamespaceOrType
,
newNodeParent
,
eventQueue
);
}
return
false
;
...
...
@@ -837,13 +834,13 @@ private bool CompareTypes(TypeSyntax oldType, TypeSyntax newType)
private
TypeSyntax
GetReturnType
(
BaseMethodDeclarationSyntax
method
)
{
if
(
method
is
MethodDeclarationSyntax
)
if
(
method
is
MethodDeclarationSyntax
methodDecl
)
{
return
((
MethodDeclarationSyntax
)
method
)
.
ReturnType
;
return
methodDecl
.
ReturnType
;
}
else
if
(
method
is
OperatorDeclarationSyntax
)
else
if
(
method
is
OperatorDeclarationSyntax
operatorDecl
)
{
return
((
OperatorDeclarationSyntax
)
method
)
.
ReturnType
;
return
operatorDecl
.
ReturnType
;
}
// TODO(DustinCa): What about conversion operators? How does the legacy code base handle those?
...
...
@@ -868,23 +865,23 @@ protected override void EnqueueAddEvent(SyntaxNode node, SyntaxNode parent, Code
return
;
}
if
(
node
is
BaseFieldDeclarationSyntax
)
if
(
node
is
BaseFieldDeclarationSyntax
baseField
)
{
foreach
(
var
variableDeclarator
in
((
BaseFieldDeclarationSyntax
)
node
)
.
Declaration
.
Variables
)
foreach
(
var
variableDeclarator
in
baseField
.
Declaration
.
Variables
)
{
eventQueue
.
EnqueueAddEvent
(
variableDeclarator
,
parent
);
}
}
else
if
(
node
is
AttributeListSyntax
)
else
if
(
node
is
AttributeListSyntax
attributeList
)
{
foreach
(
var
attribute
in
((
AttributeListSyntax
)
node
)
.
Attributes
)
foreach
(
var
attribute
in
attributeList
.
Attributes
)
{
AddEventToEventQueueForAttributes
(
attribute
,
parent
,
eventQueue
.
EnqueueAddEvent
);
}
}
else
if
(
node
is
AttributeSyntax
)
else
if
(
node
is
AttributeSyntax
attribute
)
{
AddEventToEventQueueForAttributes
(
(
AttributeSyntax
)
nod
e
,
parent
,
eventQueue
.
EnqueueAddEvent
);
AddEventToEventQueueForAttributes
(
attribut
e
,
parent
,
eventQueue
.
EnqueueAddEvent
);
}
else
{
...
...
@@ -904,23 +901,23 @@ protected override void EnqueueChangeEvent(SyntaxNode node, SyntaxNode parent, C
return
;
}
if
(
node
is
BaseFieldDeclarationSyntax
)
if
(
node
is
BaseFieldDeclarationSyntax
baseField
)
{
foreach
(
var
variableDeclarator
in
((
BaseFieldDeclarationSyntax
)
node
)
.
Declaration
.
Variables
)
foreach
(
var
variableDeclarator
in
baseField
.
Declaration
.
Variables
)
{
eventQueue
.
EnqueueChangeEvent
(
variableDeclarator
,
parent
,
eventType
);
}
}
else
if
(
node
is
AttributeListSyntax
)
else
if
(
node
is
AttributeListSyntax
attributeList
)
{
foreach
(
var
attribute
in
((
AttributeListSyntax
)
node
)
.
Attributes
)
foreach
(
var
attribute
in
attributeList
.
Attributes
)
{
ChangeEventQueueForAttributes
(
attribute
,
parent
,
eventType
,
eventQueue
);
}
}
else
if
(
node
is
AttributeSyntax
)
else
if
(
node
is
AttributeSyntax
attribute
)
{
ChangeEventQueueForAttributes
(
(
AttributeSyntax
)
nod
e
,
parent
,
eventType
,
eventQueue
);
ChangeEventQueueForAttributes
(
attribut
e
,
parent
,
eventType
,
eventQueue
);
}
else
{
...
...
@@ -930,9 +927,9 @@ protected override void EnqueueChangeEvent(SyntaxNode node, SyntaxNode parent, C
private
static
void
ChangeEventQueueForAttributes
(
AttributeSyntax
attribute
,
SyntaxNode
parent
,
CodeModelEventType
eventType
,
CodeModelEventQueue
eventQueue
)
{
if
(
parent
is
BaseFieldDeclarationSyntax
)
if
(
parent
is
BaseFieldDeclarationSyntax
baseField
)
{
foreach
(
var
variableDeclarator
in
((
BaseFieldDeclarationSyntax
)
parent
)
.
Declaration
.
Variables
)
foreach
(
var
variableDeclarator
in
baseField
.
Declaration
.
Variables
)
{
eventQueue
.
EnqueueChangeEvent
(
attribute
,
variableDeclarator
,
eventType
);
}
...
...
@@ -955,23 +952,23 @@ protected override void EnqueueRemoveEvent(SyntaxNode node, SyntaxNode parent, C
return
;
}
if
(
node
is
BaseFieldDeclarationSyntax
)
if
(
node
is
BaseFieldDeclarationSyntax
baseField
)
{
foreach
(
var
variableDeclarator
in
((
BaseFieldDeclarationSyntax
)
node
)
.
Declaration
.
Variables
)
foreach
(
var
variableDeclarator
in
baseField
.
Declaration
.
Variables
)
{
eventQueue
.
EnqueueRemoveEvent
(
variableDeclarator
,
parent
);
}
}
else
if
(
node
is
AttributeListSyntax
)
else
if
(
node
is
AttributeListSyntax
attributeList
)
{
foreach
(
var
attribute
in
((
AttributeListSyntax
)
node
)
.
Attributes
)
foreach
(
var
attribute
in
attributeList
.
Attributes
)
{
AddEventToEventQueueForAttributes
(
attribute
,
parent
,
eventQueue
.
EnqueueRemoveEvent
);
}
}
else
if
(
node
is
AttributeSyntax
)
else
if
(
node
is
AttributeSyntax
attribute
)
{
AddEventToEventQueueForAttributes
(
(
AttributeSyntax
)
nod
e
,
parent
,
eventQueue
.
EnqueueRemoveEvent
);
AddEventToEventQueueForAttributes
(
attribut
e
,
parent
,
eventQueue
.
EnqueueRemoveEvent
);
}
else
{
...
...
@@ -981,9 +978,9 @@ protected override void EnqueueRemoveEvent(SyntaxNode node, SyntaxNode parent, C
private
void
AddEventToEventQueueForAttributes
(
AttributeSyntax
attribute
,
SyntaxNode
parent
,
Action
<
SyntaxNode
,
SyntaxNode
>
enqueueAddOrRemoveEvent
)
{
if
(
parent
is
BaseFieldDeclarationSyntax
)
if
(
parent
is
BaseFieldDeclarationSyntax
baseField
)
{
foreach
(
var
variableDeclarator
in
((
BaseFieldDeclarationSyntax
)
parent
)
.
Declaration
.
Variables
)
foreach
(
var
variableDeclarator
in
baseField
.
Declaration
.
Variables
)
{
enqueueAddOrRemoveEvent
(
attribute
,
variableDeclarator
);
}
...
...
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
浏览文件 @
0905634a
此差异已折叠。
点击以展开。
src/VisualStudio/CSharp/Impl/CodeModel/SyntaxNodeExtensions.cs
浏览文件 @
0905634a
...
...
@@ -9,44 +9,44 @@ internal static class SyntaxNodeExtensions
{
public
static
bool
TryGetAttributeLists
(
this
SyntaxNode
node
,
out
SyntaxList
<
AttributeListSyntax
>
attributeLists
)
{
if
(
node
is
CompilationUnitSyntax
)
if
(
node
is
CompilationUnitSyntax
compilationUnit
)
{
attributeLists
=
((
CompilationUnitSyntax
)
node
)
.
AttributeLists
;
attributeLists
=
compilationUnit
.
AttributeLists
;
return
true
;
}
else
if
(
node
is
BaseTypeDeclarationSyntax
)
else
if
(
node
is
BaseTypeDeclarationSyntax
baseType
)
{
attributeLists
=
((
BaseTypeDeclarationSyntax
)
node
)
.
AttributeLists
;
attributeLists
=
baseType
.
AttributeLists
;
return
true
;
}
else
if
(
node
is
BaseMethodDeclarationSyntax
)
else
if
(
node
is
BaseMethodDeclarationSyntax
baseMethod
)
{
attributeLists
=
((
BaseMethodDeclarationSyntax
)
node
)
.
AttributeLists
;
attributeLists
=
baseMethod
.
AttributeLists
;
return
true
;
}
else
if
(
node
is
BasePropertyDeclarationSyntax
)
else
if
(
node
is
BasePropertyDeclarationSyntax
baseProperty
)
{
attributeLists
=
((
BasePropertyDeclarationSyntax
)
node
)
.
AttributeLists
;
attributeLists
=
baseProperty
.
AttributeLists
;
return
true
;
}
else
if
(
node
is
BaseFieldDeclarationSyntax
)
else
if
(
node
is
BaseFieldDeclarationSyntax
baseField
)
{
attributeLists
=
((
BaseFieldDeclarationSyntax
)
node
)
.
AttributeLists
;
attributeLists
=
baseField
.
AttributeLists
;
return
true
;
}
else
if
(
node
is
DelegateDeclarationSyntax
)
else
if
(
node
is
DelegateDeclarationSyntax
delegateDeclaration
)
{
attributeLists
=
((
DelegateDeclarationSyntax
)
node
)
.
AttributeLists
;
attributeLists
=
delegateDeclaration
.
AttributeLists
;
return
true
;
}
else
if
(
node
is
EnumMemberDeclarationSyntax
)
else
if
(
node
is
EnumMemberDeclarationSyntax
enumMember
)
{
attributeLists
=
((
EnumMemberDeclarationSyntax
)
node
)
.
AttributeLists
;
attributeLists
=
enumMember
.
AttributeLists
;
return
true
;
}
else
if
(
node
is
ParameterSyntax
)
else
if
(
node
is
ParameterSyntax
parameter
)
{
attributeLists
=
((
ParameterSyntax
)
node
)
.
AttributeLists
;
attributeLists
=
parameter
.
AttributeLists
;
return
true
;
}
...
...
src/VisualStudio/CSharp/Impl/Debugging/CSharpProximityExpressionsService_ExpressionTermCollector.cs
浏览文件 @
0905634a
...
...
@@ -112,46 +112,43 @@ private static void AddSubExpressionTerms(ExpressionSyntax expression, IList<str
// +, -, ++, --, !, etc.
//
// This is a valid expression if it doesn't have obvious side effects (i.e. ++, --)
if
(
expression
is
PrefixUnaryExpressionSyntax
)
if
(
expression
is
PrefixUnaryExpressionSyntax
prefixUnary
)
{
AddPrefixUnaryExpressionTerms
(
(
PrefixUnaryExpressionSyntax
)
expression
,
terms
,
ref
expressionType
);
AddPrefixUnaryExpressionTerms
(
prefixUnary
,
terms
,
ref
expressionType
);
return
;
}
if
(
expression
is
AwaitExpressionSyntax
)
if
(
expression
is
AwaitExpressionSyntax
awaitExpression
)
{
AddAwaitExpressionTerms
(
(
AwaitExpressionSyntax
)
e
xpression
,
terms
,
ref
expressionType
);
AddAwaitExpressionTerms
(
awaitE
xpression
,
terms
,
ref
expressionType
);
return
;
}
if
(
expression
is
PostfixUnaryExpressionSyntax
)
if
(
expression
is
PostfixUnaryExpressionSyntax
postfixExpression
)
{
AddPostfixUnaryExpressionTerms
(
(
PostfixUnaryExpressionSyntax
)
e
xpression
,
terms
,
ref
expressionType
);
AddPostfixUnaryExpressionTerms
(
postfixE
xpression
,
terms
,
ref
expressionType
);
return
;
}
if
(
expression
is
BinaryExpressionSyntax
)
if
(
expression
is
BinaryExpressionSyntax
binaryExpression
)
{
var
binaryExpression
=
(
BinaryExpressionSyntax
)
expression
;
AddBinaryExpressionTerms
(
expression
,
binaryExpression
.
Left
,
binaryExpression
.
Right
,
terms
,
ref
expressionType
);
return
;
}
if
(
expression
is
AssignmentExpressionSyntax
)
if
(
expression
is
AssignmentExpressionSyntax
assignmentExpression
)
{
var
assignmentExpression
=
(
AssignmentExpressionSyntax
)
expression
;
AddBinaryExpressionTerms
(
expression
,
assignmentExpression
.
Left
,
assignmentExpression
.
Right
,
terms
,
ref
expressionType
);
return
;
}
if
(
expression
is
ConditionalExpressionSyntax
)
if
(
expression
is
ConditionalExpressionSyntax
conditional
)
{
AddConditionalExpressionTerms
(
(
ConditionalExpressionSyntax
)
expression
,
terms
,
ref
expressionType
);
AddConditionalExpressionTerms
(
conditional
,
terms
,
ref
expressionType
);
return
;
}
var
parenthesizedExpression
=
expression
as
ParenthesizedExpressionSyntax
;
if
(
parenthesizedExpression
!=
null
)
if
(
expression
is
ParenthesizedExpressionSyntax
parenthesizedExpression
)
{
AddSubExpressionTerms
(
parenthesizedExpression
.
Expression
,
terms
,
ref
expressionType
);
}
...
...
src/VisualStudio/IntegrationTest/TestUtilities/Input/SendKeys.cs
浏览文件 @
0905634a
...
...
@@ -21,28 +21,27 @@ public void Send(params object[] keys)
foreach
(
var
key
in
keys
)
{
if
(
key
is
string
)
if
(
key
is
string
s
)
{
var
text
=
((
string
)
key
)
.
Replace
(
"\r\n"
,
"\r"
)
.
Replace
(
"\n"
,
"\r"
);
var
text
=
s
.
Replace
(
"\r\n"
,
"\r"
)
.
Replace
(
"\n"
,
"\r"
);
foreach
(
var
ch
in
text
)
{
AddInputs
(
inputs
,
ch
);
}
}
else
if
(
key
is
char
)
else
if
(
key
is
char
c
)
{
AddInputs
(
inputs
,
(
char
)
key
);
AddInputs
(
inputs
,
c
);
}
else
if
(
key
is
VirtualKey
)
else
if
(
key
is
VirtualKey
virtualKey
)
{
AddInputs
(
inputs
,
(
VirtualKey
)
k
ey
);
AddInputs
(
inputs
,
virtualK
ey
);
}
else
if
(
key
is
KeyPress
)
else
if
(
key
is
KeyPress
keyPress
)
{
AddInputs
(
inputs
,
(
KeyPress
)
key
);
AddInputs
(
inputs
,
keyPress
);
}
else
if
(
key
==
null
)
{
...
...
src/Workspaces/Remote/Core/Services/AssetStorage.cs
浏览文件 @
0905634a
...
...
@@ -84,9 +84,9 @@ public IEnumerable<T> GetGlobalAssetsOfType<T>(CancellationToken cancellationTok
cancellationToken
.
ThrowIfCancellationRequested
();
var
value
=
asset
.
Value
.
Object
;
if
(
value
is
T
)
if
(
value
is
T
tValue
)
{
yield
return
(
T
)
v
alue
;
yield
return
tV
alue
;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录