From 56a1244380133ab400f98d2da15353e080ffb360 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 15 Oct 2026 14:46:38 +0200 Subject: Restrict index types to Int and Word --- include/elna/boot/name_analysis.h | 10 ++++++++-- include/elna/boot/symbol.h | 10 ++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/elna/boot/name_analysis.h b/include/elna/boot/name_analysis.h index 1d9676a..3363fe5 100644 --- a/include/elna/boot/name_analysis.h +++ b/include/elna/boot/name_analysis.h @@ -133,13 +133,18 @@ namespace elna::boot constant_procedure, constant_record_constructor, module_entry, - enumeration_values + enumeration_values, + array_dimension_size }; struct not_initialized { std::vector identifiers; }; - using payload_type = std::variant; + struct array_dimension_type + { + type actual; + }; + using payload_type = std::variant; declaration_format_error(const source_position position, payload_type payload); std::optional note() const override; @@ -235,6 +240,7 @@ namespace elna::boot protected: type current_type; symbol_bag& bag; + const target_info& target; evaluator constant_evaluator; std::filesystem::path module_file; /// Number of defer bodies the visited statement stands in. diff --git a/include/elna/boot/symbol.h b/include/elna/boot/symbol.h index 190a297..c9ba88a 100644 --- a/include/elna/boot/symbol.h +++ b/include/elna/boot/symbol.h @@ -835,6 +835,16 @@ namespace elna::boot */ bool is_numeric_type(const type& checked); + /** + * Checks whether the given type is suitable as an index or dimension + * (\c Word or \c Int). + * + * \param checked The type to check. + * \param target Target type information. + * \return Whether the type is an index type. + */ + bool is_index_type(const type& checked, const target_info& target); + /** * Checks whether the given type is an integral primitive type * (\c Int or \c Word). -- cgit v1.2.3