2018-03-04 09:17:52 +03:00
|
|
|
//! Test that `#[span]` and `#[fold]` can be used at same time.
|
2019-11-17 07:21:53 +03:00
|
|
|
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
|
|
|
|
2019-03-08 05:36:23 +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,
|
|
|
|
}
|
|
|
|
|
2019-03-08 05:36:23 +03:00
|
|
|
#[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
|
|
|
|
2022-06-14 18:58:10 +03:00
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Spanned, Serialize, Deserialize)]
|
2022-01-02 10:23:37 +03:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "rkyv",
|
|
|
|
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
|
|
|
)]
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "rkyv",
|
|
|
|
archive(bound(serialize = "__S: rkyv::ser::Serializer + rkyv::ser::ScratchSpace"))
|
|
|
|
)]
|
2018-03-04 09:17:52 +03:00
|
|
|
pub struct HasSpan {
|
2022-01-02 10:23:37 +03:00
|
|
|
#[cfg_attr(feature = "rkyv", omit_bounds)]
|
2018-03-04 09:17:52 +03:00
|
|
|
pub span: Span,
|
|
|
|
}
|
2019-03-05 17:16:45 +03:00
|
|
|
|
|
|
|
#[ast_node]
|
|
|
|
pub enum Node {
|
|
|
|
#[tag("Class")]
|
|
|
|
Class(Class),
|
|
|
|
#[tag("Tuple")]
|
|
|
|
Tuple(Tuple),
|
|
|
|
}
|