Build function signature from declaration
(&self, node: &Node, source: &str)
| 989 | |
| 990 | /// Build function signature from declaration |
| 991 | fn build_function_signature(&self, node: &Node, source: &str) -> String { |
| 992 | let start = node.start_byte(); |
| 993 | |
| 994 | // Find the body to exclude it from signature |
| 995 | let body_start = node |
| 996 | .child_by_field_name("body") |
| 997 | .map(|b| b.start_byte()) |
| 998 | .unwrap_or(node.end_byte()); |
| 999 | |
| 1000 | let sig = &source[start..body_start]; |
| 1001 | |
| 1002 | // Clean up: remove newlines and extra whitespace |
| 1003 | sig.lines() |
| 1004 | .map(|l| l.trim()) |
| 1005 | .collect::<Vec<_>>() |
| 1006 | .join(" ") |
| 1007 | .trim() |
| 1008 | .to_string() |
| 1009 | } |
| 1010 | |
| 1011 | /// Build arrow function signature |
| 1012 | fn build_arrow_function_signature(&self, name: &str, node: &Node, source: &str) -> String { |