Added IsDeclaration to BoundFieldAccess nodes.

上级 091200ab
......@@ -2390,7 +2390,7 @@ private BoundExpression BindOutDeclarationArgument(DeclarationExpressionSyntax d
TypeSymbol fieldType = expressionVariableField.GetFieldType(this.FieldsBeingBound);
return new BoundFieldAccess(declarationExpression,
receiver,
expressionVariableField, null, LookupResultKind.Viable, fieldType);
expressionVariableField, null, LookupResultKind.Viable, fieldType, isDeclaration: true);
}
/// <summary>
......
......@@ -1450,6 +1450,7 @@
<Field Name="ConstantValueOpt" Type="ConstantValue" Null="allow"/>
<Field Name="ResultKind" PropertyOverrides="true" Type="LookupResultKind"/>
<Field Name="IsByValue" Type="bool"/>
<Field Name="IsDeclaration" Type="bool" />
</Node>
<!--
......
......@@ -25,8 +25,9 @@ internal sealed partial class BoundFieldAccess
ConstantValue constantValueOpt,
LookupResultKind resultKind,
TypeSymbol type,
bool hasErrors = false)
: this(syntax, receiver, fieldSymbol, constantValueOpt, resultKind, NeedsByValueFieldAccess(receiver, fieldSymbol), type, hasErrors)
bool hasErrors = false,
bool isDeclaration = false)
: this(syntax, receiver, fieldSymbol, constantValueOpt, resultKind, NeedsByValueFieldAccess(receiver, fieldSymbol), isDeclaration, type, hasErrors)
{
}
......@@ -37,7 +38,7 @@ internal sealed partial class BoundFieldAccess
LookupResultKind resultKind,
TypeSymbol typeSymbol)
{
return this.Update(receiver, fieldSymbol, constantValueOpt, resultKind, this.IsByValue, typeSymbol);
return this.Update(receiver, fieldSymbol, constantValueOpt, resultKind, this.IsByValue, this.IsDeclaration, typeSymbol);
}
private static bool NeedsByValueFieldAccess(BoundExpression receiver, FieldSymbol fieldSymbol)
......
......@@ -80,7 +80,8 @@ internal BoundExpression SetInferredType(TypeSymbol type, Binder binderOpt, Diag
return new BoundFieldAccess(this.Syntax,
this.ReceiverOpt,
fieldSymbol, null, LookupResultKind.Viable, type,
this.HasErrors || inferenceFailed);
this.HasErrors || inferenceFailed,
isDeclaration: true);
default:
throw ExceptionUtilities.UnexpectedValue(this.VariableSymbol.Kind);
......
......@@ -5263,7 +5263,7 @@ public BoundStackAllocArrayCreation Update(BoundExpression count, TypeSymbol typ
internal sealed partial class BoundFieldAccess : BoundExpression
{
public BoundFieldAccess(SyntaxNode syntax, BoundExpression receiverOpt, FieldSymbol fieldSymbol, ConstantValue constantValueOpt, LookupResultKind resultKind, bool isByValue, TypeSymbol type, bool hasErrors = false)
public BoundFieldAccess(SyntaxNode syntax, BoundExpression receiverOpt, FieldSymbol fieldSymbol, ConstantValue constantValueOpt, LookupResultKind resultKind, bool isByValue, bool isDeclaration, TypeSymbol type, bool hasErrors = false)
: base(BoundKind.FieldAccess, syntax, type, hasErrors || receiverOpt.HasErrors())
{
......@@ -5275,6 +5275,7 @@ public BoundFieldAccess(SyntaxNode syntax, BoundExpression receiverOpt, FieldSym
this.ConstantValueOpt = constantValueOpt;
this._ResultKind = resultKind;
this.IsByValue = isByValue;
this.IsDeclaration = isDeclaration;
}
......@@ -5289,16 +5290,18 @@ public BoundFieldAccess(SyntaxNode syntax, BoundExpression receiverOpt, FieldSym
public bool IsByValue { get; }
public bool IsDeclaration { get; }
public override BoundNode Accept(BoundTreeVisitor visitor)
{
return visitor.VisitFieldAccess(this);
}
public BoundFieldAccess Update(BoundExpression receiverOpt, FieldSymbol fieldSymbol, ConstantValue constantValueOpt, LookupResultKind resultKind, bool isByValue, TypeSymbol type)
public BoundFieldAccess Update(BoundExpression receiverOpt, FieldSymbol fieldSymbol, ConstantValue constantValueOpt, LookupResultKind resultKind, bool isByValue, bool isDeclaration, TypeSymbol type)
{
if (receiverOpt != this.ReceiverOpt || fieldSymbol != this.FieldSymbol || constantValueOpt != this.ConstantValueOpt || resultKind != this.ResultKind || isByValue != this.IsByValue || type != this.Type)
if (receiverOpt != this.ReceiverOpt || fieldSymbol != this.FieldSymbol || constantValueOpt != this.ConstantValueOpt || resultKind != this.ResultKind || isByValue != this.IsByValue || isDeclaration != this.IsDeclaration || type != this.Type)
{
var result = new BoundFieldAccess(this.Syntax, receiverOpt, fieldSymbol, constantValueOpt, resultKind, isByValue, type, this.HasErrors);
var result = new BoundFieldAccess(this.Syntax, receiverOpt, fieldSymbol, constantValueOpt, resultKind, isByValue, isDeclaration, type, this.HasErrors);
result.WasCompilerGenerated = this.WasCompilerGenerated;
return result;
}
......@@ -9119,7 +9122,7 @@ public override BoundNode VisitFieldAccess(BoundFieldAccess node)
{
BoundExpression receiverOpt = (BoundExpression)this.Visit(node.ReceiverOpt);
TypeSymbol type = this.VisitType(node.Type);
return node.Update(receiverOpt, node.FieldSymbol, node.ConstantValueOpt, node.ResultKind, node.IsByValue, type);
return node.Update(receiverOpt, node.FieldSymbol, node.ConstantValueOpt, node.ResultKind, node.IsByValue, node.IsDeclaration, type);
}
public override BoundNode VisitHoistedFieldAccess(BoundHoistedFieldAccess node)
{
......@@ -10578,6 +10581,7 @@ public override TreeDumperNode VisitFieldAccess(BoundFieldAccess node, object ar
new TreeDumperNode("constantValueOpt", node.ConstantValueOpt, null),
new TreeDumperNode("resultKind", node.ResultKind, null),
new TreeDumperNode("isByValue", node.IsByValue, null),
new TreeDumperNode("isDeclaration", node.IsDeclaration, null),
new TreeDumperNode("type", node.Type, null)
}
);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册