mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Track spaces between : and <- in record builders
This commit is contained in:
parent
23db4a5e87
commit
d1feb00170
7 changed files with 56 additions and 29 deletions
|
@ -694,8 +694,13 @@ pub enum RecordBuilderField<'a> {
|
|||
// A field with a value, e.g. `{ name: "blah" }`
|
||||
Value(Loc<&'a str>, &'a [CommentOrNewline<'a>], &'a Loc<Expr<'a>>),
|
||||
|
||||
// A field with a function we can apply to build part of the record, e.g. `{ name <- apply getName }`
|
||||
ApplyValue(Loc<&'a str>, &'a [CommentOrNewline<'a>], &'a Loc<Expr<'a>>),
|
||||
// A field with a function we can apply to build part of the record, e.g. `{ name: <- apply getName }`
|
||||
ApplyValue(
|
||||
Loc<&'a str>,
|
||||
&'a [CommentOrNewline<'a>],
|
||||
&'a [CommentOrNewline<'a>],
|
||||
&'a Loc<Expr<'a>>,
|
||||
),
|
||||
|
||||
// A label with no value, e.g. `{ name }` (this is sugar for { name: name })
|
||||
LabelOnly(Loc<&'a str>),
|
||||
|
@ -1615,9 +1620,8 @@ impl<'a, T: Malformed> Malformed for AssignedField<'a, T> {
|
|||
impl<'a> Malformed for RecordBuilderField<'a> {
|
||||
fn is_malformed(&self) -> bool {
|
||||
match self {
|
||||
RecordBuilderField::Value(_, _, expr) | RecordBuilderField::ApplyValue(_, _, expr) => {
|
||||
expr.is_malformed()
|
||||
}
|
||||
RecordBuilderField::Value(_, _, expr)
|
||||
| RecordBuilderField::ApplyValue(_, _, _, expr) => expr.is_malformed(),
|
||||
RecordBuilderField::LabelOnly(_) => false,
|
||||
RecordBuilderField::SpaceBefore(field, _)
|
||||
| RecordBuilderField::SpaceAfter(field, _) => field.is_malformed(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue