top | up | prev | next

BinaryNode Abstract Class

Definition at line 95 of Node.hpp

Constructors

BinaryNode(NodeType nodeType_)
BinaryNode(NodeType nodeType_, const Span& span_, Node* left_, Node* right_)

Member Functions

Node* Left()
void Read(Reader& reader) override
Node* Right()
void SetFullSpan() override
void Write(Writer& writer) override

Member Variables

std::unique_ptr<Node> left
std::unique_ptr<Node> right

Constructor Details

BinaryNode Constructor

sngcpp::ast::BinaryNode::BinaryNode(NodeType nodeType_)

Definition at line 112 of Node.cpp :
112 : Node(nodeType_)
113 {
114 }


Declaration at line 98 of Node.hpp


BinaryNode Constructor

sngcpp::ast::BinaryNode::BinaryNode(NodeType nodeType_, const Span& span_, Node * left_, Node * right_)

Definition at line 116 of Node.cpp :
116 : Node(nodeType_span_)left(left_)right(right_)
117 {
118     if (left)
119     {
120         left->SetParent(this);
121     }
122     right->SetParent(this);
123 }


Declaration at line 99 of Node.hpp


Member Function Details

Left Member Function

Node * sngcpp::ast::BinaryNode::Left()

Definition at line 100 of Node.hpp :
100 { return left.get(); }

Called by: sngcpp::ast::SourceFileResolverVisitor::Visit


Read Member Function

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

Definition at line 137 of Node.cpp
Declaration at line 103 of Node.hpp

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

Derived class overrides: sngcpp::ast::AdditiveExpressionNode::Read , sngcpp::ast::AssignmentExpressionNode::Read , sngcpp::ast::EqualityExpressionNode::Read , sngcpp::ast::MultiplicativeExpressionNode::Read , sngcpp::ast::PMExpressionNode::Read , sngcpp::ast::RelationalExpressionNode::Read , sngcpp::ast::ShiftExpressionNode::Read

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

Called by: sngcpp::ast::AdditiveExpressionNode::Read , sngcpp::ast::AssignmentExpressionNode::Read , sngcpp::ast::EqualityExpressionNode::Read , sngcpp::ast::MultiplicativeExpressionNode::Read , sngcpp::ast::PMExpressionNode::Read , sngcpp::ast::RelationalExpressionNode::Read , sngcpp::ast::ShiftExpressionNode::Read


Right Member Function

Node * sngcpp::ast::BinaryNode::Right()

Definition at line 101 of Node.hpp :
101 { return right.get(); }

Called by: sngcpp::ast::SourceFileResolverVisitor::Visit


SetFullSpan Member Function

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

Definition at line 150 of Node.cpp :
151 {
152     if (!left) return;
153     const Span& thisSpan = GetSpan();
154     left->SetFullSpan();
155     right->SetFullSpan();
156     const Span& leftSpan = left->GetSpan();
157     const Span& rightSpan = right->GetSpan();
158     SetSpanStart(std::min(thisSpan.startstd::min(leftSpan.startrightSpan.start)));
159     SetSpanEnd(std::max(thisSpan.endstd::max(leftSpan.endrightSpan.end)));
160 }


Declaration at line 104 of Node.hpp

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

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

Called by: sngcpp::ast::BinaryNode::SetFullSpan


Write Member Function

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

Definition at line 125 of Node.cpp :
126 {
127     Node::Write(writer);
128     bool hasLeft = left != nullptr;
129     writer.GetBinaryWriter().Write(hasLeft);
130     if (hasLeft)
131     {
132         left->Write(writer);
133     }
134     right->Write(writer);
135 }


Declaration at line 102 of Node.hpp

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

Derived class overrides: sngcpp::ast::AdditiveExpressionNode::Write , sngcpp::ast::AssignmentExpressionNode::Write , sngcpp::ast::EqualityExpressionNode::Write , sngcpp::ast::MultiplicativeExpressionNode::Write , sngcpp::ast::PMExpressionNode::Write , sngcpp::ast::RelationalExpressionNode::Write , sngcpp::ast::ShiftExpressionNode::Write

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

Called by: sngcpp::ast::AdditiveExpressionNode::Write , sngcpp::ast::AssignmentExpressionNode::Write , sngcpp::ast::BinaryNode::Write , sngcpp::ast::EqualityExpressionNode::Write , sngcpp::ast::MultiplicativeExpressionNode::Write , sngcpp::ast::PMExpressionNode::Write , sngcpp::ast::RelationalExpressionNode::Write , sngcpp::ast::ShiftExpressionNode::Write


top | up | prev | next