Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
6ca43e7a
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,发现更多精彩内容 >>
提交
6ca43e7a
编写于
7月 03, 2019
作者:
P
Petr Houška
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup - reorder helpers in SyntaxFacts services.
上级
9a24ddf7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
28 deletion
+28
-28
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
...arp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
+15
-15
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs
...anguageServices/SyntaxFactsService/ISyntaxFactsService.cs
+1
-1
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
...ortable/LanguageServices/VisualBasicSyntaxFactsService.vb
+12
-12
未找到文件。
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
浏览文件 @
6ca43e7a
...
...
@@ -1815,6 +1815,21 @@ public bool IsOnTypeHeader(SyntaxNode root, int position)
return
position
>=
start
&&
position
<=
end
;
}
public
bool
IsPartOfPropertyDeclarationHeader
(
SyntaxNode
node
)
{
var
propertyDeclaration
=
node
.
GetAncestor
<
PropertyDeclarationSyntax
>();
if
(
propertyDeclaration
==
null
)
{
return
false
;
}
var
start
=
propertyDeclaration
.
AttributeLists
.
LastOrDefault
()?.
GetLastToken
().
GetNextToken
().
SpanStart
??
propertyDeclaration
.
SpanStart
;
var
end
=
propertyDeclaration
.
Identifier
.
FullSpan
.
End
;
return
node
.
Span
.
Start
>=
start
&&
node
.
Span
.
End
<=
end
;
}
public
bool
IsBetweenTypeMembers
(
SourceText
sourceText
,
SyntaxNode
root
,
int
position
)
{
var
token
=
root
.
FindToken
(
position
);
...
...
@@ -1951,21 +1966,6 @@ public void GetPartsOfCastExpression(SyntaxNode node, out SyntaxNode type, out S
return
null
;
}
public
bool
IsPartOfPropertyDeclarationHeader
(
SyntaxNode
node
)
{
var
propertyDeclaration
=
node
.
GetAncestor
<
PropertyDeclarationSyntax
>();
if
(
propertyDeclaration
==
null
)
{
return
false
;
}
var
start
=
propertyDeclaration
.
AttributeLists
.
LastOrDefault
()?.
GetLastToken
().
GetNextToken
().
SpanStart
??
propertyDeclaration
.
SpanStart
;
var
end
=
propertyDeclaration
.
Identifier
.
FullSpan
.
End
;
return
node
.
Span
.
Start
>=
start
&&
node
.
Span
.
End
<=
end
;
}
public
SyntaxNode
GetContainingPropertyDeclaration
(
SyntaxNode
node
)
=>
node
.
GetAncestor
<
PropertyDeclarationSyntax
>();
public
SyntaxList
<
SyntaxNode
>
GetAttributeLists
(
SyntaxNode
node
)
=>
CSharpSyntaxGenerator
.
GetAttributeLists
(
node
);
...
...
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs
浏览文件 @
6ca43e7a
...
...
@@ -297,7 +297,6 @@ internal interface ISyntaxFactsService : ILanguageService
bool
IsQueryKeyword
(
SyntaxToken
token
);
bool
IsThrowExpression
(
SyntaxNode
node
);
bool
IsElementAccessExpression
(
SyntaxNode
node
);
bool
IsPartOfPropertyDeclarationHeader
(
SyntaxNode
node
);
bool
IsIndexerMemberCRef
(
SyntaxNode
node
);
SyntaxNode
GetContainingPropertyDeclaration
(
SyntaxNode
node
);
bool
IsIdentifierStartCharacter
(
char
c
);
...
...
@@ -409,6 +408,7 @@ internal interface ISyntaxFactsService : ILanguageService
ImmutableArray
<
SyntaxNode
>
GetSelectedFieldsAndProperties
(
SyntaxNode
root
,
TextSpan
textSpan
,
bool
allowPartialSelection
);
bool
IsOnTypeHeader
(
SyntaxNode
root
,
int
position
);
bool
IsPartOfPropertyDeclarationHeader
(
SyntaxNode
node
);
bool
IsBetweenTypeMembers
(
SourceText
sourceText
,
SyntaxNode
root
,
int
position
);
// Walks the tree, starting from contextNode, looking for the first construct
...
...
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
浏览文件 @
6ca43e7a
...
...
@@ -1754,6 +1754,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
position
>=
start
AndAlso
position
<=
_end
End
Function
Public
Function
IsPartOfPropertyDeclarationHeader
(
node
As
SyntaxNode
)
As
Boolean
Implements
ISyntaxFactsService
.
IsPartOfPropertyDeclarationHeader
Dim
propertyDeclaration
=
node
.
GetAncestor
(
Of
PropertyStatementSyntax
)()
If
propertyDeclaration
Is
Nothing
Then
Return
False
End
If
Dim
start
=
If
(
propertyDeclaration
.
AttributeLists
.
LastOrDefault
()
?
.
GetLastToken
().
GetNextToken
().
SpanStart
,
propertyDeclaration
.
SpanStart
)
Dim
[
end
]
=
If
(
propertyDeclaration
.
AsClause
?
.
FullSpan
.
[
End
]
,
propertyDeclaration
.
Identifier
.
FullSpan
.
End
)
Return
node
.
Span
.
Start
>=
start
AndAlso
node
.
Span
.
[
End
]
<=
[
end
]
End
Function
Public
Function
IsBetweenTypeMembers
(
sourceText
As
SourceText
,
root
As
SyntaxNode
,
position
As
Integer
)
As
Boolean
Implements
ISyntaxFactsService
.
IsBetweenTypeMembers
Dim
token
=
root
.
FindToken
(
position
)
Dim
typeDecl
=
token
.
GetAncestor
(
Of
TypeBlockSyntax
)
...
...
@@ -1945,18 +1957,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
MyBase
.
SpansPreprocessorDirective
(
tokens
)
End
Function
Public
Function
IsPartOfPropertyDeclarationHeader
(
node
As
SyntaxNode
)
As
Boolean
Implements
ISyntaxFactsService
.
IsPartOfPropertyDeclarationHeader
Dim
propertyDeclaration
=
node
.
GetAncestor
(
Of
PropertyStatementSyntax
)()
If
propertyDeclaration
Is
Nothing
Then
Return
False
End
If
Dim
start
=
If
(
propertyDeclaration
.
AttributeLists
.
LastOrDefault
()
?
.
GetLastToken
().
GetNextToken
().
SpanStart
,
propertyDeclaration
.
SpanStart
)
Dim
[
end
]
=
If
(
propertyDeclaration
.
AsClause
?
.
FullSpan
.
[
End
]
,
propertyDeclaration
.
Identifier
.
FullSpan
.
End
)
Return
node
.
Span
.
Start
>=
start
AndAlso
node
.
Span
.
[
End
]
<=
[
end
]
End
Function
Public
Function
GetContainingPropertyDeclaration
(
node
As
SyntaxNode
)
As
SyntaxNode
Implements
ISyntaxFactsService
.
GetContainingPropertyDeclaration
Return
node
.
GetAncestor
(
Of
PropertyStatementSyntax
)
End
Function
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录