Extract a function declaration
(
&self,
node: &Node,
source: &str,
file_path: &str,
exported: bool,
)
| 629 | |
| 630 | /// Extract a function declaration |
| 631 | fn extract_function( |
| 632 | &self, |
| 633 | node: &Node, |
| 634 | source: &str, |
| 635 | file_path: &str, |
| 636 | exported: bool, |
| 637 | ) -> Option<Entity> { |
| 638 | let name_node = node.child_by_field_name("name")?; |
| 639 | let name = self.node_text(&name_node, source)?; |
| 640 | |
| 641 | let signature = self.build_function_signature(node, source); |
| 642 | |
| 643 | Some( |
| 644 | Entity::new( |
| 645 | name, |
| 646 | EntityKind::Function, |
| 647 | file_path, |
| 648 | node.start_position().row as u32 + 1, |
| 649 | node.end_position().row as u32 + 1, |
| 650 | ) |
| 651 | .with_column(node.start_position().column as u32) |
| 652 | .with_signature(signature) |
| 653 | .with_exported(exported), |
| 654 | ) |
| 655 | } |
| 656 | |
| 657 | /// Extract variable declarations (const, let, var) |
| 658 | /// Handles arrow functions assigned to variables |
no test coverage detected