Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
ff7a1a82
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,发现更多精彩内容 >>
未验证
提交
ff7a1a82
编写于
9月 11, 2017
作者:
F
Fredric Silberberg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Moved synthetic receiver for property initializers to use the correct type in C#.
上级
1f6ae4ab
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
18 addition
and
9 deletion
+18
-9
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
+1
-0
src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml
src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml
+1
-0
src/Compilers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs
...ers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs
+11
-5
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ObjectOrCollectionInitializerExpression.cs
.../LocalRewriter_ObjectOrCollectionInitializerExpression.cs
+1
-0
src/Compilers/CSharp/Portable/Lowering/MethodToClassRewriter.cs
...mpilers/CSharp/Portable/Lowering/MethodToClassRewriter.cs
+1
-1
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
...lers/CSharp/Portable/Operations/CSharpOperationFactory.cs
+1
-1
src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IPropertyReferenceExpression.cs
...Operation/IOperationTests_IPropertyReferenceExpression.cs
+2
-2
未找到文件。
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
浏览文件 @
ff7a1a82
...
...
@@ -4020,6 +4020,7 @@ private BoundExpression MakeBadExpressionForObjectCreation(ObjectCreationExpress
expanded
,
argsToParamsOpt
,
resultKind
,
implicitReceiver
.
Type
,
binderOpt
:
this
,
type
:
boundMember
.
Type
,
hasErrors
:
hasErrors
);
...
...
src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml
浏览文件 @
ff7a1a82
...
...
@@ -1322,6 +1322,7 @@
<Field
Name=
"Expanded"
Type=
"bool"
/>
<Field
Name=
"ArgsToParamsOpt"
Type=
"ImmutableArray<int>"
Null=
"allow"
/>
<Field
Name=
"ResultKind"
PropertyOverrides=
"true"
Type=
"LookupResultKind"
/>
<Field
Name=
"InstanceSymbol"
Type=
"TypeSymbol"
Null=
"disallow"
/>
<!-- BinderOpt is a temporary solution for IOperation implementation and should probably be removed in the future -->
<!-- Tracked by https://github.com/dotnet/roslyn/issues/20787 -->
...
...
src/Compilers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs
浏览文件 @
ff7a1a82
...
...
@@ -4765,11 +4765,12 @@ public BoundObjectInitializerExpression Update(ImmutableArray<BoundExpression> i
internal
sealed
partial
class
BoundObjectInitializerMember
:
BoundExpression
{
public
BoundObjectInitializerMember
(
SyntaxNode
syntax
,
Symbol
memberSymbol
,
ImmutableArray
<
BoundExpression
>
arguments
,
ImmutableArray
<
string
>
argumentNamesOpt
,
ImmutableArray
<
RefKind
>
argumentRefKindsOpt
,
bool
expanded
,
ImmutableArray
<
int
>
argsToParamsOpt
,
LookupResultKind
resultKind
,
Binder
binderOpt
,
TypeSymbol
type
,
bool
hasErrors
=
false
)
public
BoundObjectInitializerMember
(
SyntaxNode
syntax
,
Symbol
memberSymbol
,
ImmutableArray
<
BoundExpression
>
arguments
,
ImmutableArray
<
string
>
argumentNamesOpt
,
ImmutableArray
<
RefKind
>
argumentRefKindsOpt
,
bool
expanded
,
ImmutableArray
<
int
>
argsToParamsOpt
,
LookupResultKind
resultKind
,
TypeSymbol
instanceSymbol
,
Binder
binderOpt
,
TypeSymbol
type
,
bool
hasErrors
=
false
)
:
base
(
BoundKind
.
ObjectInitializerMember
,
syntax
,
type
,
hasErrors
||
arguments
.
HasErrors
())
{
Debug
.
Assert
(!
arguments
.
IsDefault
,
"Field 'arguments' cannot be null (use Null=\"allow\" in BoundNodes.xml to remove this check)"
);
Debug
.
Assert
(
instanceSymbol
!=
null
,
"Field 'instanceSymbol' cannot be null (use Null=\"allow\" in BoundNodes.xml to remove this check)"
);
Debug
.
Assert
(
type
!=
null
,
"Field 'type' cannot be null (use Null=\"allow\" in BoundNodes.xml to remove this check)"
);
this
.
MemberSymbol
=
memberSymbol
;
...
...
@@ -4779,6 +4780,7 @@ public BoundObjectInitializerMember(SyntaxNode syntax, Symbol memberSymbol, Immu
this
.
Expanded
=
expanded
;
this
.
ArgsToParamsOpt
=
argsToParamsOpt
;
this
.
_ResultKind
=
resultKind
;
this
.
InstanceSymbol
=
instanceSymbol
;
this
.
BinderOpt
=
binderOpt
;
}
...
...
@@ -4798,6 +4800,8 @@ public BoundObjectInitializerMember(SyntaxNode syntax, Symbol memberSymbol, Immu
private
readonly
LookupResultKind
_ResultKind
;
public
override
LookupResultKind
ResultKind
{
get
{
return
_ResultKind
;}
}
public
TypeSymbol
InstanceSymbol
{
get
;
}
public
Binder
BinderOpt
{
get
;
}
public
override
BoundNode
Accept
(
BoundTreeVisitor
visitor
)
...
...
@@ -4805,11 +4809,11 @@ public override BoundNode Accept(BoundTreeVisitor visitor)
return
visitor
.
VisitObjectInitializerMember
(
this
);
}
public
BoundObjectInitializerMember
Update
(
Symbol
memberSymbol
,
ImmutableArray
<
BoundExpression
>
arguments
,
ImmutableArray
<
string
>
argumentNamesOpt
,
ImmutableArray
<
RefKind
>
argumentRefKindsOpt
,
bool
expanded
,
ImmutableArray
<
int
>
argsToParamsOpt
,
LookupResultKind
resultKind
,
Binder
binderOpt
,
TypeSymbol
type
)
public
BoundObjectInitializerMember
Update
(
Symbol
memberSymbol
,
ImmutableArray
<
BoundExpression
>
arguments
,
ImmutableArray
<
string
>
argumentNamesOpt
,
ImmutableArray
<
RefKind
>
argumentRefKindsOpt
,
bool
expanded
,
ImmutableArray
<
int
>
argsToParamsOpt
,
LookupResultKind
resultKind
,
TypeSymbol
instanceSymbol
,
Binder
binderOpt
,
TypeSymbol
type
)
{
if
(
memberSymbol
!=
this
.
MemberSymbol
||
arguments
!=
this
.
Arguments
||
argumentNamesOpt
!=
this
.
ArgumentNamesOpt
||
argumentRefKindsOpt
!=
this
.
ArgumentRefKindsOpt
||
expanded
!=
this
.
Expanded
||
argsToParamsOpt
!=
this
.
ArgsToParamsOpt
||
resultKind
!=
this
.
ResultKind
||
binderOpt
!=
this
.
BinderOpt
||
type
!=
this
.
Type
)
if
(
memberSymbol
!=
this
.
MemberSymbol
||
arguments
!=
this
.
Arguments
||
argumentNamesOpt
!=
this
.
ArgumentNamesOpt
||
argumentRefKindsOpt
!=
this
.
ArgumentRefKindsOpt
||
expanded
!=
this
.
Expanded
||
argsToParamsOpt
!=
this
.
ArgsToParamsOpt
||
resultKind
!=
this
.
ResultKind
||
instanceSymbol
!=
this
.
InstanceSymbol
||
binderOpt
!=
this
.
BinderOpt
||
type
!=
this
.
Type
)
{
var
result
=
new
BoundObjectInitializerMember
(
this
.
Syntax
,
memberSymbol
,
arguments
,
argumentNamesOpt
,
argumentRefKindsOpt
,
expanded
,
argsToParamsOpt
,
resultKind
,
binderOpt
,
type
,
this
.
HasErrors
);
var
result
=
new
BoundObjectInitializerMember
(
this
.
Syntax
,
memberSymbol
,
arguments
,
argumentNamesOpt
,
argumentRefKindsOpt
,
expanded
,
argsToParamsOpt
,
resultKind
,
instanceSymbol
,
binderOpt
,
type
,
this
.
HasErrors
);
result
.
WasCompilerGenerated
=
this
.
WasCompilerGenerated
;
return
result
;
}
...
...
@@ -9044,8 +9048,9 @@ public override BoundNode VisitObjectInitializerExpression(BoundObjectInitialize
public
override
BoundNode
VisitObjectInitializerMember
(
BoundObjectInitializerMember
node
)
{
ImmutableArray
<
BoundExpression
>
arguments
=
(
ImmutableArray
<
BoundExpression
>)
this
.
VisitList
(
node
.
Arguments
);
TypeSymbol
instanceSymbol
=
this
.
VisitType
(
node
.
InstanceSymbol
);
TypeSymbol
type
=
this
.
VisitType
(
node
.
Type
);
return
node
.
Update
(
node
.
MemberSymbol
,
arguments
,
node
.
ArgumentNamesOpt
,
node
.
ArgumentRefKindsOpt
,
node
.
Expanded
,
node
.
ArgsToParamsOpt
,
node
.
ResultKind
,
node
.
BinderOpt
,
type
);
return
node
.
Update
(
node
.
MemberSymbol
,
arguments
,
node
.
ArgumentNamesOpt
,
node
.
ArgumentRefKindsOpt
,
node
.
Expanded
,
node
.
ArgsToParamsOpt
,
node
.
ResultKind
,
instanceSymbol
,
node
.
BinderOpt
,
type
);
}
public
override
BoundNode
VisitDynamicObjectInitializerMember
(
BoundDynamicObjectInitializerMember
node
)
{
...
...
@@ -10449,6 +10454,7 @@ public override TreeDumperNode VisitObjectInitializerMember(BoundObjectInitializ
new
TreeDumperNode
(
"expanded"
,
node
.
Expanded
,
null
),
new
TreeDumperNode
(
"argsToParamsOpt"
,
node
.
ArgsToParamsOpt
,
null
),
new
TreeDumperNode
(
"resultKind"
,
node
.
ResultKind
,
null
),
new
TreeDumperNode
(
"instanceSymbol"
,
node
.
InstanceSymbol
,
null
),
new
TreeDumperNode
(
"binderOpt"
,
node
.
BinderOpt
,
null
),
new
TreeDumperNode
(
"type"
,
node
.
Type
,
null
)
}
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ObjectOrCollectionInitializerExpression.cs
浏览文件 @
ff7a1a82
...
...
@@ -239,6 +239,7 @@ private BoundExpression MakeCollectionInitializer(BoundExpression rewrittenRecei
memberInit
.
Expanded
,
memberInit
.
ArgsToParamsOpt
,
memberInit
.
ResultKind
,
memberInit
.
InstanceSymbol
,
memberInit
.
BinderOpt
,
memberInit
.
Type
);
}
...
...
src/Compilers/CSharp/Portable/Lowering/MethodToClassRewriter.cs
浏览文件 @
ff7a1a82
...
...
@@ -633,7 +633,7 @@ public override BoundNode VisitObjectInitializerMember(BoundObjectInitializerMem
break
;
}
return
node
.
Update
(
member
,
arguments
,
node
.
ArgumentNamesOpt
,
node
.
ArgumentRefKindsOpt
,
node
.
Expanded
,
node
.
ArgsToParamsOpt
,
node
.
ResultKind
,
node
.
BinderOpt
,
type
);
return
node
.
Update
(
member
,
arguments
,
node
.
ArgumentNamesOpt
,
node
.
ArgumentRefKindsOpt
,
node
.
Expanded
,
node
.
ArgsToParamsOpt
,
node
.
ResultKind
,
node
.
InstanceSymbol
,
node
.
BinderOpt
,
type
);
}
private
static
bool
BaseReferenceInReceiverWasRewritten
(
BoundExpression
originalReceiver
,
BoundExpression
rewrittenReceiver
)
...
...
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
浏览文件 @
ff7a1a82
...
...
@@ -535,7 +535,7 @@ private IMemberReferenceExpression CreateBoundObjectInitializerMemberOperation(B
Lazy
<
IOperation
>
instance
=
new
Lazy
<
IOperation
>(()
=>
new
InstanceReferenceExpression
(
semanticModel
:
_semanticModel
,
syntax
:
boundObjectInitializerMember
.
Syntax
,
type
:
boundObjectInitializerMember
.
MemberSymbol
.
ContainingType
,
type
:
boundObjectInitializerMember
.
InstanceSymbol
,
constantValue
:
default
(
Optional
<
object
>),
isImplicit
:
boundObjectInitializerMember
.
WasCompilerGenerated
));
...
...
src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IPropertyReferenceExpression.cs
浏览文件 @
ff7a1a82
...
...
@@ -10,7 +10,7 @@ public partial class IOperationTests : SemanticModelTestBase
{
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
]
public
void
IPropertyReferenceExpression_PropertyReferenceInDerivedTypeUses
Base
TypeAsInstanceType
()
public
void
IPropertyReferenceExpression_PropertyReferenceInDerivedTypeUses
Derived
TypeAsInstanceType
()
{
string
source
=
@"
class C
...
...
@@ -33,7 +33,7 @@ class C2 : C1
string
expectedOperationTree
=
@"
ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Int32) (Syntax: 'P1 = 1')
Left: IPropertyReferenceExpression: System.Int32 C1.P1 { get; set; } (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'P1')
Instance Receiver: IInstanceReferenceExpression (OperationKind.InstanceReferenceExpression, Type: C
1
) (Syntax: 'P1')
Instance Receiver: IInstanceReferenceExpression (OperationKind.InstanceReferenceExpression, Type: C
2
) (Syntax: 'P1')
Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录