mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:40:12 +01:00
Implement unused pattern bindings, continued (#6518)
Implementation of unused pattern bindings #2022, continued. Whereas previous PR #6460 took care of parsing, and PR #6479 prepared the stage by using _ in some test cases, this PR has the the actual implementation, using a simple dataflow analysis. --------- Co-authored-by: Burak Emir <bqe@google.com> Co-authored-by: jonmeow <jperkins@google.com>
This commit is contained in:
co-authored by
Burak Emir
jonmeow
parent
bea24a8bee
commit
fdb188ccfd
@@ -37,13 +37,16 @@ struct BindingPatternInfo {
|
||||
|
||||
// Creates a binding pattern. Returns the binding pattern and the bind name
|
||||
// instruction.
|
||||
// - `pattern_kind` specifies the kind of instruction to create.
|
||||
// - `is_template` indicates whether this is a template binding.
|
||||
// - `is_unused` indicates whether the binding was explicitly marked `unused`.
|
||||
// TODO: remove is_template once we have a separate InstKind for template
|
||||
// bindings.
|
||||
auto AddBindingPattern(Context& context, SemIR::LocId name_loc,
|
||||
SemIR::NameId name_id, SemIR::TypeId type_id,
|
||||
SemIR::ExprRegionId type_region_id,
|
||||
SemIR::InstKind pattern_kind, bool is_template)
|
||||
-> BindingPatternInfo;
|
||||
SemIR::InstKind pattern_kind, bool is_template,
|
||||
bool is_unused) -> BindingPatternInfo;
|
||||
|
||||
// Creates storage for `var` patterns nested within the given pattern at the
|
||||
// current location in the output SemIR. For a `returned var`, this
|
||||
|
||||
Reference in New Issue
Block a user