32 lines
881 B
C#
32 lines
881 B
C#
using System.Diagnostics;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
internal sealed class BoundExpressionStatement : BoundStatement
|
|
{
|
|
public BoundExpression Expression { get; }
|
|
|
|
public BoundExpressionStatement(SyntaxNode syntax, BoundExpression expression, bool hasErrors = false)
|
|
: base(BoundKind.ExpressionStatement, syntax, hasErrors || expression.HasErrors())
|
|
{
|
|
Expression = expression;
|
|
}
|
|
|
|
[DebuggerStepThrough]
|
|
public override BoundNode? Accept(BoundTreeVisitor visitor)
|
|
{
|
|
return visitor.VisitExpressionStatement(this);
|
|
}
|
|
|
|
public BoundExpressionStatement Update(BoundExpression expression)
|
|
{
|
|
if (expression != Expression)
|
|
{
|
|
BoundExpressionStatement boundExpressionStatement = new BoundExpressionStatement(Syntax, expression, base.HasErrors);
|
|
boundExpressionStatement.CopyAttributes(this);
|
|
return boundExpressionStatement;
|
|
}
|
|
return this;
|
|
}
|
|
}
|