aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-10-15 14:46:38 +0200
committerEugen Wissner <belka@caraus.de>2026-10-15 14:46:38 +0200
commit56a1244380133ab400f98d2da15353e080ffb360 (patch)
treef4e0aef02c8d356fc2c67bfdb2f1c490858c24cf /include
parentde6ecae0f072bb32be95382c536a517eabe4b1f1 (diff)
downloadelna-56a1244380133ab400f98d2da15353e080ffb360.tar.gz
Restrict index types to Int and WordHEADcpp
Diffstat (limited to 'include')
-rw-r--r--include/elna/boot/name_analysis.h10
-rw-r--r--include/elna/boot/symbol.h10
2 files changed, 18 insertions, 2 deletions
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<identifier> identifiers;
};
- using payload_type = std::variant<not_initialized, kind>;
+ struct array_dimension_type
+ {
+ type actual;
+ };
+ using payload_type = std::variant<not_initialized, array_dimension_type, kind>;
declaration_format_error(const source_position position, payload_type payload);
std::optional<diagnostic_note> 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
@@ -836,6 +836,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).
*