use super::{Expr, Ident, PropertyKey};
use crate::common::Span;
use alloc::boxed::Box;
use alloc::vec::Vec;
#[derive(Clone, Debug, PartialEq)]
#[allow(missing_docs)]
pub enum BindingTarget {
Ident(Ident),
Array(ArrayPattern),
Object(ObjectPattern),
}
#[derive(Clone, Debug, PartialEq)]
pub struct ArrayPattern {
pub elements: Vec<ArrayPatternElement>,
pub span: Span,
}
#[derive(Clone, Debug, PartialEq)]
#[allow(missing_docs)]
pub enum ArrayPatternElement {
Hole,
Item {
target: BindingTarget,
default: Option<Expr>,
span: Span,
},
Rest { target: BindingTarget, span: Span },
}
#[derive(Clone, Debug, PartialEq)]
pub struct ObjectPattern {
pub properties: Vec<ObjectPatternProp>,
pub rest: Option<Box<BindingTarget>>,
pub span: Span,
}
#[derive(Clone, Debug, PartialEq)]
pub struct ObjectPatternProp {
pub key: PropertyKey,
pub value: BindingTarget,
pub default: Option<Expr>,
pub shorthand: bool,
pub span: Span,
}