Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/Compilers/CSharp/Portable/BoundTree/Expression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

namespace Microsoft.CodeAnalysis.CSharp
{
internal partial class BoundTupleExpression
{
protected override ImmutableArray<BoundNode> Children => StaticCast<BoundNode>.From(this.Arguments);
}

internal partial class BoundDelegateCreationExpression
{
protected override ImmutableArray<BoundNode> Children => ImmutableArray.Create<BoundNode>(this.Argument);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ private IOperation CreateInternal(BoundNode boundNode)
return CreateBoundLabeledStatementOperation((BoundLabeledStatement)boundNode);
case BoundKind.ExpressionStatement:
return CreateBoundExpressionStatementOperation((BoundExpressionStatement)boundNode);
case BoundKind.TupleLiteral:
case BoundKind.ConvertedTupleLiteral:
return CreateBoundTupleExpressionOperation((BoundTupleExpression)boundNode);
case BoundKind.InterpolatedString:
return CreateBoundInterpolatedStringExpressionOperation((BoundInterpolatedString)boundNode);
case BoundKind.StringInsert:
Expand Down Expand Up @@ -1189,6 +1192,15 @@ private IExpressionStatement CreateBoundExpressionStatementOperation(BoundExpres
return new LazyExpressionStatement(expression, syntax, type, constantValue);
}

private ITupleExpression CreateBoundTupleExpressionOperation(BoundTupleExpression boundTupleExpression)
{
Lazy<ImmutableArray<IOperation>> elements = new Lazy<ImmutableArray<IOperation>>(() => boundTupleExpression.Arguments.SelectAsArray(element => Create(element)));
SyntaxNode syntax = boundTupleExpression.Syntax;
ITypeSymbol type = boundTupleExpression.Type;
Optional<object> constantValue = default(Optional<object>);
return new LazyTupleExpression(elements, syntax, type, constantValue);
}

private IInterpolatedStringExpression CreateBoundInterpolatedStringExpressionOperation(BoundInterpolatedString boundInterpolatedString)
{
Lazy<ImmutableArray<IInterpolatedStringContent>> parts = new Lazy<ImmutableArray<IInterpolatedStringContent>>(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public void M(int x, int y)
}
";
string expectedOperationTree = @"
IOperation: (OperationKind.None) (Syntax: '(x, x + y)')
Children(2):
ITupleExpression (OperationKind.TupleExpression, Type: (System.Int32 x, System.Int32)) (Syntax: '(x, x + y)')
Elements(2):
IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x')
IBinaryOperatorExpression (BinaryOperationKind.IntegerAdd) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y')
Left: IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x')
Expand Down Expand Up @@ -72,8 +72,8 @@ public void M(Point point)
string expectedOperationTree = @"
IOperation: (OperationKind.None) (Syntax: 'var (x, y) = point')
Children(2):
IOperation: (OperationKind.None) (Syntax: 'var (x, y)')
Children(2):
ITupleExpression (OperationKind.TupleExpression, Type: (System.Int32 x, System.Int32 y)) (Syntax: 'var (x, y)')
Elements(2):
ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'x')
ILocalReferenceExpression: y (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'y')
IConversionExpression (ConversionKind.Invalid, Implicit) (OperationKind.ConversionExpression, Type: (System.Int32 x, System.Int32 y)) (Syntax: 'point')
Expand Down
Loading