Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
553503d9
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
553503d9
编写于
7月 29, 2019
作者:
M
Manish Vasani
提交者:
GitHub
7月 29, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #37525 from CyrusNajmabadi/removeMethods
Remove unneeded method
上级
32149eb8
50b732e9
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
23 addition
and
38 deletion
+23
-38
src/Features/CSharp/Portable/Completion/KeywordRecommenders/BaseKeywordRecommender.cs
.../Completion/KeywordRecommenders/BaseKeywordRecommender.cs
+1
-1
src/Features/CSharp/Portable/Completion/KeywordRecommenders/NamespaceKeywordRecommender.cs
...letion/KeywordRecommenders/NamespaceKeywordRecommender.cs
+2
-2
src/Features/CSharp/Portable/Completion/KeywordRecommenders/WhereKeywordRecommender.cs
...Completion/KeywordRecommenders/WhereKeywordRecommender.cs
+1
-2
src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceVariableService.cs
...table/IntroduceVariable/CSharpIntroduceVariableService.cs
+1
-1
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTokenExtensions.cs
...Portable/Extensions/ContextQuery/SyntaxTokenExtensions.cs
+5
-5
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
.../Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
+7
-7
src/Workspaces/CSharp/Portable/Extensions/SyntaxNodeExtensions.cs
...spaces/CSharp/Portable/Extensions/SyntaxNodeExtensions.cs
+1
-6
src/Workspaces/CSharp/Portable/Extensions/SyntaxNodeExtensions_SharedWithCodeStyle.cs
...le/Extensions/SyntaxNodeExtensions_SharedWithCodeStyle.cs
+4
-12
src/Workspaces/Core/Portable/Shared/Extensions/SyntaxNodeExtensions.cs
...s/Core/Portable/Shared/Extensions/SyntaxNodeExtensions.cs
+1
-2
未找到文件。
src/Features/CSharp/Portable/Completion/KeywordRecommenders/BaseKeywordRecommender.cs
浏览文件 @
553503d9
...
...
@@ -49,7 +49,7 @@ private bool IsConstructorInitializerContext(int position, CSharpSyntaxContext c
if
(
token
.
Kind
()
==
SyntaxKind
.
ColonToken
&&
token
.
Parent
is
ConstructorInitializerSyntax
&&
token
.
Parent
.
IsParentKind
(
SyntaxKind
.
ConstructorDeclaration
)
&&
token
.
Parent
.
GetParent
()
.
IsParentKind
(
SyntaxKind
.
ClassDeclaration
))
token
.
Parent
.
Parent
.
IsParentKind
(
SyntaxKind
.
ClassDeclaration
))
{
var
constructor
=
token
.
GetAncestor
<
ConstructorDeclarationSyntax
>();
if
(
constructor
.
Modifiers
.
Any
(
SyntaxKind
.
StaticKeyword
))
...
...
src/Features/CSharp/Portable/Completion/KeywordRecommenders/NamespaceKeywordRecommender.cs
浏览文件 @
553503d9
...
...
@@ -121,7 +121,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
if
(
token
.
Kind
()
==
SyntaxKind
.
CloseBraceToken
)
{
if
(
token
.
Parent
is
TypeDeclarationSyntax
&&
!(
token
.
Parent
.
GetParent
()
is
TypeDeclarationSyntax
))
!(
token
.
Parent
.
Parent
is
TypeDeclarationSyntax
))
{
return
true
;
}
...
...
@@ -137,7 +137,7 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context
if
(
token
.
Kind
()
==
SyntaxKind
.
SemicolonToken
)
{
if
(
token
.
Parent
.
IsKind
(
SyntaxKind
.
DelegateDeclaration
)
&&
!(
token
.
Parent
.
GetParent
()
is
TypeDeclarationSyntax
))
!(
token
.
Parent
.
Parent
is
TypeDeclarationSyntax
))
{
return
true
;
}
...
...
src/Features/CSharp/Portable/Completion/KeywordRecommenders/WhereKeywordRecommender.cs
浏览文件 @
553503d9
...
...
@@ -79,9 +79,8 @@ private bool IsTypeParameterConstraintContext(CSharpSyntaxContext context)
// class C<T> : IGoo |
var
baseList
=
token
.
GetAncestor
<
BaseListSyntax
>();
if
(
baseList
.
GetParent
()
is
TypeDeclarationSyntax
)
if
(
baseList
?.
Parent
is
TypeDeclarationSyntax
typeDecl
)
{
var
typeDecl
=
baseList
.
GetParent
()
as
TypeDeclarationSyntax
;
if
(
typeDecl
.
TypeParameterList
!=
null
&&
typeDecl
.
BaseList
.
Types
.
Any
(
t
=>
token
==
t
.
GetLastToken
(
includeSkipped
:
true
)))
{
...
...
src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceVariableService.cs
浏览文件 @
553503d9
...
...
@@ -62,7 +62,7 @@ protected override bool IsInAutoPropertyInitializer(ExpressionSyntax expression)
protected
override
bool
IsInExpressionBodiedMember
(
ExpressionSyntax
expression
)
{
// walk up until we find a nearest enclosing block or arrow expression.
for
(
SyntaxNode
node
=
expression
;
node
!=
null
;
node
=
node
.
GetParent
()
)
for
(
SyntaxNode
node
=
expression
;
node
!=
null
;
node
=
node
.
Parent
)
{
// If we are in an expression bodied member and if the expression has a block body, then,
// act as if we're in a block context and not in an expression body context at all.
...
...
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTokenExtensions.cs
浏览文件 @
553503d9
...
...
@@ -430,9 +430,9 @@ public static bool IsConstructorOrMethodParameterArgumentContext(this SyntaxToke
if
(
targetToken
.
Kind
()
==
SyntaxKind
.
ColonToken
&&
targetToken
.
Parent
.
IsKind
(
SyntaxKind
.
NameColon
)
&&
targetToken
.
Parent
.
IsParentKind
(
SyntaxKind
.
Argument
)
&&
targetToken
.
Parent
.
GetParent
()
.
IsParentKind
(
SyntaxKind
.
ArgumentList
))
targetToken
.
Parent
.
Parent
.
IsParentKind
(
SyntaxKind
.
ArgumentList
))
{
var
owner
=
targetToken
.
Parent
.
GetParent
().
GetParent
().
GetParent
()
;
var
owner
=
targetToken
.
Parent
.
Parent
.
Parent
.
Parent
;
if
(
owner
.
IsKind
(
SyntaxKind
.
InvocationExpression
)
||
owner
.
IsKind
(
SyntaxKind
.
ObjectCreationExpression
)
||
owner
.
IsKind
(
SyntaxKind
.
BaseConstructorInitializer
)
||
...
...
@@ -564,7 +564,7 @@ private static bool IsAccessorDeclarationContextWorker(ref SyntaxToken targetTok
// int Goo { set { } private |
if
(
targetToken
.
Kind
()
==
SyntaxKind
.
CloseBraceToken
&&
targetToken
.
Parent
.
IsKind
(
SyntaxKind
.
Block
)
&&
targetToken
.
Parent
.
GetParent
()
is
AccessorDeclarationSyntax
)
targetToken
.
Parent
.
Parent
is
AccessorDeclarationSyntax
)
{
return
true
;
}
...
...
@@ -579,7 +579,7 @@ private static bool IsAccessorDeclarationContextWorker(ref SyntaxToken targetTok
// int Goo { [Bar]|
if
(
targetToken
.
Kind
()
==
SyntaxKind
.
CloseBracketToken
&&
targetToken
.
Parent
.
IsKind
(
SyntaxKind
.
AttributeList
)
&&
targetToken
.
Parent
.
GetParent
()
is
AccessorDeclarationSyntax
)
targetToken
.
Parent
.
Parent
is
AccessorDeclarationSyntax
)
{
return
true
;
}
...
...
@@ -631,7 +631,7 @@ public static bool IsTypeParameterVarianceContext(this SyntaxToken targetToken)
if
(
targetToken
.
Kind
()
==
SyntaxKind
.
CloseBracketToken
&&
targetToken
.
Parent
.
IsKind
(
SyntaxKind
.
AttributeList
)
&&
targetToken
.
Parent
.
IsParentKind
(
SyntaxKind
.
TypeParameter
)
&&
IsGenericInterfaceOrDelegateTypeParameterList
(
targetToken
.
Parent
.
GetParent
().
GetParent
()
))
IsGenericInterfaceOrDelegateTypeParameterList
(
targetToken
.
Parent
.
Parent
.
Parent
))
{
return
true
;
}
...
...
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
浏览文件 @
553503d9
...
...
@@ -142,7 +142,7 @@ public static bool IsAttributeNameContext(this SyntaxTree syntaxTree, int positi
if
(
token
.
IsKind
(
SyntaxKind
.
SemicolonToken
))
{
if
(
token
.
Parent
is
MemberDeclarationSyntax
&&
token
.
Parent
.
GetParent
()
is
BaseTypeDeclarationSyntax
)
token
.
Parent
.
Parent
is
BaseTypeDeclarationSyntax
)
{
return
true
;
}
...
...
@@ -159,7 +159,7 @@ public static bool IsAttributeNameContext(this SyntaxTree syntaxTree, int positi
if
(
token
.
IsKind
(
SyntaxKind
.
CloseBraceToken
))
{
if
(
token
.
Parent
is
BaseTypeDeclarationSyntax
&&
token
.
Parent
.
GetParent
()
is
BaseTypeDeclarationSyntax
)
token
.
Parent
.
Parent
is
BaseTypeDeclarationSyntax
)
{
// after a nested type
return
true
;
...
...
@@ -171,7 +171,7 @@ public static bool IsAttributeNameContext(this SyntaxTree syntaxTree, int positi
}
else
if
(
token
.
Parent
.
IsKind
(
SyntaxKind
.
Block
)
&&
token
.
Parent
.
GetParent
()
is
MemberDeclarationSyntax
)
token
.
Parent
.
Parent
is
MemberDeclarationSyntax
)
{
// after a method/operator/etc.
return
true
;
...
...
@@ -191,7 +191,7 @@ public static bool IsAttributeNameContext(this SyntaxTree syntaxTree, int positi
// the parent is the attribute
// the grandparent is the owner of the attribute
// the great-grandparent is the container that the owner is in
var
container
=
token
.
Parent
.
GetParent
().
GetParent
()
;
var
container
=
token
.
Parent
.
Parent
?.
Parent
;
if
(
container
is
BaseTypeDeclarationSyntax
)
{
return
true
;
...
...
@@ -460,7 +460,7 @@ public static bool IsAttributeNameContext(this SyntaxTree syntaxTree, int positi
}
else
if
(
token
.
Parent
.
IsKind
(
SyntaxKind
.
Block
)
&&
token
.
Parent
.
GetParent
()
is
MemberDeclarationSyntax
)
token
.
Parent
.
Parent
is
MemberDeclarationSyntax
)
{
return
true
;
}
...
...
@@ -485,7 +485,7 @@ public static bool IsAttributeNameContext(this SyntaxTree syntaxTree, int positi
// the parent is the attribute
// the grandparent is the owner of the attribute
// the great-grandparent is the container that the owner is in
var
container
=
token
.
Parent
.
GetParent
().
GetParent
()
;
var
container
=
token
.
Parent
?.
Parent
?.
Parent
;
if
(
container
.
IsKind
(
SyntaxKind
.
CompilationUnit
)
||
container
.
IsKind
(
SyntaxKind
.
NamespaceDeclaration
)
||
container
.
IsKind
(
SyntaxKind
.
ClassDeclaration
)
||
...
...
@@ -572,7 +572,7 @@ public static bool IsAttributeNameContext(this SyntaxTree syntaxTree, int positi
{
// the parent is the member
// the grandparent is the container of the member
var
container
=
token
.
Parent
.
GetParent
()
;
var
container
=
token
.
Parent
?.
Parent
;
// ref $$
// readonly ref $$
...
...
src/Workspaces/CSharp/Portable/Extensions/SyntaxNodeExtensions.cs
浏览文件 @
553503d9
...
...
@@ -520,11 +520,6 @@ internal static SyntaxNodeOrToken ChildThatContainsPosition(this SyntaxNode self
throw
new
ArgumentOutOfRangeException
(
nameof
(
position
));
}
public
static
SyntaxNode
GetParent
(
this
SyntaxNode
node
)
{
return
node
!=
null
?
node
.
Parent
:
null
;
}
public
static
(
SyntaxToken
openBrace
,
SyntaxToken
closeBrace
)
GetParentheses
(
this
SyntaxNode
node
)
{
switch
(
node
)
...
...
@@ -753,7 +748,7 @@ public static ConditionalAccessExpressionSyntax GetInnerMostConditionalAccessExp
public
static
bool
IsInDeconstructionLeft
(
this
SyntaxNode
node
,
out
SyntaxNode
deconstructionLeft
)
{
SyntaxNode
previous
=
null
;
for
(
var
current
=
node
;
current
!=
null
;
current
=
current
.
GetParent
()
)
for
(
var
current
=
node
;
current
!=
null
;
current
=
current
.
Parent
)
{
if
((
current
is
AssignmentExpressionSyntax
assignment
&&
previous
==
assignment
.
Left
&&
assignment
.
IsDeconstruction
())
||
(
current
is
ForEachVariableStatementSyntax
@foreach
&&
previous
==
@foreach
.
Variable
))
...
...
src/Workspaces/CSharp/Portable/Extensions/SyntaxNodeExtensions_SharedWithCodeStyle.cs
浏览文件 @
553503d9
...
...
@@ -27,24 +27,16 @@ public static bool IsKind<TNode>(this SyntaxNode node, SyntaxKind kind, out TNod
}
public
static
bool
IsParentKind
(
this
SyntaxNode
node
,
SyntaxKind
kind
)
{
return
node
!=
null
&&
CodeAnalysis
.
CSharpExtensions
.
IsKind
(
node
.
Parent
,
kind
);
}
=>
CodeAnalysis
.
CSharpExtensions
.
IsKind
(
node
?.
Parent
,
kind
);
public
static
bool
IsParentKind
(
this
SyntaxNode
node
,
SyntaxKind
kind1
,
SyntaxKind
kind2
)
{
return
node
!=
null
&&
IsKind
(
node
.
Parent
,
kind1
,
kind2
);
}
=>
IsKind
(
node
?.
Parent
,
kind1
,
kind2
);
public
static
bool
IsParentKind
(
this
SyntaxNode
node
,
SyntaxKind
kind1
,
SyntaxKind
kind2
,
SyntaxKind
kind3
)
{
return
node
!=
null
&&
IsKind
(
node
.
Parent
,
kind1
,
kind2
,
kind3
);
}
=>
IsKind
(
node
?.
Parent
,
kind1
,
kind2
,
kind3
);
public
static
bool
IsParentKind
(
this
SyntaxNode
node
,
SyntaxKind
kind1
,
SyntaxKind
kind2
,
SyntaxKind
kind3
,
SyntaxKind
kind4
)
{
return
node
!=
null
&&
IsKind
(
node
.
Parent
,
kind1
,
kind2
,
kind3
,
kind4
);
}
=>
IsKind
(
node
?.
Parent
,
kind1
,
kind2
,
kind3
,
kind4
);
public
static
bool
IsKind
(
this
SyntaxNode
node
,
SyntaxKind
kind1
,
SyntaxKind
kind2
)
{
...
...
src/Workspaces/Core/Portable/Shared/Extensions/SyntaxNodeExtensions.cs
浏览文件 @
553503d9
...
...
@@ -762,8 +762,7 @@ public static SyntaxNode GetParent(this SyntaxNode node, bool ascendOutOfTrivia)
var
parent
=
node
.
Parent
;
if
(
parent
==
null
&&
ascendOutOfTrivia
)
{
var
structuredTrivia
=
node
as
IStructuredTriviaSyntax
;
if
(
structuredTrivia
!=
null
)
if
(
node
is
IStructuredTriviaSyntax
structuredTrivia
)
{
parent
=
structuredTrivia
.
ParentTrivia
.
Token
.
Parent
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录