mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
add OptionalField constructor
This commit is contained in:
parent
1b4f7ccfa5
commit
c4971675eb
6 changed files with 30 additions and 0 deletions
|
@ -353,6 +353,7 @@ pub fn assigned_expr_field_to_pattern<'a>(
|
|||
)
|
||||
}
|
||||
}
|
||||
AssignedField::OptionalField(_, _, _) => panic!("invalid in literals"),
|
||||
AssignedField::LabelOnly(name) => Pattern::Identifier(name.value),
|
||||
AssignedField::SpaceBefore(nested, spaces) => Pattern::SpaceBefore(
|
||||
arena.alloc(assigned_expr_field_to_pattern(arena, nested)?),
|
||||
|
@ -393,6 +394,9 @@ pub fn assigned_pattern_field_to_pattern<'a>(
|
|||
)
|
||||
}
|
||||
}
|
||||
AssignedField::OptionalField(_, _, _) => {
|
||||
panic!("invalid as a pattern");
|
||||
}
|
||||
AssignedField::LabelOnly(name) => Located::at(name.region, Pattern::Identifier(name.value)),
|
||||
AssignedField::SpaceBefore(nested, spaces) => {
|
||||
let can_nested = assigned_pattern_field_to_pattern(arena, nested, backup_region)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue