parse the region of the preceding comment for an expect

This commit is contained in:
Folkert 2022-07-19 00:12:15 +02:00 committed by Richard Feldman
parent 35733d51dc
commit 7597d11b59
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
8 changed files with 35 additions and 11 deletions

View file

@ -2457,9 +2457,12 @@ fn to_pending_value_def<'a>(
}
}
Expect(condition) => PendingValue::Expect(PendingExpect {
Expect {
condition,
preceding_comment: Region::zero(),
preceding_comment,
} => PendingValue::Expect(PendingExpect {
condition,
preceding_comment: *preceding_comment,
}),
}
}

View file

@ -82,9 +82,15 @@ fn desugar_value_def<'a>(arena: &'a Bump, def: &'a ValueDef<'a>) -> ValueDef<'a>
body_pattern: *body_pattern,
body_expr: desugar_expr(arena, body_expr),
},
Expect(condition) => {
Expect {
condition,
preceding_comment,
} => {
let desugared_condition = &*arena.alloc(desugar_expr(arena, condition));
Expect(desugared_condition)
Expect {
condition: desugared_condition,
preceding_comment: *preceding_comment,
}
}
}
}