mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-27 02:11:17 +00:00
Add check support for struct patterns (#7876)
Implements check and pattern matching support for struct patterns. This PR implements complete patterns, and leaves `_` field handling for future work.
This commit is contained in:
1 parent
3ee012b86a
commit
c6b54b57e2
23 files changed
+1764
-110
No files matched your search
@@ -65,7 +65,11 @@ auto GetFirstBindingNameFromPatternId(const File& sem_ir, InstId pattern_id)
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Look through struct patterns.
|
||||
if (auto struct_patt = inst.TryAs<StructPattern>()) {
|
||||
auto block = sem_ir.inst_blocks().Get(struct_patt->elements_id);
|
||||
work_list.append(block.rbegin(), block.rend());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto ref_pattern = inst.TryAs<RefParamPattern>()) {
|
||||
// TODO: This introduces a name, but we don't model it as a binding.
|
||||
|
||||
Reference in new issue
Block a user