ltk_ritobin 0.12.0

Ritobin text format parser and writer for League Toolkit
Documentation
use ltk_hash::BinHash;

use crate::ast::{hash::HashedLiteral, node::Property};
use crate::span::Span;

#[derive(Debug, Clone)]
#[cfg_attr(feature = "span_print", derive(crate::span::DebugSpans))]
pub struct Object {
    pub class_hash: HashedLiteral<BinHash>,
    /// The entire `ClassName { .. }` span
    pub span: Span,
    pub properties: Vec<Property>,
}

impl Object {
    pub fn properties_span(&self) -> Option<Span> {
        self.properties
            .first()
            .zip(self.properties.last())
            .map(|(l, r)| Span::new(l.span().start, r.span().end))
    }
}