diff options
Diffstat (limited to 'tiger-compiler/src/type/field.hh')
| -rw-r--r-- | tiger-compiler/src/type/field.hh | 45 |
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> |
