typescriptExtractor.resolveBody / javascriptExtractor.resolveBody: the body of a function-valued class field, nested in the arrow / HOF-wrapped arrow.
(node: Node)
| 872 | /// typescriptExtractor.resolveBody / javascriptExtractor.resolveBody: the body |
| 873 | /// of a function-valued class field, nested in the arrow / HOF-wrapped arrow. |
| 874 | fn resolve_field_body(node: Node) -> Option<Node> { |
| 875 | if !matches!(node.kind(), "public_field_definition" | "field_definition") { |
| 876 | return None; |
| 877 | } |
| 878 | for i in 0..node.named_child_count() { |
| 879 | let child = node.named_child(i)?; |
| 880 | if matches!(child.kind(), "arrow_function" | "function_expression") { |
| 881 | return child.child_by_field_name("body"); |
| 882 | } |
| 883 | if child.kind() == "call_expression" { |
| 884 | if let Some(args) = child.child_by_field_name("arguments") { |
| 885 | for j in 0..args.named_child_count() { |
| 886 | if let Some(arg) = args.named_child(j) { |
| 887 | if matches!(arg.kind(), "arrow_function" | "function_expression") { |
| 888 | return arg.child_by_field_name("body"); |
| 889 | } |
| 890 | } |
| 891 | } |
| 892 | } |
| 893 | } |
| 894 | } |
| 895 | None |
| 896 | } |
| 897 | |
| 898 | /// resolveBody ?? getChildByField(node, 'body') — the body-walk resolution. |
| 899 | fn body_of(node: Node) -> Option<Node> { |
no outgoing calls
no test coverage detected