aboutsummaryrefslogtreecommitdiff
path: root/boot/symbol.cc
diff options
context:
space:
mode:
Diffstat (limited to 'boot/symbol.cc')
-rw-r--r--boot/symbol.cc25
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();
+ }
}