mirror of
https://github.com/swc-project/swc.git
synced 2024-12-29 00:23:10 +03:00
6f19f8902f
**Description:** Another update to enable bytecheck rkyv feature flag. Our dep tree is quite tangled with implicit enable (plugin -> rkyv). PR tries to detach some of it while trying to preserve existing behavior as much as it can.
37 lines
963 B
Rust
37 lines
963 B
Rust
//! Test that `#[span]` and `#[fold]` can be used at same time.
|
|
use serde::{self, Deserialize, Serialize};
|
|
use swc_common::{self, 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", feature = "rkyv-bytecheck-impl"),
|
|
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
|
)]
|
|
#[cfg_attr(
|
|
any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"),
|
|
archive(bound(serialize = "__S: rkyv::ser::Serializer + rkyv::ser::ScratchSpace"))
|
|
)]
|
|
pub struct HasSpan {
|
|
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
|
pub span: Span,
|
|
}
|
|
|
|
#[ast_node]
|
|
pub enum Node {
|
|
#[tag("Class")]
|
|
Class(Class),
|
|
#[tag("Tuple")]
|
|
Tuple(Tuple),
|
|
}
|