Skip to main content

ComponentFunction

Struct ComponentFunction 

Source
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: String

The component name (the binding or declaration identifier).

§span_start: u32

Start byte offset of the component definition (anchors findings).

§kind: ComponentFunctionKind

The syntactic shape of the definition.

§is_exported: bool

Whether 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: bool

true 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: bool

true 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: bool

true 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: bool

true 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: bool

true 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).

Trait Implementations§

Source§

impl Clone for ComponentFunction

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ComponentFunction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'__de> Decode<'__de> for ComponentFunction
where '__de:,

Source§

impl Encode for ComponentFunction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DecodeOwned for T
where T: for<'de> Decode<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.