Added fix to Fn find_node

This commit is contained in:
Riley-Kilgore 2024-08-08 17:15:28 -07:00
parent 6fd9b34b92
commit 52c8ca6cee
1 changed files with 14 additions and 2 deletions

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 {