mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 20:11:12 +01:00
Initial support for binding patterns in SemIR (#4221)
Introduces the `BindingPattern` and `SymbolicBindingPattern` insts, and a separate stack of pattern blocks that they are emitted into. The intent is to generate the corresponding pattern-matching insts (like `BindName`) from them in a separate pass, but that is deferred to future PRs. See [here](https://docs.google.com/document/d/1U_vQH17V893J9aF1LJXUnFYBNSs2MjKl4bJPaWCB2zo/edit?usp=sharing&resourcekey=0-w0xGYZ0An31Kpz-wvzSXwQ) for the design this is based on, but note that during review we have chosen to deviate from that design by putting the patterns in separate blocks, and omitting the "forward references" from a `BindingPattern` to its corresponding `BindName`. This in turn necessitates having separate inst kinds for symbolic and non-symbolic binding patterns. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
87678cc374
commit
dc32aa2690
@@ -25,6 +25,10 @@ auto HandleParseNode(Context& context, Parse::InterfaceIntroducerId node_id)
|
||||
context.decl_name_stack().PushScopeAndStartName();
|
||||
// This interface is potentially generic.
|
||||
StartGenericDecl(context);
|
||||
// Push a pattern block for the signature (if any) of the first NameComponent.
|
||||
// TODO: Instead use a separate parse node kind for an identifier that's
|
||||
// followed by a pattern, and push a pattern block when handling it.
|
||||
context.pattern_block_stack().Push();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user