top | up | prev | next

ReturnStatementNode Class

Definition at line 81 of Statement.hpp

Constructors

ReturnStatementNode(const Span& span_)
ReturnStatementNode(const Span& span_, Node* expression_)

Member Functions

void Accept(Visitor& visitor) override
Node* Clone(CloneContext& cloneContext) const override
const Node* Expression() const
Node* Expression()
bool IsCaseTerminatingNode() const override
bool IsDefaultTerminatingNode() const override
bool IsFunctionTerminatingNode() const override
void Read(AstReader& reader) override
void Write(AstWriter& writer) override

Member Variables

std::unique_ptr<Node> expression

Constructor Details

ReturnStatementNode Constructor

sngcm::ast::ReturnStatementNode::ReturnStatementNode(const Span& span_)

Definition at line 145 of Statement.cpp :
 145 : StatementNode(NodeType::returnStatementNodespan_)expression()
 146 {
 147 }


Declaration at line 84 of Statement.hpp


ReturnStatementNode Constructor

sngcm::ast::ReturnStatementNode::ReturnStatementNode(const Span& span_, Node * expression_)

Definition at line 149 of Statement.cpp :
 149 : StatementNode(NodeType::returnStatementNodespan_)expression(expression_)
 150 {
 151     if (expression)
 152     {
 153         expression->SetParent(this);
 154     }
 155 }


Declaration at line 85 of Statement.hpp


Member Function Details

Accept Member Function

void sngcm::ast::ReturnStatementNode::Accept(Visitor & visitor) override

Definition at line 168 of Statement.cpp :
 169 {
 170     visitor.Visit(*this);
 171 }


Declaration at line 87 of Statement.hpp

Base class overridden functions: sngcm::ast::Node::Accept

Calls: sngcm::ast::Visitor::Visit


Clone Member Function

Node * sngcm::ast::ReturnStatementNode::Clone(CloneContext & cloneContext) const override

Definition at line 157 of Statement.cpp :
 158 {
 159     Node* clonedExpression = nullptr;
 160     if (expression)
 161     {
 162         clonedExpression = expression->Clone(cloneContext);
 163     }
 164     ReturnStatementNode* clone = new ReturnStatementNode(GetSpan()clonedExpression);
 165     return clone;
 166 }


Declaration at line 86 of Statement.hpp

Base class overridden functions: sngcm::ast::Node::Clone

Calls: sngcm::ast::Node::GetSpan , sngcm::ast::ReturnStatementNode::Clone

Called by: sngcm::ast::ReturnStatementNode::Clone


Expression Member Function

const Node * sngcm::ast::ReturnStatementNode::Expression() const

Definition at line 93 of Statement.hpp :
 93 { return expression.get(); }


Expression Member Function

Node * sngcm::ast::ReturnStatementNode::Expression()

Definition at line 94 of Statement.hpp :
 94 { return expression.get(); }

Called by: sngcm::ast::SourceWriter::Visit


IsCaseTerminatingNode Member Function

bool sngcm::ast::ReturnStatementNode::IsCaseTerminatingNode() const override

Definition at line 91 of Statement.hpp :
 91 { return true; }

Base class overridden functions: sngcm::ast::StatementNode::IsCaseTerminatingNode


IsDefaultTerminatingNode Member Function

bool sngcm::ast::ReturnStatementNode::IsDefaultTerminatingNode() const override

Definition at line 92 of Statement.hpp :
 92 { return true; }

Base class overridden functions: sngcm::ast::StatementNode::IsDefaultTerminatingNode


IsFunctionTerminatingNode Member Function

bool sngcm::ast::ReturnStatementNode::IsFunctionTerminatingNode() const override

Definition at line 90 of Statement.hpp :
 90 { return true; }

Base class overridden functions: sngcm::ast::StatementNode::IsFunctionTerminatingNode


Read Member Function

void sngcm::ast::ReturnStatementNode::Read(AstReader & reader) override

Definition at line 184 of Statement.cpp :
 185 {
 186     StatementNode::Read(reader);
 187     bool hasExpression = reader.GetBinaryReader().ReadBool();
 188     if (hasExpression)
 189     {
 190         expression.reset(reader.ReadNode());
 191         expression->SetParent(this);
 192     }
 193 }


Declaration at line 89 of Statement.hpp

Base class overridden functions: sngcm::ast::Node::Read , sngcm::ast::StatementNode::Read

Calls: sngcm::ast::AstReader::GetBinaryReader , sngcm::ast::AstReader::ReadNode , sngcm::ast::Node::SetParent , sngcm::ast::StatementNode::Read , soulng::util::BinaryReader::ReadBool


Write Member Function

void sngcm::ast::ReturnStatementNode::Write(AstWriter & writer) override

Definition at line 173 of Statement.cpp :
 174 {
 175     StatementNode::Write(writer);
 176     bool hasExpression = expression != nullptr;
 177     writer.GetBinaryWriter().Write(hasExpression);
 178     if (hasExpression)
 179     {
 180         writer.Write(expression.get());
 181     }
 182 }


Declaration at line 88 of Statement.hpp

Base class overridden functions: sngcm::ast::Node::Write , sngcm::ast::StatementNode::Write

Calls: sngcm::ast::AstWriter::GetBinaryWriter , sngcm::ast::StatementNode::Write , soulng::util::BinaryWriter::Write


top | up | prev | next