diff options
Diffstat (limited to 'tiger-compiler/src/ast/name-ty.hh')
| -rw-r--r-- | tiger-compiler/src/ast/name-ty.hh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tiger-compiler/src/ast/name-ty.hh b/tiger-compiler/src/ast/name-ty.hh new file mode 100644 index 0000000..de08848 --- /dev/null +++ b/tiger-compiler/src/ast/name-ty.hh @@ -0,0 +1,56 @@ +/** + ** \file ast/name-ty.hh + ** \brief Declaration of ast::NameTy. + */ + +#pragma once + +#include <ast/ty.hh> +#include <ast/type-dec.hh> +#include <misc/symbol.hh> + +namespace ast +{ + /// NameTy. + class NameTy : public Ty + { + public: + /** \name Ctor & dtor. + ** \{ */ + /// Construct a NameTy node. + NameTy(const Location& location, misc::symbol name); + NameTy(const NameTy&) = delete; + NameTy& operator=(const NameTy&) = delete; + /// Destroy a NameTy node. + /** \} */ + + /// \name Visitors entry point. + /// \{ */ + /// Accept a const visitor \a v. + void accept(ConstVisitor& v) const override; + /// Accept a non-const visitor \a v. + void accept(Visitor& v) override; + /// \} + + /** \name Accessors. + ** \{ */ + /// Return the name of the type. + misc::symbol name_get() const; + /// Set the name of the type. + void name_set(misc::symbol); + /// Return definition site. + const TypeDec* def_get() const; + /// Return definition site. + TypeDec* def_get(); + /// Set definition site. + void def_set(TypeDec*); + /** \} */ + + protected: + /// The name of the type. + misc::symbol name_; + /// Definition site. + TypeDec* def_ = nullptr; + }; +} // namespace ast +#include <ast/name-ty.hxx> |
