top | up | prev | next

CompileUnitNode Class

Definition at line 12 of CompileUnit.hpp

Constructors

CompileUnitNode(const Span& span_)
CompileUnitNode(const Span& span_, const std::string& filePath_)

Member Functions

void Accept(Visitor& visitor) override
Node* Clone(CloneContext& cloneContext) const override
void ComputeLineStarts(const std::u32string& sourceFileContent)
const std::string& FilePath() const
const NamespaceNode* GlobalNs() const
NamespaceNode* GlobalNs()
const std::string& Id()
bool IsSynthesizedUnit() const
const std::vector<int32_t>& LineStarts()
void ResetGlobalNs(NamespaceNode* ns)
void SetSynthesizedUnit()

Member Variables

std::string filePath
std::unique_ptr<NamespaceNode> globalNs
std::string id
bool isSynthesizedUnit
std::vector<int32_t> lineStarts

Constructor Details

CompileUnitNode Constructor

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

Definition at line 16 of CompileUnit.cpp :
 16 : Node(NodeType::compileUnitNodespan_)globalNs()isSynthesizedUnit(false)
 17 {
 18 }


Declaration at line 15 of CompileUnit.hpp


CompileUnitNode Constructor

sngcm::ast::CompileUnitNode::CompileUnitNode(const Span& span_, const std::string& filePath_)

Definition at line 20 of CompileUnit.cpp :
 20 :
 21 Node(NodeType::compileUnitNodespan_)filePath(filePath_)globalNs(new NamespaceNode(span_new IdentifierNode(span_U"")))isSynthesizedUnit(false)
 22 {
 23 }


Declaration at line 16 of CompileUnit.hpp


Member Function Details

Accept Member Function

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

Definition at line 32 of CompileUnit.cpp :
 33 {
 34     visitor.Visit(*this);
 35 }


Declaration at line 18 of CompileUnit.hpp

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

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


Clone Member Function

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

Definition at line 25 of CompileUnit.cpp :
 26 {
 27     CompileUnitNode* clone = new CompileUnitNode(GetSpan()filePath);
 28     clone->globalNs.reset(static_cast<NamespaceNode*>(globalNs->Clone(cloneContext)));
 29     return clone;
 30 }


Declaration at line 17 of CompileUnit.hpp

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

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

Called by: sngcm::ast::CompileUnitNode::Clone


ComputeLineStarts Member Function

void sngcm::ast::CompileUnitNode::ComputeLineStarts(const std::u32string& sourceFileContent)

Definition at line 42 of CompileUnit.cpp
Declaration at line 23 of CompileUnit.hpp


FilePath Member Function

const std::string& sngcm::ast::CompileUnitNode::FilePath() const

Definition at line 19 of CompileUnit.hpp :
19 { return filePath; }


GlobalNs Member Function

const NamespaceNode * sngcm::ast::CompileUnitNode::GlobalNs() const

Definition at line 20 of CompileUnit.hpp :
20 { return globalNs.get(); }


GlobalNs Member Function

NamespaceNode * sngcm::ast::CompileUnitNode::GlobalNs()

Definition at line 21 of CompileUnit.hpp :
21 { return globalNs.get(); }

Called by: sngcm::ast::ClassMemberArranger::Visit , sngcm::ast::NamespaceCombiner::Visit , sngcm::ast::SourceWriter::Visit , sngcm::ast::UnnamedNamespaceProcessor::Visit


Id Member Function

const std::string& sngcm::ast::CompileUnitNode::Id()

Definition at line 61 of CompileUnit.cpp :
 62 {
 63     if (id.empty())
 64     {
 65         id = GetSha1MessageDigest(filePath);
 66     }
 67     return id;
 68 }


Declaration at line 27 of CompileUnit.hpp


IsSynthesizedUnit Member Function

bool sngcm::ast::CompileUnitNode::IsSynthesizedUnit() const

Definition at line 26 of CompileUnit.hpp :
26 { return isSynthesizedUnit; }


LineStarts Member Function

const std::vector<int32_t>& sngcm::ast::CompileUnitNode::LineStarts()

Definition at line 24 of CompileUnit.hpp :
24 { return lineStarts; }


ResetGlobalNs Member Function

void sngcm::ast::CompileUnitNode::ResetGlobalNs(NamespaceNode * ns)

Definition at line 37 of CompileUnit.cpp :
 38 {
 39     globalNs.reset(ns);
 40 }


Declaration at line 22 of CompileUnit.hpp


SetSynthesizedUnit Member Function

void sngcm::ast::CompileUnitNode::SetSynthesizedUnit()

Definition at line 25 of CompileUnit.hpp :
25 { isSynthesizedUnit = true; }


top | up | prev | next