typescriptExtractor.resolveBody / javascriptExtractor.resolveBody: the body of a function-valued class field, nested in the arrow / HOF-wrapped arrow.
(node: Node)
| 1129 | /// typescriptExtractor.resolveBody / javascriptExtractor.resolveBody: the body |
| 1130 | /// of a function-valued class field, nested in the arrow / HOF-wrapped arrow. |
| 1131 | fn resolve_field_body(node: Node) -> Option<Node> { |
| 1132 | if !matches!(node.kind(), "public_field_definition" | "field_definition") { |
| 1133 | return None; |
| 1134 | } |
| 1135 | for i in 0..node.named_child_count() { |
| 1136 | let child = node.named_child(i)?; |
| 1137 | if matches!(child.kind(), "arrow_function" | "function_expression") { |
| 1138 | return child.child_by_field_name("body"); |
| 1139 | } |
| 1140 | if child.kind() == "call_expression" { |
| 1141 | if let Some(args) = child.child_by_field_name("arguments") { |
| 1142 | for j in 0..args.named_child_count() { |
| 1143 | if let Some(arg) = args.named_child(j) { |
| 1144 | if matches!(arg.kind(), "arrow_function" | "function_expression") { |
| 1145 | return arg.child_by_field_name("body"); |
| 1146 | } |
| 1147 | } |
| 1148 | } |
| 1149 | } |
| 1150 | } |
| 1151 | } |
| 1152 | None |
| 1153 | } |
| 1154 | |
| 1155 | /// resolveBody ?? getChildByField(node, 'body') — the body-walk resolution. |
| 1156 | fn body_of(node: Node) -> Option<Node> { |
no outgoing calls
no test coverage detected