pub struct Property {Show 14 fields
pub name: Identifier,
pub kind: PropertyKind,
pub generics: Vec<GenericParam>,
pub annotations: Vec<Attribute>,
pub params: Vec<Param>,
pub return_type: Option<Type>,
pub body: Block,
pub span: Span,
pub is_abstract: bool,
pub is_final: bool,
pub is_static: bool,
pub is_virtual: bool,
pub is_override: bool,
pub is_lazy: bool,
}Expand description
A property declaration (getter or setter).
Fields§
§name: IdentifierThe name of the property.
kind: PropertyKindWhether this is a getter or setter.
generics: Vec<GenericParam>Generic parameters for the property.
annotations: Vec<Attribute>Annotations on the property.
params: Vec<Param>Parameters for the property (self for getter, self + value for setter).
return_type: Option<Type>Return type for getter, None for setter.
body: BlockThe body of the property.
span: SpanSource span.
is_abstract: boolWhether this property is abstract (has no body implementation).
Abstract properties are declared without a body in abstract classes and must be implemented by concrete subclasses.
is_final: boolWhether this property is final (cannot be overridden).
is_static: boolWhether this property is static (belongs to the class, not instances).
Static properties are accessed via ClassName.property_name syntax
and do not have access to self.
is_virtual: boolWhether this property is virtual (can be overridden by subclasses).
Virtual properties use dynamic dispatch through the vtable, allowing subclasses to provide their own implementation.
is_override: boolWhether this property overrides a parent class property.
Override properties must match the signature of the parent property and are verified during type checking.
is_lazy: boolWhether this property uses lazy initialization.
Lazy properties cache their computed value after first access. The getter is only called once, and subsequent accesses return the cached value.