typescriptExtractor.resolveBody / javascriptExtractor.resolveBody: the body of a function-valued class field, nested in the arrow / HOF-wrapped arrow.
(node: Node)
| 1142 | /// typescriptExtractor.resolveBody / javascriptExtractor.resolveBody: the body |
| 1143 | /// of a function-valued class field, nested in the arrow / HOF-wrapped arrow. |
| 1144 | fn resolve_field_body(node: Node) -> Option<Node> { |
| 1145 | if !matches!(node.kind(), "public_field_definition" | "field_definition") { |
| 1146 | return None; |
| 1147 | } |
| 1148 | for i in 0..node.named_child_count() { |
| 1149 | let child = node.named_child(i)?; |
| 1150 | if matches!(child.kind(), "arrow_function" | "function_expression") { |
| 1151 | return child.child_by_field_name("body"); |
| 1152 | } |
| 1153 | if child.kind() == "call_expression" { |
| 1154 | if let Some(args) = child.child_by_field_name("arguments") { |
| 1155 | for arg in args.named_children(&mut args.walk()) { |
| 1156 | if matches!(arg.kind(), "arrow_function" | "function_expression") { |
| 1157 | return arg.child_by_field_name("body"); |
| 1158 | } |
| 1159 | } |
| 1160 | } |
| 1161 | } |
| 1162 | } |
| 1163 | None |
| 1164 | } |
| 1165 | |
| 1166 | /// resolveBody ?? getChildByField(node, 'body') — the body-walk resolution. |
| 1167 | fn body_of(node: Node) -> Option<Node> { |
no test coverage detected