Extract a function declaration
(
&self,
node: &Node,
source: &str,
file_path: &str,
exported: bool,
)
| 674 | |
| 675 | /// Extract a function declaration |
| 676 | fn extract_function( |
| 677 | &self, |
| 678 | node: &Node, |
| 679 | source: &str, |
| 680 | file_path: &str, |
| 681 | exported: bool, |
| 682 | ) -> Option<Entity> { |
| 683 | let name_node = node.child_by_field_name("name")?; |
| 684 | let name = self.node_text(&name_node, source)?; |
| 685 | |
| 686 | let signature = self.build_function_signature(node, source); |
| 687 | |
| 688 | Some( |
| 689 | Entity::new( |
| 690 | name, |
| 691 | EntityKind::Function, |
| 692 | file_path, |
| 693 | node.start_position().row as u32 + 1, |
| 694 | node.end_position().row as u32 + 1, |
| 695 | ) |
| 696 | .with_column(node.start_position().column as u32) |
| 697 | .with_signature(signature) |
| 698 | .with_exported(exported), |
| 699 | ) |
| 700 | } |
| 701 | |
| 702 | /// Extract variable declarations (const, let, var) |
| 703 | /// Handles arrow functions assigned to variables |
no test coverage detected