mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
add AnnotatedBody in AST enum type
This commit is contained in:
parent
b0c169bc5a
commit
efe3497cc9
3 changed files with 100 additions and 31 deletions
|
@ -277,6 +277,14 @@ pub enum Def<'a> {
|
|||
// No need to track that relationship in any data structure.
|
||||
Body(&'a Loc<Pattern<'a>>, &'a Loc<Expr<'a>>),
|
||||
|
||||
AnnotatedBody {
|
||||
ann_pattern: Loc<Pattern<'a>>,
|
||||
ann_type: Loc<TypeAnnotation<'a>>,
|
||||
comment: Option<&'a str>,
|
||||
body_pattern: Loc<Pattern<'a>>,
|
||||
body_expr: Loc<Expr<'a>>,
|
||||
},
|
||||
|
||||
// Blank Space (e.g. comments, spaces, newlines) before or after a def.
|
||||
// We preserve this for the formatter; canonicalization ignores it.
|
||||
SpaceBefore(&'a Def<'a>, &'a [CommentOrNewline<'a>]),
|
||||
|
@ -668,6 +676,7 @@ impl<'a> Spaceable<'a> for Def<'a> {
|
|||
/// "currently attempting to parse a list." This helps error messages!
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Attempting {
|
||||
LineComment,
|
||||
List,
|
||||
Keyword,
|
||||
StrLiteral,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue