Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8025e92d
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,发现更多精彩内容 >>
提交
8025e92d
编写于
7月 18, 2019
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use pattern matching
上级
15b00bf6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
33 deletion
+17
-33
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
...ualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
+14
-30
src/VisualStudio/CSharp/Impl/EventHookup/EventHookupSessionManager_EventHookupSession.cs
...entHookup/EventHookupSessionManager_EventHookupSession.cs
+3
-3
未找到文件。
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
浏览文件 @
8025e92d
...
@@ -1406,8 +1406,7 @@ public override SyntaxNode SetDocComment(SyntaxNode node, string value)
...
@@ -1406,8 +1406,7 @@ public override SyntaxNode SetDocComment(SyntaxNode node, string value)
throw
Exceptions
.
ThrowEInvalidArg
();
throw
Exceptions
.
ThrowEInvalidArg
();
}
}
var
docElement
=
xmlDocument
.
FirstNode
as
XElement
;
if
(!(
xmlDocument
.
FirstNode
is
XElement
docElement
)
||
if
(
docElement
==
null
||
docElement
.
Name
.
ToString
().
ToLower
()
!=
"doc"
)
docElement
.
Name
.
ToString
().
ToLower
()
!=
"doc"
)
{
{
throw
Exceptions
.
ThrowEInvalidArg
();
throw
Exceptions
.
ThrowEInvalidArg
();
...
@@ -1900,9 +1899,7 @@ public override EnvDTE80.vsCMParameterKind GetParameterKind(SyntaxNode node)
...
@@ -1900,9 +1899,7 @@ public override EnvDTE80.vsCMParameterKind GetParameterKind(SyntaxNode node)
public
override
SyntaxNode
SetParameterKind
(
SyntaxNode
node
,
EnvDTE80
.
vsCMParameterKind
kind
)
public
override
SyntaxNode
SetParameterKind
(
SyntaxNode
node
,
EnvDTE80
.
vsCMParameterKind
kind
)
{
{
var
parameter
=
node
as
ParameterSyntax
;
if
(!(
node
is
ParameterSyntax
parameter
))
if
(
parameter
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2013,8 +2010,7 @@ public override bool GetCanOverride(SyntaxNode memberNode)
...
@@ -2013,8 +2010,7 @@ public override bool GetCanOverride(SyntaxNode memberNode)
{
{
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
);
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
);
var
member
=
memberNode
as
MemberDeclarationSyntax
;
if
(!(
memberNode
is
MemberDeclarationSyntax
member
))
if
(
member
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2252,8 +2248,7 @@ public override bool GetMustImplement(SyntaxNode memberNode)
...
@@ -2252,8 +2248,7 @@ public override bool GetMustImplement(SyntaxNode memberNode)
{
{
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
);
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
);
var
member
=
memberNode
as
MemberDeclarationSyntax
;
if
(!(
memberNode
is
MemberDeclarationSyntax
member
))
if
(
member
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2274,8 +2269,7 @@ public override SyntaxNode SetMustImplement(SyntaxNode memberNode, bool value)
...
@@ -2274,8 +2269,7 @@ public override SyntaxNode SetMustImplement(SyntaxNode memberNode, bool value)
memberNode
is
BasePropertyDeclarationSyntax
||
memberNode
is
BasePropertyDeclarationSyntax
||
memberNode
is
EventFieldDeclarationSyntax
);
memberNode
is
EventFieldDeclarationSyntax
);
var
member
=
memberNode
as
MemberDeclarationSyntax
;
if
(!(
memberNode
is
MemberDeclarationSyntax
member
))
if
(
member
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2390,8 +2384,7 @@ public override SyntaxNode SetInheritanceKind(SyntaxNode typeNode, EnvDTE80.vsCM
...
@@ -2390,8 +2384,7 @@ public override SyntaxNode SetInheritanceKind(SyntaxNode typeNode, EnvDTE80.vsCM
{
{
Debug
.
Assert
(
typeNode
is
ClassDeclarationSyntax
);
Debug
.
Assert
(
typeNode
is
ClassDeclarationSyntax
);
var
member
=
typeNode
as
MemberDeclarationSyntax
;
if
(!(
typeNode
is
MemberDeclarationSyntax
member
))
if
(
member
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2532,8 +2525,7 @@ public override SyntaxNode SetIsAbstract(SyntaxNode memberNode, bool value)
...
@@ -2532,8 +2525,7 @@ public override SyntaxNode SetIsAbstract(SyntaxNode memberNode, bool value)
{
{
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
);
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
);
var
member
=
memberNode
as
MemberDeclarationSyntax
;
if
(!(
memberNode
is
MemberDeclarationSyntax
member
))
if
(
member
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2562,8 +2554,7 @@ public override bool GetIsConstant(SyntaxNode variableNode)
...
@@ -2562,8 +2554,7 @@ public override bool GetIsConstant(SyntaxNode variableNode)
return
true
;
return
true
;
}
}
var
member
=
GetNodeWithModifiers
(
variableNode
)
as
MemberDeclarationSyntax
;
if
(!(
GetNodeWithModifiers
(
variableNode
)
is
MemberDeclarationSyntax
member
))
if
(
member
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2586,8 +2577,7 @@ public override SyntaxNode SetIsConstant(SyntaxNode variableNode, bool value)
...
@@ -2586,8 +2577,7 @@ public override SyntaxNode SetIsConstant(SyntaxNode variableNode, bool value)
return
variableNode
;
return
variableNode
;
}
}
var
member
=
variableNode
as
MemberDeclarationSyntax
;
if
(!(
variableNode
is
MemberDeclarationSyntax
member
))
if
(
member
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2615,8 +2605,7 @@ public override bool GetIsDefault(SyntaxNode propertyNode)
...
@@ -2615,8 +2605,7 @@ public override bool GetIsDefault(SyntaxNode propertyNode)
{
{
Debug
.
Assert
(
propertyNode
is
BasePropertyDeclarationSyntax
);
Debug
.
Assert
(
propertyNode
is
BasePropertyDeclarationSyntax
);
var
property
=
propertyNode
as
BasePropertyDeclarationSyntax
;
if
(!(
propertyNode
is
BasePropertyDeclarationSyntax
property
))
if
(
property
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2634,8 +2623,7 @@ public override bool GetIsGeneric(SyntaxNode memberNode)
...
@@ -2634,8 +2623,7 @@ public override bool GetIsGeneric(SyntaxNode memberNode)
{
{
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
);
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
);
var
member
=
GetNodeWithModifiers
(
memberNode
)
as
MemberDeclarationSyntax
;
if
(!(
GetNodeWithModifiers
(
memberNode
)
is
MemberDeclarationSyntax
member
))
if
(
member
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2656,8 +2644,7 @@ public override bool GetIsShared(SyntaxNode memberNode, ISymbol symbol)
...
@@ -2656,8 +2644,7 @@ public override bool GetIsShared(SyntaxNode memberNode, ISymbol symbol)
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
||
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
||
memberNode
is
VariableDeclaratorSyntax
);
memberNode
is
VariableDeclaratorSyntax
);
var
member
=
GetNodeWithModifiers
(
memberNode
)
as
MemberDeclarationSyntax
;
if
(!(
GetNodeWithModifiers
(
memberNode
)
is
MemberDeclarationSyntax
member
))
if
(
member
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -2669,8 +2656,7 @@ public override SyntaxNode SetIsShared(SyntaxNode memberNode, bool value)
...
@@ -2669,8 +2656,7 @@ public override SyntaxNode SetIsShared(SyntaxNode memberNode, bool value)
{
{
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
);
Debug
.
Assert
(
memberNode
is
MemberDeclarationSyntax
);
var
member
=
memberNode
as
MemberDeclarationSyntax
;
if
(!(
memberNode
is
MemberDeclarationSyntax
member
))
if
(
member
==
null
)
{
{
throw
Exceptions
.
ThrowEFail
();
throw
Exceptions
.
ThrowEFail
();
}
}
...
@@ -3715,11 +3701,9 @@ public override object GetTypeExtender(string name, AbstractCodeType symbol)
...
@@ -3715,11 +3701,9 @@ public override object GetTypeExtender(string name, AbstractCodeType symbol)
protected
override
bool
AddBlankLineToMethodBody
(
SyntaxNode
node
,
SyntaxNode
newNode
)
protected
override
bool
AddBlankLineToMethodBody
(
SyntaxNode
node
,
SyntaxNode
newNode
)
{
{
var
newMethodDeclaration
=
newNode
as
MethodDeclarationSyntax
;
return
node
is
MethodDeclarationSyntax
methodDeclaration
return
node
is
MethodDeclarationSyntax
methodDeclaration
&&
methodDeclaration
.
Body
==
null
&&
methodDeclaration
.
Body
==
null
&&
new
MethodDeclaration
!=
null
&&
new
Node
is
MethodDeclarationSyntax
newMethodDeclaration
&&
newMethodDeclaration
.
Body
!=
null
;
&&
newMethodDeclaration
.
Body
!=
null
;
}
}
...
...
src/VisualStudio/CSharp/Impl/EventHookup/EventHookupSessionManager_EventHookupSession.cs
浏览文件 @
8025e92d
...
@@ -191,8 +191,7 @@ private async Task<string> DetermineIfEventHookupAndGetHandlerNameAsync(Document
...
@@ -191,8 +191,7 @@ private async Task<string> DetermineIfEventHookupAndGetHandlerNameAsync(Document
private
IEventSymbol
GetEventSymbol
(
SemanticModel
semanticModel
,
SyntaxToken
plusEqualsToken
,
CancellationToken
cancellationToken
)
private
IEventSymbol
GetEventSymbol
(
SemanticModel
semanticModel
,
SyntaxToken
plusEqualsToken
,
CancellationToken
cancellationToken
)
{
{
AssertIsBackground
();
AssertIsBackground
();
var
parentToken
=
plusEqualsToken
.
Parent
as
AssignmentExpressionSyntax
;
if
(!(
plusEqualsToken
.
Parent
is
AssignmentExpressionSyntax
parentToken
))
if
(
parentToken
==
null
)
{
{
return
null
;
return
null
;
}
}
...
@@ -254,7 +253,8 @@ private string GetNameObjectPart(IEventSymbol eventSymbol, SyntaxToken plusEqual
...
@@ -254,7 +253,8 @@ private string GetNameObjectPart(IEventSymbol eventSymbol, SyntaxToken plusEqual
// Note: For generic, it's ok(it's even a good idea) to exclude type variables,
// Note: For generic, it's ok(it's even a good idea) to exclude type variables,
// because the name is only used as a prefix for the method name.
// because the name is only used as a prefix for the method name.
var
typeDeclaration
=
syntaxFactsService
.
GetContainingTypeDeclaration
(
return
syntaxFactsService
.
GetContainingTypeDeclaration
(
semanticModel
.
SyntaxTree
.
GetRoot
(),
semanticModel
.
SyntaxTree
.
GetRoot
(),
plusEqualsToken
.
SpanStart
)
as
BaseTypeDeclarationSyntax
;
plusEqualsToken
.
SpanStart
)
as
BaseTypeDeclarationSyntax
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录