From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- tiger-compiler/src/ast/field-init.hh | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tiger-compiler/src/ast/field-init.hh (limited to 'tiger-compiler/src/ast/field-init.hh') diff --git a/tiger-compiler/src/ast/field-init.hh b/tiger-compiler/src/ast/field-init.hh new file mode 100644 index 0000000..9ea18b2 --- /dev/null +++ b/tiger-compiler/src/ast/field-init.hh @@ -0,0 +1,55 @@ +/** + ** \file ast/field-init.hh + ** \brief Declaration of ast::FieldInit. + */ + +#pragma once + +#include +#include +#include + +namespace ast +{ + /// FieldInit. + class FieldInit : public Ast + { + public: + /** \name Ctor & dtor. + ** \{ */ + /// Construct a FieldInit node. + FieldInit(const Location& location, misc::symbol name, Exp* init); + FieldInit(const FieldInit&) = delete; + FieldInit& operator=(const FieldInit&) = delete; + /// Destroy a FieldInit node. + ~FieldInit() 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 name of the field. + misc::symbol name_get() const; + /// Set name of the field. + void name_set(misc::symbol); + /// Return initial value of the field. + const Exp& init_get() const; + /// Return initial value of the field. + Exp& init_get(); + /** \} */ + + protected: + /// Name of the field. + misc::symbol name_; + /// Initial value of the field. + Exp* init_; + }; +} // namespace ast +#include -- cgit v1.2.3