diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-08-30 22:36:32 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-08-30 22:36:32 +0200 |
| commit | 26a1b9ad9f347315bc14f2bf3ee064ede51794fc (patch) | |
| tree | 64ecb7c41cb4b3f26ccbd216197c667d5cd8d8bd /boot/symbol.cc | |
| parent | dbca249757a98d6d56e23db43baa93ad30a91709 (diff) | |
| download | elna-26a1b9ad9f347315bc14f2bf3ee064ede51794fc.tar.gz | |
Fix record constructor for base records
Diffstat (limited to 'boot/symbol.cc')
| -rw-r--r-- | boot/symbol.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/boot/symbol.cc b/boot/symbol.cc index 4d6832d..0d847e1 100644 --- a/boot/symbol.cc +++ b/boot/symbol.cc @@ -176,11 +176,11 @@ namespace elna::boot if (payload->return_type.no_return) { - result += ": !"; + result += " -> !"; } else if (!payload->return_type.proper_type.empty()) { - result += ": " + payload->return_type.proper_type.to_string(); + result += " -> " + payload->return_type.proper_type.to_string(); } return result; } @@ -570,4 +570,25 @@ namespace elna::boot } return type(); } + + type lookup_field(const type& composite_type, const std::string& field_name) + { + const type resolved_type = resolve_underlying_type(composite_type); + + if (auto record = resolved_type.get<record_type>()) + { + for (const auto& [name, field_type] : record->fields) + { + if (name == field_name) + { + return field_type; + } + } + if (!record->base.empty()) + { + return lookup_field(record->base, field_name); + } + } + return type(); + } } |
