Skip to content

Commit

Permalink
feat(transformer): add async_generator_functions plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Oct 15, 2024
1 parent 77ddab8 commit 3ff16d0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/oxc_transformer/src/es2018/async_generator_functions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Async Generator Function
//!

use oxc_traverse::Traverse;

use crate::context::TransformCtx;

pub struct AsyncGeneratorFunctions<'a, 'ctx> {
ctx: &'ctx TransformCtx<'a>,
}

impl<'a, 'ctx> AsyncGeneratorFunctions<'a, 'ctx> {
pub fn new(ctx: &'ctx TransformCtx<'a>) -> Self {
Self { ctx }
}
}

impl<'a, 'ctx> Traverse<'a> for AsyncGeneratorFunctions<'a, 'ctx> {}

impl<'a, 'ctx> AsyncGeneratorFunctions<'a, 'ctx> {}
4 changes: 4 additions & 0 deletions crates/oxc_transformer/src/es2018/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mod async_generator_functions;
mod object_rest_spread;
mod options;

use async_generator_functions::AsyncGeneratorFunctions;
pub use object_rest_spread::{ObjectRestSpread, ObjectRestSpreadOptions};
pub use options::ES2018Options;
use oxc_ast::ast::*;
Expand All @@ -13,6 +15,7 @@ pub struct ES2018<'a, 'ctx> {

// Plugins
object_rest_spread: ObjectRestSpread<'a, 'ctx>,
async_generator_functions: AsyncGeneratorFunctions<'a, 'ctx>,
}

impl<'a, 'ctx> ES2018<'a, 'ctx> {
Expand All @@ -22,6 +25,7 @@ impl<'a, 'ctx> ES2018<'a, 'ctx> {
options.object_rest_spread.unwrap_or_default(),
ctx,
),
async_generator_functions: AsyncGeneratorFunctions::new(ctx),
options,
}
}
Expand Down

0 comments on commit 3ff16d0

Please sign in to comment.