提交 8553c530 编写于 作者: V VSadov

Renamed bound nodes for tuple literals to be consistent with other literal nodes.

(Literal, Lambda, InterpolatedString)
They do not have "Expression" at the end.
上级 2d3554fb
......@@ -58,10 +58,10 @@ internal partial class Binder
{
// identity tuple conversions result in a converted tuple
// to indicate that tuple conversions are no longer applicable.
if (source.Kind == BoundKind.NaturalTupleExpression)
if (source.Kind == BoundKind.TupleLiteral)
{
var tuple = (BoundNaturalTupleExpression)source;
return new BoundConvertedTupleExpression(tuple.Syntax, tuple.Arguments, tuple.ArgumentNamesOpt, tuple.Type, tuple.HasErrors);
var tuple = (BoundTupleLiteral)source;
return new BoundConvertedTupleLiteral(tuple.Syntax, tuple.Arguments, tuple.ArgumentNamesOpt, tuple.Type, tuple.HasErrors);
}
// We need to preserve any conversion that changes the type (even identity conversions, like object->dynamic),
......@@ -85,7 +85,7 @@ internal partial class Binder
}
if (conversion.IsTuple ||
(conversion.Kind == ConversionKind.ImplicitNullable && source.Kind == BoundKind.NaturalTupleExpression))
(conversion.Kind == ConversionKind.ImplicitNullable && source.Kind == BoundKind.TupleLiteral))
{
return CreateTupleConversion(syntax, source, conversion, destination, diagnostics);
}
......@@ -330,7 +330,7 @@ private BoundExpression CreateTupleConversion(CSharpSyntaxNode syntax, BoundExpr
// We have a successful tuple conversion; rather than producing a node
// which is a conversion on top of a tuple literal, tuple conversion is an element-wise conversion of arguments.
var sourceTuple = (BoundNaturalTupleExpression)source;
var sourceTuple = (BoundTupleLiteral)source;
var targetType = (NamedTypeSymbol)destination;
Debug.Assert(conversion.Kind == ConversionKind.ImplicitTuple || conversion.Kind == ConversionKind.ImplicitNullable);
......@@ -371,11 +371,11 @@ private BoundExpression CreateTupleConversion(CSharpSyntaxNode syntax, BoundExpr
if ((object)destinationWithoutNullable == null)
{
return new BoundConvertedTupleExpression(syntax, convertedArguments.ToImmutableAndFree(), sourceTuple.ArgumentNamesOpt, destination, hasErrors);
return new BoundConvertedTupleLiteral(syntax, convertedArguments.ToImmutableAndFree(), sourceTuple.ArgumentNamesOpt, destination, hasErrors);
}
else
{
var tuple = new BoundConvertedTupleExpression(syntax, convertedArguments.ToImmutableAndFree(), sourceTuple.ArgumentNamesOpt, destinationWithoutNullable, hasErrors);
var tuple = new BoundConvertedTupleLiteral(syntax, convertedArguments.ToImmutableAndFree(), sourceTuple.ArgumentNamesOpt, destinationWithoutNullable, hasErrors);
return new BoundConversion(
syntax,
......
......@@ -719,7 +719,7 @@ private BoundExpression BindTupleExpression(TupleExpressionSyntax node, Diagnost
tupleTypeOpt = new TupleTypeSymbol(elements, elementNamesArray, node, this, diagnostics);
}
return new BoundNaturalTupleExpression(node, boundArguments.ToImmutableAndFree(), elementNamesArray, tupleTypeOpt, hasErrors);
return new BoundTupleLiteral(node, boundArguments.ToImmutableAndFree(), elementNamesArray, tupleTypeOpt, hasErrors);
}
/// <summary>
......
......@@ -148,7 +148,7 @@ private Conversion ClassifyImplicitBuiltInConversionFromExpression(BoundExpressi
}
break;
case BoundKind.NaturalTupleExpression:
case BoundKind.TupleLiteral:
kind = ClassifyImplicitTupleConversion(sourceExpression, destination, ref useSiteDiagnostics);
if (kind != ConversionKind.NoConversion)
{
......@@ -700,13 +700,13 @@ public override Conversion GetMethodGroupConversion(BoundMethodGroup source, Typ
protected override bool HasImplicitTupleConversion(BoundExpression source, TypeSymbol destination, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
{
if (source.Kind != BoundKind.NaturalTupleExpression)
if (source.Kind != BoundKind.TupleLiteral)
{
// source must be a natural tuple expression
// source must be a tuple literal with no conversions
return false;
}
var tupleExpression = (BoundNaturalTupleExpression)source;
var tupleExpression = (BoundTupleLiteral)source;
var arguments = tupleExpression.Arguments;
// unwrap tuple to its underlying
......
......@@ -1830,7 +1830,7 @@ private bool ExpressionMatchExactly(BoundExpression node, TypeSymbol t, ref Hash
return true;
}
if (node.Kind == BoundKind.NaturalTupleExpression)
if (node.Kind == BoundKind.TupleLiteral)
{
if ((object)node.Type != null)
{
......@@ -1841,7 +1841,7 @@ private bool ExpressionMatchExactly(BoundExpression node, TypeSymbol t, ref Hash
}
// recurse into tuple constituent arguments
return ExpressionMatchExactly((BoundNaturalTupleExpression)node, t, ref useSiteDiagnostics);
return ExpressionMatchExactly((BoundTupleLiteral)node, t, ref useSiteDiagnostics);
}
// - E is an anonymous function, T is either a delegate type D or an expression tree
......@@ -1940,7 +1940,7 @@ private bool ExpressionMatchExactly(BoundExpression node, TypeSymbol t, ref Hash
}
// check every argument of a tuple vs corresponding type in destination tuple type
private bool ExpressionMatchExactly(BoundNaturalTupleExpression tupleSource, TypeSymbol targetType, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
private bool ExpressionMatchExactly(BoundTupleLiteral tupleSource, TypeSymbol targetType, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
{
if (targetType.Kind != SymbolKind.NamedType)
{
......
......@@ -1144,7 +1144,7 @@
<!--
Tuple literals can exist in two forms - natural and converted.
Tuple literals can exist in two forms - literal and converted literal.
This is the base node for both forms.
-->
<AbstractNode Name="BoundTupleExpression" Base="BoundExpression">
......@@ -1155,11 +1155,11 @@
<!--
Tuple literals can convert to the target type.
Once converted to a target type, they cannot convert through any conversion other than identity.
The Natural tuple literal is one which has not been converted to a target type.
The tuple literal is one which has not been converted to a target type.
-->
<Node Name="BoundNaturalTupleExpression" Base="BoundTupleExpression">
<Node Name="BoundTupleLiteral" Base="BoundTupleExpression">
<!--
It is possible for a tuple to not have a type in a natural form
It is possible for a tuple to not have a type in a literal form
Ex:
(a: 1, b: (c: 1, d: null)) does not have a natural type, because "null" does not have one
-->
......@@ -1172,7 +1172,7 @@
The Converted tuple literal is one which has been already converted to a target type.
Converted tuple literal always has a type.
-->
<Node Name="BoundConvertedTupleExpression" Base="BoundTupleExpression">
<Node Name="BoundConvertedTupleLiteral" Base="BoundTupleExpression">
<!-- Converted tuple must have a type -->
<Field Name="Type" Type="TypeSymbol" Override="true" Null="disallow"/>
</Node>
......
......@@ -910,12 +910,12 @@ public override BoundNode VisitIsPatternExpression(BoundIsPatternExpression node
return null;
}
public override BoundNode VisitNaturalTupleExpression(BoundNaturalTupleExpression node)
public override BoundNode VisitTupleLiteral(BoundTupleLiteral node)
{
return VisitTupleExpression(node);
}
public override BoundNode VisitConvertedTupleExpression(BoundConvertedTupleExpression node)
public override BoundNode VisitConvertedTupleLiteral(BoundConvertedTupleLiteral node)
{
return VisitTupleExpression(node);
}
......
......@@ -7,12 +7,12 @@ namespace Microsoft.CodeAnalysis.CSharp
{
internal partial class LocalRewriter
{
public override BoundNode VisitNaturalTupleExpression(BoundNaturalTupleExpression node)
public override BoundNode VisitTupleLiteral(BoundTupleLiteral node)
{
return VisitTupleExpression(node);
}
public override BoundNode VisitConvertedTupleExpression(BoundConvertedTupleExpression node)
public override BoundNode VisitConvertedTupleLiteral(BoundConvertedTupleLiteral node)
{
return VisitTupleExpression(node);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册