mirror of
https://github.com/swc-project/swc.git
synced 2024-12-19 19:52:21 +03:00
248a53ce7c
swc_ecma_ast: - make deserialization faster
31 lines
682 B
Rust
31 lines
682 B
Rust
//! Test that `#[span]` and `#[fold]` can be used at same time.
|
|
extern crate serde;
|
|
extern crate swc_common;
|
|
use serde::{Deserialize, Serialize};
|
|
use swc_common::{ast_node, Fold, Span, Spanned};
|
|
|
|
#[ast_node("Class")]
|
|
// See https://github.com/rust-lang/rust/issues/44925
|
|
pub struct Class {
|
|
#[span]
|
|
pub has_span: HasSpan,
|
|
#[fold(ignore)]
|
|
pub s: String,
|
|
}
|
|
|
|
#[ast_node("Tuple")]
|
|
pub struct Tuple(#[span] HasSpan, #[fold(ignore)] usize, usize);
|
|
|
|
#[derive(Debug, Clone, PartialEq, Fold, Spanned, Serialize, Deserialize)]
|
|
pub struct HasSpan {
|
|
pub span: Span,
|
|
}
|
|
|
|
#[ast_node]
|
|
pub enum Node {
|
|
#[tag("Class")]
|
|
Class(Class),
|
|
#[tag("Tuple")]
|
|
Tuple(Tuple),
|
|
}
|