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/object/libobject.hxx | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tiger-compiler/src/object/libobject.hxx (limited to 'tiger-compiler/src/object/libobject.hxx') diff --git a/tiger-compiler/src/object/libobject.hxx b/tiger-compiler/src/object/libobject.hxx new file mode 100644 index 0000000..7c75b08 --- /dev/null +++ b/tiger-compiler/src/object/libobject.hxx @@ -0,0 +1,48 @@ +#pragma once + +/** + ** \file object/libobject.hxx + ** \brief Functions exported by the object module. + */ + +#include + +#include +#include +#include + +namespace object +{ + + /*------------------. + | Desugar objects. | + `------------------*/ + + template + A* raw_desugar(const A& tree, const class_names_type& class_names) + { + // Desugar. + ::object::DesugarVisitor desugar(class_names); + desugar(tree); + return dynamic_cast(desugar.result_get()); + } + + template + A* desugar(const A& tree, const class_names_type& class_names) + { + // Desugar. + A* desugared = raw_desugar(tree, class_names); + assertion(desugared); + std::unique_ptr desugared_ptr(desugared); + // Recompute the bindings and the types. + ::desugar::bind_and_types_check(*desugared_ptr); + return desugared_ptr.release(); + } + + /// Explicit instantiations. + template ast::ChunkList* raw_desugar(const ast::ChunkList&, + const class_names_type&); + template ast::ChunkList* desugar(const ast::ChunkList&, + const class_names_type&); + +} // namespace object -- cgit v1.2.3