Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
9c42f02e
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,发现更多精彩内容 >>
提交
9c42f02e
编写于
2月 01, 2016
作者:
G
Gen Lu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Address code review comments
上级
eeb689ef
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
35 addition
and
27 deletion
+35
-27
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
+1
-0
src/Compilers/CSharp/Portable/BoundTree/Statement.cs
src/Compilers/CSharp/Portable/BoundTree/Statement.cs
+1
-0
src/Compilers/Core/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs
...ore/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs
+4
-6
src/Compilers/Core/Portable/Compilation/IOperationWalker.cs
src/Compilers/Core/Portable/Compilation/IOperationWalker.cs
+27
-20
src/Compilers/VisualBasic/Portable/BoundTree/Statement.vb
src/Compilers/VisualBasic/Portable/BoundTree/Statement.vb
+1
-0
src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb
...Basic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb
+1
-1
未找到文件。
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
浏览文件 @
9c42f02e
...
...
@@ -494,6 +494,7 @@ IExpression IMemberReferenceExpression.Instance
protected
override
OperationKind
ExpressionKind
=>
OperationKind
.
MethodBindingExpression
;
// SyntaxNode for MethodBindingExpression is the argument of DelegateCreationExpression
SyntaxNode
IOperation
.
Syntax
=>
this
.
Argument
.
Syntax
;
public
override
void
Accept
(
OperationVisitor
visitor
)
...
...
src/Compilers/CSharp/Portable/BoundTree/Statement.cs
浏览文件 @
9c42f02e
...
...
@@ -32,6 +32,7 @@ ImmutableArray<IStatement> IBlockStatement.Statements
{
get
{
// This is to filter out operations of kind None.
return
(
ImmutableArray
<
IStatement
>)
s_blockStatementsMappings
.
GetValue
(
this
,
blockStatement
=>
{
return
blockStatement
.
Statements
.
AsImmutable
<
IStatement
>().
WhereAsArray
(
statement
=>
statement
.
Kind
!=
OperationKind
.
None
);
}
);
...
...
src/Compilers/Core/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs
浏览文件 @
9c42f02e
...
...
@@ -1149,12 +1149,10 @@ public class LambdaTestAnalyzer : DiagnosticAnalyzer
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
true
);
public
sealed
override
ImmutableArray
<
DiagnosticDescriptor
>
SupportedDiagnostics
{
get
{
return
ImmutableArray
.
Create
(
LambdaExpressionDescriptor
,
TooManyStatementsInLambdaExpressionDescriptor
,
NoneOperationInLambdaExpressionDescriptor
);
}
}
public
sealed
override
ImmutableArray
<
DiagnosticDescriptor
>
SupportedDiagnostics
=>
ImmutableArray
.
Create
(
LambdaExpressionDescriptor
,
TooManyStatementsInLambdaExpressionDescriptor
,
NoneOperationInLambdaExpressionDescriptor
);
public
sealed
override
void
Initialize
(
AnalysisContext
context
)
{
...
...
src/Compilers/Core/Portable/Compilation/IOperationWalker.cs
浏览文件 @
9c42f02e
...
...
@@ -12,13 +12,13 @@ public abstract class OperationWalker : OperationVisitor
{
private
int
_recursionDepth
;
private
void
Visit
List
<
T
>(
ImmutableArray
<
T
>
list
)
where
T
:
IOperation
private
void
Visit
Array
<
T
>(
ImmutableArray
<
T
>
list
)
where
T
:
IOperation
{
if
(!
list
.
IsDefault
)
{
for
(
int
i
=
0
;
i
<
list
.
Length
;
i
++
)
for
each
(
var
operation
in
list
)
{
Visit
(
list
[
i
]
);
Visit
(
operation
);
}
}
}
...
...
@@ -28,20 +28,27 @@ public override void Visit(IOperation operation)
if
(
operation
!=
null
)
{
_recursionDepth
++;
StackGuard
.
EnsureSufficientExecutionStack
(
_recursionDepth
);
operation
.
Accept
(
this
);
_recursionDepth
--;
try
{
StackGuard
.
EnsureSufficientExecutionStack
(
_recursionDepth
);
operation
.
Accept
(
this
);
}
finally
{
_recursionDepth
--;
}
}
}
public
override
void
VisitBlockStatement
(
IBlockStatement
operation
)
{
Visit
List
(
operation
.
Statements
);
Visit
Array
(
operation
.
Statements
);
}
public
override
void
VisitVariableDeclarationStatement
(
IVariableDeclarationStatement
operation
)
{
Visit
List
(
operation
.
Variables
);
Visit
Array
(
operation
.
Variables
);
}
public
override
void
VisitVariable
(
IVariable
operation
)
...
...
@@ -52,13 +59,13 @@ public override void VisitVariable(IVariable operation)
public
override
void
VisitSwitchStatement
(
ISwitchStatement
operation
)
{
Visit
(
operation
.
Value
);
Visit
List
(
operation
.
Cases
);
Visit
Array
(
operation
.
Cases
);
}
public
override
void
VisitCase
(
ICase
operation
)
{
Visit
List
(
operation
.
Clauses
);
Visit
List
(
operation
.
Body
);
Visit
Array
(
operation
.
Clauses
);
Visit
Array
(
operation
.
Body
);
}
public
override
void
VisitSingleValueCaseClause
(
ISingleValueCaseClause
operation
)
...
...
@@ -100,10 +107,10 @@ public override void VisitWhileUntilLoopStatement(IWhileUntilLoopStatement opera
public
override
void
VisitForLoopStatement
(
IForLoopStatement
operation
)
{
Visit
List
(
operation
.
Before
);
Visit
Array
(
operation
.
Before
);
Visit
(
operation
.
Condition
);
Visit
(
operation
.
Body
);
Visit
List
(
operation
.
AtLoopBottom
);
Visit
Array
(
operation
.
AtLoopBottom
);
}
public
override
void
VisitForEachLoopStatement
(
IForEachLoopStatement
operation
)
...
...
@@ -148,7 +155,7 @@ public override void VisitLockStatement(ILockStatement operation)
public
override
void
VisitTryStatement
(
ITryStatement
operation
)
{
Visit
(
operation
.
Body
);
Visit
List
(
operation
.
Catches
);
Visit
Array
(
operation
.
Catches
);
Visit
(
operation
.
FinallyHandler
);
}
...
...
@@ -194,7 +201,7 @@ public override void VisitEndStatement(IStatement operation)
public
override
void
VisitInvocationExpression
(
IInvocationExpression
operation
)
{
Visit
(
operation
.
Instance
);
Visit
List
(
operation
.
ArgumentsInSourceOrder
);
Visit
Array
(
operation
.
ArgumentsInSourceOrder
);
}
public
override
void
VisitArgument
(
IArgument
operation
)
...
...
@@ -210,7 +217,7 @@ public override void VisitOmittedArgumentExpression(IExpression operation)
public
override
void
VisitArrayElementReferenceExpression
(
IArrayElementReferenceExpression
operation
)
{
Visit
(
operation
.
ArrayReference
);
Visit
List
(
operation
.
Indices
);
Visit
Array
(
operation
.
Indices
);
}
public
override
void
VisitPointerIndirectionReferenceExpression
(
IPointerIndirectionReferenceExpression
operation
)
...
...
@@ -318,8 +325,8 @@ public override void VisitAddressOfExpression(IAddressOfExpression operation)
public
override
void
VisitObjectCreationExpression
(
IObjectCreationExpression
operation
)
{
Visit
List
(
operation
.
ConstructorArguments
);
Visit
List
(
operation
.
MemberInitializers
);
Visit
Array
(
operation
.
ConstructorArguments
);
Visit
Array
(
operation
.
MemberInitializers
);
}
public
override
void
VisitFieldInitializer
(
IFieldInitializer
operation
)
...
...
@@ -339,13 +346,13 @@ public override void VisitParameterInitializer(IParameterInitializer operation)
public
override
void
VisitArrayCreationExpression
(
IArrayCreationExpression
operation
)
{
Visit
List
(
operation
.
DimensionSizes
);
Visit
Array
(
operation
.
DimensionSizes
);
Visit
(
operation
.
Initializer
);
}
public
override
void
VisitArrayInitializer
(
IArrayInitializer
operation
)
{
Visit
List
(
operation
.
ElementValues
);
Visit
Array
(
operation
.
ElementValues
);
}
public
override
void
VisitAssignmentExpression
(
IAssignmentExpression
operation
)
...
...
src/Compilers/VisualBasic/Portable/BoundTree/Statement.vb
浏览文件 @
9c42f02e
...
...
@@ -851,6 +851,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Private
ReadOnly
Property
IStatements
As
ImmutableArray
(
Of
IStatement
)
Implements
IBlockStatement
.
Statements
Get
' This is to filter out operations of kind None.
Dim
statements
=
s_blockStatementsMappings
.
GetValue
(
Me
,
Function
(
boundBlock
)
Return
boundBlock
.
Statements
.
As
(
Of
IStatement
).
WhereAsArray
(
Function
(
statement
)
Return
statement
.
Kind
<>
OperationKind
.
None
...
...
src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb
浏览文件 @
9c42f02e
...
...
@@ -1160,7 +1160,7 @@ End Class
comp
.
VerifyAnalyzerDiagnostics
({
New
MemberReferenceAnalyzer
},
Nothing
,
Nothing
,
False
,
Diagnostic
(
MemberReferenceAnalyzer
.
HandlerAddedDescriptor
.
Id
,
"AddHandler Mumble, New MumbleEventHandler(AddressOf Mumbler)"
).
WithLocation
(
7
,
9
),
Diagnostic
(
MemberReferenceAnalyzer
.
MethodBindingDescriptor
.
Id
,
"AddressOf Mumbler"
).
WithLocation
(
7
,
51
),
Diagnostic
(
"HandlerAdded"
,
"AddHandler Mumble, New MumbleEventHandler(Sub(s As Object, a As System.EventArgs)
Diagnostic
(
MemberReferenceAnalyzer
.
HandlerAddedDescriptor
.
Id
,
"AddHandler Mumble, New MumbleEventHandler(Sub(s As Object, a As System.EventArgs)
End Sub)"
).
WithLocation
(
8
,
9
),
Diagnostic
(
MemberReferenceAnalyzer
.
FieldReferenceDescriptor
.
Id
,
"Mumble"
).
WithLocation
(
10
,
20
),
Diagnostic
(
MemberReferenceAnalyzer
.
MethodBindingDescriptor
.
Id
,
"AddressOf Mumbler"
).
WithLocation
(
12
,
39
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录