diff options
Diffstat (limited to 'boot/symbol.cc')
| -rw-r--r-- | boot/symbol.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/boot/symbol.cc b/boot/symbol.cc index 9854acc..05eea31 100644 --- a/boot/symbol.cc +++ b/boot/symbol.cc @@ -284,7 +284,8 @@ namespace elna::boot static void builtin_integers(const std::shared_ptr<symbol_table>& symbols, const std::array<type_properties, target_integer_count>& properties, - const std::string& integer_name) + const std::string& integer_name, + std::vector<std::shared_ptr<alias_type>>& alias_owners) { for (std::size_t i = 1; i < properties.size(); ++i) { @@ -293,6 +294,16 @@ namespace elna::boot const type variant_type = type(std::make_shared<primitive_type>(type_name, properties[i])); symbols->enter(type_name, std::make_shared<type_info>(variant_type)); + + // The unsuffixed integer type is an alias of the fixed-size type + // matching the machine word. + if (bit_size == properties.front().size * CHAR_BIT) + { + auto alias = std::make_shared<alias_type>(integer_name, variant_type); + + alias_owners.push_back(alias); + symbols->enter(integer_name, std::make_shared<type_info>(type(alias))); + } } if (!symbols->contains(integer_name)) { @@ -302,12 +313,13 @@ namespace elna::boot } } - std::shared_ptr<symbol_table> builtin_symbol_table(const target_info& target) + std::shared_ptr<symbol_table> builtin_symbol_table(const target_info& target, + std::vector<std::shared_ptr<alias_type>>& alias_owners) { auto result = std::make_shared<symbol_table>(); - builtin_integers(result, target.int_properties, "Int"); - builtin_integers(result, target.word_properties, "Word"); + builtin_integers(result, target.int_properties, "Int", alias_owners); + builtin_integers(result, target.word_properties, "Word", alias_owners); result->enter("Char", std::make_shared<type_info>(type(std::make_shared<primitive_type>("Char", target.char_properties)))); @@ -494,7 +506,7 @@ namespace elna::boot { if (auto base = resolve_aliases(slice->base).get<constant_type>()) { - return is_primitive_type(resolve_aliases(base->unqualified), "Char"); + return is_primitive_type(resolve_aliases(base->unqualified), "Word8"); } } return false; |
