Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
97bec5c1
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,发现更多精彩内容 >>
提交
97bec5c1
编写于
5月 01, 2015
作者:
B
Balaji Soundrarajan
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2438 from basoundr/fix2356GetSetAttributes
Get Attribute Collection CodeElements for Get/Set in C# and VB
上级
9c1e84c0
2be6cc3e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
223 addition
and
1 deletion
+223
-1
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
...ualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
+4
-0
src/VisualStudio/Core/Impl/CodeModel/InternalElements/CodeAccessorFunction.cs
...e/Impl/CodeModel/InternalElements/CodeAccessorFunction.cs
+4
-1
src/VisualStudio/Core/Test/CodeModel/AbstractCodeFunctionTests.vb
...alStudio/Core/Test/CodeModel/AbstractCodeFunctionTests.vb
+4
-0
src/VisualStudio/Core/Test/CodeModel/CSharp/CodeFunctionTests.vb
...ualStudio/Core/Test/CodeModel/CSharp/CodeFunctionTests.vb
+113
-0
src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeFunctionTests.vb
...udio/Core/Test/CodeModel/VisualBasic/CodeFunctionTests.vb
+98
-0
未找到文件。
src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs
浏览文件 @
97bec5c1
...
...
@@ -324,6 +324,10 @@ public override IEnumerable<SyntaxNode> GetAttributeNodes(SyntaxNode parent)
{
return
GetAttributeNodes
(
parent
.
Parent
);
}
else
if
(
parent
is
AccessorDeclarationSyntax
)
{
return
GetAttributeNodes
(((
AccessorDeclarationSyntax
)
parent
).
AttributeLists
);
}
return
SpecializedCollections
.
EmptyEnumerable
<
SyntaxNode
>();
}
...
...
src/VisualStudio/Core/Impl/CodeModel/InternalElements/CodeAccessorFunction.cs
浏览文件 @
97bec5c1
...
...
@@ -94,7 +94,10 @@ protected override string GetFullName()
public
EnvDTE
.
CodeElements
Attributes
{
get
{
return
EmptyCollection
.
Create
(
this
.
State
,
this
);
}
get
{
return
AttributeCollection
.
Create
(
this
.
State
,
this
);
}
}
public
EnvDTE
.
vsCMAccess
Access
...
...
src/VisualStudio/Core/Test/CodeModel/AbstractCodeFunctionTests.vb
浏览文件 @
97bec5c1
...
...
@@ -18,6 +18,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel
Return
codeElement
.
Access
End
Function
Protected
Overrides
Function
GetAttributes
(
codeElement
As
EnvDTE80
.
CodeFunction2
)
As
EnvDTE
.
CodeElements
Return
codeElement
.
Attributes
End
Function
Protected
Overrides
Function
GetComment
(
codeElement
As
EnvDTE80
.
CodeFunction2
)
As
String
Return
codeElement
.
Comment
End
Function
...
...
src/VisualStudio/Core/Test/CodeModel/CSharp/CodeFunctionTests.vb
浏览文件 @
97bec5c1
...
...
@@ -146,6 +146,119 @@ interface I
#End Region
#Region "Attribute Tests"
<
WorkItem
(
2356
,
"https://github.com/dotnet/roslyn/issues/2356"
)
>
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
Public
Sub
PropertyGetAttribute_WithNoSet
()
Dim
code
=
<
Code
>
public
class
Class1
{
public
int
Property1
{
[
Obsolete
]
$$
get
{
return
0
;
}
}
}
</
Code
>
TestAttributes
(
code
,
IsElement
(
"Obsolete"
))
End
Sub
<
WorkItem
(
2356
,
"https://github.com/dotnet/roslyn/issues/2356"
)
>
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
Public
Sub
PropertySetAttribute_WithNoGet
()
Dim
code
=
<
Code
>
public
class
Class1
{
public
int
Property1
{
[
Obsolete
]
$$
set
{
}
}
}
</
Code
>
TestAttributes
(
code
,
IsElement
(
"Obsolete"
))
End
Sub
<
WorkItem
(
2356
,
"https://github.com/dotnet/roslyn/issues/2356"
)
>
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
Public
Sub
PropertyGetAttribute_WithSet
()
Dim
code
=
<
Code
>
public
class
Class1
{
public
int
Property1
{
[
Obsolete
]
$$
get
{
return
0
;
}
[
Obsolete
]
set
{
}
}
}
</
Code
>
TestAttributes
(
code
,
IsElement
(
"Obsolete"
))
End
Sub
<
WorkItem
(
2356
,
"https://github.com/dotnet/roslyn/issues/2356"
)
>
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
Public
Sub
PropertySetAttribute_WithGet
()
Dim
code
=
<
Code
>
public
class
Class1
{
public
int
Property1
{
[
Obsolete
]
get
{
return
0
;
}
[
Obsolete
]
$$
set
{
}
}
}
</
Code
>
TestAttributes
(
code
,
IsElement
(
"Obsolete"
))
End
Sub
<
WorkItem
(
2356
,
"https://github.com/dotnet/roslyn/issues/2356"
)
>
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
Public
Sub
Attribute_1
()
Dim
code
=
<
Code
>
class
Class2
{
[
Obsolete
]
void
$$
F
()
{
}
}
</
Code
>
TestAttributes
(
code
,
IsElement
(
"Obsolete"
))
End
Sub
#End Region
#Region "CanOverride tests"
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
...
...
src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeFunctionTests.vb
浏览文件 @
97bec5c1
...
...
@@ -515,6 +515,104 @@ End Interface
#End Region
#Region "Attribute Tests"
<
WorkItem
(
2356
,
"https://github.com/dotnet/roslyn/issues/2356"
)
>
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
Public
Sub
PropertyGetAttribute_WithNoSet
()
Dim
code
=
<
Code
>
Public
Class
Class1
Public
Property
Property1
As
Integer
&
lt
;
Obsolete
&
gt
;
$$
Get
Return
0
End
Get
End
Property
End
Class
</
Code
>
TestAttributes
(
code
,
IsElement
(
"Obsolete"
))
End
Sub
<
WorkItem
(
2356
,
"https://github.com/dotnet/roslyn/issues/2356"
)
>
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
Public
Sub
PropertySetAttribute_WithNoGet
()
Dim
code
=
<
Code
>
Public
Class
Class1
Public
Property
Property1
As
Integer
&
lt
;
Obsolete
&
gt
;
$$
Set
(
value
As
Integer
)
End
Set
End
Property
End
Class
</
Code
>
TestAttributes
(
code
,
IsElement
(
"Obsolete"
))
End
Sub
<
WorkItem
(
2356
,
"https://github.com/dotnet/roslyn/issues/2356"
)
>
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
Public
Sub
PropertySetAttribute_WithGet
()
Dim
code
=
<
Code
>
Public
Class
Class1
Public
Property
Property1
As
Integer
&
lt
;
Obsolete
&
gt
;
Get
Return
0
End
Get
&
lt
;
Obsolete
&
gt
;
$$
Set
(
value
As
Integer
)
End
Set
End
Property
End
Class
</
Code
>
TestAttributes
(
code
,
IsElement
(
"Obsolete"
))
End
Sub
<
WorkItem
(
2356
,
"https://github.com/dotnet/roslyn/issues/2356"
)
>
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
Public
Sub
PropertyGetAttribute_WithSet
()
Dim
code
=
<
Code
>
Public
Class
Class1
Public
Property
Property1
As
Integer
&
lt
;
Obsolete
&
gt
;
$$
Get
Return
0
End
Get
&
lt
;
Obsolete
&
gt
;
Set
(
value
As
Integer
)
End
Set
End
Property
End
Class
</
Code
>
TestAttributes
(
code
,
IsElement
(
"Obsolete"
))
End
Sub
<
WorkItem
(
2356
,
"https://github.com/dotnet/roslyn/issues/2356"
)
>
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
Public
Sub
Attribute_1
()
Dim
code
=
<
Code
>
Class
Program
&
lt
;
Obsolete
&
gt
;
Sub
F
$$
()
End
Sub
End
Class
</
Code
>
TestAttributes
(
code
,
IsElement
(
"Obsolete"
))
End
Sub
#End Region
#Region "CanOverride tests"
<
ConditionalFact
(
GetType
(
x86
)),
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeModel
)
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录