1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
//! Test that `#[span]` and `#[fold]` can be used at same time.
#![allow(unexpected_cfgs)]
use serde::{Deserialize, Serialize};
use swc_common::{ast_node, Span, Spanned};
#[ast_node("Class")]
// See https://github.com/rust-lang/rust/issues/44925
pub struct Class {
#[span]
pub has_span: HasSpan,
pub s: String,
}
#[ast_node("Tuple")]
pub struct Tuple(#[span] HasSpan, usize, usize);
#[derive(Debug, Clone, PartialEq, Eq, Spanned, Serialize, Deserialize)]
#[cfg_attr(
any(feature = "rkyv-impl"),
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
)]
#[cfg_attr(
feature = "rkyv-impl",
rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator,
__S::Error: rkyv::rancor::Source))
)]
#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))]
#[cfg_attr(
feature = "rkyv-impl",
rkyv(deserialize_bounds(__D::Error: rkyv::rancor::Source))
)]
#[cfg_attr(
feature = "rkyv-impl",
bytecheck(bounds(
__C: rkyv::validation::ArchiveContext
))
)]
#[cfg_attr(feature = "rkyv-impl", repr(C))]
pub struct HasSpan {
#[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))]
pub span: Span,
}
#[ast_node]
pub enum Node {
#[tag("Class")]
Class(Class),
#[tag("Tuple")]
Tuple(Tuple),
}
|