Skip to main content

python_self_attribute_name

Function python_self_attribute_name 

Source
pub fn python_self_attribute_name<'a>(
    attr: &Node<'a>,
    code: &'a [u8],
) -> Option<&'a [u8]>
Expand description

The attribute name of a self.<attr> / cls.<attr> attribute node, or None when the receiver is not a self / cls alias — the bytes the Member row’s gate and the attribute count both read.

The node’s first child is the receiver: self.x → receiver is Identifier “self” → counts db.x → receiver is Identifier “db” → foreign, skip self.f.g → receiver is itself an Attribute → skip The last named child is the attribute identifier. Only a direct self.<name> names an attribute of the class; self.f.g writes g on self.f, so the nested-attribute receiver is rejected. Borrows from code so the slice is the canonical dedup key.