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 --- boot/symbol.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'boot/symbol.cc') diff --git a/boot/symbol.cc b/boot/symbol.cc index 8feba4a..310ae8a 100644 --- a/boot/symbol.cc +++ b/boot/symbol.cc @@ -830,6 +830,21 @@ namespace elna::boot || is_float_type(checked); } + bool is_index_type(const type& checked, const target_info& target) + { + const type unaliased = resolve_underlying_type(checked); + if (const auto primitive = unaliased.get()) + { + const bool is_int = primitive->identifier.starts_with("Int") + && primitive->properties.size == target.int_properties.front().size; + const bool is_word = primitive->identifier.starts_with("Word") + && primitive->properties.size == target.word_properties.front().size; + + return is_int || is_word; + } + return false; + } + bool is_integral_type(const type& checked) { return is_integer_type(checked) || is_word_type(checked); -- cgit v1.2.3