summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/type/attribute.hh
diff options
context:
space:
mode:
Diffstat (limited to 'tiger-compiler/src/type/attribute.hh')
-rw-r--r--tiger-compiler/src/type/attribute.hh44
1 files changed, 44 insertions, 0 deletions
diff --git a/tiger-compiler/src/type/attribute.hh b/tiger-compiler/src/type/attribute.hh
new file mode 100644
index 0000000..d252da4
--- /dev/null
+++ b/tiger-compiler/src/type/attribute.hh
@@ -0,0 +1,44 @@
+/**
+ ** \file type/attribute.hh
+ ** \brief The class Attribute (of a class type).
+ */
+#pragma once
+
+#include <ast/var-dec.hh>
+
+namespace type
+{
+
+ /** \brief The base object for Class attributes.
+ **
+ ** Very much like Named, but it is *not* a Type. */
+ class Attribute
+ {
+ /** \name Constructor.
+ ** \{ */
+ public:
+ /** \brief Construct a Attribute.
+ ** \param def attribute's definition site.*/
+ explicit Attribute(const ast::VarDec* def);
+ /** \} */
+
+ /** \name Accessors.
+ ** \{ */
+ public:
+ /// Return the attribute's name.
+ misc::symbol name_get() const;
+ /// Return the attribute's type.
+ const Type& type_get() const;
+ /// Return attribute's definition site.
+ const ast::VarDec* def_get() const;
+ /// Set the attribute's definition site.
+ void def_set(const ast::VarDec* def);
+ /** \} */
+
+ private:
+ const ast::VarDec* def_;
+ };
+
+} // namespace type
+
+#include <type/attribute.hxx>