Some(inner) when the initializer is a recognized component wrapper — inner is the inline render function, or None for `styled.x`/`memo(Ref)`. Outer None = not a component wrapper.
(&self, value: Node<'t>)
| 71 | /// inner is the inline render function, or None for `styled.x`/`memo(Ref)`. |
| 72 | /// Outer None = not a component wrapper. |
| 73 | fn react_component_hoc(&self, value: Node<'t>) -> Option<Option<Node<'t>>> { |
| 74 | if value.kind() != "call_expression" { |
| 75 | return None; |
| 76 | } |
| 77 | let callee = value.child_by_field_name("function")?; |
| 78 | let callee_text = self.text(callee); |
| 79 | if util::styled_callee().is_match(callee_text) { |
| 80 | return Some(None); |
| 81 | } |
| 82 | if !is_react_hoc(callee_text) { |
| 83 | return None; |
| 84 | } |
| 85 | let mut inner: Option<Node> = None; |
| 86 | if let Some(args) = value.child_by_field_name("arguments") { |
| 87 | for i in 0..args.named_child_count() { |
| 88 | if let Some(a) = args.named_child(i) { |
| 89 | if matches!(a.kind(), "arrow_function" | "function_expression") { |
| 90 | inner = Some(a); |
| 91 | break; |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | Some(inner) |
| 97 | } |
| 98 | |
| 99 | fn extract_react_component_node( |
| 100 | &mut self, |
no test coverage detected