mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 14:43:33 +03:00
Fix folder for stable rustc (#797)
This commit is contained in:
parent
13a67a4848
commit
84f1759910
@ -13,5 +13,5 @@ edition = "2018"
|
||||
swc_atoms = { version = "0.2", path = "../../atoms" }
|
||||
swc_common = { version = "0.5.9", path = "../../common" }
|
||||
swc_ecma_ast = { version = "0.20.0", path ="../ast" }
|
||||
swc_ecma_visit_macros = { version = "0.3.0", path ="./macros" }
|
||||
swc_ecma_visit_macros = { version = "0.4.0", path ="./macros" }
|
||||
num-bigint = { version = "0.2", features = ["serde"] }
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "swc_ecma_visit_macros"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
authors = ["강동윤 <kdy1997.dev@gmail.com>"]
|
||||
license = "Apache-2.0/MIT"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
|
@ -778,7 +778,18 @@ fn create_method_body(mode: Mode, ty: &Type) -> Block {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
return q!(
|
||||
return match mode {
|
||||
Mode::Folder => q!(
|
||||
Vars { ident },
|
||||
({
|
||||
match n {
|
||||
Some(n) => Some(_visitor.ident(n)),
|
||||
None => None,
|
||||
}
|
||||
})
|
||||
)
|
||||
.parse(),
|
||||
Mode::Visitor => q!(
|
||||
Vars { ident },
|
||||
({
|
||||
match n {
|
||||
@ -787,7 +798,8 @@ fn create_method_body(mode: Mode, ty: &Type) -> Block {
|
||||
}
|
||||
})
|
||||
)
|
||||
.parse();
|
||||
.parse(),
|
||||
};
|
||||
}
|
||||
_ => unimplemented!("generic parameter other than type"),
|
||||
}
|
||||
|
29
ecmascript/visit/macros/tests/fold.rs
Normal file
29
ecmascript/visit/macros/tests/fold.rs
Normal file
@ -0,0 +1,29 @@
|
||||
use std::any::Any;
|
||||
use swc_ecma_visit_macros::define;
|
||||
|
||||
/// Visitable nodes.
|
||||
pub trait Node: Any {}
|
||||
|
||||
impl<T: ?Sized> Node for T where T: Any {}
|
||||
|
||||
pub struct Item {
|
||||
// pub field: usize,
|
||||
// pub inner: Option<Box<Item>>,
|
||||
pub opt_vec: Option<Vec<Item>>,
|
||||
pub vec_opt: Vec<Option<Item>>,
|
||||
}
|
||||
pub enum Enum {
|
||||
Item(Item),
|
||||
}
|
||||
|
||||
define!({
|
||||
pub struct Item {
|
||||
// pub field: usize,
|
||||
// pub inner: Option<Box<Item>>,
|
||||
pub opt_vec: Option<Vec<Item>>,
|
||||
pub vec_opt: Vec<Option<Item>>,
|
||||
}
|
||||
pub enum Enum {
|
||||
Item(Item),
|
||||
}
|
||||
});
|
25
ecmascript/visit/macros/tests/opt_vec.rs
Normal file
25
ecmascript/visit/macros/tests/opt_vec.rs
Normal file
@ -0,0 +1,25 @@
|
||||
use std::any::Any;
|
||||
use swc_ecma_visit_macros::define;
|
||||
|
||||
/// Visitable nodes.
|
||||
pub trait Node: Any {}
|
||||
|
||||
impl<T: ?Sized> Node for T where T: Any {}
|
||||
|
||||
pub struct Item {
|
||||
pub opt_vec1: Option<Vec<Item>>,
|
||||
pub opt_vec2: Option<Vec<Enum>>,
|
||||
}
|
||||
pub enum Enum {
|
||||
Item(Item),
|
||||
}
|
||||
|
||||
define!({
|
||||
pub struct Item {
|
||||
pub opt_vec1: Option<Vec<Item>>,
|
||||
pub opt_vec2: Option<Vec<Enum>>,
|
||||
}
|
||||
pub enum Enum {
|
||||
Item(Item),
|
||||
}
|
||||
});
|
25
ecmascript/visit/macros/tests/vec_opt.rs
Normal file
25
ecmascript/visit/macros/tests/vec_opt.rs
Normal file
@ -0,0 +1,25 @@
|
||||
use std::any::Any;
|
||||
use swc_ecma_visit_macros::define;
|
||||
|
||||
/// Visitable nodes.
|
||||
pub trait Node: Any {}
|
||||
|
||||
impl<T: ?Sized> Node for T where T: Any {}
|
||||
|
||||
pub struct Item {
|
||||
pub vec_opt1: Vec<Option<Item>>,
|
||||
pub vec_opt2: Vec<Option<Enum>>,
|
||||
}
|
||||
pub enum Enum {
|
||||
Item(Item),
|
||||
}
|
||||
|
||||
define!({
|
||||
pub struct Item {
|
||||
pub vec_opt1: Vec<Option<Item>>,
|
||||
pub vec_opt2: Vec<Option<Enum>>,
|
||||
}
|
||||
pub enum Enum {
|
||||
Item(Item),
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user