Extract a function declaration
(
&self,
node: &Node,
source: &str,
file_path: &str,
exported: bool,
)
| 646 | |
| 647 | /// Extract a function declaration |
| 648 | fn extract_function( |
| 649 | &self, |
| 650 | node: &Node, |
| 651 | source: &str, |
| 652 | file_path: &str, |
| 653 | exported: bool, |
| 654 | ) -> Option<Entity> { |
| 655 | let name_node = node.child_by_field_name("name")?; |
| 656 | let name = self.node_text(&name_node, source)?; |
| 657 | |
| 658 | let signature = self.build_function_signature(node, source); |
| 659 | |
| 660 | Some( |
| 661 | Entity::new( |
| 662 | name, |
| 663 | EntityKind::Function, |
| 664 | file_path, |
| 665 | node.start_position().row as u32 + 1, |
| 666 | node.end_position().row as u32 + 1, |
| 667 | ) |
| 668 | .with_column(node.start_position().column as u32) |
| 669 | .with_signature(signature) |
| 670 | .with_exported(exported), |
| 671 | ) |
| 672 | } |
| 673 | |
| 674 | /// Extract variable declarations (const, let, var) |
| 675 | /// Handles arrow functions assigned to variables |
no test coverage detected