![]() |
Zen
A cross-platform functional programming language
|
AST Node for a compilation unit. More...
#include <Ast.hpp>
Public Types | |
|
typedef z::list< const Ast::ImportStatement * > | ImportList |
| List of import statements in this unit. | |
|
typedef z::list< const Ast::ImplItem * > | ImplList |
| List of all implementation items in this unit. | |
Public Member Functions | |
| Unit (const AccessType::T &accessType) | |
| Default constructor. | |
| void | setProjectDef (const Ast::StructInitExpr &expr) |
| Set the project definition, if this is a project unit This is used only if unit represents project file. | |
| const Ast::StructInitExpr & | getProjectDef () |
| Return the project defjinition, if this is a project unit. | |
| void | setMainContinuation (const Ast::ContinuationImplItem &continuation) |
| Set the main continuation, if this compilation has a main() function. | |
| bool | hasMainContinuation () const |
| Check if this compilation has a main() function. | |
| const Ast::ContinuationImplItem & | getMainContinuation () const |
| Return the main continuation. | |
| void | setFilename (const z::string &filename) |
| Set the filename for this compilation unit. | |
| const z::string & | getFilename () const |
| Return the filename for this compilation unit. | |
| Ast::ImportStatement & | addImport (Ast::ImportStatement &stmt) |
| Add an import statement to the unit. | |
| void | addUnitNS (const z::string &name) |
| Add a namespace to the unit. | |
| void | addItem (const ImplItem &item) |
| Add an implementation item to the unit. | |
| template<typename T > | |
| T & | addNode (T *node) |
| Add an AST node to the unit. | |
| Namespace & | getRootNS () |
| Return a reference to the root namespace for this compilation unit. | |
| const Namespace & | getRootNS () const |
| Return a const reference to the root namespace for this compilation unit. | |
| Namespace & | getImportNS () |
| Return a reference to the import namespace for this compilation unit. | |
| const Namespace & | getImportNS () const |
| Return a const reference to the import namespace for this compilation unit. | |
| const z::stringlist & | getUnitNS () const |
| Return the name of namespace for this compilation unit. | |
| const ImportList & | getImportList () const |
| Return the list of imports for this compilation unit. | |
| const ImplList & | getImplList () const |
| Return the list of implementations for this compilation unit. | |
Private Types | |
| typedef z::sharedptr< Node > | Ptr |
| Shared NodePtr. | |
Private Member Functions | |
| virtual void | visit (TypeSpec::Visitor &visitor) const |
| Abstract visitor function. | |
Private Attributes | |
| z::string | _filename |
| The filename. | |
| ImportList | _importList |
| The list of imports in this unit. | |
| Ast::Namespace | _importNS |
| This NS contains all imported typespec's. It is not used for source file generation, only for reference. | |
| Namespace | _rootNS |
| This NS contains all types defined in the current compilation unit. | |
| z::stringlist | _unitNS |
| The NS for the current compilation unit. | |
| ImplList | _implList |
| List of all ImplItem nodes in this unit. | |
| z::list< Ptr > | _nodeList |
| The owner list of all nodes in this unit. | |
| const Ast::ContinuationImplItem * | _mainContinuation |
| This is non-zero if this compilation has a main function. | |
| const Ast::StructInitExpr * | _projectDef |
| This is non-zero if this is AST for a project file. | |
AST Node for a compilation unit.
The Unit AST node is the owner for all AST nodes in the unit. This node maintains two namespace hierarchies
| Unit | ( | const AccessType::T & | accessType | ) | [inline] |
Default constructor.
| accessType | Specifies the AccessType for this type, for example, whether it is a public or a private type. |
| Ast::ImportStatement& addImport | ( | Ast::ImportStatement & | stmt | ) | [inline] |
Add an import statement to the unit.
| stmt | The import statement to add. |
| void addItem | ( | const ImplItem & | item | ) | [inline] |
Add an implementation item to the unit.
| item | The item to add |
| T& addNode | ( | T * | node | ) | [inline] |
Add an AST node to the unit.
| node | A pointer to the node to add |
| void addUnitNS | ( | const z::string & | name | ) | [inline] |
Add a namespace to the unit.
| name | The namespace to add |
| const z::string& getFilename | ( | ) | const [inline] |
Return the filename for this compilation unit.
| const ImplList& getImplList | ( | ) | const [inline] |
Return the list of implementations for this compilation unit.
| const ImportList& getImportList | ( | ) | const [inline] |
Return the list of imports for this compilation unit.
| Namespace& getImportNS | ( | ) | [inline] |
Return a reference to the import namespace for this compilation unit.
| const Namespace& getImportNS | ( | ) | const [inline] |
Return a const reference to the import namespace for this compilation unit.
| const Ast::ContinuationImplItem& getMainContinuation | ( | ) | const [inline] |
Return the main continuation.
| const Ast::StructInitExpr& getProjectDef | ( | ) | [inline] |
Return the project defjinition, if this is a project unit.
| Namespace& getRootNS | ( | ) | [inline] |
Return a reference to the root namespace for this compilation unit.
| const Namespace& getRootNS | ( | ) | const [inline] |
Return a const reference to the root namespace for this compilation unit.
| const z::stringlist& getUnitNS | ( | ) | const [inline] |
Return the name of namespace for this compilation unit.
| bool hasMainContinuation | ( | ) | const [inline] |
Check if this compilation has a main() function.
| void setFilename | ( | const z::string & | filename | ) | [inline] |
Set the filename for this compilation unit.
| filename | The filename |
| void setMainContinuation | ( | const Ast::ContinuationImplItem & | continuation | ) | [inline] |
Set the main continuation, if this compilation has a main() function.
| continuation | The main continuation |
| void setProjectDef | ( | const Ast::StructInitExpr & | expr | ) | [inline] |
Set the project definition, if this is a project unit This is used only if unit represents project file.
| expr | The project definition |
| void visit | ( | TypeSpec::Visitor & | visitor | ) | const [private, virtual] |