Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
f9bb0caf
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,发现更多精彩内容 >>
提交
f9bb0caf
编写于
3月 26, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support getting and setting Module accessibility through the SyntaxGenerator.
上级
f97a2dc6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
33 deletion
+53
-33
src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb
...sic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb
+42
-32
src/Workspaces/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb
...es/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb
+11
-1
未找到文件。
src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb
浏览文件 @
f9bb0caf
...
@@ -2468,6 +2468,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
...
@@ -2468,6 +2468,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Return
DirectCast
(
declaration
,
EnumBlockSyntax
).
EnumStatement
.
Modifiers
Return
DirectCast
(
declaration
,
EnumBlockSyntax
).
EnumStatement
.
Modifiers
Case
SyntaxKind
.
EnumStatement
Case
SyntaxKind
.
EnumStatement
Return
DirectCast
(
declaration
,
EnumStatementSyntax
).
Modifiers
Return
DirectCast
(
declaration
,
EnumStatementSyntax
).
Modifiers
Case
SyntaxKind
.
ModuleBlock
Return
DirectCast
(
declaration
,
ModuleBlockSyntax
).
ModuleStatement
.
Modifiers
Case
SyntaxKind
.
ModuleStatement
Return
DirectCast
(
declaration
,
ModuleStatementSyntax
).
Modifiers
Case
SyntaxKind
.
DelegateFunctionStatement
,
Case
SyntaxKind
.
DelegateFunctionStatement
,
SyntaxKind
.
DelegateSubStatement
SyntaxKind
.
DelegateSubStatement
Return
DirectCast
(
declaration
,
DelegateStatementSyntax
).
Modifiers
Return
DirectCast
(
declaration
,
DelegateStatementSyntax
).
Modifiers
...
@@ -2538,6 +2542,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
...
@@ -2538,6 +2542,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Return
DirectCast
(
declaration
,
EnumBlockSyntax
).
WithEnumStatement
(
DirectCast
(
declaration
,
EnumBlockSyntax
).
EnumStatement
.
WithModifiers
(
tokens
))
Return
DirectCast
(
declaration
,
EnumBlockSyntax
).
WithEnumStatement
(
DirectCast
(
declaration
,
EnumBlockSyntax
).
EnumStatement
.
WithModifiers
(
tokens
))
Case
SyntaxKind
.
EnumStatement
Case
SyntaxKind
.
EnumStatement
Return
DirectCast
(
declaration
,
EnumStatementSyntax
).
WithModifiers
(
tokens
)
Return
DirectCast
(
declaration
,
EnumStatementSyntax
).
WithModifiers
(
tokens
)
Case
SyntaxKind
.
ModuleBlock
Return
DirectCast
(
declaration
,
ModuleBlockSyntax
).
WithModuleStatement
(
DirectCast
(
declaration
,
ModuleBlockSyntax
).
ModuleStatement
.
WithModifiers
(
tokens
))
Case
SyntaxKind
.
ModuleStatement
Return
DirectCast
(
declaration
,
ModuleStatementSyntax
).
WithModifiers
(
tokens
)
Case
SyntaxKind
.
DelegateFunctionStatement
,
Case
SyntaxKind
.
DelegateFunctionStatement
,
SyntaxKind
.
DelegateSubStatement
SyntaxKind
.
DelegateSubStatement
Return
DirectCast
(
declaration
,
DelegateStatementSyntax
).
WithModifiers
(
tokens
)
Return
DirectCast
(
declaration
,
DelegateStatementSyntax
).
WithModifiers
(
tokens
)
...
@@ -2618,38 +2626,40 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
...
@@ -2618,38 +2626,40 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Private
Function
CanHaveAccessibility
(
declaration
As
SyntaxNode
)
As
Boolean
Private
Function
CanHaveAccessibility
(
declaration
As
SyntaxNode
)
As
Boolean
Select
Case
declaration
.
Kind
Select
Case
declaration
.
Kind
Case
SyntaxKind
.
ClassBlock
,
Case
SyntaxKind
.
ClassBlock
,
SyntaxKind
.
ClassStatement
,
SyntaxKind
.
ClassStatement
,
SyntaxKind
.
StructureBlock
,
SyntaxKind
.
StructureBlock
,
SyntaxKind
.
StructureStatement
,
SyntaxKind
.
StructureStatement
,
SyntaxKind
.
InterfaceBlock
,
SyntaxKind
.
InterfaceBlock
,
SyntaxKind
.
InterfaceStatement
,
SyntaxKind
.
InterfaceStatement
,
SyntaxKind
.
EnumBlock
,
SyntaxKind
.
EnumBlock
,
SyntaxKind
.
EnumStatement
,
SyntaxKind
.
EnumStatement
,
SyntaxKind
.
DelegateFunctionStatement
,
SyntaxKind
.
ModuleBlock
,
SyntaxKind
.
DelegateSubStatement
,
SyntaxKind
.
ModuleStatement
,
SyntaxKind
.
FieldDeclaration
,
SyntaxKind
.
DelegateFunctionStatement
,
SyntaxKind
.
FunctionBlock
,
SyntaxKind
.
DelegateSubStatement
,
SyntaxKind
.
SubBlock
,
SyntaxKind
.
FieldDeclaration
,
SyntaxKind
.
ConstructorBlock
,
SyntaxKind
.
FunctionBlock
,
SyntaxKind
.
FunctionStatement
,
SyntaxKind
.
SubBlock
,
SyntaxKind
.
SubStatement
,
SyntaxKind
.
ConstructorBlock
,
SyntaxKind
.
SubNewStatement
,
SyntaxKind
.
FunctionStatement
,
SyntaxKind
.
PropertyBlock
,
SyntaxKind
.
SubStatement
,
SyntaxKind
.
PropertyStatement
,
SyntaxKind
.
SubNewStatement
,
SyntaxKind
.
OperatorBlock
,
SyntaxKind
.
PropertyBlock
,
SyntaxKind
.
OperatorStatement
,
SyntaxKind
.
PropertyStatement
,
SyntaxKind
.
EventBlock
,
SyntaxKind
.
OperatorBlock
,
SyntaxKind
.
EventStatement
,
SyntaxKind
.
OperatorStatement
,
SyntaxKind
.
GetAccessorBlock
,
SyntaxKind
.
EventBlock
,
SyntaxKind
.
GetAccessorStatement
,
SyntaxKind
.
EventStatement
,
SyntaxKind
.
SetAccessorBlock
,
SyntaxKind
.
GetAccessorBlock
,
SyntaxKind
.
SetAccessorStatement
,
SyntaxKind
.
GetAccessorStatement
,
SyntaxKind
.
AddHandlerAccessorBlock
,
SyntaxKind
.
SetAccessorBlock
,
SyntaxKind
.
AddHandlerAccessorStatement
,
SyntaxKind
.
SetAccessorStatement
,
SyntaxKind
.
RemoveHandlerAccessorBlock
,
SyntaxKind
.
AddHandlerAccessorBlock
,
SyntaxKind
.
RemoveHandlerAccessorStatement
,
SyntaxKind
.
AddHandlerAccessorStatement
,
SyntaxKind
.
RaiseEventAccessorBlock
,
SyntaxKind
.
RemoveHandlerAccessorBlock
,
SyntaxKind
.
RaiseEventAccessorStatement
SyntaxKind
.
RemoveHandlerAccessorStatement
,
SyntaxKind
.
RaiseEventAccessorBlock
,
SyntaxKind
.
RaiseEventAccessorStatement
Return
True
Return
True
Case
Else
Case
Else
Return
False
Return
False
...
...
src/Workspaces/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb
浏览文件 @
f9bb0caf
...
@@ -2301,7 +2301,7 @@ End Class
...
@@ -2301,7 +2301,7 @@ End Class
Public
Sub
TestGetAccessibility
()
Public
Sub
TestGetAccessibility
()
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
ClassDeclaration
(
"c"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
ClassDeclaration
(
"c"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
StructDeclaration
(
"s"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
StructDeclaration
(
"s"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
Enum
Declaration
(
"i"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
Interface
Declaration
(
"i"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
EnumDeclaration
(
"e"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
EnumDeclaration
(
"e"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
DelegateDeclaration
(
"d"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
DelegateDeclaration
(
"d"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
MethodDeclaration
(
"m"
,
accessibility
:
=
Accessibility
.
Internal
)))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
MethodDeclaration
(
"m"
,
accessibility
:
=
Accessibility
.
Internal
)))
...
@@ -2318,6 +2318,11 @@ End Class
...
@@ -2318,6 +2318,11 @@ End Class
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
_g
.
LocalDeclarationStatement
(
_g
.
IdentifierName
(
"t"
),
"loc"
)))
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
_g
.
LocalDeclarationStatement
(
_g
.
IdentifierName
(
"t"
),
"loc"
)))
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
_g
.
Attribute
(
"a"
)))
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
_g
.
Attribute
(
"a"
)))
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
SyntaxFactory
.
TypeParameter
(
"tp"
)))
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
SyntaxFactory
.
TypeParameter
(
"tp"
)))
Dim
m
=
SyntaxFactory
.
ModuleBlock
(
SyntaxFactory
.
ModuleStatement
(
"module2"
).
WithModifiers
(
SyntaxFactory
.
TokenList
(
SyntaxFactory
.
Token
(
SyntaxKind
.
PublicKeyword
))))
Assert
.
Equal
(
Accessibility
.
Public
,
_g
.
GetAccessibility
(
m
))
End
Sub
End
Sub
<
Fact
>
<
Fact
>
...
@@ -2341,6 +2346,11 @@ End Class
...
@@ -2341,6 +2346,11 @@ End Class
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
_g
.
WithAccessibility
(
_g
.
LocalDeclarationStatement
(
_g
.
IdentifierName
(
"t"
),
"loc"
),
Accessibility
.
Private
)))
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
_g
.
WithAccessibility
(
_g
.
LocalDeclarationStatement
(
_g
.
IdentifierName
(
"t"
),
"loc"
),
Accessibility
.
Private
)))
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
_g
.
WithAccessibility
(
_g
.
Attribute
(
"a"
),
Accessibility
.
Private
)))
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
_g
.
WithAccessibility
(
_g
.
Attribute
(
"a"
),
Accessibility
.
Private
)))
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
_g
.
WithAccessibility
(
SyntaxFactory
.
TypeParameter
(
"tp"
),
Accessibility
.
Private
)))
Assert
.
Equal
(
Accessibility
.
NotApplicable
,
_g
.
GetAccessibility
(
_g
.
WithAccessibility
(
SyntaxFactory
.
TypeParameter
(
"tp"
),
Accessibility
.
Private
)))
Dim
m
=
SyntaxFactory
.
ModuleBlock
(
SyntaxFactory
.
ModuleStatement
(
"module2"
).
WithModifiers
(
SyntaxFactory
.
TokenList
(
SyntaxFactory
.
Token
(
SyntaxKind
.
PublicKeyword
))))
Assert
.
Equal
(
Accessibility
.
Internal
,
_g
.
GetAccessibility
(
_g
.
WithAccessibility
(
m
,
Accessibility
.
Internal
)))
End
Sub
End
Sub
<
Fact
>
<
Fact
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录