Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
627168da
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,发现更多精彩内容 >>
提交
627168da
编写于
11月 07, 2017
作者:
M
Manish Vasani
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Address PR feedback and use singleton for null instance
上级
4dd2a449
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
13 addition
and
7 deletion
+13
-7
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
...lers/CSharp/Portable/Operations/CSharpOperationFactory.cs
+7
-4
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
...lBasic/Portable/Operations/VisualBasicOperationFactory.vb
+6
-3
未找到文件。
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
浏览文件 @
627168da
...
...
@@ -18,6 +18,9 @@ internal sealed partial class CSharpOperationFactory
private
readonly
ConcurrentDictionary
<
BoundNode
,
IOperation
>
_cache
=
new
ConcurrentDictionary
<
BoundNode
,
IOperation
>(
concurrencyLevel
:
2
,
capacity
:
10
);
private
readonly
Lazy
<
IOperation
>
_lazyNullOperation
=
new
Lazy
<
IOperation
>(()
=>
null
);
private
readonly
SemanticModel
_semanticModel
;
public
CSharpOperationFactory
(
SemanticModel
semanticModel
)
...
...
@@ -479,7 +482,7 @@ private IAnonymousObjectCreationOperation CreateBoundAnonymousObjectCreationExpr
private
IPropertyReferenceOperation
CreateBoundAnonymousPropertyDeclarationOperation
(
BoundAnonymousPropertyDeclaration
boundAnonymousPropertyDeclaration
)
{
PropertySymbol
property
=
boundAnonymousPropertyDeclaration
.
Property
;
Lazy
<
IOperation
>
instance
=
new
Lazy
<
IOperation
>(()
=>
null
)
;
Lazy
<
IOperation
>
instance
=
_lazyNullOperation
;
Lazy
<
ImmutableArray
<
IArgumentOperation
>>
arguments
=
new
Lazy
<
ImmutableArray
<
IArgumentOperation
>>(()
=>
ImmutableArray
<
IArgumentOperation
>.
Empty
);
SyntaxNode
syntax
=
boundAnonymousPropertyDeclaration
.
Syntax
;
ITypeSymbol
type
=
boundAnonymousPropertyDeclaration
.
Type
;
...
...
@@ -1309,7 +1312,7 @@ private IWhileLoopOperation CreateBoundWhileStatementOperation(BoundWhileStateme
{
Lazy
<
IOperation
>
condition
=
new
Lazy
<
IOperation
>(()
=>
Create
(
boundWhileStatement
.
Condition
));
Lazy
<
IOperation
>
body
=
new
Lazy
<
IOperation
>(()
=>
Create
(
boundWhileStatement
.
Body
));
Lazy
<
IOperation
>
ignoredCondition
=
new
Lazy
<
IOperation
>(()
=>
null
)
;
Lazy
<
IOperation
>
ignoredCondition
=
_lazyNullOperation
;
ImmutableArray
<
ILocalSymbol
>
locals
=
boundWhileStatement
.
Locals
.
As
<
ILocalSymbol
>();
bool
conditionIsTop
=
true
;
bool
conditionIsUntil
=
false
;
...
...
@@ -1324,7 +1327,7 @@ private IWhileLoopOperation CreateBoundDoStatementOperation(BoundDoStatement bou
{
Lazy
<
IOperation
>
condition
=
new
Lazy
<
IOperation
>(()
=>
Create
(
boundDoStatement
.
Condition
));
Lazy
<
IOperation
>
body
=
new
Lazy
<
IOperation
>(()
=>
Create
(
boundDoStatement
.
Body
));
Lazy
<
IOperation
>
ignoredCondition
=
new
Lazy
<
IOperation
>(()
=>
null
)
;
Lazy
<
IOperation
>
ignoredCondition
=
_lazyNullOperation
;
bool
conditionIsTop
=
false
;
bool
conditionIsUntil
=
false
;
ImmutableArray
<
ILocalSymbol
>
locals
=
boundDoStatement
.
Locals
.
As
<
ILocalSymbol
>();
...
...
@@ -1366,7 +1369,7 @@ private IForEachLoopOperation CreateBoundForEachStatementOperation(BoundForEachS
}
else
{
loopControlVariable
=
new
Lazy
<
IOperation
>(()
=>
null
)
;
loopControlVariable
=
_lazyNullOperation
;
}
Lazy
<
IOperation
>
collection
=
new
Lazy
<
IOperation
>(()
=>
Create
(
boundForEachStatement
.
Expression
));
...
...
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
浏览文件 @
627168da
...
...
@@ -13,6 +13,9 @@ Namespace Microsoft.CodeAnalysis.Operations
Private
ReadOnly
_cache
As
ConcurrentDictionary
(
Of
BoundNode
,
IOperation
)
=
New
ConcurrentDictionary
(
Of
BoundNode
,
IOperation
)(
concurrencyLevel
:
=
2
,
capacity
:
=
10
)
Private
ReadOnly
_lazyNothingOperation
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
Nothing
)
Private
ReadOnly
_semanticModel
As
SemanticModel
Public
Sub
New
(
semanticModel
As
SemanticModel
)
...
...
@@ -1215,7 +1218,7 @@ Namespace Microsoft.CodeAnalysis.Operations
Private
Function
CreateBoundWhileStatementOperation
(
boundWhileStatement
As
BoundWhileStatement
)
As
IWhileLoopOperation
Dim
condition
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
Create
(
boundWhileStatement
.
Condition
))
Dim
body
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
Create
(
boundWhileStatement
.
Body
))
Dim
ignoredCondition
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
Nothing
)
Dim
ignoredCondition
As
Lazy
(
Of
IOperation
)
=
_lazyNothingOperation
Dim
locals
As
ImmutableArray
(
Of
ILocalSymbol
)
=
ImmutableArray
(
Of
ILocalSymbol
).
Empty
Dim
conditionIsTop
As
Boolean
=
True
Dim
conditionIsUntil
As
Boolean
=
False
...
...
@@ -1246,7 +1249,7 @@ Namespace Microsoft.CodeAnalysis.Operations
Private
Function
CreateBoundLabelStatementOperation
(
boundLabelStatement
As
BoundLabelStatement
)
As
ILabeledOperation
Dim
label
As
ILabelSymbol
=
boundLabelStatement
.
Label
Dim
statement
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
Nothing
)
Dim
statement
As
Lazy
(
Of
IOperation
)
=
_lazyNothingOperation
Dim
syntax
As
SyntaxNode
=
boundLabelStatement
.
Syntax
Dim
type
As
ITypeSymbol
=
Nothing
Dim
constantValue
As
[
Optional
]
(
Of
Object
)
=
New
[
Optional
]
(
Of
Object
)()
...
...
@@ -1493,7 +1496,7 @@ Namespace Microsoft.CodeAnalysis.Operations
End
Function
Private
Function
CreateBoundAnonymousTypePropertyAccessOperation
(
boundAnonymousTypePropertyAccess
As
BoundAnonymousTypePropertyAccess
)
As
IPropertyReferenceOperation
Dim
instance
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
Nothing
)
Dim
instance
As
Lazy
(
Of
IOperation
)
=
_lazyNothingOperation
Dim
[
property
]
As
IPropertySymbol
=
DirectCast
(
boundAnonymousTypePropertyAccess
.
ExpressionSymbol
,
IPropertySymbol
)
Dim
arguments
As
Lazy
(
Of
ImmutableArray
(
Of
IArgumentOperation
))
=
New
Lazy
(
Of
ImmutableArray
(
Of
IArgumentOperation
))(
Function
()
ImmutableArray
(
Of
IArgumentOperation
).
Empty
)
Dim
syntax
As
SyntaxNode
=
boundAnonymousTypePropertyAccess
.
Syntax
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录