Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
700099b8
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,体验更适合开发者的 AI 搜索 >>
提交
700099b8
编写于
10月 04, 2017
作者:
G
Gen Lu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change IRaiseEventExpressionn to IRaiseEventStatement
上级
55eea6c4
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
194 addition
and
110 deletion
+194
-110
src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs
...ilers/Core/Portable/Generated/Operations.xml.Generated.cs
+21
-21
src/Compilers/Core/Portable/Operations/IHasArgumentsExpression.cs
...ilers/Core/Portable/Operations/IHasArgumentsExpression.cs
+1
-1
src/Compilers/Core/Portable/Operations/IInvocationExpression.cs
...mpilers/Core/Portable/Operations/IInvocationExpression.cs
+1
-1
src/Compilers/Core/Portable/Operations/IObjectCreationExpression.cs
...ers/Core/Portable/Operations/IObjectCreationExpression.cs
+1
-1
src/Compilers/Core/Portable/Operations/IPropertyReferenceExpression.cs
.../Core/Portable/Operations/IPropertyReferenceExpression.cs
+1
-1
src/Compilers/Core/Portable/Operations/IRaiseEventExpression.cs
...mpilers/Core/Portable/Operations/IRaiseEventExpression.cs
+2
-2
src/Compilers/Core/Portable/Operations/OperationCloner.cs
src/Compilers/Core/Portable/Operations/OperationCloner.cs
+2
-2
src/Compilers/Core/Portable/Operations/OperationKind.cs
src/Compilers/Core/Portable/Operations/OperationKind.cs
+4
-2
src/Compilers/Core/Portable/Operations/OperationVisitor.cs
src/Compilers/Core/Portable/Operations/OperationVisitor.cs
+2
-2
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
+7
-7
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
...lBasic/Portable/Operations/VisualBasicOperationFactory.vb
+47
-3
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb
...ortable/Operations/VisualBasicOperationFactory_Methods.vb
+0
-44
src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IRaiseEventExpression.vb
...antic/IOperation/IOperationTests_IRaiseEventExpression.vb
+102
-20
src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs
...t/Utilities/Portable/Compilation/OperationTreeVerifier.cs
+3
-3
未找到文件。
src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs
浏览文件 @
700099b8
...
...
@@ -2546,7 +2546,7 @@ public LazyInvalidStatement(Lazy<ImmutableArray<IOperation>> children, SemanticM
/// <summary>
/// Represents a C# or VB method invocation.
/// </summary>
internal
abstract
partial
class
BaseInvocationExpression
:
Operation
,
IHasArguments
Expression
,
IInvocationExpression
internal
abstract
partial
class
BaseInvocationExpression
:
Operation
,
IHasArguments
,
IInvocationExpression
{
protected
BaseInvocationExpression
(
IMethodSymbol
targetMethod
,
bool
isVirtual
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
OperationKind
.
InvocationExpression
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
...
...
@@ -2600,7 +2600,7 @@ public override void Accept(OperationVisitor visitor)
/// <summary>
/// Represents a C# or VB method invocation.
/// </summary>
internal
sealed
partial
class
InvocationExpression
:
BaseInvocationExpression
,
IHasArguments
Expression
,
IInvocationExpression
internal
sealed
partial
class
InvocationExpression
:
BaseInvocationExpression
,
IHasArguments
,
IInvocationExpression
{
public
InvocationExpression
(
IMethodSymbol
targetMethod
,
IOperation
instance
,
bool
isVirtual
,
ImmutableArray
<
IArgument
>
argumentsInEvaluationOrder
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
targetMethod
,
isVirtual
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
...
...
@@ -2616,7 +2616,7 @@ internal sealed partial class InvocationExpression : BaseInvocationExpression, I
/// <summary>
/// Represents a C# or VB method invocation.
/// </summary>
internal
sealed
partial
class
LazyInvocationExpression
:
BaseInvocationExpression
,
IHasArguments
Expression
,
IInvocationExpression
internal
sealed
partial
class
LazyInvocationExpression
:
BaseInvocationExpression
,
IHasArguments
,
IInvocationExpression
{
private
readonly
Lazy
<
IOperation
>
_lazyInstance
;
private
readonly
Lazy
<
ImmutableArray
<
IArgument
>>
_lazyArgumentsInEvaluationOrder
;
...
...
@@ -2633,12 +2633,12 @@ public LazyInvocationExpression(IMethodSymbol targetMethod, Lazy<IOperation> ins
}
/// <summary>
/// Represents a VB raise event
expression
.
/// Represents a VB raise event
statement
.
/// </summary>
internal
abstract
partial
class
BaseRaiseEvent
Expression
:
Operation
,
IHasArgumentsExpression
,
IRaiseEventExpression
internal
abstract
partial
class
BaseRaiseEvent
Statement
:
Operation
,
IHasArguments
,
IRaiseEventStatement
{
protected
BaseRaiseEvent
Expression
(
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
OperationKind
.
RaiseEvent
Expression
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
protected
BaseRaiseEvent
Statement
(
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
OperationKind
.
RaiseEvent
Statement
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
}
...
...
@@ -2665,20 +2665,20 @@ public override IEnumerable<IOperation> Children
public
override
void
Accept
(
OperationVisitor
visitor
)
{
visitor
.
VisitRaiseEvent
Expression
(
this
);
visitor
.
VisitRaiseEvent
Statement
(
this
);
}
public
override
TResult
Accept
<
TArgument
,
TResult
>(
OperationVisitor
<
TArgument
,
TResult
>
visitor
,
TArgument
argument
)
{
return
visitor
.
VisitRaiseEvent
Expression
(
this
,
argument
);
return
visitor
.
VisitRaiseEvent
Statement
(
this
,
argument
);
}
}
/// <summary>
/// Represents a VB raise event
expression
.
/// Represents a VB raise event
statement
.
/// </summary>
internal
sealed
partial
class
RaiseEvent
Expression
:
BaseRaiseEventExpression
,
IHasArgumentsExpression
,
IRaiseEventExpression
internal
sealed
partial
class
RaiseEvent
Statement
:
BaseRaiseEventStatement
,
IHasArguments
,
IRaiseEventStatement
{
public
RaiseEvent
Expression
(
IEventReferenceExpression
eventReference
,
ImmutableArray
<
IArgument
>
argumentsInEvaluationOrder
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
public
RaiseEvent
Statement
(
IEventReferenceExpression
eventReference
,
ImmutableArray
<
IArgument
>
argumentsInEvaluationOrder
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
EventReferenceImpl
=
eventReference
;
...
...
@@ -2691,14 +2691,14 @@ internal sealed partial class RaiseEventExpression : BaseRaiseEventExpression, I
}
/// <summary>
/// Represents a VB raise event
expression
.
/// Represents a VB raise event
statement
.
/// </summary>
internal
sealed
partial
class
LazyRaiseEvent
Expression
:
BaseRaiseEventExpression
,
IHasArgumentsExpression
,
IRaiseEventExpression
internal
sealed
partial
class
LazyRaiseEvent
Statement
:
BaseRaiseEventStatement
,
IHasArguments
,
IRaiseEventStatement
{
private
readonly
Lazy
<
IEventReferenceExpression
>
_lazyEventReference
;
private
readonly
Lazy
<
ImmutableArray
<
IArgument
>>
_lazyArgumentsInEvaluationOrder
;
public
LazyRaiseEvent
Expression
(
Lazy
<
IEventReferenceExpression
>
eventReference
,
Lazy
<
ImmutableArray
<
IArgument
>>
argumentsInEvaluationOrder
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
public
LazyRaiseEvent
Statement
(
Lazy
<
IEventReferenceExpression
>
eventReference
,
Lazy
<
ImmutableArray
<
IArgument
>>
argumentsInEvaluationOrder
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
_lazyEventReference
=
eventReference
;
...
...
@@ -3302,7 +3302,7 @@ public LazyCoalesceExpression(Lazy<IOperation> expression, Lazy<IOperation> when
/// <summary>
/// Represents a new/New expression.
/// </summary>
internal
abstract
partial
class
BaseObjectCreationExpression
:
Operation
,
IHasArguments
Expression
,
IObjectCreationExpression
internal
abstract
partial
class
BaseObjectCreationExpression
:
Operation
,
IHasArguments
,
IObjectCreationExpression
{
protected
BaseObjectCreationExpression
(
IMethodSymbol
constructor
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
OperationKind
.
ObjectCreationExpression
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
...
...
@@ -3351,7 +3351,7 @@ public override void Accept(OperationVisitor visitor)
/// <summary>
/// Represents a new/New expression.
/// </summary>
internal
sealed
partial
class
ObjectCreationExpression
:
BaseObjectCreationExpression
,
IHasArguments
Expression
,
IObjectCreationExpression
internal
sealed
partial
class
ObjectCreationExpression
:
BaseObjectCreationExpression
,
IHasArguments
,
IObjectCreationExpression
{
public
ObjectCreationExpression
(
IMethodSymbol
constructor
,
IObjectOrCollectionInitializerExpression
initializer
,
ImmutableArray
<
IArgument
>
argumentsInEvaluationOrder
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
constructor
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
...
...
@@ -3367,7 +3367,7 @@ internal sealed partial class ObjectCreationExpression : BaseObjectCreationExpre
/// <summary>
/// Represents a new/New expression.
/// </summary>
internal
sealed
partial
class
LazyObjectCreationExpression
:
BaseObjectCreationExpression
,
IHasArguments
Expression
,
IObjectCreationExpression
internal
sealed
partial
class
LazyObjectCreationExpression
:
BaseObjectCreationExpression
,
IHasArguments
,
IObjectCreationExpression
{
private
readonly
Lazy
<
IObjectOrCollectionInitializerExpression
>
_lazyInitializer
;
private
readonly
Lazy
<
ImmutableArray
<
IArgument
>>
_lazyArgumentsInEvaluationOrder
;
...
...
@@ -3782,7 +3782,7 @@ internal sealed partial class LazyPropertyInitializer : BasePropertyInitializer,
/// <summary>
/// Represents a reference to a property.
/// </summary>
internal
abstract
partial
class
BasePropertyReferenceExpression
:
MemberReferenceExpression
,
IPropertyReferenceExpression
,
IHasArguments
Expression
internal
abstract
partial
class
BasePropertyReferenceExpression
:
MemberReferenceExpression
,
IPropertyReferenceExpression
,
IHasArguments
{
protected
BasePropertyReferenceExpression
(
IPropertySymbol
property
,
ISymbol
member
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
member
,
OperationKind
.
PropertyReferenceExpression
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
...
...
@@ -3827,7 +3827,7 @@ public override void Accept(OperationVisitor visitor)
/// <summary>
/// Represents a reference to a property.
/// </summary>
internal
sealed
partial
class
PropertyReferenceExpression
:
BasePropertyReferenceExpression
,
IPropertyReferenceExpression
,
IHasArguments
Expression
internal
sealed
partial
class
PropertyReferenceExpression
:
BasePropertyReferenceExpression
,
IPropertyReferenceExpression
,
IHasArguments
{
public
PropertyReferenceExpression
(
IPropertySymbol
property
,
IOperation
instance
,
ISymbol
member
,
ImmutableArray
<
IArgument
>
argumentsInEvaluationOrder
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
property
,
member
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
...
...
@@ -3851,7 +3851,7 @@ public override void Accept(OperationVisitor visitor)
/// <summary>
/// Represents a reference to a property.
/// </summary>
internal
sealed
partial
class
LazyPropertyReferenceExpression
:
BasePropertyReferenceExpression
,
IPropertyReferenceExpression
,
IHasArguments
Expression
internal
sealed
partial
class
LazyPropertyReferenceExpression
:
BasePropertyReferenceExpression
,
IPropertyReferenceExpression
,
IHasArguments
{
private
readonly
Lazy
<
IOperation
>
_lazyInstance
;
private
readonly
Lazy
<
ImmutableArray
<
IArgument
>>
_lazyArgumentsInEvaluationOrder
;
...
...
src/Compilers/Core/Portable/Operations/IHasArgumentsExpression.cs
浏览文件 @
700099b8
...
...
@@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Semantics
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public
interface
IHasArguments
Expression
:
IOperation
public
interface
IHasArguments
:
IOperation
{
/// <summary>
/// Arguments of the invocation, excluding the instance argument. Arguments are in evaluation order.
...
...
src/Compilers/Core/Portable/Operations/IInvocationExpression.cs
浏览文件 @
700099b8
...
...
@@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.Semantics
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public
interface
IInvocationExpression
:
IHasArguments
Expression
public
interface
IInvocationExpression
:
IHasArguments
{
/// <summary>
/// Method to be invoked.
...
...
src/Compilers/Core/Portable/Operations/IObjectCreationExpression.cs
浏览文件 @
700099b8
...
...
@@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Semantics
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public
interface
IObjectCreationExpression
:
IHasArguments
Expression
public
interface
IObjectCreationExpression
:
IHasArguments
{
/// <summary>
/// Constructor to be invoked on the created instance.
...
...
src/Compilers/Core/Portable/Operations/IPropertyReferenceExpression.cs
浏览文件 @
700099b8
...
...
@@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Semantics
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public
interface
IPropertyReferenceExpression
:
IMemberReferenceExpression
,
IHasArguments
Expression
public
interface
IPropertyReferenceExpression
:
IMemberReferenceExpression
,
IHasArguments
{
/// <summary>
/// Referenced property.
...
...
src/Compilers/Core/Portable/Operations/IRaiseEventExpression.cs
浏览文件 @
700099b8
...
...
@@ -3,13 +3,13 @@
namespace
Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a raise event
expression
.
/// Represents a raise event
statement
.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public
interface
IRaiseEvent
Expression
:
IHasArgumentsExpression
public
interface
IRaiseEvent
Statement
:
IHasArguments
{
/// <summary>
/// Reference to the event to be raised.
...
...
src/Compilers/Core/Portable/Operations/OperationCloner.cs
浏览文件 @
700099b8
...
...
@@ -481,9 +481,9 @@ public override IOperation VisitTranslatedQueryExpression(ITranslatedQueryExpres
return
new
TranslatedQueryExpression
(
Visit
(
operation
.
Expression
),
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
);
}
public
override
IOperation
VisitRaiseEvent
Expression
(
IRaiseEventExpression
operation
,
object
argument
)
public
override
IOperation
VisitRaiseEvent
Statement
(
IRaiseEventStatement
operation
,
object
argument
)
{
return
new
RaiseEvent
Expression
(
Visit
(
operation
.
EventReference
),
VisitArray
(
operation
.
ArgumentsInEvaluationOrder
),
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
);
return
new
RaiseEvent
Statement
(
Visit
(
operation
.
EventReference
),
VisitArray
(
operation
.
ArgumentsInEvaluationOrder
),
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
);
}
}
}
src/Compilers/Core/Portable/Operations/OperationKind.cs
浏览文件 @
700099b8
...
...
@@ -64,6 +64,8 @@ public enum OperationKind
// https://github.com/dotnet/roslyn/issues/22005
// /// <summary>Indicates an <see cref="IWithStatement"/>.</summary>
// WithStatement = 0x52,
/// <summary>Indicates an <see cref="IRaiseEventStatement"/>.</summary>
RaiseEventStatement
=
0x53
,
// Expressions
...
...
@@ -176,8 +178,8 @@ public enum OperationKind
/// <summary>Indicates an <see cref="IOmittedArgumentExpression"/>.</summary>
OmittedArgumentExpression
=
0x300
,
/// <summary>Indicates an <see cref="IRaiseEventExpression"/>.</summary>
RaiseEventExpression
=
0x301
,
// Unused 0x301
// https://github.com/dotnet/roslyn/issues/21294
// /// <summary>Indicates an <see cref="IPlaceholderExpression"/>.</summary>
...
...
src/Compilers/Core/Portable/Operations/OperationVisitor.cs
浏览文件 @
700099b8
...
...
@@ -485,7 +485,7 @@ public virtual void VisitTranslatedQueryExpression(ITranslatedQueryExpression op
DefaultVisit
(
operation
);
}
public
virtual
void
VisitRaiseEvent
Expression
(
IRaiseEventExpression
operation
)
public
virtual
void
VisitRaiseEvent
Statement
(
IRaiseEventStatement
operation
)
{
DefaultVisit
(
operation
);
}
...
...
@@ -980,7 +980,7 @@ public virtual TResult VisitTranslatedQueryExpression(ITranslatedQueryExpression
return
DefaultVisit
(
operation
,
argument
);
}
public
virtual
TResult
VisitRaiseEvent
Expression
(
IRaiseEventExpression
operation
,
TArgument
argument
)
public
virtual
TResult
VisitRaiseEvent
Statement
(
IRaiseEventStatement
operation
,
TArgument
argument
)
{
return
DefaultVisit
(
operation
,
argument
);
}
...
...
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
浏览文件 @
700099b8
...
...
@@ -116,7 +116,7 @@ Microsoft.CodeAnalysis.OperationKind.ParameterReferenceExpression = 262 -> Micro
Microsoft.CodeAnalysis.OperationKind.ParenthesizedExpression = 282 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.PropertyInitializer = 1027 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.PropertyReferenceExpression = 266 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.RaiseEvent
Expression = 769
-> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.RaiseEvent
Statement = 83
-> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.ReturnStatement = 11 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.SimpleAssignmentExpression = 280 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.SizeOfExpression = 514 -> Microsoft.CodeAnalysis.OperationKind
...
...
@@ -321,8 +321,8 @@ Microsoft.CodeAnalysis.Semantics.IForToLoopStatement.LimitValue.get -> Microsoft
Microsoft.CodeAnalysis.Semantics.IForToLoopStatement.LoopControlVariable.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IForToLoopStatement.NextVariables.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.IOperation>
Microsoft.CodeAnalysis.Semantics.IForToLoopStatement.StepValue.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IHasArguments
Expression
Microsoft.CodeAnalysis.Semantics.IHasArguments
Expression
.ArgumentsInEvaluationOrder.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Semantics.IArgument>
Microsoft.CodeAnalysis.Semantics.IHasArguments
Microsoft.CodeAnalysis.Semantics.IHasArguments.ArgumentsInEvaluationOrder.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Semantics.IArgument>
Microsoft.CodeAnalysis.Semantics.IHasOperatorMethodExpression
Microsoft.CodeAnalysis.Semantics.IHasOperatorMethodExpression.OperatorMethod.get -> Microsoft.CodeAnalysis.IMethodSymbol
Microsoft.CodeAnalysis.Semantics.IHasOperatorMethodExpression.UsesOperatorMethod.get -> bool
...
...
@@ -407,8 +407,8 @@ Microsoft.CodeAnalysis.Semantics.IPropertyInitializer
Microsoft.CodeAnalysis.Semantics.IPropertyInitializer.InitializedProperty.get -> Microsoft.CodeAnalysis.IPropertySymbol
Microsoft.CodeAnalysis.Semantics.IPropertyReferenceExpression
Microsoft.CodeAnalysis.Semantics.IPropertyReferenceExpression.Property.get -> Microsoft.CodeAnalysis.IPropertySymbol
Microsoft.CodeAnalysis.Semantics.IRaiseEvent
Expression
Microsoft.CodeAnalysis.Semantics.IRaiseEvent
Expression
.EventReference.get -> Microsoft.CodeAnalysis.Semantics.IEventReferenceExpression
Microsoft.CodeAnalysis.Semantics.IRaiseEvent
Statement
Microsoft.CodeAnalysis.Semantics.IRaiseEvent
Statement
.EventReference.get -> Microsoft.CodeAnalysis.Semantics.IEventReferenceExpression
Microsoft.CodeAnalysis.Semantics.IRangeCaseClause
Microsoft.CodeAnalysis.Semantics.IRangeCaseClause.MaximumValue.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IRangeCaseClause.MinimumValue.get -> Microsoft.CodeAnalysis.IOperation
...
...
@@ -585,7 +585,7 @@ virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitParenthesizedExpr
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitPatternCaseClause(Microsoft.CodeAnalysis.Semantics.IPatternCaseClause operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitPropertyInitializer(Microsoft.CodeAnalysis.Semantics.IPropertyInitializer operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitPropertyReferenceExpression(Microsoft.CodeAnalysis.Semantics.IPropertyReferenceExpression operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitRaiseEvent
Expression(Microsoft.CodeAnalysis.Semantics.IRaiseEventExpression
operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitRaiseEvent
Statement(Microsoft.CodeAnalysis.Semantics.IRaiseEventStatement
operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitRangeCaseClause(Microsoft.CodeAnalysis.Semantics.IRangeCaseClause operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitRelationalCaseClause(Microsoft.CodeAnalysis.Semantics.IRelationalCaseClause operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitReturnStatement(Microsoft.CodeAnalysis.Semantics.IReturnStatement operation) -> void
...
...
@@ -675,7 +675,7 @@ virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.Vi
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitPatternCaseClause(Microsoft.CodeAnalysis.Semantics.IPatternCaseClause operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitPropertyInitializer(Microsoft.CodeAnalysis.Semantics.IPropertyInitializer operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitPropertyReferenceExpression(Microsoft.CodeAnalysis.Semantics.IPropertyReferenceExpression operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitRaiseEvent
Expression(Microsoft.CodeAnalysis.Semantics.IRaiseEventExpression
operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitRaiseEvent
Statement(Microsoft.CodeAnalysis.Semantics.IRaiseEventStatement
operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitRangeCaseClause(Microsoft.CodeAnalysis.Semantics.IRangeCaseClause operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitRelationalCaseClause(Microsoft.CodeAnalysis.Semantics.IRelationalCaseClause operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitReturnStatement(Microsoft.CodeAnalysis.Semantics.IReturnStatement operation, TArgument argument) -> TResult
...
...
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
浏览文件 @
700099b8
...
...
@@ -1317,13 +1317,57 @@ Namespace Microsoft.CodeAnalysis.Semantics
Return
New
LazyExpressionStatement
(
expression
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
End
Function
Private
Function
CreateBoundRaiseEventStatementOperation
(
boundRaiseEventStatement
As
BoundRaiseEventStatement
)
As
IExpressionStatement
Dim
expression
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
GetRaiseEventExpression
(
boundRaiseEventStatement
))
Private
Function
CreateBoundRaiseEventStatementOperation
(
boundRaiseEventStatement
As
BoundRaiseEventStatement
)
As
IOperation
Dim
syntax
As
SyntaxNode
=
boundRaiseEventStatement
.
Syntax
Dim
type
As
ITypeSymbol
=
Nothing
Dim
constantValue
As
[
Optional
]
(
Of
Object
)
=
New
[
Optional
]
(
Of
Object
)()
Dim
isImplicit
As
Boolean
=
boundRaiseEventStatement
.
WasCompilerGenerated
Return
New
LazyExpressionStatement
(
expression
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
Dim
eventInvocation
=
TryCast
(
boundRaiseEventStatement
.
EventInvocation
,
BoundCall
)
' Return an invalid statement for invalid raise event statement
If
eventInvocation
Is
Nothing
OrElse
eventInvocation
.
ReceiverOpt
Is
Nothing
Debug
.
Assert
(
boundRaiseEventStatement
.
HasErrors
)
Dim
children
As
Lazy
(
Of
ImmutableArray
(
Of
IOperation
))
=
New
Lazy
(
Of
ImmutableArray
(
Of
IOperation
))(
Function
()
ImmutableArray
.
Create
(
Of
IOperation
)(
Create
(
boundRaiseEventStatement
.
EventInvocation
)))
return
New
LazyInvalidStatement
(
children
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
End
If
Dim
receiver
=
eventInvocation
.
ReceiverOpt
Dim
eventSymbol
=
boundRaiseEventStatement
.
EventSymbol
Dim
eventReferenceSyntax
=
receiver
.
Syntax
Dim
eventReferenceType
As
ITypeSymbol
=
eventSymbol
.
Type
Dim
eventReferenceConstantValue
As
[
Optional
]
(
Of
Object
)
=
ConvertToOptional
(
receiver
.
ConstantValueOpt
)
dim
eventReferenceIsImplicit
as
Boolean
=
eventInvocation
.
WasCompilerGenerated
Dim
boundInstance
As
BoundNode
If
receiver
.
Kind
=
BoundKind
.
FieldAccess
Dim
eventFieldAccess
=
CType
(
eventInvocation
.
ReceiverOpt
,
BoundFieldAccess
)
Debug
.
Assert
(
eventFieldAccess
.
FieldSymbol
.
AssociatedSymbol
=
eventSymbol
)
boundInstance
=
eventFieldAccess
.
ReceiverOpt
Else
boundInstance
=
receiver
End
If
Dim
eventReferenceInstance
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
If
(
eventSymbol
.
IsShared
,
Nothing
,
Create
(
boundInstance
)))
Dim
EventReference
As
Lazy
(
Of
IEventReferenceExpression
)
=
New
Lazy
(
Of
IEventReferenceExpression
)(
Function
()
As
IEventReferenceExpression
Return
New
LazyEventReferenceExpression
(
eventSymbol
,
eventReferenceInstance
,
eventSymbol
,
_semanticModel
,
eventReferenceSyntax
,
eventReferenceType
,
eventReferenceConstantValue
,
eventReferenceIsImplicit
)
End
Function
)
Dim
argumentsInEvaluationOrder
As
Lazy
(
Of
ImmutableArray
(
Of
IArgument
))
=
New
Lazy
(
Of
ImmutableArray
(
Of
IArgument
))(
Function
()
Return
DeriveArguments
(
eventInvocation
.
Arguments
,
eventInvocation
.
Method
.
Parameters
)
End
Function
)
Return
New
LazyRaiseEventStatement
(
eventReference
,
argumentsInEvaluationOrder
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
End
Function
Private
Function
CreateBoundAddHandlerStatementOperation
(
boundAddHandlerStatement
As
BoundAddHandlerStatement
)
As
IExpressionStatement
...
...
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb
浏览文件 @
700099b8
...
...
@@ -269,50 +269,6 @@ Namespace Microsoft.CodeAnalysis.Semantics
eventReference
,
Create
(
statement
.
Handler
),
adds
:
=
adds
,
semanticModel
:
=
_semanticModel
,
syntax
:
=
statement
.
Syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
,
isImplicit
:
=
statement
.
WasCompilerGenerated
)
End
Function
Private
Function
GetRaiseEventExpression
(
raiseEventStatement
As
BoundRaiseEventStatement
)
As
IOperation
Dim
eventInvocation
=
TryCast
(
raiseEventStatement
.
EventInvocation
,
BoundCall
)
Dim
eventSymbol
=
raiseEventStatement
.
EventSymbol
' Return an operation for invalid raise event expression
If
eventInvocation
Is
Nothing
OrElse
eventInvocation
.
ReceiverOpt
Is
Nothing
Debug
.
Assert
(
raiseEventStatement
.
HasErrors
)
Return
Create
(
raiseEventStatement
.
EventInvocation
)
End
If
Dim
receiver
=
eventInvocation
.
ReceiverOpt
Dim
syntax
=
receiver
.
Syntax
Dim
constantValue
As
[
Optional
]
(
Of
Object
)
=
ConvertToOptional
(
receiver
.
ConstantValueOpt
)
Dim
boundInstance
As
BoundNode
If
receiver
.
Kind
=
BoundKind
.
FieldAccess
Dim
eventFieldAccess
=
CType
(
eventInvocation
.
ReceiverOpt
,
BoundFieldAccess
)
Debug
.
Assert
(
eventFieldAccess
.
FieldSymbol
.
AssociatedSymbol
=
eventSymbol
)
boundInstance
=
eventFieldAccess
.
ReceiverOpt
Else
boundInstance
=
receiver
End
If
Dim
instance
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
If
(
eventSymbol
.
IsShared
,
Nothing
,
Create
(
boundInstance
)))
Dim
EventReference
As
Lazy
(
Of
IEventReferenceExpression
)
=
New
Lazy
(
Of
IEventReferenceExpression
)(
Function
()
As
IEventReferenceExpression
Return
New
LazyEventReferenceExpression
(
eventSymbol
,
instance
,
eventSymbol
,
_semanticModel
,
syntax
,
eventSymbol
.
Type
,
constantValue
,
eventInvocation
.
WasCompilerGenerated
)
End
Function
)
Dim
argumentsInEvaluationOrder
As
Lazy
(
Of
ImmutableArray
(
Of
IArgument
))
=
New
Lazy
(
Of
ImmutableArray
(
Of
IArgument
))(
Function
()
Return
DeriveArguments
(
eventInvocation
.
Arguments
,
eventInvocation
.
Method
.
Parameters
)
End
Function
)
Return
New
LazyRaiseEventExpression
(
eventReference
,
argumentsInEvaluationOrder
,
_semanticModel
,
syntax
:
=
eventInvocation
.
Syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
,
isImplicit
:
=
eventInvocation
.
WasCompilerGenerated
)
End
Function
Friend
Class
Helper
Friend
Shared
Function
DeriveUnaryOperatorKind
(
operatorKind
As
VisualBasic
.
UnaryOperatorKind
)
As
UnaryOperatorKind
Select
Case
operatorKind
And
VisualBasic
.
UnaryOperatorKind
.
OpMask
...
...
src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IRaiseEventExpression.vb
浏览文件 @
700099b8
...
...
@@ -24,11 +24,45 @@ Class TestClass
End
Class
]]
>
.
Value
Dim
expectedOperationTree
=
<
!
[
CDATA
[
IExpressionStatement
(
OperationKind
.
ExpressionStatement
)
(
Syntax
:
'RaiseEvent TestEvent()')
Expression
:
IRaiseEventExpression
(
OperationKind
.
RaiseEventExpression
,
Type
:
null
)
(
Syntax
:
'RaiseEvent TestEvent()')
Event
Reference
:
IEventReferenceExpression
:
Event
TestClass
.
TestEvent
As
System
.
Action
(
OperationKind
.
EventReferenceExpression
,
Type
:
System
.
Action
)
(
Syntax
:
'TestEvent')
Instance
Receiver
:
IInstanceReferenceExpression
(
OperationKind
.
InstanceReferenceExpression
,
Type
:
TestClass
)
(
Syntax
:
'TestEvent')
Arguments
(
0
)
IRaiseEventStatement
(
OperationKind
.
RaiseEventStatement
)
(
Syntax
:
'RaiseEvent TestEvent()')
Event
Reference
:
IEventReferenceExpression
:
Event
TestClass
.
TestEvent
As
System
.
Action
(
OperationKind
.
EventReferenceExpression
,
Type
:
System
.
Action
)
(
Syntax
:
'TestEvent')
Instance
Receiver
:
IInstanceReferenceExpression
(
OperationKind
.
InstanceReferenceExpression
,
Type
:
TestClass
)
(
Syntax
:
'TestEvent')
Arguments
(
0
)
]]
>
.
Value
Dim
expectedDiagnostics
=
String
.
Empty
VerifyOperationTreeAndDiagnosticsForTest
(
Of
RaiseEventStatementSyntax
)(
source
,
expectedOperationTree
,
expectedDiagnostics
)
End
Sub
<
CompilerTrait
(
CompilerFeature
.
IOperation
)
>
<
Fact
>
Public
Sub
RaiseInstanceEventWithArguments
()
Dim
source
=
<
!
[
CDATA
[
Imports
System
Class
TestClass
Public
Event
MyEvent
(
x
As
String
,
y
As
Integer
)
Sub
M
()
RaiseEvent
MyEvent
(
y
:
=
1
,
x
:
=
String
.
Empty
)
'BIND:"RaiseEvent MyEvent(y:=1, x:=String.Empty)"
End
Sub
End
Class
]]
>
.
Value
Dim
expectedOperationTree
=
<
!
[
CDATA
[
IRaiseEventStatement
(
OperationKind
.
RaiseEventStatement
)
(
Syntax
:
'RaiseEvent ... ring.Empty)')
Event
Reference
:
IEventReferenceExpression
:
Event
TestClass
.
MyEvent
(
x
As
System
.
String
,
y
As
System
.
Int32
)
(
OperationKind
.
EventReferenceExpression
,
Type
:
TestClass
.
MyEventEventHandler
)
(
Syntax
:
'MyEvent')
Instance
Receiver
:
IInstanceReferenceExpression
(
OperationKind
.
InstanceReferenceExpression
,
Type
:
TestClass
)
(
Syntax
:
'MyEvent')
Arguments
(
2
):
IArgument
(
ArgumentKind
.
Explicit
,
Matching
Parameter
:
x
)
(
OperationKind
.
Argument
)
(
Syntax
:
'x:=String.Empty')
IFieldReferenceExpression
:
System
.
String
.
Empty
As
System
.
String
(
Static
)
(
OperationKind
.
FieldReferenceExpression
,
Type
:
System
.
String
)
(
Syntax
:
'String.Empty')
Instance
Receiver
:
null
InConversion
:
CommonConversion
(
Exists
:
True
,
IsIdentity
:
True
,
IsNumeric
:
False
,
IsReference
:
False
,
IsUserDefined
:
False
)
(
MethodSymbol
:
null
)
OutConversion
:
CommonConversion
(
Exists
:
True
,
IsIdentity
:
True
,
IsNumeric
:
False
,
IsReference
:
False
,
IsUserDefined
:
False
)
(
MethodSymbol
:
null
)
IArgument
(
ArgumentKind
.
Explicit
,
Matching
Parameter
:
y
)
(
OperationKind
.
Argument
)
(
Syntax
:
'y:=1')
ILiteralExpression
(
OperationKind
.
LiteralExpression
,
Type
:
System
.
Int32
,
Constant
:
1
)
(
Syntax
:
'1')
InConversion
:
CommonConversion
(
Exists
:
True
,
IsIdentity
:
True
,
IsNumeric
:
False
,
IsReference
:
False
,
IsUserDefined
:
False
)
(
MethodSymbol
:
null
)
OutConversion
:
CommonConversion
(
Exists
:
True
,
IsIdentity
:
True
,
IsNumeric
:
False
,
IsReference
:
False
,
IsUserDefined
:
False
)
(
MethodSymbol
:
null
)
]]
>
.
Value
Dim
expectedDiagnostics
=
String
.
Empty
...
...
@@ -51,11 +85,10 @@ Class TestClass
End
Class
]]
>
.
Value
Dim
expectedOperationTree
=
<
!
[
CDATA
[
IExpressionStatement
(
OperationKind
.
ExpressionStatement
)
(
Syntax
:
'RaiseEvent TestEvent()')
Expression
:
IRaiseEventExpression
(
OperationKind
.
RaiseEventExpression
,
Type
:
null
)
(
Syntax
:
'RaiseEvent TestEvent()')
Event
Reference
:
IEventReferenceExpression
:
Event
TestClass
.
TestEvent
As
System
.
Action
(
Static
)
(
OperationKind
.
EventReferenceExpression
,
Type
:
System
.
Action
)
(
Syntax
:
'TestEvent')
Instance
Receiver
:
null
Arguments
(
0
)
IRaiseEventStatement
(
OperationKind
.
RaiseEventStatement
)
(
Syntax
:
'RaiseEvent TestEvent()')
Event
Reference
:
IEventReferenceExpression
:
Event
TestClass
.
TestEvent
As
System
.
Action
(
Static
)
(
OperationKind
.
EventReferenceExpression
,
Type
:
System
.
Action
)
(
Syntax
:
'TestEvent')
Instance
Receiver
:
null
Arguments
(
0
)
]]
>
.
Value
Dim
expectedDiagnostics
=
String
.
Empty
...
...
@@ -78,11 +111,15 @@ Class TestClass
End
Class
]]
>
.
Value
Dim
expectedOperationTree
=
<
!
[
CDATA
[
IExpressionStatement
(
OperationKind
.
ExpressionStatement
,
IsInvalid
)
(
Syntax
:
'RaiseEvent TestEvent(1)')
Expression
:
IInvalidExpression
(
OperationKind
.
InvalidExpression
,
Type
:
System
.
Void
,
IsInvalid
)
(
Syntax
:
'RaiseEvent TestEvent(1)')
Children
(
2
):
IOperation
:
(
OperationKind
.
None
,
IsInvalid
)
(
Syntax
:
'RaiseEvent TestEvent(1)')
ILiteralExpression
(
OperationKind
.
LiteralExpression
,
Type
:
System
.
Int32
,
Constant
:
1
,
IsInvalid
)
(
Syntax
:
'1')
IInvalidStatement
(
OperationKind
.
InvalidStatement
,
IsInvalid
)
(
Syntax
:
'RaiseEvent TestEvent(1)')
Children
(
1
):
IInvalidExpression
(
OperationKind
.
InvalidExpression
,
Type
:
System
.
Void
,
IsInvalid
)
(
Syntax
:
'RaiseEvent TestEvent(1)')
Children
(
2
):
IOperation
:
(
OperationKind
.
None
,
IsInvalid
)
(
Syntax
:
'RaiseEvent TestEvent(1)')
Children
(
1
):
IFieldReferenceExpression
:
TestClass
.
TestEventEvent
As
System
.
Action
(
OperationKind
.
FieldReferenceExpression
,
Type
:
System
.
Action
)
(
Syntax
:
'TestEvent')
Instance
Receiver
:
IInstanceReferenceExpression
(
OperationKind
.
InstanceReferenceExpression
,
Type
:
TestClass
)
(
Syntax
:
'TestEvent')
ILiteralExpression
(
OperationKind
.
LiteralExpression
,
Type
:
System
.
Int32
,
Constant
:
1
,
IsInvalid
)
(
Syntax
:
'1')
]]
>
.
Value
Dim
expectedDiagnostics
=
<
!
[
CDATA
[
...
...
@@ -199,11 +236,56 @@ Class TestClass
End
Class
]]
>
.
Value
Dim
expectedOperationTree
=
<
!
[
CDATA
[
IExpressionStatement
(
OperationKind
.
ExpressionStatement
)
(
Syntax
:
'RaiseEvent TestEvent()')
Expression
:
IRaiseEventExpression
(
OperationKind
.
RaiseEventExpression
,
Type
:
null
)
(
Syntax
:
'RaiseEvent TestEvent()')
Event
Reference
:
IEventReferenceExpression
:
Event
TestClass
.
TestEvent
As
System
.
Action
(
OperationKind
.
EventReferenceExpression
,
Type
:
System
.
Action
)
(
Syntax
:
'TestEvent')
Instance
Receiver
:
IInstanceReferenceExpression
(
OperationKind
.
InstanceReferenceExpression
,
Type
:
TestClass
)
(
Syntax
:
'TestEvent')
Arguments
(
0
)
IRaiseEventStatement
(
OperationKind
.
RaiseEventStatement
)
(
Syntax
:
'RaiseEvent TestEvent()')
Event
Reference
:
IEventReferenceExpression
:
Event
TestClass
.
TestEvent
As
System
.
Action
(
OperationKind
.
EventReferenceExpression
,
Type
:
System
.
Action
)
(
Syntax
:
'TestEvent')
Instance
Receiver
:
IInstanceReferenceExpression
(
OperationKind
.
InstanceReferenceExpression
,
Type
:
TestClass
)
(
Syntax
:
'TestEvent')
Arguments
(
0
)
]]
>
.
Value
Dim
expectedDiagnostics
=
String
.
Empty
VerifyOperationTreeAndDiagnosticsForTest
(
Of
RaiseEventStatementSyntax
)(
source
,
expectedOperationTree
,
expectedDiagnostics
)
End
Sub
<
CompilerTrait
(
CompilerFeature
.
IOperation
)
>
<
Fact
>
Public
Sub
RaiseCustomEventWithArguments
()
Dim
source
=
<
!
[
CDATA
[
Imports
System
Class
TestClass
Public
Custom
Event
TestEvent
As
Eventhandler
AddHandler
(
value
As
Eventhandler
)
End
AddHandler
RemoveHandler
(
value
As
Eventhandler
)
End
RemoveHandler
RaiseEvent
(
sender
As
Object
,
e
As
EventArgs
)
End
RaiseEvent
End
Event
Sub
M
()
RaiseEvent
TestEvent
(
Nothing
,
Nothing
)
'BIND:"RaiseEvent TestEvent(Nothing, Nothing)"
End
Sub
End
Class
]]
>
.
Value
Dim
expectedOperationTree
=
<
!
[
CDATA
[
IRaiseEventStatement
(
OperationKind
.
RaiseEventStatement
)
(
Syntax
:
'RaiseEvent ... g, Nothing)')
Event
Reference
:
IEventReferenceExpression
:
Event
TestClass
.
TestEvent
As
System
.
EventHandler
(
OperationKind
.
EventReferenceExpression
,
Type
:
System
.
EventHandler
)
(
Syntax
:
'TestEvent')
Instance
Receiver
:
IInstanceReferenceExpression
(
OperationKind
.
InstanceReferenceExpression
,
Type
:
TestClass
)
(
Syntax
:
'TestEvent')
Arguments
(
2
):
IArgument
(
ArgumentKind
.
Explicit
,
Matching
Parameter
:
sender
)
(
OperationKind
.
Argument
)
(
Syntax
:
'Nothing')
IConversionExpression
(
Implicit
,
TryCast
:
False
,
Unchecked
)
(
OperationKind
.
ConversionExpression
,
Type
:
System
.
Object
,
Constant
:
null
)
(
Syntax
:
'Nothing')
Conversion
:
CommonConversion
(
Exists
:
True
,
IsIdentity
:
False
,
IsNumeric
:
False
,
IsReference
:
False
,
IsUserDefined
:
False
)
(
MethodSymbol
:
null
)
Operand
:
ILiteralExpression
(
OperationKind
.
LiteralExpression
,
Type
:
null
,
Constant
:
null
)
(
Syntax
:
'Nothing')
InConversion
:
CommonConversion
(
Exists
:
True
,
IsIdentity
:
True
,
IsNumeric
:
False
,
IsReference
:
False
,
IsUserDefined
:
False
)
(
MethodSymbol
:
null
)
OutConversion
:
CommonConversion
(
Exists
:
True
,
IsIdentity
:
True
,
IsNumeric
:
False
,
IsReference
:
False
,
IsUserDefined
:
False
)
(
MethodSymbol
:
null
)
IArgument
(
ArgumentKind
.
Explicit
,
Matching
Parameter
:
e
)
(
OperationKind
.
Argument
)
(
Syntax
:
'Nothing')
IConversionExpression
(
Implicit
,
TryCast
:
False
,
Unchecked
)
(
OperationKind
.
ConversionExpression
,
Type
:
System
.
EventArgs
,
Constant
:
null
)
(
Syntax
:
'Nothing')
Conversion
:
CommonConversion
(
Exists
:
True
,
IsIdentity
:
False
,
IsNumeric
:
False
,
IsReference
:
False
,
IsUserDefined
:
False
)
(
MethodSymbol
:
null
)
Operand
:
ILiteralExpression
(
OperationKind
.
LiteralExpression
,
Type
:
null
,
Constant
:
null
)
(
Syntax
:
'Nothing')
InConversion
:
CommonConversion
(
Exists
:
True
,
IsIdentity
:
True
,
IsNumeric
:
False
,
IsReference
:
False
,
IsUserDefined
:
False
)
(
MethodSymbol
:
null
)
OutConversion
:
CommonConversion
(
Exists
:
True
,
IsIdentity
:
True
,
IsNumeric
:
False
,
IsReference
:
False
,
IsUserDefined
:
False
)
(
MethodSymbol
:
null
)
]]
>
.
Value
Dim
expectedDiagnostics
=
String
.
Empty
...
...
src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs
浏览文件 @
700099b8
...
...
@@ -644,7 +644,7 @@ public override void VisitInvocationExpression(IInvocationExpression operation)
VisitArguments
(
operation
);
}
private
void
VisitArguments
(
IHasArguments
Expression
operation
)
private
void
VisitArguments
(
IHasArguments
operation
)
{
VisitArray
(
operation
.
ArgumentsInEvaluationOrder
,
"Arguments"
,
logElementCount
:
true
);
}
...
...
@@ -1441,9 +1441,9 @@ public override void VisitTranslatedQueryExpression(ITranslatedQueryExpression o
Visit
(
operation
.
Expression
,
"Expression"
);
}
public
override
void
VisitRaiseEvent
Expression
(
IRaiseEventExpression
operation
)
public
override
void
VisitRaiseEvent
Statement
(
IRaiseEventStatement
operation
)
{
LogString
(
nameof
(
IRaiseEvent
Expression
));
LogString
(
nameof
(
IRaiseEvent
Statement
));
LogCommonPropertiesAndNewLine
(
operation
);
Visit
(
operation
.
EventReference
,
header
:
"Event Reference"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录