mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Change guard to DestructType
This commit is contained in:
parent
85f51ef39d
commit
8b53ec15fe
4 changed files with 69 additions and 16 deletions
|
@ -25,7 +25,9 @@ impl<'a> Formattable<'a> for Pattern<'a> {
|
|||
Pattern::Nested(nested_pat) => nested_pat.is_multiline(),
|
||||
|
||||
Pattern::RecordDestructure(fields) => fields.iter().any(|f| f.is_multiline()),
|
||||
Pattern::RecordField(_, subpattern) => subpattern.is_multiline(),
|
||||
Pattern::RequiredField(_, subpattern) | Pattern::OptionalField(_, subpattern) => {
|
||||
subpattern.is_multiline()
|
||||
}
|
||||
|
||||
Pattern::Identifier(_)
|
||||
| Pattern::GlobalTag(_)
|
||||
|
@ -92,12 +94,18 @@ impl<'a> Formattable<'a> for Pattern<'a> {
|
|||
buf.push_str(" }");
|
||||
}
|
||||
|
||||
RecordField(name, loc_pattern) => {
|
||||
RequiredField(name, loc_pattern) => {
|
||||
buf.push_str(name);
|
||||
buf.push_str(": ");
|
||||
loc_pattern.format(buf, indent);
|
||||
}
|
||||
|
||||
OptionalField(name, loc_pattern) => {
|
||||
buf.push_str(name);
|
||||
buf.push_str(" ? ");
|
||||
loc_pattern.format(buf, indent);
|
||||
}
|
||||
|
||||
NumLiteral(string) => buf.push_str(string),
|
||||
NonBase10Literal {
|
||||
base,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue