pub struct ComponentFunction {
pub name: String,
pub span_start: u32,
pub kind: ComponentFunctionKind,
pub is_exported: bool,
pub has_unharvestable_props: bool,
pub uses_clone_element: bool,
pub renders_provider: bool,
pub has_children_as_function: bool,
pub is_pure_passthrough: bool,
}Expand description
An identified React component: a function/arrow whose body returns JSX.
Captured by visit_jsx_element’s enclosing-component tracking. The
unused-component-prop (React arm) and complexity-fold phases consume this;
the abstain flags keep zero-FP on the cases ADR-001 cannot resolve.
Fields§
§name: StringThe component name (the binding or declaration identifier).
span_start: u32Start byte offset of the component definition (anchors findings).
kind: ComponentFunctionKindThe syntactic shape of the definition.
is_exported: boolWhether the component is exported from its module (a named export, a
export default, or re-exported in the same module). Public-API
components abstain in the prop phase.
has_unharvestable_props: booltrue when the component’s props are not statically harvestable: a
rest/spread in the signature ({ ...rest }), props passed wholesale to a
hook/helper, or a forwardRef / memo wrapper whose props come from an
imported interface generic fallow cannot resolve (ADR-001). The prop
phase abstains on the whole component when set.
uses_clone_element: booltrue when the component body calls cloneElement / React.cloneElement.
cloneElement injects props by reflection, so the static forward-set is
incomplete; the prop-drilling phase abstains on any chain through this
component (ADR-001, zero-FP).
renders_provider: booltrue when the component renders a *.Provider member-expression tag
(<FooContext.Provider>). A context provider in the subtree means the
drilling may be a deliberate non-context choice (or the prop is about to
be provided); the prop-drilling phase downgrades/abstains.
has_children_as_function: booltrue when the component passes a function as a child render value
(render-props / children-as-function: <Foo>{() => ...}</Foo> or
<Foo render={() => ...}/>). The forwarded shape is dynamic; the
prop-drilling phase abstains on chains through this component.
is_pure_passthrough: booltrue when the component body is pure structural indirection: a single
statement returning exactly one capitalized/member-expression JSX element
(no host wrapper, no extra children, optionally a fragment wrapping a
single element) that forwards props via a bare spread of the component’s
own props binding / rest local (<Child {...props}/>), with NO named
attributes alongside the spread and NO self-render. The cross-component
thin-wrapper phase joins this with hook-density / cyclomatic checks and
the resolved single render edge to flag a component that is a candidate
for inlining. Computed from the component’s own AST only, so it caches
byte-identity-safe (ADR-001).