Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
1119e6fe
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,发现更多精彩内容 >>
提交
1119e6fe
编写于
7月 09, 2019
作者:
P
Petr Houska
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor IsInHeader helpers.
上级
996cc3aa
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
15 deletion
+30
-15
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
...arp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
+4
-9
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/AbstractSyntaxFactsService.cs
...Services/SyntaxFactsService/AbstractSyntaxFactsService.cs
+16
-0
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
...ortable/LanguageServices/VisualBasicSyntaxFactsService.vb
+10
-6
未找到文件。
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
浏览文件 @
1119e6fe
...
...
@@ -1783,24 +1783,19 @@ public bool IsInPropertyDeclarationHeader(SyntaxNode node)
{
return
false
;
}
var
start
=
GetStartOfNodeExcludingAttributes
(
propertyDeclaration
);
var
end
=
propertyDeclaration
.
Identifier
.
FullSpan
.
End
;
return
node
.
Span
.
Start
>=
start
&&
node
.
Span
.
End
<=
end
;
return
IsInHeader
(
node
,
propertyDeclaration
,
propertyDeclaration
.
Identifier
)
;
}
public
bool
IsInParameterHeader
(
SyntaxNode
node
)
{
var
p
ropertyDeclaration
=
node
.
GetAncestorOrThis
<
ParameterSyntax
>();
if
(
p
ropertyDeclaration
==
null
)
var
p
arameter
=
node
.
GetAncestorOrThis
<
ParameterSyntax
>();
if
(
p
arameter
==
null
)
{
return
false
;
}
var
start
=
GetStartOfNodeExcludingAttributes
(
propertyDeclaration
);
var
end
=
propertyDeclaration
.
Identifier
.
FullSpan
.
End
;
return
node
.
Span
.
Start
>=
start
&&
node
.
Span
.
End
<=
end
;
return
IsInHeader
(
node
,
parameter
,
parameter
.
Identifier
);
}
public
bool
IsBetweenTypeMembers
(
SourceText
sourceText
,
SyntaxNode
root
,
int
position
)
...
...
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/AbstractSyntaxFactsService.cs
浏览文件 @
1119e6fe
...
...
@@ -488,6 +488,22 @@ public bool SpansPreprocessorDirective(IEnumerable<SyntaxToken> tokens)
private
bool
SpansPreprocessorDirective
(
SyntaxTriviaList
list
)
=>
list
.
Any
(
t
=>
IsPreprocessorDirective
(
t
));
public
bool
IsInHeader
(
SyntaxNode
node
,
SyntaxNode
ownerOfHeader
,
SyntaxToken
lastTokenOfHeader
)
{
var
start
=
GetStartOfNodeExcludingAttributes
(
ownerOfHeader
);
var
end
=
lastTokenOfHeader
.
FullSpan
.
End
;
return
node
.
Span
.
Start
>=
start
&&
node
.
Span
.
End
<=
end
;
}
public
bool
IsInHeader
(
SyntaxNode
node
,
SyntaxNode
ownerOfHeader
,
SyntaxNode
lastNodeOfHeader
)
{
var
start
=
GetStartOfNodeExcludingAttributes
(
ownerOfHeader
);
var
end
=
lastNodeOfHeader
.
FullSpan
.
End
;
return
node
.
Span
.
Start
>=
start
&&
node
.
Span
.
End
<=
end
;
}
protected
int
GetStartOfNodeExcludingAttributes
(
SyntaxNode
node
)
{
var
attributeLists
=
GetAttributeLists
(
node
);
...
...
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
浏览文件 @
1119e6fe
...
...
@@ -1760,9 +1760,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
False
End
If
Dim
start
=
GetStartOfNodeExcludingAttributes
(
propertyDeclaration
)
Dim
[
end
]
=
If
(
propertyDeclaration
.
AsClause
?
.
FullSpan
.
[
End
]
,
propertyDeclaration
.
Identifier
.
FullSpan
.
End
)
Return
node
.
Span
.
Start
>=
start
AndAlso
node
.
Span
.
[
End
]
<=
[
end
]
If
propertyDeclaration
.
AsClause
Is
Nothing
Then
Return
IsInHeader
(
node
,
propertyDeclaration
,
propertyDeclaration
.
AsClause
)
End
If
Return
IsInHeader
(
node
,
propertyDeclaration
,
propertyDeclaration
.
Identifier
)
End
Function
Public
Function
IsInParameterHeader
(
node
As
SyntaxNode
)
As
Boolean
Implements
ISyntaxFactsService
.
IsInParameterHeader
...
...
@@ -1772,9 +1774,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
False
End
If
Dim
start
=
GetStartOfNodeExcludingAttributes
(
parameter
)
Dim
[
end
]
=
If
(
parameter
.
AsClause
?
.
FullSpan
.
[
End
]
,
parameter
.
Identifier
.
FullSpan
.
End
)
Return
node
.
Span
.
Start
>=
start
AndAlso
node
.
Span
.
[
End
]
<=
[
end
]
If
parameter
.
AsClause
Is
Nothing
Then
Return
IsInHeader
(
node
,
parameter
,
parameter
.
AsClause
)
End
If
Return
IsInHeader
(
node
,
parameter
,
parameter
.
Identifier
)
End
Function
Public
Function
IsBetweenTypeMembers
(
sourceText
As
SourceText
,
root
As
SyntaxNode
,
position
As
Integer
)
As
Boolean
Implements
ISyntaxFactsService
.
IsBetweenTypeMembers
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录