summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/type-dec.hh
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
commit967be9e750221ab2ab783f95df79bb26d290a45e (patch)
tree6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/src/ast/type-dec.hh
add: added projectsHEADmain
Diffstat (limited to 'tiger-compiler/src/ast/type-dec.hh')
-rw-r--r--tiger-compiler/src/ast/type-dec.hh51
1 files changed, 51 insertions, 0 deletions
diff --git a/tiger-compiler/src/ast/type-dec.hh b/tiger-compiler/src/ast/type-dec.hh
new file mode 100644
index 0000000..0e19926
--- /dev/null
+++ b/tiger-compiler/src/ast/type-dec.hh
@@ -0,0 +1,51 @@
+/**
+ ** \file ast/type-dec.hh
+ ** \brief Declaration of ast::TypeDec.
+ */
+
+#pragma once
+
+#include <ast/dec.hh>
+#include <ast/ty.hh>
+#include <ast/type-constructor.hh>
+
+namespace ast
+{
+ /// TypeDec.
+ class TypeDec
+ : public Dec
+ , public TypeConstructor
+ {
+ public:
+ /** \name Ctor & dtor.
+ ** \{ */
+ /// Construct a TypeDec node.
+ TypeDec(const Location& location, misc::symbol name, Ty* ty);
+ TypeDec(const TypeDec&) = delete;
+ TypeDec& operator=(const TypeDec&) = delete;
+ /// Destroy a TypeDec node.
+ ~TypeDec() override;
+ /** \} */
+
+ /// \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 type definition.
+ const Ty& ty_get() const;
+ /// Return type definition.
+ Ty& ty_get();
+ /** \} */
+
+ protected:
+ /// Type definition.
+ Ty* ty_;
+ };
+} // namespace ast
+#include <ast/type-dec.hxx>