mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 20:20:10 +01:00
This removes the inheritance noise, and adds label prefixes for
consistency with the raw textual format.
Before:
```
> p function_info.first_owning_decl_id
(Carbon::SemIR::InstId) {
Carbon::IdBase<Carbon::SemIR::InstId> = {
Carbon::AnyIdBase = (index = 0x50000023)
}
}
> p function_info.call_param_ranges.implicit_end_
(Carbon::SemIR::CallParamIndex) {
Carbon::IndexBase<Carbon::SemIR::CallParamIndex> = {
Carbon::IdBase<Carbon::SemIR::CallParamIndex> = {
Carbon::AnyIdBase = (index = 0x00000001)
}
}
}
```
After:
```
> p function_info.first_owning_decl_id
(Carbon::SemIR::InstId) inst50000023
> p function_info.call_param_ranges.implicit_end_
(Carbon::SemIR::CallParamIndex) call_param1
```
The benefit compounds when printing aggregates (which often lack `Dump`
support or omit information from it). For example, this change reduces
`p function_info` from 129 lines to just 31 (including reducing the
`call_param_ranges` field from 32 lines to just 1):
```
> p function_info
(Carbon::SemIR::Function) {
Carbon::SemIR::EntityWithParamsBase = {
name_id = name1
parent_scope_id = name_scope50000002
generic_id = generic<none>
first_param_node_id = nodeB
last_param_node_id = node12
pattern_block_id = inst_block5000000E
implicit_param_patterns_id = inst_block5000000A
param_patterns_id = inst_block0
is_extern = false
extern_library_id = library_name<none>
non_owning_decl_id = inst<none>
first_owning_decl_id = inst50000023
definition_id = inst<none>
}
Carbon::SemIR::FunctionFields = {
call_param_patterns_id = inst_block5000000C
call_params_id = inst_block5000000D
call_param_ranges = (implicit_end_ = call_param1, explicit_end_ = call_param1, return_end_ = call_param1)
return_type_inst_id = inst<none>
return_form_inst_id = inst<none>
return_pattern_id = inst<none>
special_function_kind = None
virtual_modifier = None
virtual_index = 0xffffffff
evaluation_mode = None
self_param_id = inst50000020
special_function_kind_data = any_raw<none>
body_block_ids = size=0 {}
}
}
```