libhanzzok/core/ast/
inline_constructor.rs

1use core::fmt;
2
3use crate::{
4    core::{Span, Spanned},
5    syntax::Token,
6};
7
8use super::Raw;
9
10#[cfg_attr(target_arch = "wasm32", wasm_bindgen::prelude::wasm_bindgen)]
11#[derive(Clone, Debug)]
12pub struct InlineConstructorNode {
13    pub(crate) name: String,
14    pub(crate) params: Vec<Token>,
15    pub(crate) tokens: Vec<Token>,
16}
17
18impl Raw for InlineConstructorNode {
19    fn raw(&self) -> Vec<Token> {
20        self.tokens.clone()
21    }
22}
23
24impl Spanned for InlineConstructorNode {
25    fn span(&self) -> Span {
26        self.tokens.span()
27    }
28}
29
30impl fmt::Display for InlineConstructorNode {
31    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32        write!(f, "InlineConstructor(name={})", self.name)
33    }
34}