mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
More impls for to_node
This commit is contained in:
parent
dbbd097708
commit
3a7265baed
2 changed files with 22 additions and 0 deletions
|
@ -1410,6 +1410,18 @@ impl<'a> Nodify<'a> for TypeAnnotation<'a> {
|
||||||
item
|
item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TypeAnnotation::BoundVariable(text) => {
|
||||||
|
let item = Spaces::item(Node::Literal(text));
|
||||||
|
|
||||||
|
if *text == "implements" {
|
||||||
|
parens_around_node(arena, item)
|
||||||
|
} else {
|
||||||
|
item
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TypeAnnotation::Inferred => Spaces::item(Node::Literal("_")),
|
||||||
|
TypeAnnotation::Wildcard => Spaces::item(Node::Literal("*")),
|
||||||
|
TypeAnnotation::Malformed(text) => Spaces::item(Node::Literal(text)),
|
||||||
_ => {
|
_ => {
|
||||||
let lifted = ann_lift_spaces(arena, self);
|
let lifted = ann_lift_spaces(arena, self);
|
||||||
Spaces {
|
Spaces {
|
||||||
|
|
|
@ -40,6 +40,16 @@ impl<'a, T: Copy> ExtractSpaces<'a> for Spaces<'a, T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, T> Spaces<'a, T> {
|
||||||
|
pub fn item(item: T) -> Self {
|
||||||
|
Self {
|
||||||
|
before: &[],
|
||||||
|
item,
|
||||||
|
after: &[],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub struct SpacesBefore<'a, T> {
|
pub struct SpacesBefore<'a, T> {
|
||||||
pub before: &'a [CommentOrNewline<'a>],
|
pub before: &'a [CommentOrNewline<'a>],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue