Skip to main content

impl_has_instance_method

Function impl_has_instance_method 

Source
pub fn impl_has_instance_method(
    impl_block: &AIRNode,
    effect_ops: &HashMap<String, String>,
) -> bool
Expand description

True when an impl block (an bock_air::NodeKind::ImplBlock) declares at least one instance method — one that binds self, or an effect operation (which is dispatched on a handler instance despite taking no self; see is_associated_impl_method).

An impl whose methods are all associated functions (e.g. impl From[A] for B with only from(value)) contributes no instance contract: implementing it adds only static members. Backends that model trait conformance through instance inheritance / structural interfaces (Python base class, TS interface … extends Trait) must wire the trait in only when this returns true; otherwise the base/extends reference points at a trait with no instance members — often a prelude trait not even emitted into the consuming module, so the reference would be undefined.