Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
7dada160
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,发现更多精彩内容 >>
提交
7dada160
编写于
6月 26, 2017
作者:
H
Heejae Chang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
addressed AssignmentExpression design
上级
a8591634
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
93 addition
and
97 deletion
+93
-97
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
...lers/CSharp/Portable/Operations/CSharpOperationFactory.cs
+2
-2
src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs
...pilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs
+3
-3
src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs
...ilers/Core/Portable/Generated/Operations.xml.Generated.cs
+43
-47
src/Compilers/Core/Portable/Operations/IAssignmentExpression.cs
...mpilers/Core/Portable/Operations/IAssignmentExpression.cs
+2
-2
src/Compilers/Core/Portable/Operations/ICompoundAssignmentExpression.cs
...Core/Portable/Operations/ICompoundAssignmentExpression.cs
+1
-1
src/Compilers/Core/Portable/Operations/OperationFactory.cs
src/Compilers/Core/Portable/Operations/OperationFactory.cs
+2
-2
src/Compilers/Core/Portable/Operations/OperationKind.cs
src/Compilers/Core/Portable/Operations/OperationKind.cs
+2
-2
src/Compilers/Core/Portable/Operations/OperationVisitor.cs
src/Compilers/Core/Portable/Operations/OperationVisitor.cs
+2
-2
src/Compilers/Core/Portable/Operations/OperationWalker.cs
src/Compilers/Core/Portable/Operations/OperationWalker.cs
+1
-1
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
+1
-1
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb
...ortable/Operations/VisualBasicOperationFactory_Methods.vb
+4
-4
src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb
...s/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb
+6
-6
src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs
...t/Utilities/Portable/Compilation/OperationTreeVerifier.cs
+2
-2
src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs
...est/Utilities/Portable/Compilation/TestOperationWalker.cs
+2
-2
src/Test/Utilities/Portable/Diagnostics/CouldHaveMoreSpecificTypeAnalyzer.cs
...Portable/Diagnostics/CouldHaveMoreSpecificTypeAnalyzer.cs
+2
-2
src/Test/Utilities/Portable/Diagnostics/FieldCouldBeReadOnlyAnalyzer.cs
...ties/Portable/Diagnostics/FieldCouldBeReadOnlyAnalyzer.cs
+2
-2
src/Test/Utilities/Portable/Diagnostics/LocalCouldBeConstAnalyzer.cs
...ilities/Portable/Diagnostics/LocalCouldBeConstAnalyzer.cs
+2
-2
src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs
...t/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs
+7
-7
未找到文件。
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
浏览文件 @
7dada160
...
...
@@ -536,7 +536,7 @@ private IInstanceReferenceExpression CreateBoundThisReferenceOperation(BoundThis
return
new
InstanceReferenceExpression
(
instanceReferenceKind
,
isInvalid
,
syntax
,
type
,
constantValue
);
}
private
IAssignmentExpression
CreateBoundAssignmentOperatorOperation
(
BoundAssignmentOperator
boundAssignmentOperator
)
private
I
Simple
AssignmentExpression
CreateBoundAssignmentOperatorOperation
(
BoundAssignmentOperator
boundAssignmentOperator
)
{
Lazy
<
IOperation
>
target
=
new
Lazy
<
IOperation
>(()
=>
Create
(
boundAssignmentOperator
.
Left
));
Lazy
<
IOperation
>
value
=
new
Lazy
<
IOperation
>(()
=>
Create
(
boundAssignmentOperator
.
Right
));
...
...
@@ -544,7 +544,7 @@ private IAssignmentExpression CreateBoundAssignmentOperatorOperation(BoundAssign
SyntaxNode
syntax
=
boundAssignmentOperator
.
Syntax
;
ITypeSymbol
type
=
boundAssignmentOperator
.
Type
;
Optional
<
object
>
constantValue
=
ConvertToOptional
(
boundAssignmentOperator
.
ConstantValue
);
return
new
LazyAssignmentExpression
(
target
,
value
,
isInvalid
,
syntax
,
type
,
constantValue
);
return
new
Lazy
Simple
AssignmentExpression
(
target
,
value
,
isInvalid
,
syntax
,
type
,
constantValue
);
}
private
ICompoundAssignmentExpression
CreateBoundCompoundAssignmentOperatorOperation
(
BoundCompoundAssignmentOperator
boundCompoundAssignmentOperator
)
...
...
src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs
浏览文件 @
7dada160
...
...
@@ -85,19 +85,19 @@ public void Deconstruct(out int a, out int b, out int c)
IOperation
operation1
=
model
.
GetOperation
(
assignments
[
0
]);
Assert
.
NotNull
(
operation1
);
Assert
.
Equal
(
OperationKind
.
None
,
operation1
.
Kind
);
Assert
.
False
(
operation1
is
IAssignmentExpression
);
Assert
.
False
(
operation1
is
I
Simple
AssignmentExpression
);
Assert
.
Equal
(
"(x, y, z) = new C()"
,
assignments
[
1
].
ToString
());
IOperation
operation2
=
model
.
GetOperation
(
assignments
[
1
]);
Assert
.
NotNull
(
operation2
);
Assert
.
Equal
(
OperationKind
.
None
,
operation2
.
Kind
);
Assert
.
False
(
operation2
is
IAssignmentExpression
);
Assert
.
False
(
operation2
is
I
Simple
AssignmentExpression
);
Assert
.
Equal
(
"var (a, b) = (1, 2)"
,
assignments
[
2
].
ToString
());
IOperation
operation3
=
model
.
GetOperation
(
assignments
[
2
]);
Assert
.
NotNull
(
operation3
);
Assert
.
Equal
(
OperationKind
.
None
,
operation3
.
Kind
);
Assert
.
False
(
operation3
is
IAssignmentExpression
);
Assert
.
False
(
operation3
is
I
Simple
AssignmentExpression
);
}
}
}
\ No newline at end of file
src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs
浏览文件 @
7dada160
...
...
@@ -364,11 +364,11 @@ public LazyArrayInitializer(Lazy<ImmutableArray<IOperation>> elementValues, bool
}
/// <summary>
/// Represents an assignment expression.
/// Represents an
base type of
assignment expression.
/// </summary>
internal
abstract
partial
class
BaseAssignmentExpression
:
Operation
,
IBase
AssignmentExpression
internal
abstract
partial
class
AssignmentExpression
:
Operation
,
I
AssignmentExpression
{
protected
Base
AssignmentExpression
(
OperationKind
kind
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
protected
AssignmentExpression
(
OperationKind
kind
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
kind
,
isInvalid
,
syntax
,
type
,
constantValue
)
{
}
...
...
@@ -385,10 +385,29 @@ internal abstract partial class BaseAssignmentExpression : Operation, IBaseAssig
/// <summary>
/// Represents an assignment expression.
/// </summary>
internal
sealed
partial
class
AssignmentExpression
:
BaseAssignmentExpression
,
I
AssignmentExpression
internal
abstract
partial
class
BaseSimpleAssignmentExpression
:
AssignmentExpression
,
ISimple
AssignmentExpression
{
public
AssignmentExpression
(
IOperation
target
,
IOperation
value
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
OperationKind
.
AssignmentExpression
,
isInvalid
,
syntax
,
type
,
constantValue
)
public
BaseSimpleAssignmentExpression
(
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
OperationKind
.
SimpleAssignmentExpression
,
isInvalid
,
syntax
,
type
,
constantValue
)
{
}
public
override
void
Accept
(
OperationVisitor
visitor
)
{
visitor
.
VisitSimpleAssignmentExpression
(
this
);
}
public
override
TResult
Accept
<
TArgument
,
TResult
>(
OperationVisitor
<
TArgument
,
TResult
>
visitor
,
TArgument
argument
)
{
return
visitor
.
VisitAssignmentExpression
(
this
,
argument
);
}
}
/// <summary>
/// Represents an assignment expression.
/// </summary>
internal
sealed
partial
class
SimpleAssignmentExpression
:
BaseSimpleAssignmentExpression
,
ISimpleAssignmentExpression
{
public
SimpleAssignmentExpression
(
IOperation
target
,
IOperation
value
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
isInvalid
,
syntax
,
type
,
constantValue
)
{
Target
=
target
;
Value
=
value
;
...
...
@@ -401,25 +420,18 @@ internal sealed partial class AssignmentExpression : BaseAssignmentExpression, I
/// Value to be assigned to the target of the assignment.
/// </summary>
public
override
IOperation
Value
{
get
;
}
public
override
void
Accept
(
OperationVisitor
visitor
)
{
visitor
.
VisitAssignmentExpression
(
this
);
}
public
override
TResult
Accept
<
TArgument
,
TResult
>(
OperationVisitor
<
TArgument
,
TResult
>
visitor
,
TArgument
argument
)
{
return
visitor
.
VisitAssignmentExpression
(
this
,
argument
);
}
}
/// <summary>
/// Represents an assignment expression.
/// </summary>
internal
sealed
partial
class
Lazy
AssignmentExpression
:
BaseAssignmentExpression
,
I
AssignmentExpression
internal
sealed
partial
class
Lazy
SimpleAssignmentExpression
:
BaseSimpleAssignmentExpression
,
ISimple
AssignmentExpression
{
private
readonly
Lazy
<
IOperation
>
_lazyTarget
;
private
readonly
Lazy
<
IOperation
>
_lazyValue
;
public
LazyAssignmentExpression
(
Lazy
<
IOperation
>
target
,
Lazy
<
IOperation
>
value
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
OperationKind
.
AssignmentExpression
,
isInvalid
,
syntax
,
type
,
constantValue
)
public
LazySimpleAssignmentExpression
(
Lazy
<
IOperation
>
target
,
Lazy
<
IOperation
>
value
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
isInvalid
,
syntax
,
type
,
constantValue
)
{
_lazyTarget
=
target
??
throw
new
System
.
ArgumentNullException
(
"target"
);
_lazyValue
=
value
??
throw
new
System
.
ArgumentNullException
(
"value"
);
...
...
@@ -433,15 +445,6 @@ public LazyAssignmentExpression(Lazy<IOperation> target, Lazy<IOperation> value,
/// Value to be assigned to the target of the assignment.
/// </summary>
public
override
IOperation
Value
=>
_lazyValue
.
Value
;
public
override
void
Accept
(
OperationVisitor
visitor
)
{
visitor
.
VisitAssignmentExpression
(
this
);
}
public
override
TResult
Accept
<
TArgument
,
TResult
>(
OperationVisitor
<
TArgument
,
TResult
>
visitor
,
TArgument
argument
)
{
return
visitor
.
VisitAssignmentExpression
(
this
,
argument
);
}
}
/// <summary>
...
...
@@ -778,10 +781,10 @@ public LazyCatchClause(Lazy<IBlockStatement> handler, ITypeSymbol caughtType, La
/// <summary>
/// Represents an assignment expression that includes a binary operation.
/// </summary>
internal
abstract
partial
class
BaseCompoundAssignmentExpression
:
Base
AssignmentExpression
,
IHasOperatorMethodExpression
,
ICompoundAssignmentExpression
internal
abstract
partial
class
BaseCompoundAssignmentExpression
:
AssignmentExpression
,
IHasOperatorMethodExpression
,
ICompoundAssignmentExpression
{
protected
BaseCompoundAssignmentExpression
(
BinaryOperationKind
binaryOperationKind
,
bool
usesOperatorMethod
,
IMethodSymbol
operatorMethod
,
OperationKind
kind
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
kind
,
isInvalid
,
syntax
,
type
,
constantValue
)
protected
BaseCompoundAssignmentExpression
(
BinaryOperationKind
binaryOperationKind
,
bool
usesOperatorMethod
,
IMethodSymbol
operatorMethod
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
OperationKind
.
CompoundAssignmentExpression
,
isInvalid
,
syntax
,
type
,
constantValue
)
{
BinaryOperationKind
=
binaryOperationKind
;
UsesOperatorMethod
=
usesOperatorMethod
;
...
...
@@ -799,6 +802,15 @@ internal abstract partial class BaseCompoundAssignmentExpression : BaseAssignmen
/// Operation method used by the operation, null if the operation does not use an operator method.
/// </summary>
public
IMethodSymbol
OperatorMethod
{
get
;
}
public
override
void
Accept
(
OperationVisitor
visitor
)
{
visitor
.
VisitCompoundAssignmentExpression
(
this
);
}
public
override
TResult
Accept
<
TArgument
,
TResult
>(
OperationVisitor
<
TArgument
,
TResult
>
visitor
,
TArgument
argument
)
{
return
visitor
.
VisitCompoundAssignmentExpression
(
this
,
argument
);
}
}
/// <summary>
...
...
@@ -807,7 +819,7 @@ internal abstract partial class BaseCompoundAssignmentExpression : BaseAssignmen
internal
sealed
partial
class
CompoundAssignmentExpression
:
BaseCompoundAssignmentExpression
,
IHasOperatorMethodExpression
,
ICompoundAssignmentExpression
{
public
CompoundAssignmentExpression
(
BinaryOperationKind
binaryOperationKind
,
IOperation
target
,
IOperation
value
,
bool
usesOperatorMethod
,
IMethodSymbol
operatorMethod
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
binaryOperationKind
,
usesOperatorMethod
,
operatorMethod
,
OperationKind
.
CompoundAssignmentExpression
,
isInvalid
,
syntax
,
type
,
constantValue
)
base
(
binaryOperationKind
,
usesOperatorMethod
,
operatorMethod
,
isInvalid
,
syntax
,
type
,
constantValue
)
{
Target
=
target
;
Value
=
value
;
...
...
@@ -820,14 +832,6 @@ internal sealed partial class CompoundAssignmentExpression : BaseCompoundAssignm
/// Value to be assigned to the target of the assignment.
/// </summary>
public
override
IOperation
Value
{
get
;
}
public
override
void
Accept
(
OperationVisitor
visitor
)
{
visitor
.
VisitCompoundAssignmentExpression
(
this
);
}
public
override
TResult
Accept
<
TArgument
,
TResult
>(
OperationVisitor
<
TArgument
,
TResult
>
visitor
,
TArgument
argument
)
{
return
visitor
.
VisitCompoundAssignmentExpression
(
this
,
argument
);
}
}
/// <summary>
...
...
@@ -838,7 +842,8 @@ internal sealed partial class LazyCompoundAssignmentExpression : BaseCompoundAss
private
readonly
Lazy
<
IOperation
>
_lazyTarget
;
private
readonly
Lazy
<
IOperation
>
_lazyValue
;
public
LazyCompoundAssignmentExpression
(
BinaryOperationKind
binaryOperationKind
,
Lazy
<
IOperation
>
target
,
Lazy
<
IOperation
>
value
,
bool
usesOperatorMethod
,
IMethodSymbol
operatorMethod
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
binaryOperationKind
,
usesOperatorMethod
,
operatorMethod
,
OperationKind
.
CompoundAssignmentExpression
,
isInvalid
,
syntax
,
type
,
constantValue
)
public
LazyCompoundAssignmentExpression
(
BinaryOperationKind
binaryOperationKind
,
Lazy
<
IOperation
>
target
,
Lazy
<
IOperation
>
value
,
bool
usesOperatorMethod
,
IMethodSymbol
operatorMethod
,
bool
isInvalid
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
binaryOperationKind
,
usesOperatorMethod
,
operatorMethod
,
isInvalid
,
syntax
,
type
,
constantValue
)
{
_lazyTarget
=
target
??
throw
new
System
.
ArgumentNullException
(
"target"
);
_lazyValue
=
value
??
throw
new
System
.
ArgumentNullException
(
"value"
);
...
...
@@ -852,15 +857,6 @@ public LazyCompoundAssignmentExpression(BinaryOperationKind binaryOperationKind,
/// Value to be assigned to the target of the assignment.
/// </summary>
public
override
IOperation
Value
=>
_lazyValue
.
Value
;
public
override
void
Accept
(
OperationVisitor
visitor
)
{
visitor
.
VisitCompoundAssignmentExpression
(
this
);
}
public
override
TResult
Accept
<
TArgument
,
TResult
>(
OperationVisitor
<
TArgument
,
TResult
>
visitor
,
TArgument
argument
)
{
return
visitor
.
VisitCompoundAssignmentExpression
(
this
,
argument
);
}
}
/// <summary>
...
...
src/Compilers/Core/Portable/Operations/IAssignmentExpression.cs
浏览文件 @
7dada160
...
...
@@ -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
I
Base
AssignmentExpression
:
IOperation
public
interface
IAssignmentExpression
:
IOperation
{
/// <summary>
/// Target of the assignment.
...
...
@@ -30,7 +30,7 @@ public interface IBaseAssignmentExpression : IOperation
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public
interface
I
AssignmentExpression
:
IBase
AssignmentExpression
public
interface
I
SimpleAssignmentExpression
:
I
AssignmentExpression
{
}
}
...
...
src/Compilers/Core/Portable/Operations/ICompoundAssignmentExpression.cs
浏览文件 @
7dada160
...
...
@@ -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
ICompoundAssignmentExpression
:
I
Base
AssignmentExpression
,
IHasOperatorMethodExpression
public
interface
ICompoundAssignmentExpression
:
IAssignmentExpression
,
IHasOperatorMethodExpression
{
/// <summary>
/// Kind of binary operation.
...
...
src/Compilers/Core/Portable/Operations/OperationFactory.cs
浏览文件 @
7dada160
...
...
@@ -37,10 +37,10 @@ public static IConditionalChoiceExpression CreateConditionalChoiceExpression(IOp
default
(
Optional
<
object
>));
}
public
static
IExpressionStatement
CreateAssignmentExpressionStatement
(
IOperation
target
,
IOperation
value
,
SyntaxNode
syntax
)
public
static
IExpressionStatement
Create
Simple
AssignmentExpressionStatement
(
IOperation
target
,
IOperation
value
,
SyntaxNode
syntax
)
{
var
isInvalid
=
target
==
null
||
target
.
IsInvalid
||
value
==
null
||
value
.
IsInvalid
;
var
expression
=
new
AssignmentExpression
(
target
,
value
,
isInvalid
,
syntax
,
target
.
Type
,
default
(
Optional
<
object
>));
var
expression
=
new
Simple
AssignmentExpression
(
target
,
value
,
isInvalid
,
syntax
,
target
.
Type
,
default
(
Optional
<
object
>));
return
new
ExpressionStatement
(
expression
,
expression
.
IsInvalid
,
syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>));
}
...
...
src/Compilers/Core/Portable/Operations/OperationKind.cs
浏览文件 @
7dada160
...
...
@@ -114,8 +114,8 @@ public enum OperationKind
IsTypeExpression
=
0x116
,
/// <summary>Indicates an <see cref="IAwaitExpression"/>.</summary>
AwaitExpression
=
0x117
,
/// <summary>Indicates an <see cref="IAssignmentExpression"/>.</summary>
AssignmentExpression
=
0x118
,
/// <summary>Indicates an <see cref="I
Simple
AssignmentExpression"/>.</summary>
Simple
AssignmentExpression
=
0x118
,
/// <summary>Indicates an <see cref="ICompoundAssignmentExpression"/>.</summary>
CompoundAssignmentExpression
=
0x119
,
/// <summary>Indicates an <see cref="IParenthesizedExpression"/>.</summary>
...
...
src/Compilers/Core/Portable/Operations/OperationVisitor.cs
浏览文件 @
7dada160
...
...
@@ -340,7 +340,7 @@ public virtual void VisitArrayInitializer(IArrayInitializer operation)
DefaultVisit
(
operation
);
}
public
virtual
void
Visit
AssignmentExpression
(
I
AssignmentExpression
operation
)
public
virtual
void
Visit
SimpleAssignmentExpression
(
ISimple
AssignmentExpression
operation
)
{
DefaultVisit
(
operation
);
}
...
...
@@ -770,7 +770,7 @@ public virtual TResult VisitArrayInitializer(IArrayInitializer operation, TArgum
return
DefaultVisit
(
operation
,
argument
);
}
public
virtual
TResult
VisitAssignmentExpression
(
IAssignmentExpression
operation
,
TArgument
argument
)
public
virtual
TResult
VisitAssignmentExpression
(
I
Simple
AssignmentExpression
operation
,
TArgument
argument
)
{
return
DefaultVisit
(
operation
,
argument
);
}
...
...
src/Compilers/Core/Portable/Operations/OperationWalker.cs
浏览文件 @
7dada160
...
...
@@ -379,7 +379,7 @@ public override void VisitArrayInitializer(IArrayInitializer operation)
VisitArray
(
operation
.
ElementValues
);
}
public
override
void
Visit
AssignmentExpression
(
I
AssignmentExpression
operation
)
public
override
void
Visit
SimpleAssignmentExpression
(
ISimple
AssignmentExpression
operation
)
{
Visit
(
operation
.
Target
);
Visit
(
operation
.
Value
);
...
...
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
浏览文件 @
7dada160
...
...
@@ -59,7 +59,6 @@ Microsoft.CodeAnalysis.OperationKind.Argument = 1031 -> Microsoft.CodeAnalysis.O
Microsoft.CodeAnalysis.OperationKind.ArrayCreationExpression = 276 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.ArrayElementReferenceExpression = 260 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.ArrayInitializer = 1029 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.AssignmentExpression = 280 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.AwaitExpression = 279 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.BinaryOperatorExpression = 270 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.BlockStatement = 2 -> Microsoft.CodeAnalysis.OperationKind
...
...
@@ -119,6 +118,7 @@ Microsoft.CodeAnalysis.OperationKind.PropertyReferenceExpression = 266 -> Micros
Microsoft.CodeAnalysis.OperationKind.RangeCaseClause = 1036 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.RelationalCaseClause = 1035 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.ReturnStatement = 11 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.SimpleAssignmentExpression = 280 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.SingleValueCaseClause = 1034 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.SizeOfExpression = 514 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.StopStatement = 80 -> Microsoft.CodeAnalysis.OperationKind
...
...
@@ -351,11 +351,10 @@ Microsoft.CodeAnalysis.Semantics.IArrayElementReferenceExpression.Indices.get ->
Microsoft.CodeAnalysis.Semantics.IArrayInitializer
Microsoft.CodeAnalysis.Semantics.IArrayInitializer.ElementValues.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.IOperation>
Microsoft.CodeAnalysis.Semantics.IAssignmentExpression
Microsoft.CodeAnalysis.Semantics.IAssignmentExpression.Target.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IAssignmentExpression.Value.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IAwaitExpression
Microsoft.CodeAnalysis.Semantics.IAwaitExpression.AwaitedValue.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IBaseAssignmentExpression
Microsoft.CodeAnalysis.Semantics.IBaseAssignmentExpression.Target.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IBaseAssignmentExpression.Value.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IBasePropertyReferenceExpression
Microsoft.CodeAnalysis.Semantics.IBasePropertyReferenceExpression.Property.get -> Microsoft.CodeAnalysis.IPropertySymbol
Microsoft.CodeAnalysis.Semantics.IBinaryOperatorExpression
...
...
@@ -519,6 +518,7 @@ Microsoft.CodeAnalysis.Semantics.IRelationalCaseClause.Relation.get -> Microsoft
Microsoft.CodeAnalysis.Semantics.IRelationalCaseClause.Value.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IReturnStatement
Microsoft.CodeAnalysis.Semantics.IReturnStatement.ReturnedValue.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.ISimpleAssignmentExpression
Microsoft.CodeAnalysis.Semantics.ISingleValueCaseClause
Microsoft.CodeAnalysis.Semantics.ISingleValueCaseClause.Equality.get -> Microsoft.CodeAnalysis.Semantics.BinaryOperationKind
Microsoft.CodeAnalysis.Semantics.ISingleValueCaseClause.Value.get -> Microsoft.CodeAnalysis.IOperation
...
...
@@ -709,7 +709,6 @@ override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitArgument(Microsof
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitArrayCreationExpression(Microsoft.CodeAnalysis.Semantics.IArrayCreationExpression operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitArrayElementReferenceExpression(Microsoft.CodeAnalysis.Semantics.IArrayElementReferenceExpression operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitArrayInitializer(Microsoft.CodeAnalysis.Semantics.IArrayInitializer operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitAssignmentExpression(Microsoft.CodeAnalysis.Semantics.IAssignmentExpression operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitAwaitExpression(Microsoft.CodeAnalysis.Semantics.IAwaitExpression operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitBinaryOperatorExpression(Microsoft.CodeAnalysis.Semantics.IBinaryOperatorExpression operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitBlockStatement(Microsoft.CodeAnalysis.Semantics.IBlockStatement operation) -> void
...
...
@@ -767,6 +766,7 @@ override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitPropertyReference
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitRangeCaseClause(Microsoft.CodeAnalysis.Semantics.IRangeCaseClause operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitRelationalCaseClause(Microsoft.CodeAnalysis.Semantics.IRelationalCaseClause operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitReturnStatement(Microsoft.CodeAnalysis.Semantics.IReturnStatement operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitSimpleAssignmentExpression(Microsoft.CodeAnalysis.Semantics.ISimpleAssignmentExpression operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitSingleValueCaseClause(Microsoft.CodeAnalysis.Semantics.ISingleValueCaseClause operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitSizeOfExpression(Microsoft.CodeAnalysis.Semantics.ISizeOfExpression operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.VisitStopStatement(Microsoft.CodeAnalysis.Semantics.IStopStatement operation) -> void
...
...
@@ -814,7 +814,6 @@ virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitArgument(Microsof
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitArrayCreationExpression(Microsoft.CodeAnalysis.Semantics.IArrayCreationExpression operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitArrayElementReferenceExpression(Microsoft.CodeAnalysis.Semantics.IArrayElementReferenceExpression operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitArrayInitializer(Microsoft.CodeAnalysis.Semantics.IArrayInitializer operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitAssignmentExpression(Microsoft.CodeAnalysis.Semantics.IAssignmentExpression operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitAwaitExpression(Microsoft.CodeAnalysis.Semantics.IAwaitExpression operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitBinaryOperatorExpression(Microsoft.CodeAnalysis.Semantics.IBinaryOperatorExpression operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitBlockStatement(Microsoft.CodeAnalysis.Semantics.IBlockStatement operation) -> void
...
...
@@ -872,6 +871,7 @@ virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitPropertyReference
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
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitSimpleAssignmentExpression(Microsoft.CodeAnalysis.Semantics.ISimpleAssignmentExpression operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitSingleValueCaseClause(Microsoft.CodeAnalysis.Semantics.ISingleValueCaseClause operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitSizeOfExpression(Microsoft.CodeAnalysis.Semantics.ISizeOfExpression operation) -> void
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitStopStatement(Microsoft.CodeAnalysis.Semantics.IStopStatement operation) -> void
...
...
@@ -896,7 +896,7 @@ virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.Vi
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitArrayCreationExpression(Microsoft.CodeAnalysis.Semantics.IArrayCreationExpression operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitArrayElementReferenceExpression(Microsoft.CodeAnalysis.Semantics.IArrayElementReferenceExpression operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitArrayInitializer(Microsoft.CodeAnalysis.Semantics.IArrayInitializer operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitAssignmentExpression(Microsoft.CodeAnalysis.Semantics.IAssignmentExpression operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitAssignmentExpression(Microsoft.CodeAnalysis.Semantics.I
Simple
AssignmentExpression operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitAwaitExpression(Microsoft.CodeAnalysis.Semantics.IAwaitExpression operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitBinaryOperatorExpression(Microsoft.CodeAnalysis.Semantics.IBinaryOperatorExpression operation, TArgument argument) -> TResult
virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult>.VisitBlockStatement(Microsoft.CodeAnalysis.Semantics.IBlockStatement operation, TArgument argument) -> TResult
...
...
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
浏览文件 @
7dada160
...
...
@@ -207,7 +207,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim
syntax
As
SyntaxNode
=
boundAssignmentOperator
.
Syntax
Dim
type
As
ITypeSymbol
=
boundAssignmentOperator
.
Type
Dim
constantValue
As
[
Optional
]
(
Of
Object
)
=
ConvertToOptional
(
boundAssignmentOperator
.
ConstantValueOpt
)
Return
New
LazyAssignmentExpression
(
target
,
value
,
isInvalid
,
syntax
,
type
,
constantValue
)
Return
New
Lazy
Simple
AssignmentExpression
(
target
,
value
,
isInvalid
,
syntax
,
type
,
constantValue
)
End
If
End
Function
...
...
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb
浏览文件 @
7dada160
...
...
@@ -31,7 +31,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
End
Select
End
If
Return
OperationKind
.
AssignmentExpression
Return
OperationKind
.
Simple
AssignmentExpression
End
Function
Private
Function
GetUserDefinedBinaryOperatorChild
(
[
operator
]
As
BoundUserDefinedBinaryOperator
,
index
As
Integer
)
As
IOperation
...
...
@@ -242,14 +242,14 @@ Namespace Microsoft.CodeAnalysis.Semantics
' ControlVariable = InitialValue
Dim
controlReference
As
IOperation
=
Create
(
boundFor
.
ControlVariable
)
If
controlReference
IsNot
Nothing
Then
statements
.
Add
(
OperationFactory
.
CreateAssignmentExpressionStatement
(
controlReference
,
Create
(
boundFor
.
InitialValue
),
boundFor
.
InitialValue
.
Syntax
))
statements
.
Add
(
OperationFactory
.
Create
Simple
AssignmentExpressionStatement
(
controlReference
,
Create
(
boundFor
.
InitialValue
),
boundFor
.
InitialValue
.
Syntax
))
End
If
' T0 = LimitValue
If
Not
boundFor
.
LimitValue
.
IsConstant
Then
Dim
value
=
Create
(
boundFor
.
LimitValue
)
statements
.
Add
(
OperationFactory
.
CreateAssignmentExpressionStatement
(
OperationFactory
.
Create
Simple
AssignmentExpressionStatement
(
New
SyntheticLocalReferenceExpression
(
SyntheticLocalKind
.
ForLoopLimitValue
,
Create
(
boundFor
),
...
...
@@ -263,7 +263,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
If
boundFor
.
StepValue
IsNot
Nothing
AndAlso
Not
boundFor
.
StepValue
.
IsConstant
Then
Dim
value
=
Create
(
boundFor
.
StepValue
)
statements
.
Add
(
OperationFactory
.
CreateAssignmentExpressionStatement
(
OperationFactory
.
Create
Simple
AssignmentExpressionStatement
(
New
SyntheticLocalReferenceExpression
(
SyntheticLocalKind
.
ForLoopStepValue
,
Create
(
boundFor
),
...
...
src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb
浏览文件 @
7dada160
...
...
@@ -56,8 +56,8 @@ End Module
Dim
statement1
As
IOperation
=
model
.
GetOperation
(
nodes
(
0
))
Assert
.
Equal
(
statement1
.
Kind
,
OperationKind
.
ExpressionStatement
)
Dim
expression1
As
IOperation
=
DirectCast
(
statement1
,
IExpressionStatement
).
Expression
Assert
.
Equal
(
expression1
.
Kind
,
OperationKind
.
AssignmentExpression
)
Dim
assignment1
As
I
AssignmentExpression
=
DirectCast
(
expression1
,
I
AssignmentExpression
)
Assert
.
Equal
(
expression1
.
Kind
,
OperationKind
.
Simple
AssignmentExpression
)
Dim
assignment1
As
I
SimpleAssignmentExpression
=
DirectCast
(
expression1
,
ISimple
AssignmentExpression
)
Assert
.
Equal
(
assignment1
.
Value
.
Kind
,
OperationKind
.
BinaryOperatorExpression
)
Dim
add1
As
IBinaryOperatorExpression
=
DirectCast
(
assignment1
.
Value
,
IBinaryOperatorExpression
)
Assert
.
Equal
(
add1
.
BinaryOperationKind
,
BinaryOperationKind
.
OperatorMethodAdd
)
...
...
@@ -86,8 +86,8 @@ IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid) (Syntax: 'x
Dim
statement2
As
IOperation
=
model
.
GetOperation
(
nodes
(
1
))
Assert
.
Equal
(
statement2
.
Kind
,
OperationKind
.
ExpressionStatement
)
Dim
expression2
As
IOperation
=
DirectCast
(
statement2
,
IExpressionStatement
).
Expression
Assert
.
Equal
(
expression2
.
Kind
,
OperationKind
.
AssignmentExpression
)
Dim
assignment2
As
I
AssignmentExpression
=
DirectCast
(
expression2
,
I
AssignmentExpression
)
Assert
.
Equal
(
expression2
.
Kind
,
OperationKind
.
Simple
AssignmentExpression
)
Dim
assignment2
As
I
SimpleAssignmentExpression
=
DirectCast
(
expression2
,
ISimple
AssignmentExpression
)
Assert
.
Equal
(
assignment2
.
Value
.
Kind
,
OperationKind
.
BinaryOperatorExpression
)
Dim
add2
As
IBinaryOperatorExpression
=
DirectCast
(
assignment2
.
Value
,
IBinaryOperatorExpression
)
Assert
.
Equal
(
add2
.
BinaryOperationKind
,
BinaryOperationKind
.
OperatorMethodAdd
)
...
...
@@ -116,8 +116,8 @@ IExpressionStatement (OperationKind.ExpressionStatement) (Syntax: 'x = x + y')
Dim
statement3
As
IOperation
=
model
.
GetOperation
(
nodes
(
2
))
Assert
.
Equal
(
statement3
.
Kind
,
OperationKind
.
ExpressionStatement
)
Dim
expression3
As
IOperation
=
DirectCast
(
statement3
,
IExpressionStatement
).
Expression
Assert
.
Equal
(
expression3
.
Kind
,
OperationKind
.
AssignmentExpression
)
Dim
assignment3
As
I
AssignmentExpression
=
DirectCast
(
expression3
,
I
AssignmentExpression
)
Assert
.
Equal
(
expression3
.
Kind
,
OperationKind
.
Simple
AssignmentExpression
)
Dim
assignment3
As
I
SimpleAssignmentExpression
=
DirectCast
(
expression3
,
ISimple
AssignmentExpression
)
Assert
.
Equal
(
assignment3
.
Value
.
Kind
,
OperationKind
.
UnaryOperatorExpression
)
Dim
negate3
As
IUnaryOperatorExpression
=
DirectCast
(
assignment3
.
Value
,
IUnaryOperatorExpression
)
Assert
.
Equal
(
negate3
.
UnaryOperationKind
,
UnaryOperationKind
.
OperatorMethodMinus
)
...
...
src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs
浏览文件 @
7dada160
...
...
@@ -955,9 +955,9 @@ public override void VisitArrayInitializer(IArrayInitializer operation)
VisitArray
(
operation
.
ElementValues
,
"Element Values"
,
logElementCount
:
true
);
}
public
override
void
Visit
AssignmentExpression
(
I
AssignmentExpression
operation
)
public
override
void
Visit
SimpleAssignmentExpression
(
ISimple
AssignmentExpression
operation
)
{
LogString
(
nameof
(
IAssignmentExpression
));
LogString
(
nameof
(
I
Simple
AssignmentExpression
));
LogCommonPropertiesAndNewLine
(
operation
);
Visit
(
operation
.
Target
,
"Left"
);
...
...
src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs
浏览文件 @
7dada160
...
...
@@ -459,9 +459,9 @@ public override void VisitArrayInitializer(IArrayInitializer operation)
base
.
VisitArrayInitializer
(
operation
);
}
public
override
void
Visit
AssignmentExpression
(
I
AssignmentExpression
operation
)
public
override
void
Visit
SimpleAssignmentExpression
(
ISimple
AssignmentExpression
operation
)
{
base
.
VisitAssignmentExpression
(
operation
);
base
.
Visit
Simple
AssignmentExpression
(
operation
);
}
public
override
void
VisitCompoundAssignmentExpression
(
ICompoundAssignmentExpression
operation
)
...
...
src/Test/Utilities/Portable/Diagnostics/CouldHaveMoreSpecificTypeAnalyzer.cs
浏览文件 @
7dada160
...
...
@@ -55,10 +55,10 @@ public sealed override void Initialize(AnalysisContext context)
operationBlockContext
.
RegisterOperationAction
(
(
operationContext
)
=>
{
I
BaseAssignmentExpression
assignment
=
(
IBase
AssignmentExpression
)
operationContext
.
Operation
;
I
AssignmentExpression
assignment
=
(
I
AssignmentExpression
)
operationContext
.
Operation
;
AssignTo
(
assignment
.
Target
,
localsSourceTypes
,
fieldsSourceTypes
,
assignment
.
Value
);
},
OperationKind
.
AssignmentExpression
,
OperationKind
.
Simple
AssignmentExpression
,
OperationKind
.
CompoundAssignmentExpression
,
OperationKind
.
IncrementExpression
);
...
...
src/Test/Utilities/Portable/Diagnostics/FieldCouldBeReadOnlyAnalyzer.cs
浏览文件 @
7dada160
...
...
@@ -48,10 +48,10 @@ public sealed override void Initialize(AnalysisContext context)
operationBlockContext
.
RegisterOperationAction
(
(
operationContext
)
=>
{
I
BaseAssignmentExpression
assignment
=
(
IBase
AssignmentExpression
)
operationContext
.
Operation
;
I
AssignmentExpression
assignment
=
(
I
AssignmentExpression
)
operationContext
.
Operation
;
AssignTo
(
assignment
.
Target
,
inConstructor
,
staticConstructorType
,
assignedToFields
,
mightBecomeReadOnlyFields
);
},
OperationKind
.
AssignmentExpression
,
OperationKind
.
Simple
AssignmentExpression
,
OperationKind
.
CompoundAssignmentExpression
,
OperationKind
.
IncrementExpression
);
...
...
src/Test/Utilities/Portable/Diagnostics/LocalCouldBeConstAnalyzer.cs
浏览文件 @
7dada160
...
...
@@ -42,10 +42,10 @@ public sealed override void Initialize(AnalysisContext context)
operationBlockContext
.
RegisterOperationAction
(
(
operationContext
)
=>
{
I
BaseAssignmentExpression
assignment
=
(
IBase
AssignmentExpression
)
operationContext
.
Operation
;
I
AssignmentExpression
assignment
=
(
I
AssignmentExpression
)
operationContext
.
Operation
;
AssignTo
(
assignment
.
Target
,
assignedToLocals
,
mightBecomeConstLocals
);
},
OperationKind
.
AssignmentExpression
,
OperationKind
.
Simple
AssignmentExpression
,
OperationKind
.
CompoundAssignmentExpression
,
OperationKind
.
IncrementExpression
);
...
...
src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs
浏览文件 @
7dada160
...
...
@@ -161,9 +161,9 @@ public sealed override void Initialize(AnalysisContext context)
if
(
forLoop
.
Before
.
Length
==
1
)
{
IOperation
setup
=
forLoop
.
Before
[
0
];
if
(
setup
.
Kind
==
OperationKind
.
ExpressionStatement
&&
((
IExpressionStatement
)
setup
).
Expression
.
Kind
==
OperationKind
.
AssignmentExpression
)
if
(
setup
.
Kind
==
OperationKind
.
ExpressionStatement
&&
((
IExpressionStatement
)
setup
).
Expression
.
Kind
==
OperationKind
.
Simple
AssignmentExpression
)
{
I
AssignmentExpression
setupAssignment
=
(
I
AssignmentExpression
)((
IExpressionStatement
)
setup
).
Expression
;
I
SimpleAssignmentExpression
setupAssignment
=
(
ISimple
AssignmentExpression
)((
IExpressionStatement
)
setup
).
Expression
;
if
(
setupAssignment
.
Target
.
Kind
==
OperationKind
.
LocalReferenceExpression
&&
((
ILocalReferenceExpression
)
setupAssignment
.
Target
).
Local
==
testVariable
&&
setupAssignment
.
Value
.
ConstantValue
.
HasValue
&&
...
...
@@ -182,9 +182,9 @@ public sealed override void Initialize(AnalysisContext context)
IOperation
advanceIncrement
=
null
;
BinaryOperationKind
advanceOperationCode
=
BinaryOperationKind
.
None
;
if
(
advanceExpression
.
Kind
==
OperationKind
.
AssignmentExpression
)
if
(
advanceExpression
.
Kind
==
OperationKind
.
Simple
AssignmentExpression
)
{
I
AssignmentExpression
advanceAssignment
=
(
I
AssignmentExpression
)
advanceExpression
;
I
SimpleAssignmentExpression
advanceAssignment
=
(
ISimple
AssignmentExpression
)
advanceExpression
;
if
(
advanceAssignment
.
Target
.
Kind
==
OperationKind
.
LocalReferenceExpression
&&
((
ILocalReferenceExpression
)
advanceAssignment
.
Target
).
Local
==
testVariable
&&
...
...
@@ -752,7 +752,7 @@ public sealed override void Initialize(AnalysisContext context)
context
.
RegisterOperationAction
(
(
operationContext
)
=>
{
var
assignment
=
(
IAssignmentExpression
)
operationContext
.
Operation
;
var
assignment
=
(
I
Simple
AssignmentExpression
)
operationContext
.
Operation
;
var
kind
=
assignment
.
Target
.
Kind
;
if
(
kind
==
OperationKind
.
FieldReferenceExpression
||
kind
==
OperationKind
.
PropertyReferenceExpression
)
...
...
@@ -760,7 +760,7 @@ public sealed override void Initialize(AnalysisContext context)
Report
(
operationContext
,
assignment
.
Syntax
,
DoNotUseMemberAssignmentDescriptor
);
}
},
OperationKind
.
AssignmentExpression
);
OperationKind
.
Simple
AssignmentExpression
);
}
private
static
void
Report
(
OperationAnalysisContext
context
,
SyntaxNode
syntax
,
DiagnosticDescriptor
descriptor
)
...
...
@@ -2068,7 +2068,7 @@ public sealed override void Initialize(AnalysisContext context)
{
operationContext
.
ReportDiagnostic
(
Diagnostic
.
Create
(
AssignmentOperationDescriptor
,
operationContext
.
Operation
.
Syntax
.
GetLocation
()));
},
OperationKind
.
AssignmentExpression
);
OperationKind
.
Simple
AssignmentExpression
);
context
.
RegisterSyntaxNodeAction
(
(
syntaxContext
)
=>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录