From e676e74efbbbf62887b9442326399eebccc4d108 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 17 Jul 2026 16:16:23 +0200 Subject: Handle base type constness --- include/elna/boot/symbol.h | 58 ++++++++++++++-------------------------------- 1 file changed, 18 insertions(+), 40 deletions(-) (limited to 'include') diff --git a/include/elna/boot/symbol.h b/include/elna/boot/symbol.h index 6884dd7..216021e 100644 --- a/include/elna/boot/symbol.h +++ b/include/elna/boot/symbol.h @@ -18,11 +18,12 @@ along with GCC; see the file COPYING3. If not see #pragma once #include -#include -#include +#include #include +#include +#include +#include #include -#include #include "elna/boot/result.h" @@ -39,36 +40,21 @@ namespace elna::boot class type { - enum class type_tag - { - empty, - alias, - primitive, - record, - pointer, - constant, - array, - procedure, - enumeration - }; - type_tag tag{ type_tag::empty }; - union - { - std::weak_ptr alias; - std::shared_ptr primitive; - std::shared_ptr record; - std::shared_ptr pointer; - std::shared_ptr constant; - std::shared_ptr array; - std::shared_ptr procedure; - std::shared_ptr enumeration; - }; - - void copy(const type& other); - void move(type&& other); + std::variant< + std::monostate, + std::weak_ptr, + std::shared_ptr, + std::shared_ptr, + std::shared_ptr, + std::shared_ptr, + std::shared_ptr, + std::shared_ptr, + std::shared_ptr + > payload; public: - type(); + type() = default; + explicit type(std::shared_ptr alias); explicit type(std::shared_ptr primitive); explicit type(std::shared_ptr record); @@ -78,14 +64,6 @@ namespace elna::boot explicit type(std::shared_ptr procedure); explicit type(std::shared_ptr enumeration); - type(const type& other); - type& operator=(const type& other); - - type(type&& other); - type& operator=(type&& other); - - ~type(); - template std::shared_ptr get() const; @@ -104,7 +82,7 @@ namespace elna::boot struct alias_type { const std::string name; - type reference; + type referent; explicit alias_type(const std::string& name); }; -- cgit v1.2.3