typescriptExtractor.resolveBody / javascriptExtractor.resolveBody: the body of a function-valued class field, nested in the arrow / HOF-wrapped arrow.
(node: Node)
| 1256 | /// typescriptExtractor.resolveBody / javascriptExtractor.resolveBody: the body |
| 1257 | /// of a function-valued class field, nested in the arrow / HOF-wrapped arrow. |
| 1258 | fn resolve_field_body(node: Node) -> Option<Node> { |
| 1259 | if !matches!(node.kind(), "public_field_definition" | "field_definition") { |
| 1260 | return None; |
| 1261 | } |
| 1262 | for i in 0..node.named_child_count() { |
| 1263 | let child = node.named_child(i)?; |
| 1264 | if matches!(child.kind(), "arrow_function" | "function_expression") { |
| 1265 | return child.child_by_field_name("body"); |
| 1266 | } |
| 1267 | if child.kind() == "call_expression" { |
| 1268 | if let Some(args) = child.child_by_field_name("arguments") { |
| 1269 | for arg in args.named_children(&mut args.walk()) { |
| 1270 | if matches!(arg.kind(), "arrow_function" | "function_expression") { |
| 1271 | return arg.child_by_field_name("body"); |
| 1272 | } |
| 1273 | } |
| 1274 | } |
| 1275 | } |
| 1276 | } |
| 1277 | None |
| 1278 | } |
| 1279 | |
| 1280 | /// resolveBody ?? getChildByField(node, 'body') — the body-walk resolution. |
| 1281 | fn body_of(node: Node) -> Option<Node> { |
no test coverage detected