summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/type/field.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/type/field.hh
add: added projectsHEADmain
Diffstat (limited to 'tiger-compiler/src/type/field.hh')
-rw-r--r--tiger-compiler/src/type/field.hh45
1 files changed, 45 insertions, 0 deletions
diff --git a/tiger-compiler/src/type/field.hh b/tiger-compiler/src/type/field.hh
new file mode 100644
index 0000000..e1f5609
--- /dev/null
+++ b/tiger-compiler/src/type/field.hh
@@ -0,0 +1,45 @@
+/**
+ ** \file type/field.hh
+ ** \brief The class Field (of a record type).
+ */
+#pragma once
+
+#include <misc/symbol.hh>
+#include <type/fwd.hh>
+#include <type/type.hh>
+
+namespace type
+{
+ /** \brief The base type for Record fields.
+ **
+ ** Very much like Named, but it is *not* a Type. */
+ class Field
+ {
+ public:
+ /** \name Ctor & dtor.
+ ** \{ */
+ /** \brief Construct a Field.
+ ** \param name field's identifier.
+ ** \param type field's type. */
+ Field(misc::symbol name, const Type& type);
+ /** \} */
+
+ /** \name Accessors.
+ ** \{ */
+ /// Return the field's name.
+ misc::symbol name_get() const;
+ /// Return the field's type.
+ const Type& type_get() const;
+ /** \} */
+
+ protected:
+ /// Field's identifier.
+ misc::symbol name_;
+
+ /// Field's type.
+ const Type& type_;
+ };
+
+} // namespace type
+
+#include <type/field.hxx>