use std::fmt::{Display, Formatter};
use indexmap::IndexMap;
use proc_macro2::TokenStream;
use crate::names::NodeName;
pub type AnonUnions = IndexMap<AnonUnionId, TokenStream>;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct AnonUnionId {
pub name: String
}
impl AnonUnionId {
pub fn new(names: &[NodeName]) -> Self {
Self {
name: NodeName::anon_union_type_name(names).to_string()
}
}
pub fn query_capture(capture_variant_name: &str) -> Self {
Self {
name: capture_variant_name.to_string()
}
}
}
impl Display for AnonUnionId {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.name)
}
}