Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
7e1a61be
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,发现更多精彩内容 >>
提交
7e1a61be
编写于
12月 15, 2014
作者:
A
AlekseyTs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
VB: Prevent SemanticModel from crashing on an invalid syntax used as a type parameter. Fixes #436.
***NO_CI*** (changeset 1386442)
上级
3c135233
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
134 addition
and
7 deletion
+134
-7
Src/Compilers/VisualBasic/Portable/Binding/DocumentationCommentCrefBinder.vb
...lBasic/Portable/Binding/DocumentationCommentCrefBinder.vb
+13
-6
Src/Compilers/VisualBasic/Portable/Symbols/Source/CrefTypeParameterSymbol.vb
...lBasic/Portable/Symbols/Source/CrefTypeParameterSymbol.vb
+1
-1
Src/Compilers/VisualBasic/Test/Symbol/DocumentationComments/DocCommentTests.vb
...asic/Test/Symbol/DocumentationComments/DocCommentTests.vb
+120
-0
未找到文件。
Src/Compilers/VisualBasic/Portable/Binding/DocumentationCommentCrefBinder.vb
浏览文件 @
7e1a61be
...
...
@@ -293,7 +293,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
If
Case
Else
Throw
ExceptionUtilities
.
UnexpectedValue
(
typeSyntax
.
Kind
)
' An error case
End
Select
Next
End
If
...
...
@@ -309,11 +309,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Dim
parent
As
VisualBasicSyntaxNode
=
name
.
Parent
' Type parameter
If
name
.
Kind
=
SyntaxKind
.
IdentifierName
AndAlso
parent
IsNot
Nothing
AndAlso
parent
.
Kind
=
SyntaxKind
.
TypeArgumentList
Then
Dim
identifier
=
DirectCast
(
name
,
IdentifierNameSyntax
)
If
parent
IsNot
Nothing
AndAlso
parent
.
Kind
=
SyntaxKind
.
TypeArgumentList
Then
Dim
ordinal
As
Integer
=
DirectCast
(
parent
,
TypeArgumentListSyntax
).
Arguments
.
IndexOf
(
name
)
Return
ImmutableArray
.
Create
(
Of
Symbol
)(
New
CrefTypeParameterSymbol
(
ordinal
,
identifier
.
Identifier
.
ValueText
,
identifier
))
If
name
.
Kind
=
SyntaxKind
.
IdentifierName
Then
Dim
identifier
=
DirectCast
(
name
,
IdentifierNameSyntax
)
Return
ImmutableArray
.
Create
(
Of
Symbol
)(
New
CrefTypeParameterSymbol
(
ordinal
,
identifier
.
Identifier
.
ValueText
,
identifier
))
End
If
' An error case
Return
ImmutableArray
.
Create
(
Of
Symbol
)(
New
CrefTypeParameterSymbol
(
ordinal
,
StringConstants
.
NamedSymbolErrorName
,
name
))
End
If
' Names considered to be checked for color-color case are Identifier or Generic names which
...
...
@@ -835,7 +840,9 @@ lAgain:
typeParameterSymbols
(
i
)
=
created
Case
Else
Throw
ExceptionUtilities
.
UnexpectedValue
(
typeSyntax
.
Kind
)
' An error case
created
=
New
CrefTypeParameterSymbol
(
i
,
StringConstants
.
NamedSymbolErrorName
,
typeSyntax
)
typeParameterSymbols
(
i
)
=
created
End
Select
typeParameters
(
created
.
Name
)
=
created
...
...
Src/Compilers/VisualBasic/Portable/Symbols/Source/CrefTypeParameterSymbol.vb
浏览文件 @
7e1a61be
...
...
@@ -25,7 +25,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Private
ReadOnly
_name
As
String
Private
ReadOnly
_syntaxReference
As
SyntaxReference
Public
Sub
New
(
ordinal
As
Integer
,
name
As
String
,
syntax
As
IdentifierNam
eSyntax
)
Public
Sub
New
(
ordinal
As
Integer
,
name
As
String
,
syntax
As
Typ
eSyntax
)
Me
.
_ordinal
=
ordinal
Me
.
_name
=
name
Me
.
_syntaxReference
=
syntax
.
GetReference
()
...
...
Src/Compilers/VisualBasic/Test/Symbol/DocumentationComments/DocCommentTests.vb
浏览文件 @
7e1a61be
...
...
@@ -12090,5 +12090,125 @@ xmlDoc)
End
Sub
#End Region
<
WorkItem
(
1087447
,
"DevDiv"
),
WorkItem
(
436
,
"CodePlex"
)
>
<
Fact
>
Public
Sub
Bug1087447_01
()
Dim
compilation
=
CompileCheckDiagnosticsAndXmlDocument
(
<
compilation
name
=
"EmptyCref"
>
<
file
name
=
"a.vb"
>
<
!
[
CDATA
[
''' <summary>
''' <see cref="C(Of Integer).f()"/>
''' </summary>
Class
C
(
Of
T
)
Sub
f
()
End
Sub
End
Class
]]
>
</
file
>
</
compilation
>
,
<
error
><
!
[
CDATA
[
BC42309
:
XML
comment
has
a
tag
with
a
'cref' attribute 'C(Of Integer).f()' that could not be resolved.
''' <see cref="C(Of Integer).f()"/>
~~~~~~~~~~~~~~~~~~~~~~~~
]]
></
error
>
,
<
xml
>
<
!
[
CDATA
[
<
?
xml
version
=
"1.0"
?
>
<
doc
>
<
assembly
>
<
name
>
EmptyCref
</
name
>
</
assembly
>
<
members
>
<
member
name
=
"T:C`1"
>
<
summary
>
<
see
cref
=
"!:C(Of Integer).f()"
/>
</
summary
>
</
member
>
</
members
>
</
doc
>
]]
>
</
xml
>
)
Dim
tree
=
compilation
.
SyntaxTrees
(
0
)
Dim
model
=
compilation
.
GetSemanticModel
(
tree
)
Dim
node1
=
tree
.
GetRoot
().
DescendantNodes
(
descendIntoTrivia
:
=
True
).
OfType
(
Of
IdentifierNameSyntax
)().
Where
(
Function
(
n
)
n
.
Identifier
.
ValueText
=
"f"
).
Single
()
Dim
symbolInfo1
=
model
.
GetSymbolInfo
(
node1
.
Parent
)
Assert
.
Equal
(
"Sub C(Of ?).f()"
,
symbolInfo1
.
Symbol
.
ToTestDisplayString
())
Dim
node
=
tree
.
GetRoot
().
DescendantNodes
(
descendIntoTrivia
:
=
True
).
OfType
(
Of
TypeSyntax
)().
Where
(
Function
(
n
)
n
.
ToString
()
=
"Integer"
).
Single
()
Dim
symbolInfo
=
model
.
GetSymbolInfo
(
node
)
Assert
.
Equal
(
"?"
,
symbolInfo
.
Symbol
.
ToTestDisplayString
())
End
Sub
<
WorkItem
(
1087447
,
"DevDiv"
),
WorkItem
(
436
,
"CodePlex"
)
>
<
Fact
>
Public
Sub
Bug1087447_02
()
Dim
compilation
=
CompileCheckDiagnosticsAndXmlDocument
(
<
compilation
name
=
"EmptyCref"
>
<
file
name
=
"a.vb"
>
<
!
[
CDATA
[
''' <summary>
''' <see cref="C(Of System.Int32).f()"/>
''' </summary>
Class
C
(
Of
T
)
Sub
f
()
End
Sub
End
Class
]]
>
</
file
>
</
compilation
>
,
<
error
><
!
[
CDATA
[
BC42309
:
XML
comment
has
a
tag
with
a
'cref' attribute 'C(Of System.Int32).f()' that could not be resolved.
''' <see cref="C(Of System.Int32).f()"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]
></
error
>
,
<
xml
>
<
!
[
CDATA
[
<
?
xml
version
=
"1.0"
?
>
<
doc
>
<
assembly
>
<
name
>
EmptyCref
</
name
>
</
assembly
>
<
members
>
<
member
name
=
"T:C`1"
>
<
summary
>
<
see
cref
=
"!:C(Of System.Int32).f()"
/>
</
summary
>
</
member
>
</
members
>
</
doc
>
]]
>
</
xml
>
)
Dim
tree
=
compilation
.
SyntaxTrees
(
0
)
Dim
model
=
compilation
.
GetSemanticModel
(
tree
)
Dim
node1
=
tree
.
GetRoot
().
DescendantNodes
(
descendIntoTrivia
:
=
True
).
OfType
(
Of
IdentifierNameSyntax
)().
Where
(
Function
(
n
)
n
.
Identifier
.
ValueText
=
"f"
).
Single
()
Dim
symbolInfo1
=
model
.
GetSymbolInfo
(
node1
.
Parent
)
Assert
.
Equal
(
"Sub C(Of ?).f()"
,
symbolInfo1
.
Symbol
.
ToTestDisplayString
())
Dim
node
=
tree
.
GetRoot
().
DescendantNodes
(
descendIntoTrivia
:
=
True
).
OfType
(
Of
TypeSyntax
)().
Where
(
Function
(
n
)
n
.
ToString
()
=
"System.Int32"
).
Single
()
Dim
symbolInfo
=
model
.
GetSymbolInfo
(
node
)
Assert
.
Equal
(
"?"
,
symbolInfo
.
Symbol
.
ToTestDisplayString
())
End
Sub
End
Class
End
Namespace
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录