top | up | prev | next

UnaryNode Abstract Class

Definition at line 79 of Node.hpp

Constructors

UnaryNode(NodeType nodeType_)
UnaryNode(NodeType nodeType_, const Span& span_)
UnaryNode(NodeType nodeType_, const Span& span_, Node* child_)

Member Functions

Node* Child()
void Read(Reader& reader) override
Node* ReleaseChild()
void SetChild(Node* child_)
void SetFullSpan() override
void Write(Writer& writer) override

Member Variables

std::unique_ptr<Node> child

Constructor Details

UnaryNode Constructor

sngcpp::ast::UnaryNode::UnaryNode(NodeType nodeType_)

Definition at line 63 of Node.cpp :
 63 : Node(nodeType_)
 64 {
 65 }


Declaration at line 82 of Node.hpp


UnaryNode Constructor

sngcpp::ast::UnaryNode::UnaryNode(NodeType nodeType_, const Span& span_)

Definition at line 67 of Node.cpp :
 67 : Node(nodeType_span_)
 68 {
 69 }


Declaration at line 83 of Node.hpp


UnaryNode Constructor

sngcpp::ast::UnaryNode::UnaryNode(NodeType nodeType_, const Span& span_, Node * child_)

Definition at line 71 of Node.cpp :
 71 : Node(nodeType_span_)child(child_)
 72 {
 73     if (child)
 74     {
 75         child->SetParent(this);
 76     }
 77 }


Declaration at line 84 of Node.hpp


Member Function Details

Child Member Function

Node * sngcpp::ast::UnaryNode::Child()

Definition at line 88 of Node.hpp :
 88 { return child.get(); }

Called by: sngcpp::ast::BracedInitializerListNode::AddInitializer , sngcpp::ast::CompoundStatementNode::AddStatement , sngcpp::ast::NamespaceNode::AddMember


Read Member Function

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

Definition at line 89 of Node.cpp :
 90 {
 91     Node::Read(reader);
 92     bool hasChild = reader.GetBinaryReader().ReadBool();
 93     if (hasChild)
 94     {
 95         child.reset(reader.ReadNode());
 96         child->SetParent(this);
 97     }
 98 }


Declaration at line 86 of Node.hpp

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

Derived class overrides: sngcpp::ast::ArrowNode::Read , sngcpp::ast::BracedInitializerListNode::Read , sngcpp::ast::CaseStatementNode::Read , sngcpp::ast::CompoundStatementNode::Read , sngcpp::ast::DeleteExpressionNode::Read , sngcpp::ast::DotNode::Read , sngcpp::ast::InvokeExpressionNode::Read , sngcpp::ast::LabeledStatementNode::Read , sngcpp::ast::NamespaceNode::Read , sngcpp::ast::SubscriptExpressionNode::Read , sngcpp::ast::UnaryExpressionNode::Read

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

Called by: sngcpp::ast::ArrowNode::Read , sngcpp::ast::BracedInitializerListNode::Read , sngcpp::ast::CaseStatementNode::Read , sngcpp::ast::CompoundStatementNode::Read , sngcpp::ast::DeleteExpressionNode::Read , sngcpp::ast::DotNode::Read , sngcpp::ast::InvokeExpressionNode::Read , sngcpp::ast::LabeledStatementNode::Read , sngcpp::ast::NamespaceNode::Read , sngcpp::ast::SubscriptExpressionNode::Read , sngcpp::ast::UnaryExpressionNode::Read


ReleaseChild Member Function

Node * sngcpp::ast::UnaryNode::ReleaseChild()

Definition at line 90 of Node.hpp :
 90 { return child.release(); }

Called by: sngcpp::ast::BracedInitializerListNode::AddInitializer , sngcpp::ast::CompoundStatementNode::AddStatement , sngcpp::ast::NamespaceNode::AddMember


SetChild Member Function

void sngcpp::ast::UnaryNode::SetChild(Node * child_)

Definition at line 89 of Node.hpp :
 89 { child.reset(child_); }

Called by: sngcpp::ast::BracedInitializerListNode::AddInitializer , sngcpp::ast::CompoundStatementNode::AddStatement , sngcpp::ast::NamespaceNode::AddMember


SetFullSpan Member Function

void sngcpp::ast::UnaryNode::SetFullSpan() override

Definition at line 100 of Node.cpp :
101 {
102     if (child)
103     {
104         const Span& thisSpan = GetSpan();
105         child->SetFullSpan();
106         const Span& childSpan = child->GetSpan();
107         SetSpanStart(std::min(thisSpan.startchildSpan.start));
108         SetSpanEnd(std::max(thisSpan.endchildSpan.end));
109     }
110 }


Declaration at line 87 of Node.hpp

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

Calls: sngcpp::ast::Node::GetSpan , sngcpp::ast::Node::SetSpanEnd , sngcpp::ast::Node::SetSpanStart , sngcpp::ast::UnaryNode::SetFullSpan

Called by: sngcpp::ast::UnaryNode::SetFullSpan


Write Member Function

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

Definition at line 79 of Node.cpp :
 80 {
 81     Node::Write(writer);
 82     writer.GetBinaryWriter().Write(child != nullptr);
 83     if (child)
 84     {
 85         child->Write(writer);
 86     }
 87 }


Declaration at line 85 of Node.hpp

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

Derived class overrides: sngcpp::ast::ArrowNode::Write , sngcpp::ast::BracedInitializerListNode::Write , sngcpp::ast::CaseStatementNode::Write , sngcpp::ast::CompoundStatementNode::Write , sngcpp::ast::DeleteExpressionNode::Write , sngcpp::ast::DotNode::Write , sngcpp::ast::InvokeExpressionNode::Write , sngcpp::ast::LabeledStatementNode::Write , sngcpp::ast::NamespaceNode::Write , sngcpp::ast::SubscriptExpressionNode::Write , sngcpp::ast::UnaryExpressionNode::Write

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

Called by: sngcpp::ast::ArrowNode::Write , sngcpp::ast::BracedInitializerListNode::Write , sngcpp::ast::CaseStatementNode::Write , sngcpp::ast::CompoundStatementNode::Write , sngcpp::ast::DeleteExpressionNode::Write , sngcpp::ast::DotNode::Write , sngcpp::ast::InvokeExpressionNode::Write , sngcpp::ast::LabeledStatementNode::Write , sngcpp::ast::NamespaceNode::Write , sngcpp::ast::SubscriptExpressionNode::Write , sngcpp::ast::UnaryExpressionNode::Write , sngcpp::ast::UnaryNode::Write


top | up | prev | next