Skip to content

Commit 68d740c

Browse files
authored
feat(es/transfomer): Add modules to prepare porting (#11347)
1 parent 1a8759f commit 68d740c

File tree

13 files changed

+38
-4
lines changed

13 files changed

+38
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

crates/swc_ecma_transformer/src/es2017/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
mod async_to_generator;
2+
13
use swc_ecma_hooks::VisitMutHook;
24

35
use crate::TraverseCtx;
46

57
#[derive(Debug, Default)]
68
#[non_exhaustive]
7-
pub struct Es2017Options {}
9+
pub struct Es2017Options {
10+
pub async_to_generator: bool,
11+
}
812

913
pub fn hook(options: Es2017Options) -> impl VisitMutHook<TraverseCtx> {
1014
Es2017Pass { options }

crates/swc_ecma_transformer/src/es2018/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ use swc_ecma_hooks::VisitMutHook;
22

33
use crate::TraverseCtx;
44

5+
mod object_rest_spread;
6+
57
#[derive(Debug, Default)]
68
#[non_exhaustive]
7-
pub struct Es2018Options {}
9+
pub struct Es2018Options {
10+
pub object_rest_spread: bool,
11+
}
812

913
pub fn hook(options: Es2018Options) -> impl VisitMutHook<TraverseCtx> {
1014
Es2018Pass { options }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

crates/swc_ecma_transformer/src/es2020/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ use swc_ecma_hooks::VisitMutHook;
33
use crate::{hook_utils::OptionalHook, TraverseCtx};
44

55
mod export_namespace_from;
6+
mod nullish_coalescing;
7+
mod optional_chaining;
68

79
#[derive(Debug, Default)]
810
#[non_exhaustive]
911
pub struct Es2020Options {
1012
pub export_namespace_from: bool,
13+
14+
pub nullish_coalescing: bool,
15+
16+
pub optional_chaining: bool,
1117
}
1218

1319
pub fn hook(options: Es2020Options) -> impl VisitMutHook<TraverseCtx> {

crates/swc_ecma_transformer/src/es2020/nullish_coalescing.rs

Whitespace-only changes.

crates/swc_ecma_transformer/src/es2020/optional_chaining.rs

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

crates/swc_ecma_transformer/src/es2021/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
mod logical_assignment_operators;
2+
13
use swc_ecma_hooks::VisitMutHook;
24

35
use crate::TraverseCtx;
46

57
#[derive(Debug, Default)]
68
#[non_exhaustive]
7-
pub struct Es2021Options {}
9+
pub struct Es2021Options {
10+
pub logical_assignment_operators: bool,
11+
}
812

913
pub fn hook(options: Es2021Options) -> impl VisitMutHook<TraverseCtx> {
1014
Es2021Pass { options }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)