mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:06:21 +01:00
Implement checking observe declarations (#6709)
This adds SemIR structs and implements building `observe` lists, as well as naming, formatting, and importing `observe` declarations. --------- Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
co-authored by
Dana Jansens
parent
918bb9364f
commit
08385adeb5
@@ -198,6 +198,7 @@ auto HandleParseNode(Context& context,
|
||||
|
||||
context.inst_block_stack().Push();
|
||||
context.require_impls_stack().Push(interface_id);
|
||||
context.observe_stack().PushArray();
|
||||
// We use the arg stack to build the witness table type.
|
||||
context.args_type_info_stack().Push();
|
||||
|
||||
@@ -229,9 +230,14 @@ auto HandleParseNode(Context& context, Parse::InterfaceDefinitionId /*node_id*/)
|
||||
context.require_impls_stack().PeekTop());
|
||||
context.require_impls_stack().Pop();
|
||||
|
||||
auto observe_block_id =
|
||||
context.observe_blocks().Add(context.observe_stack().PeekArray());
|
||||
context.observe_stack().PopArray();
|
||||
|
||||
auto& interface_info = context.interfaces().Get(interface_id);
|
||||
if (!interface_info.associated_entities_id.has_value()) {
|
||||
interface_info.require_impls_block_id = require_impls_block_id;
|
||||
interface_info.observe_block_id = observe_block_id;
|
||||
// This marks the interface type as fully defined.
|
||||
interface_info.associated_entities_id = associated_entities_id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user