mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Initial scaffolding for building a witness table for an impl. (#3743)
Add an instruction to hold the witness table, along with a corresponding
type to keep things simpler. Add `check/impl.{h,cpp}` to house the new
logic. No checking of impls against interfaces is performed yet.
---------
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
2424ea16ea
commit
abf23ae7fe
@@ -5,6 +5,7 @@
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/convert.h"
|
||||
#include "toolchain/check/decl_name_stack.h"
|
||||
#include "toolchain/check/impl.h"
|
||||
#include "toolchain/check/modifiers.h"
|
||||
#include "toolchain/parse/typed_nodes.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
@@ -270,11 +271,14 @@ auto HandleImplDefinition(Context& context,
|
||||
Parse::ImplDefinitionId /*parse_node*/) -> bool {
|
||||
auto impl_id =
|
||||
context.node_stack().Pop<Parse::NodeKind::ImplDefinitionStart>();
|
||||
|
||||
if (!context.impls().Get(impl_id).is_defined()) {
|
||||
context.impls().Get(impl_id).witness_id =
|
||||
BuildImplWitness(context, impl_id);
|
||||
}
|
||||
|
||||
context.inst_block_stack().Pop();
|
||||
context.decl_name_stack().PopScope();
|
||||
|
||||
// The impl is now fully defined.
|
||||
context.impls().Get(impl_id).defined = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user