Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
6ecf1570
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,发现更多精彩内容 >>
提交
6ecf1570
编写于
4月 26, 2017
作者:
M
Manish Vasani
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
VB side changes and unit tests for IOperationWithChildren
上级
81b8036b
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
851 addition
and
137 deletion
+851
-137
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
+4
-4
src/Compilers/CSharp/Portable/BoundTree/Statement.cs
src/Compilers/CSharp/Portable/BoundTree/Statement.cs
+1
-1
src/Compilers/Test/Utilities/VisualBasic/SemanticModelTestBase.vb
...ilers/Test/Utilities/VisualBasic/SemanticModelTestBase.vb
+2
-2
src/Compilers/VisualBasic/Portable/BoundTree/BoundNode.vb
src/Compilers/VisualBasic/Portable/BoundTree/BoundNode.vb
+1
-1
src/Compilers/VisualBasic/Portable/BoundTree/Expression.vb
src/Compilers/VisualBasic/Portable/BoundTree/Expression.vb
+309
-120
src/Compilers/VisualBasic/Portable/BoundTree/Statement.vb
src/Compilers/VisualBasic/Portable/BoundTree/Statement.vb
+123
-7
src/Compilers/VisualBasic/Test/Semantic/BasicCompilerSemanticTest.vbproj
...isualBasic/Test/Semantic/BasicCompilerSemanticTest.vbproj
+1
-0
src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb
...peration/IOperationTests_IParameterReferenceExpression.vb
+404
-0
src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs
...t/Utilities/Portable/Compilation/OperationTreeVerifier.cs
+6
-2
未找到文件。
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
浏览文件 @
6ecf1570
...
...
@@ -1420,7 +1420,7 @@ internal partial class BoundDynamicIndexerAccess
{
protected
override
OperationKind
ExpressionKind
=>
OperationKind
.
None
;
protected
override
ImmutableArray
<
IOperation
>
Children
=>
this
.
Arguments
.
Concat
(
this
.
ReceiverOpt
).
As
<
IOperation
>();
protected
override
ImmutableArray
<
IOperation
>
Children
=>
this
.
Arguments
.
Add
(
this
.
ReceiverOpt
).
As
<
IOperation
>();
public
override
void
Accept
(
OperationVisitor
visitor
)
{
...
...
@@ -1486,7 +1486,7 @@ internal partial class BoundAttribute
{
protected
override
OperationKind
ExpressionKind
=>
OperationKind
.
None
;
protected
override
ImmutableArray
<
IOperation
>
Children
=>
this
.
ConstructorArguments
.
Concat
(
this
.
NamedArguments
).
As
<
IOperation
>();
protected
override
ImmutableArray
<
IOperation
>
Children
=>
this
.
ConstructorArguments
.
AddRange
(
this
.
NamedArguments
).
As
<
IOperation
>();
public
override
void
Accept
(
OperationVisitor
visitor
)
{
...
...
@@ -1873,7 +1873,7 @@ internal partial class BoundDynamicInvocation
{
protected
override
OperationKind
ExpressionKind
=>
OperationKind
.
None
;
protected
override
ImmutableArray
<
IOperation
>
Children
=>
this
.
Arguments
.
As
<
IOperation
>().
Concat
(
this
.
Expression
);
protected
override
ImmutableArray
<
IOperation
>
Children
=>
this
.
Arguments
.
As
<
IOperation
>().
Add
(
this
.
Expression
);
public
override
void
Accept
(
OperationVisitor
visitor
)
{
...
...
@@ -2140,7 +2140,7 @@ internal partial class BoundDynamicObjectCreationExpression
{
protected
override
OperationKind
ExpressionKind
=>
OperationKind
.
None
;
protected
override
ImmutableArray
<
IOperation
>
Children
=>
this
.
Arguments
.
Concat
(
BoundObjectCreationExpression
.
GetChildInitializers
(
this
.
InitializerExpressionOpt
)).
As
<
IOperation
>();
protected
override
ImmutableArray
<
IOperation
>
Children
=>
this
.
Arguments
.
AddRange
(
BoundObjectCreationExpression
.
GetChildInitializers
(
this
.
InitializerExpressionOpt
)).
As
<
IOperation
>();
public
override
void
Accept
(
OperationVisitor
visitor
)
{
...
...
src/Compilers/CSharp/Portable/BoundTree/Statement.cs
浏览文件 @
6ecf1570
...
...
@@ -904,7 +904,7 @@ public override void Accept(OperationVisitor visitor)
partial
class
BoundPatternSwitchSection
{
protected
override
ImmutableArray
<
IOperation
>
Children
=>
this
.
SwitchLabels
.
As
<
IOperation
>().
Concat
(
this
.
Statements
).
ToImmutableArray
();
protected
override
ImmutableArray
<
IOperation
>
Children
=>
this
.
SwitchLabels
.
As
<
IOperation
>().
AddRange
(
this
.
Statements
).
ToImmutableArray
();
}
partial
class
BoundPatternSwitchLabel
...
...
src/Compilers/Test/Utilities/VisualBasic/SemanticModelTestBase.vb
浏览文件 @
6ecf1570
...
...
@@ -169,7 +169,7 @@ Public MustInherit Class SemanticModelTestBase : Inherits BasicTestBase
Friend
Function
GetOperationTreeForTest
(
Of
TSyntaxNode
As
SyntaxNode
)(
testSrc
As
String
,
Optional
compilationOptions
As
VisualBasicCompilationOptions
=
Nothing
,
Optional
parseOptions
As
VisualBasicParseOptions
=
Nothing
,
Optional
which
As
Integer
=
0
)
As
String
Dim
fileName
=
"a.vb"
Dim
syntaxTree
=
Parse
(
testSrc
,
fileName
,
parseOptions
)
Dim
compilation
=
CreateCompilationWithMscorlib45AndVBRuntime
({
syntaxTree
},
references
:
=
DefaultVbReferences
,
options
:
=
If
(
compilationOptions
,
TestOptions
.
ReleaseDll
))
Dim
compilation
=
CreateCompilationWithMscorlib45AndVBRuntime
({
syntaxTree
},
references
:
=
DefaultVbReferences
.
Append
({
ValueTupleRef
,
SystemRuntimeFacadeRef
})
,
options
:
=
If
(
compilationOptions
,
TestOptions
.
ReleaseDll
))
Return
GetOperationTreeForTest
(
Of
TSyntaxNode
)(
compilation
,
fileName
,
which
)
End
Function
...
...
@@ -196,7 +196,7 @@ Public MustInherit Class SemanticModelTestBase : Inherits BasicTestBase
Friend
Sub
VerifyOperationTreeAndDiagnosticsForTest
(
Of
TSyntaxNode
As
SyntaxNode
)(
testSrc
As
String
,
expectedOperationTree
As
String
,
expectedDiagnostics
As
String
,
Optional
compilationOptions
As
VisualBasicCompilationOptions
=
Nothing
,
Optional
parseOptions
As
VisualBasicParseOptions
=
Nothing
,
Optional
which
As
Integer
=
0
)
Dim
fileName
=
"a.vb"
Dim
syntaxTree
=
Parse
(
testSrc
,
fileName
,
parseOptions
)
Dim
compilation
=
CreateCompilationWithMscorlib45AndVBRuntime
({
syntaxTree
},
references
:
=
DefaultVbReferences
,
options
:
=
If
(
compilationOptions
,
TestOptions
.
ReleaseDll
))
Dim
compilation
=
CreateCompilationWithMscorlib45AndVBRuntime
({
syntaxTree
},
references
:
=
DefaultVbReferences
.
Append
({
ValueTupleRef
,
SystemRuntimeFacadeRef
})
,
options
:
=
If
(
compilationOptions
,
TestOptions
.
ReleaseDll
))
VerifyOperationTreeAndDiagnosticsForTest
(
Of
TSyntaxNode
)(
compilation
,
fileName
,
expectedOperationTree
,
expectedDiagnostics
,
which
)
End
Sub
...
...
src/Compilers/VisualBasic/Portable/BoundTree/BoundNode.vb
浏览文件 @
6ecf1570
...
...
@@ -93,7 +93,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Get
End
Property
Public
Overridable
Function
Accept
(
visitor
As
BoundTreeVisitor
)
As
BoundNode
Public
Overridable
Overloads
Function
Accept
(
visitor
As
BoundTreeVisitor
)
As
BoundNode
Throw
ExceptionUtilities
.
Unreachable
End
Function
...
...
src/Compilers/VisualBasic/Portable/BoundTree/Expression.vb
浏览文件 @
6ecf1570
此差异已折叠。
点击以展开。
src/Compilers/VisualBasic/Portable/BoundTree/Statement.vb
浏览文件 @
6ecf1570
...
...
@@ -6,12 +6,12 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Namespace
Microsoft.CodeAnalysis.VisualBasic
Partial
Friend
Class
Bound
Statement
Implements
IOperation
Partial
Friend
Class
Bound
Node
Implements
IOperation
,
IOperationWithChildren
Private
ReadOnly
Property
IOperation_Kind
As
OperationKind
Implements
IOperation
.
Kind
Get
Return
Me
.
StatementKind
()
Return
Me
.
OperationKind
End
Get
End
Property
...
...
@@ -29,21 +29,71 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Private
ReadOnly
Property
IOperation_Type
As
ITypeSymbol
Implements
IOperation
.
Type
Get
Return
Nothing
Return
Me
.
OperationType
End
Get
End
Property
Private
ReadOnly
Property
IOperation_ConstantValue
As
[
Optional
]
(
Of
Object
)
Implements
IOperation
.
ConstantValue
Get
Return
Me
.
OperationConstantValue
End
Get
End
Property
Public
ReadOnly
Property
IOperationWithChildren_Children
As
ImmutableArray
(
Of
IOperation
)
Implements
IOperationWithChildren
.
Children
Get
Return
Me
.
Children
End
Get
End
Property
Protected
Overridable
ReadOnly
Property
OperationKind
As
OperationKind
Get
Return
OperationKind
.
None
End
Get
End
Property
Protected
Overridable
ReadOnly
Property
OperationType
As
ITypeSymbol
Get
Return
Nothing
End
Get
End
Property
Protected
Overridable
ReadOnly
Property
OperationConstantValue
As
[
Optional
]
(
Of
Object
)
Get
Return
New
[
Optional
]
(
Of
Object
)()
End
Get
End
Property
''' <summary>
''' Override this property to return the child operations if the IOperation API corresponding to this bound node is not yet designed or implemented.
''' </summary>
Protected
Overridable
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
ImmutableArray
(
Of
IOperation
).
Empty
End
Get
End
Property
Public
Overridable
Overloads
Sub
Accept
(
visitor
As
OperationVisitor
)
Implements
IOperation
.
Accept
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
Public
Overridable
Overloads
Function
Accept
(
Of
TArgument
,
TResult
)(
visitor
As
OperationVisitor
(
Of
TArgument
,
TResult
),
argument
As
TArgument
)
As
TResult
Implements
IOperation
.
Accept
visitor
.
VisitNoneOperation
(
Me
,
argument
)
End
Function
End
Class
Partial
Friend
Class
BoundStatement
Protected
Overrides
ReadOnly
Property
OperationKind
As
OperationKind
Get
Return
Me
.
StatementKind
End
Get
End
Property
Protected
MustOverride
Function
StatementKind
()
As
OperationKind
Public
MustOverride
Overloads
Sub
Accept
(
visitor
As
OperationVisitor
)
Implements
IOperation
.
Accept
Public
MustOverride
Overloads
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
Public
MustOverride
Overloads
Function
Accept
(
Of
TArgument
,
TResult
)(
visitor
As
OperationVisitor
(
Of
TArgument
,
TResult
),
argument
As
TArgument
)
As
TResult
Implements
IOperation
.
Accep
t
Public
MustOverride
Overloads
Overrides
Function
Accept
(
Of
TArgument
,
TResult
)(
visitor
As
OperationVisitor
(
Of
TArgument
,
TResult
),
argument
As
TArgument
)
As
TResul
t
End
Class
Partial
Friend
Class
BoundIfStatement
...
...
@@ -261,6 +311,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
ImmutableArray
.
Create
(
Of
IOperation
)(
Me
.
CaseStatement
,
Me
.
Body
)
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
@@ -486,6 +542,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
Me
.
CaseClauses
.
As
(
Of
IOperation
).
Add
(
Me
.
ConditionOpt
)
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
@@ -943,7 +1005,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Partial
Friend
Class
BoundBadStatement
Implements
IInvalidStatement
P
ublic
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Implements
IInvalidStatement
.
Children
P
rotected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Implements
IInvalidStatement
.
Children
Get
Dim
builder
As
ArrayBuilder
(
Of
IOperation
)
=
ArrayBuilder
(
Of
IOperation
).
GetInstance
(
Me
.
ChildBoundNodes
.
Length
)
For
Each
childNode
In
Me
.
ChildBoundNodes
...
...
@@ -1630,6 +1692,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
Me
.
Clauses
.
As
(
Of
IOperation
)
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
@@ -1644,6 +1712,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
Me
.
Indices
.
As
(
Of
IOperation
).
Insert
(
0
,
Me
.
Operand
)
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
@@ -1658,6 +1732,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
Me
.
Clauses
.
As
(
Of
IOperation
)
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
@@ -1714,6 +1794,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
ImmutableArray
.
Create
(
Of
IOperation
)(
Me
.
Condition
)
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
@@ -1764,6 +1850,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
ImmutableArray
.
Create
(
Of
IOperation
)(
Me
.
LabelExpressionOpt
)
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
@@ -1778,6 +1870,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
ImmutableArray
.
Create
(
Of
IOperation
)(
Me
.
LabelExpressionOpt
)
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
@@ -1792,6 +1890,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
ImmutableArray
.
Create
(
Of
IOperation
)(
Me
.
Body
)
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
@@ -1806,6 +1910,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
Me
.
Jumps
.
As
(
Of
IOperation
).
Insert
(
0
,
Me
.
Value
)
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
@@ -1820,6 +1930,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
OperationKind
.
None
End
Function
Protected
Overrides
ReadOnly
Property
Children
As
ImmutableArray
(
Of
IOperation
)
Get
Return
Me
.
Jumps
.
As
(
Of
IOperation
).
InsertRange
(
0
,
{
Me
.
ResumeLabel
,
Me
.
ResumeNextLabel
})
End
Get
End
Property
Public
Overrides
Sub
Accept
(
visitor
As
OperationVisitor
)
visitor
.
VisitNoneOperation
(
Me
)
End
Sub
...
...
src/Compilers/VisualBasic/Test/Semantic/BasicCompilerSemanticTest.vbproj
浏览文件 @
6ecf1570
...
...
@@ -97,6 +97,7 @@
<Compile
Include=
"Diagnostics\DiagnosticTests.vb"
/>
<Compile
Include=
"Diagnostics\GetDiagnosticsTests.vb"
/>
<Compile
Include=
"IOperation\IOperationTests_IArgument.vb"
/>
<Compile
Include=
"IOperation\IOperationTests_IParameterReferenceExpression.vb"
/>
<Compile
Include=
"IOperation\IOperationTests_InvalidStatement.vb"
/>
<Compile
Include=
"IOperation\IOperationTests_InvalidExpression.vb"
/>
<Compile
Include=
"IOperation\IOperationTests_IBlockStatement_MethodBlocks.vb"
/>
...
...
src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb
0 → 100644
浏览文件 @
6ecf1570
此差异已折叠。
点击以展开。
src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs
浏览文件 @
6ecf1570
...
...
@@ -257,9 +257,13 @@ internal override void VisitNoneOperation(IOperation operation)
LogString
(
"IOperation: "
);
LogCommonPropertiesAndNewLine
(
operation
);
if
(
operation
is
IOperationWithChildren
operationWithChildren
&&
operationWithChildren
.
Children
.
Length
>
0
)
if
(
operation
is
IOperationWithChildren
operationWithChildren
)
{
VisitArray
(
operationWithChildren
.
Children
.
WhereNotNull
().
ToImmutableArray
(),
"Children"
,
logElementCount
:
true
);
var
children
=
operationWithChildren
.
Children
.
WhereNotNull
().
ToImmutableArray
();
if
(
children
.
Length
>
0
)
{
VisitArray
(
children
,
"Children"
,
logElementCount
:
true
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录