Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
a9c3074e
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 搜索 >>
未验证
提交
a9c3074e
编写于
12月 15, 2020
作者:
F
Fredric Silberberg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Address remaining PROTOTYPE comments.
上级
e39b6beb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
1 addition
and
72 deletion
+1
-72
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
...lers/CSharp/Portable/Operations/CSharpOperationFactory.cs
+0
-19
src/Compilers/Core/Portable/Operations/OperationOld.cs
src/Compilers/Core/Portable/Operations/OperationOld.cs
+0
-36
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
...lBasic/Portable/Operations/VisualBasicOperationFactory.vb
+1
-17
未找到文件。
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
浏览文件 @
a9c3074e
...
...
@@ -1418,25 +1418,6 @@ private IAwaitOperation CreateBoundAwaitExpressionOperation(BoundAwaitExpression
private
IArrayElementReferenceOperation
CreateBoundArrayAccessOperation
(
BoundArrayAccess
boundArrayAccess
)
{
// PROTOTYPE(iop): When removing the laziness, this comment will no longer be relevant, because caching won't
// occur here
// The compiler will dedupe the _arrayAccess.Expression between different array references. Some example code:
//
// class C
// {
// int[] a;
// static void Main()
// {
// // Compiler dedupes the array access receiver for [0] and [1]
// var a = new C { a = { [0] = 1, [1] = 2 } };
// }
// }
//
// In order to prevent parent pointer from having an issue with this, we intentionally create a new IOperation node every time
// we encounter an array access. Since we create from the top down, it should be impossible for us to see the node in
// boundArrayAccess.Expression before seeing the boundArrayAccess itself, so this should not create any other parent pointer
// issues.
IOperation
arrayReference
=
Create
(
boundArrayAccess
.
Expression
);
ImmutableArray
<
IOperation
>
indices
=
CreateFromArray
<
BoundExpression
,
IOperation
>(
boundArrayAccess
.
Indices
);
SyntaxNode
syntax
=
boundArrayAccess
.
Syntax
;
...
...
src/Compilers/Core/Portable/Operations/OperationOld.cs
已删除
100644 → 0
浏览文件 @
e39b6beb
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System.Diagnostics
;
namespace
Microsoft.CodeAnalysis
{
// PROTOTYPE(iop): Delete this after migration
internal
abstract
class
OperationOld
:
Operation
{
protected
OperationOld
(
OperationKind
kind
,
SemanticModel
?
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
ConstantValue
constantValue
,
bool
isImplicit
)
:
base
(
semanticModel
,
syntax
,
isImplicit
)
{
// Constant value cannot be "null" for non-nullable value type operations.
Debug
.
Assert
(
type
?.
IsValueType
!=
true
||
ITypeSymbolHelpers
.
IsNullableType
(
type
)
||
constantValue
==
null
||
constantValue
==
CodeAnalysis
.
ConstantValue
.
Unset
||
!
constantValue
.
IsNull
);
Type
=
type
;
Kind
=
kind
;
OperationConstantValue
=
constantValue
;
}
/// <summary>
/// <inheritdoc/>
/// </summary>
public
override
ITypeSymbol
?
Type
{
get
;
}
/// <summary>
/// <inheritdoc/>
/// </summary>
public
override
OperationKind
Kind
{
get
;
}
internal
override
CodeAnalysis
.
ConstantValue
?
OperationConstantValue
{
get
;
}
}
}
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
浏览文件 @
a9c3074e
...
...
@@ -20,12 +20,6 @@ Namespace Microsoft.CodeAnalysis.Operations
_semanticModel
=
semanticModel
End
Sub
Private
Function
Clone
()
As
VisualBasicOperationFactory
Dim
factory
As
New
VisualBasicOperationFactory
(
_semanticModel
)
factory
.
_lazyPlaceholderToParentMap
=
_lazyPlaceholderToParentMap
Return
factory
End
Function
''' <summary>
''' Returns <code>Nothing</code> if parent is not known.
''' </summary>
...
...
@@ -1062,17 +1056,7 @@ Namespace Microsoft.CodeAnalysis.Operations
End
Function
Friend
Function
CreateBoundCaseBlockCondition
(
boundCaseBlock
As
BoundCaseBlock
)
As
IOperation
' Some bound nodes used by the boundCaseBlock.CaseStatement.CaseClauses are also going to be used in boundCaseBlock.CaseStatement.ConditionOpt.
' If we simply create another tree based on boundCaseBlock.CaseStatement.ConditionOpt, due to the caching we will end up with the same
' IOperation nodes in two trees, and two parents will compete for assigning itself as the parent - trouble. To avoid that, we simply use
' a new factory to create IOperation tree for the condition. Note that the condition tree is internal and regular consumers cannot get to
' the nodes it contains. At the moment, it is used only by CFG builder. The builder, rewrites all nodes anyway, it is producing a "forest"
' of different trees. So, there is really no chance of some external consumer getting confused by multiple explicit nodes tied to the same
' syntax.
'
' PROTOTYPE(iop): this can be removed when `Create` is refactored to not cache here
Return
Clone
().
Create
(
boundCaseBlock
.
CaseStatement
.
ConditionOpt
)
Return
Create
(
boundCaseBlock
.
CaseStatement
.
ConditionOpt
)
End
Function
Private
Function
CreateBoundCaseBlockOperation
(
boundCaseBlock
As
BoundCaseBlock
)
As
ISwitchCaseOperation
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录