mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 11:11:05 +01:00
Add require decls to Interface and NamedConstraint (#6321)
They are not used for impl lookup or verifying anything yet, but now they appear in the textual semir. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
81e55bed8a
commit
ff0cea55f6
@@ -129,7 +129,7 @@ auto HandleParseNode(Context& context,
|
||||
StartGenericDefinition(context, interface_info.generic_id);
|
||||
|
||||
context.inst_block_stack().Push();
|
||||
|
||||
context.require_impls_stack().PushArray();
|
||||
// We use the arg stack to build the witness table type.
|
||||
context.args_type_info_stack().Push();
|
||||
|
||||
@@ -168,9 +168,14 @@ auto HandleParseNode(Context& context, Parse::InterfaceDefinitionId /*node_id*/)
|
||||
context.inst_block_stack().Pop();
|
||||
auto associated_entities_id = context.args_type_info_stack().Pop();
|
||||
|
||||
// The interface type is now fully defined.
|
||||
auto require_impls_block_id = context.require_impls_blocks().Add(
|
||||
context.require_impls_stack().PeekArray());
|
||||
context.require_impls_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;
|
||||
// This marks the interface type as fully defined.
|
||||
interface_info.associated_entities_id = associated_entities_id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user