Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
471b48fb
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,发现更多精彩内容 >>
提交
471b48fb
编写于
2月 10, 2015
作者:
M
Matt Warren
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #339 from mattwar/SyntaxGenerator
Move VB end construct code fix away from CodeGenerator
上级
91710c6a
3f91cca0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
96 addition
and
34 deletion
+96
-34
src/EditorFeatures/VisualBasicTest/EndConstructGeneration/PropertyBlockTests.vb
...ualBasicTest/EndConstructGeneration/PropertyBlockTests.vb
+0
-1
src/Features/VisualBasic/CodeFixes/GenerateEndConstruct/GenerateEndConstructCodeFixProvider.vb
...nerateEndConstruct/GenerateEndConstructCodeFixProvider.vb
+7
-30
src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
...s/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
+45
-3
src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb
...sic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb
+44
-0
未找到文件。
src/EditorFeatures/VisualBasicTest/EndConstructGeneration/PropertyBlockTests.vb
浏览文件 @
471b48fb
...
...
@@ -6,7 +6,6 @@ Imports Microsoft.CodeAnalysis.VisualBasic
Imports
Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports
Microsoft.VisualStudio.Text
Imports
Roslyn.Test.EditorUtilities
Imports
Roslyn.Test.Utilities
Namespace
Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EndConstructGeneration
...
...
src/Features/VisualBasic/CodeFixes/GenerateEndConstruct/GenerateEndConstructCodeFixProvider.vb
浏览文件 @
471b48fb
...
...
@@ -163,37 +163,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEndConstruct
updatedProperty
=
updatedProperty
.
ReplaceNode
(
setter
,
setter
.
WithEndBlockStatement
(
SyntaxFactory
.
EndSetStatement
()))
End
If
Dim
semanticModel
=
Await
document
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
False
)
Dim
propertySymbol
=
TryCast
(
semanticModel
.
GetDeclaredSymbol
(
node
),
IPropertySymbol
)
If
propertySymbol
IsNot
Nothing
Then
Dim
codeGenService
=
document
.
GetLanguageService
(
Of
ICodeGenerationService
)()
Dim
syntaxFactory
=
document
.
GetLanguageService
(
Of
SyntaxGenerator
)()
Dim
generatedAccessor
=
CodeGenerationSymbolFactory
.
CreateAccessorSymbol
(
SpecializedCollections
.
EmptyList
(
Of
AttributeData
)(),
Accessibility
.
Public
,
SpecializedCollections
.
EmptyList
(
Of
SyntaxNode
)())
Dim
generatedProperty
=
CodeGenerationSymbolFactory
.
CreatePropertySymbol
(
attributes
:
=
SpecializedCollections
.
EmptyList
(
Of
AttributeData
)(),
accessibility
:
=
Accessibility
.
Public
,
modifiers
:
=
New
DeclarationModifiers
(),
explicitInterfaceSymbol
:
=
Nothing
,
name
:
=
propertySymbol
.
Name
,
type
:
=
propertySymbol
.
Type
,
parameters
:
=
propertySymbol
.
Parameters
,
getMethod
:
=
generatedAccessor
,
setMethod
:
=
generatedAccessor
,
isIndexer
:
=
propertySymbol
.
IsIndexer
)
' Generate any missing setter or getter
Dim
generatedPropertyCode
=
DirectCast
(
codeGenService
.
CreatePropertyDeclaration
(
generatedProperty
,
options
:
=
CodeGenerationOptions
.
Default
),
PropertyBlockSyntax
)
If
getter
Is
Nothing
AndAlso
Not
updatedProperty
.
PropertyStatement
.
Modifiers
.
Any
(
SyntaxKind
.
WriteOnlyKeyword
)
Then
updatedProperty
=
updatedProperty
.
AddAccessors
(
generatedPropertyCode
.
Accessors
.
FirstOrDefault
(
Function
(
n
)
n
.
Kind
=
SyntaxKind
.
GetAccessorBlock
))
End
If
Dim
gen
=
document
.
GetLanguageService
(
Of
SyntaxGenerator
)()
If
setter
Is
Nothing
AndAlso
Not
updatedProperty
.
PropertyStatement
.
Modifiers
.
Any
(
SyntaxKind
.
ReadOnlyKeyword
)
Then
updatedProperty
=
updatedProperty
.
AddAccessors
(
generatedPropertyCode
.
Accessors
.
FirstOrDefault
(
Function
(
n
)
n
.
Kind
=
SyntaxKind
.
SetAccessorBlock
))
End
If
If
getter
Is
Nothing
AndAlso
Not
updatedProperty
.
PropertyStatement
.
Modifiers
.
Any
(
SyntaxKind
.
WriteOnlyKeyword
)
Then
updatedProperty
=
DirectCast
(
gen
.
WithGetAccessorStatements
(
updatedProperty
,
{}),
PropertyBlockSyntax
)
End
If
If
setter
Is
Nothing
AndAlso
Not
updatedProperty
.
PropertyStatement
.
Modifiers
.
Any
(
SyntaxKind
.
ReadOnlyKeyword
)
Then
updatedProperty
=
DirectCast
(
gen
.
WithSetAccessorStatements
(
updatedProperty
,
{}),
PropertyBlockSyntax
)
End
If
Dim
updatedDocument
=
Await
document
.
ReplaceNodeAsync
(
node
,
updatedProperty
.
WithAdditionalAnnotations
(
Formatter
.
Annotation
),
cancellationToken
).
ConfigureAwait
(
False
)
...
...
src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
浏览文件 @
471b48fb
...
...
@@ -92,6 +92,9 @@ public override SyntaxNode NamespaceDeclaration(SyntaxNode name, IEnumerable<Syn
DeclarationModifiers
modifiers
,
SyntaxNode
initializer
)
{
type
=
this
.
ClearTrivia
(
type
);
initializer
=
this
.
ClearTrivia
(
initializer
);
return
SyntaxFactory
.
FieldDeclaration
(
default
(
SyntaxList
<
AttributeListSyntax
>),
AsModifierList
(
accessibility
,
modifiers
,
SyntaxKind
.
FieldDeclaration
),
...
...
@@ -106,6 +109,9 @@ public override SyntaxNode NamespaceDeclaration(SyntaxNode name, IEnumerable<Syn
public
override
SyntaxNode
ParameterDeclaration
(
string
name
,
SyntaxNode
type
,
SyntaxNode
initializer
,
RefKind
refKind
)
{
type
=
this
.
ClearTrivia
(
type
);
initializer
=
this
.
ClearTrivia
(
initializer
);
return
SyntaxFactory
.
Parameter
(
default
(
SyntaxList
<
AttributeListSyntax
>),
GetParameterModifiers
(
refKind
),
...
...
@@ -137,6 +143,9 @@ private SyntaxTokenList GetParameterModifiers(RefKind refKind)
DeclarationModifiers
modifiers
,
IEnumerable
<
SyntaxNode
>
statements
)
{
parameters
=
this
.
ClearTrivia
(
parameters
);
returnType
=
this
.
ClearTrivia
(
returnType
);
bool
hasBody
=
!
modifiers
.
IsAbstract
;
return
SyntaxFactory
.
MethodDeclaration
(
...
...
@@ -167,6 +176,9 @@ private ParameterListSyntax AsParameterList(IEnumerable<SyntaxNode> parameters)
IEnumerable
<
SyntaxNode
>
baseConstructorArguments
,
IEnumerable
<
SyntaxNode
>
statements
)
{
parameters
=
this
.
ClearTrivia
(
parameters
);
baseConstructorArguments
=
this
.
ClearTrivia
(
baseConstructorArguments
);
return
SyntaxFactory
.
ConstructorDeclaration
(
default
(
SyntaxList
<
AttributeListSyntax
>),
AsModifierList
(
accessibility
,
modifiers
,
SyntaxKind
.
ConstructorDeclaration
),
...
...
@@ -184,6 +196,8 @@ private ParameterListSyntax AsParameterList(IEnumerable<SyntaxNode> parameters)
IEnumerable
<
SyntaxNode
>
getAccessorStatements
,
IEnumerable
<
SyntaxNode
>
setAccessorStatements
)
{
type
=
this
.
ClearTrivia
(
type
);
var
accessors
=
new
List
<
AccessorDeclarationSyntax
>();
var
hasSetter
=
!
modifiers
.
IsReadOnly
;
...
...
@@ -229,6 +243,8 @@ private ParameterListSyntax AsParameterList(IEnumerable<SyntaxNode> parameters)
IEnumerable
<
SyntaxNode
>
getAccessorStatements
,
IEnumerable
<
SyntaxNode
>
setAccessorStatements
)
{
type
=
this
.
ClearTrivia
(
type
);
var
accessors
=
new
List
<
AccessorDeclarationSyntax
>();
var
hasSetter
=
!
modifiers
.
IsReadOnly
;
...
...
@@ -293,6 +309,8 @@ private AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, IEnumerab
Accessibility
accessibility
,
DeclarationModifiers
modifiers
)
{
type
=
this
.
ClearTrivia
(
type
);
return
SyntaxFactory
.
EventFieldDeclaration
(
default
(
SyntaxList
<
AttributeListSyntax
>),
AsModifierList
(
accessibility
,
modifiers
,
SyntaxKind
.
EventFieldDeclaration
),
...
...
@@ -311,6 +329,9 @@ private AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, IEnumerab
IEnumerable
<
SyntaxNode
>
addAccessorStatements
,
IEnumerable
<
SyntaxNode
>
removeAccessorStatements
)
{
type
=
this
.
ClearTrivia
(
type
);
parameters
=
this
.
ClearTrivia
(
parameters
);
var
accessors
=
new
List
<
AccessorDeclarationSyntax
>();
if
(
modifiers
.
IsAbstract
)
{
...
...
@@ -350,6 +371,8 @@ public override SyntaxNode AsPublicInterfaceImplementation(SyntaxNode declaratio
public
override
SyntaxNode
AsPrivateInterfaceImplementation
(
SyntaxNode
declaration
,
SyntaxNode
typeName
)
{
typeName
=
this
.
ClearTrivia
(
typeName
);
return
PreserveTrivia
(
declaration
,
d
=>
{
var
specifier
=
SyntaxFactory
.
ExplicitInterfaceSpecifier
((
NameSyntax
)
typeName
);
...
...
@@ -468,9 +491,12 @@ private AccessorDeclarationSyntax WithoutBody(AccessorDeclarationSyntax accessor
Accessibility
accessibility
,
DeclarationModifiers
modifiers
,
SyntaxNode
baseType
,
IEnumerable
<
SyntaxNode
>
interfaceTypes
,
IEnumerable
<
SyntaxNode
>
interfaceTypes
,
IEnumerable
<
SyntaxNode
>
members
)
{
baseType
=
this
.
ClearTrivia
(
baseType
);
interfaceTypes
=
this
.
ClearTrivia
(
interfaceTypes
);
List
<
BaseTypeSyntax
>
baseTypes
=
null
;
if
(
baseType
!=
null
||
interfaceTypes
!=
null
)
{
...
...
@@ -534,6 +560,8 @@ private MemberDeclarationSyntax AsClassMember(SyntaxNode node, string className)
IEnumerable
<
SyntaxNode
>
interfaceTypes
,
IEnumerable
<
SyntaxNode
>
members
)
{
interfaceTypes
=
this
.
ClearTrivia
(
interfaceTypes
);
var
itypes
=
interfaceTypes
!=
null
?
interfaceTypes
.
Select
(
i
=>
(
BaseTypeSyntax
)
SyntaxFactory
.
SimpleBaseType
((
TypeSyntax
)
i
)).
ToList
()
:
null
;
if
(
itypes
!=
null
&&
itypes
.
Count
==
0
)
{
...
...
@@ -557,6 +585,8 @@ private MemberDeclarationSyntax AsClassMember(SyntaxNode node, string className)
IEnumerable
<
SyntaxNode
>
interfaceTypes
=
null
,
IEnumerable
<
SyntaxNode
>
members
=
null
)
{
interfaceTypes
=
this
.
ClearTrivia
(
interfaceTypes
);
var
itypes
=
interfaceTypes
!=
null
?
interfaceTypes
.
Select
(
i
=>
(
BaseTypeSyntax
)
SyntaxFactory
.
SimpleBaseType
((
TypeSyntax
)
i
)).
ToList
()
:
null
;
if
(
itypes
!=
null
&&
itypes
.
Count
==
0
)
{
...
...
@@ -649,6 +679,8 @@ private SyntaxNode AsInterfaceMember(SyntaxNode m)
public
override
SyntaxNode
EnumMember
(
string
name
,
SyntaxNode
expression
)
{
expression
=
this
.
ClearTrivia
(
expression
);
return
SyntaxFactory
.
EnumMemberDeclaration
(
default
(
SyntaxList
<
AttributeListSyntax
>),
name
.
ToIdentifierToken
(),
...
...
@@ -689,6 +721,9 @@ private SeparatedSyntaxList<EnumMemberDeclarationSyntax> AsEnumMembers(IEnumerab
Accessibility
accessibility
=
Accessibility
.
NotApplicable
,
DeclarationModifiers
modifiers
=
default
(
DeclarationModifiers
))
{
parameters
=
this
.
ClearTrivia
(
parameters
);
returnType
=
this
.
ClearTrivia
(
returnType
);
return
SyntaxFactory
.
DelegateDeclaration
(
default
(
SyntaxList
<
AttributeListSyntax
>),
AsModifierList
(
accessibility
,
modifiers
),
...
...
@@ -742,8 +777,15 @@ private AttributeArgumentSyntax AsAttributeArgument(SyntaxNode node)
protected
override
TNode
ClearTrivia
<
TNode
>(
TNode
node
)
{
return
node
.
WithLeadingTrivia
(
SyntaxFactory
.
ElasticMarker
)
.
WithTrailingTrivia
(
SyntaxFactory
.
ElasticMarker
);
if
(
node
!=
null
)
{
return
node
.
WithLeadingTrivia
(
SyntaxFactory
.
ElasticMarker
)
.
WithTrailingTrivia
(
SyntaxFactory
.
ElasticMarker
);
}
else
{
return
null
;
}
}
private
SyntaxList
<
AttributeListSyntax
>
AsAttributeLists
(
IEnumerable
<
SyntaxNode
>
attributes
)
...
...
src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb
浏览文件 @
471b48fb
...
...
@@ -576,6 +576,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Public
Overrides
Function
FieldDeclaration
(
name
As
String
,
type
As
SyntaxNode
,
Optional
accessibility
As
Accessibility
=
Nothing
,
Optional
modifiers
As
DeclarationModifiers
=
Nothing
,
Optional
initializer
As
SyntaxNode
=
Nothing
)
As
SyntaxNode
type
=
Me
.
ClearTrivia
(
type
)
initializer
=
Me
.
ClearTrivia
(
initializer
)
Return
SyntaxFactory
.
FieldDeclaration
(
attributeLists
:
=
Nothing
,
modifiers
:
=
GetModifierList
(
accessibility
,
modifiers
And
fieldModifiers
,
isField
:
=
True
),
...
...
@@ -591,6 +594,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Optional
modifiers
As
DeclarationModifiers
=
Nothing
,
Optional
statements
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
)
As
SyntaxNode
parameters
=
MyBase
.
ClearTrivia
(
parameters
)
returnType
=
Me
.
ClearTrivia
(
returnType
)
Dim
statement
=
SyntaxFactory
.
MethodStatement
(
kind
:
=
If
(
returnType
Is
Nothing
,
SyntaxKind
.
SubStatement
,
SyntaxKind
.
FunctionStatement
),
attributeLists
:
=
Nothing
,
...
...
@@ -619,6 +625,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Public
Overrides
Function
ParameterDeclaration
(
name
As
String
,
Optional
type
As
SyntaxNode
=
Nothing
,
Optional
initializer
As
SyntaxNode
=
Nothing
,
Optional
refKind
As
RefKind
=
Nothing
)
As
SyntaxNode
type
=
Me
.
ClearTrivia
(
type
)
Return
SyntaxFactory
.
Parameter
(
attributeLists
:
=
Nothing
,
modifiers
:
=
GetParameterModifiers
(
refKind
,
initializer
),
...
...
@@ -646,6 +654,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Optional
getAccessorStatements
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
,
Optional
setAccessorStatements
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
)
As
SyntaxNode
type
=
Me
.
ClearTrivia
(
type
)
Dim
asClause
=
SyntaxFactory
.
SimpleAsClause
(
DirectCast
(
type
,
TypeSyntax
))
Dim
statement
=
SyntaxFactory
.
PropertyStatement
(
attributeLists
:
=
Nothing
,
...
...
@@ -682,6 +692,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Optional
getAccessorStatements
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
,
Optional
setAccessorStatements
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
)
As
SyntaxNode
type
=
ClearTrivia
(
type
)
parameters
=
MyBase
.
ClearTrivia
(
parameters
)
Dim
asClause
=
SyntaxFactory
.
SimpleAsClause
(
DirectCast
(
type
,
TypeSyntax
))
Dim
statement
=
SyntaxFactory
.
PropertyStatement
(
attributeLists
:
=
Nothing
,
...
...
@@ -711,6 +724,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Private
Function
AccessorBlock
(
kind
As
SyntaxKind
,
statements
As
IEnumerable
(
Of
SyntaxNode
),
type
As
SyntaxNode
)
As
AccessorBlockSyntax
type
=
Me
.
ClearTrivia
(
type
)
Select
Case
kind
Case
SyntaxKind
.
GetAccessorBlock
Return
CreateGetAccessorBlock
(
statements
)
...
...
@@ -734,6 +749,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Private
Function
CreateSetAccessorBlock
(
type
As
SyntaxNode
,
statements
As
IEnumerable
(
Of
SyntaxNode
))
As
AccessorBlockSyntax
type
=
Me
.
ClearTrivia
(
type
)
Dim
asClause
=
SyntaxFactory
.
SimpleAsClause
(
DirectCast
(
type
,
TypeSyntax
))
Dim
valueParameter
=
SyntaxFactory
.
Parameter
(
...
...
@@ -756,6 +773,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Private
Function
CreateAddHandlerAccessorBlock
(
delegateType
As
SyntaxNode
,
statements
As
IEnumerable
(
Of
SyntaxNode
))
As
AccessorBlockSyntax
delegateType
=
Me
.
ClearTrivia
(
delegateType
)
Dim
asClause
=
SyntaxFactory
.
SimpleAsClause
(
DirectCast
(
delegateType
,
TypeSyntax
))
Dim
valueParameter
=
SyntaxFactory
.
Parameter
(
...
...
@@ -778,6 +797,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Private
Function
CreateRemoveHandlerAccessorBlock
(
delegateType
As
SyntaxNode
,
statements
As
IEnumerable
(
Of
SyntaxNode
))
As
AccessorBlockSyntax
delegateType
=
Me
.
ClearTrivia
(
delegateType
)
Dim
asClause
=
SyntaxFactory
.
SimpleAsClause
(
DirectCast
(
delegateType
,
TypeSyntax
))
Dim
valueParameter
=
SyntaxFactory
.
Parameter
(
...
...
@@ -800,6 +821,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Private
Function
CreateRaiseEventAccessorBlock
(
parameters
As
IEnumerable
(
Of
SyntaxNode
),
statements
As
IEnumerable
(
Of
SyntaxNode
))
As
AccessorBlockSyntax
parameters
=
MyBase
.
ClearTrivia
(
parameters
)
Dim
parameterList
=
GetParameterList
(
parameters
)
Return
SyntaxFactory
.
AccessorBlock
(
...
...
@@ -815,6 +837,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Public
Overrides
Function
AsPublicInterfaceImplementation
(
declaration
As
SyntaxNode
,
typeName
As
SyntaxNode
)
As
SyntaxNode
typeName
=
Me
.
ClearTrivia
(
typeName
)
Dim
type
=
DirectCast
(
typeName
,
NameSyntax
)
declaration
=
AsImplementation
(
declaration
,
Accessibility
.
Public
,
allowDefault
:
=
True
)
...
...
@@ -837,6 +860,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Public
Overrides
Function
AsPrivateInterfaceImplementation
(
declaration
As
SyntaxNode
,
typeName
As
SyntaxNode
)
As
SyntaxNode
typeName
=
Me
.
ClearTrivia
(
typeName
)
Dim
type
=
DirectCast
(
typeName
,
NameSyntax
)
' convert declaration statements to blocks
...
...
@@ -947,6 +971,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Optional
baseConstructorArguments
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
,
Optional
statements
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
)
As
SyntaxNode
parameters
=
MyBase
.
ClearTrivia
(
parameters
)
baseConstructorArguments
=
MyBase
.
ClearTrivia
(
baseConstructorArguments
)
Dim
stats
=
GetStatementList
(
statements
)
If
(
baseConstructorArguments
IsNot
Nothing
)
Then
...
...
@@ -971,6 +998,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Optional
interfaceTypes
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
,
Optional
members
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
)
As
SyntaxNode
baseType
=
Me
.
ClearTrivia
(
baseType
)
interfaceTypes
=
MyBase
.
ClearTrivia
(
interfaceTypes
)
Dim
itypes
=
If
(
interfaceTypes
IsNot
Nothing
,
interfaceTypes
.
Cast
(
Of
TypeSyntax
),
Nothing
)
If
itypes
IsNot
Nothing
AndAlso
itypes
.
Count
=
0
Then
itypes
=
Nothing
...
...
@@ -1007,6 +1037,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Optional
interfaceTypes
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
,
Optional
members
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
)
As
SyntaxNode
interfaceTypes
=
MyBase
.
ClearTrivia
(
interfaceTypes
)
Dim
itypes
=
If
(
interfaceTypes
IsNot
Nothing
,
interfaceTypes
.
Cast
(
Of
TypeSyntax
),
Nothing
)
If
itypes
IsNot
Nothing
AndAlso
itypes
.
Count
=
0
Then
itypes
=
Nothing
...
...
@@ -1042,6 +1074,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Optional
interfaceTypes
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
,
Optional
members
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
)
As
SyntaxNode
interfaceTypes
=
MyBase
.
ClearTrivia
(
interfaceTypes
)
Dim
itypes
=
If
(
interfaceTypes
IsNot
Nothing
,
interfaceTypes
.
Cast
(
Of
TypeSyntax
),
Nothing
)
If
itypes
IsNot
Nothing
AndAlso
itypes
.
Count
=
0
Then
itypes
=
Nothing
...
...
@@ -1135,6 +1169,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
Optional
accessibility
As
Accessibility
=
Accessibility
.
NotApplicable
,
Optional
modifiers
As
DeclarationModifiers
=
Nothing
)
As
SyntaxNode
parameters
=
MyBase
.
ClearTrivia
(
parameters
)
Dim
kind
=
If
(
returnType
Is
Nothing
,
SyntaxKind
.
DelegateSubStatement
,
SyntaxKind
.
DelegateFunctionStatement
)
Return
SyntaxFactory
.
DelegateStatement
(
...
...
@@ -1169,10 +1205,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Public
Overrides
Function
NamespaceImportDeclaration
(
name
As
SyntaxNode
)
As
SyntaxNode
name
=
Me
.
ClearTrivia
(
name
)
Return
SyntaxFactory
.
ImportsStatement
(
SyntaxFactory
.
SingletonSeparatedList
(
Of
ImportsClauseSyntax
)(
SyntaxFactory
.
SimpleImportsClause
(
DirectCast
(
name
,
NameSyntax
))))
End
Function
Public
Overrides
Function
NamespaceDeclaration
(
name
As
SyntaxNode
,
nestedDeclarations
As
IEnumerable
(
Of
SyntaxNode
))
As
SyntaxNode
name
=
Me
.
ClearTrivia
(
name
)
Dim
imps
As
IEnumerable
(
Of
StatementSyntax
)
=
AsImports
(
nestedDeclarations
)
Dim
members
As
IEnumerable
(
Of
StatementSyntax
)
=
AsNamespaceMembers
(
nestedDeclarations
)
...
...
@@ -1185,6 +1224,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Public
Overrides
Function
Attribute
(
name
As
SyntaxNode
,
Optional
attributeArguments
As
IEnumerable
(
Of
SyntaxNode
)
=
Nothing
)
As
SyntaxNode
name
=
Me
.
ClearTrivia
(
name
)
attributeArguments
=
MyBase
.
ClearTrivia
(
attributeArguments
)
Dim
attr
=
SyntaxFactory
.
Attribute
(
target
:
=
Nothing
,
name
:
=
DirectCast
(
name
,
TypeSyntax
),
...
...
@@ -1202,6 +1244,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
End
Function
Public
Overrides
Function
AttributeArgument
(
name
As
String
,
expression
As
SyntaxNode
)
As
SyntaxNode
expression
=
Me
.
ClearTrivia
(
expression
)
Return
Argument
(
name
,
RefKind
.
None
,
expression
)
End
Function
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录