Merge pull request #998 from aiken-lang/riley/misc-hover

Added more granularity to find_node for Fn
This commit is contained in:
Matthias Benkort
2024-08-12 02:16:38 +02:00
committed by GitHub

View File

@@ -377,8 +377,20 @@ impl TypedExpr {
expressions.iter().find_map(|e| e.find_node(byte_index))
}
TypedExpr::Fn { body, .. } => body
.find_node(byte_index)
TypedExpr::Fn {
body,
args,
return_annotation,
..
} => args
.iter()
.find_map(|arg| arg.find_node(byte_index))
.or_else(|| body.find_node(byte_index))
.or_else(|| {
return_annotation
.as_ref()
.and_then(|a| a.find_node(byte_index))
})
.or(Some(Located::Expression(self))),
TypedExpr::Tuple {