top | up | prev | next

ReturnStatementNode Class

Definition at line 196 of Statement.hpp

Constructors

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

Member Functions

void Accept(Visitor& visitor) override
void Read(Reader& reader) override
Node* ReturnExpr()
void Write(Writer& writer) override

Member Variables

std::unique_ptr<Node> returnExpr

Constructor Details

ReturnStatementNode Constructor

sngcpp::ast::ReturnStatementNode::ReturnStatementNode()

Definition at line 367 of Statement.cpp :
367 : Node(NodeType::returnStatementNode)
368 {
369 }


Declaration at line 199 of Statement.hpp


ReturnStatementNode Constructor

sngcpp::ast::ReturnStatementNode::ReturnStatementNode(const Span& span_, Node * returnExpr_)

Definition at line 371 of Statement.cpp :
371 : Node(NodeType::returnStatementNodespan_)returnExpr(returnExpr_)
372 {
373 }


Declaration at line 200 of Statement.hpp


Member Function Details

Accept Member Function

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

Definition at line 375 of Statement.cpp :
376 {
377     visitor.Visit(*this);
378 }


Declaration at line 201 of Statement.hpp

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

Calls: sngcpp::ast::Visitor::Visit


Read Member Function

void sngcpp::ast::ReturnStatementNode::Read(Reader & reader) override

Definition at line 390 of Statement.cpp :
391 {
392     Node::Read(reader);
393     bool hasReturnExpr = reader.GetBinaryReader().ReadBool();
394     if (hasReturnExpr)
395     {
396         returnExpr.reset(reader.ReadNode());
397     }
398 }


Declaration at line 203 of Statement.hpp

Base class overridden functions: sngcpp::ast::Node::Read

Calls: sngcpp::ast::Node::Read , sngcpp::ast::Reader::GetBinaryReader , sngcpp::ast::Reader::ReadNode


ReturnExpr Member Function

Node * sngcpp::ast::ReturnStatementNode::ReturnExpr()

Definition at line 204 of Statement.hpp :
204 { return returnExpr.get(); }


Write Member Function

void sngcpp::ast::ReturnStatementNode::Write(Writer & writer) override

Definition at line 380 of Statement.cpp :
381 {
382     Node::Write(writer);
383     writer.GetBinaryWriter().Write(returnExpr != nullptr);
384     if (returnExpr)
385     {
386         returnExpr->Write(writer);
387     }
388 }


Declaration at line 202 of Statement.hpp

Base class overridden functions: sngcpp::ast::Node::Write

Calls: sngcpp::ast::Node::Write , sngcpp::ast::ReturnStatementNode::Write , sngcpp::ast::Writer::GetBinaryWriter

Called by: sngcpp::ast::ReturnStatementNode::Write


top | up | prev | next