swc/crates/swc_common/tests/attr_interop.rs

28 lines
601 B
Rust
Raw Normal View History

2018-03-04 09:17:52 +03:00
//! Test that `#[span]` and `#[fold]` can be used at same time.
use serde::{self, Deserialize, Serialize};
2020-07-23 20:18:22 +03:00
use swc_common::{self, ast_node, Span, Spanned};
2018-03-04 09:17:52 +03:00
#[ast_node("Class")]
2018-03-04 09:17:52 +03:00
// See https://github.com/rust-lang/rust/issues/44925
pub struct Class {
#[span]
pub has_span: HasSpan,
pub s: String,
}
#[ast_node("Tuple")]
2020-07-23 20:18:22 +03:00
pub struct Tuple(#[span] HasSpan, usize, usize);
2018-03-04 09:17:52 +03:00
2020-07-23 20:18:22 +03:00
#[derive(Debug, Clone, PartialEq, Spanned, Serialize, Deserialize)]
2018-03-04 09:17:52 +03:00
pub struct HasSpan {
pub span: Span,
}
#[ast_node]
pub enum Node {
#[tag("Class")]
Class(Class),
#[tag("Tuple")]
Tuple(Tuple),
}