Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(transformer): re-order fields of Common and TransformCtx #6562

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/oxc_transformer/src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ use top_level_statements::TopLevelStatements;
use var_declarations::VarDeclarations;

pub struct Common<'a, 'ctx> {
helper_loader: HelperLoader<'a, 'ctx>,
module_imports: ModuleImports<'a, 'ctx>,
var_declarations: VarDeclarations<'a, 'ctx>,
top_level_statements: TopLevelStatements<'a, 'ctx>,
helper_loader: HelperLoader<'a, 'ctx>,
}

impl<'a, 'ctx> Common<'a, 'ctx> {
pub fn new(ctx: &'ctx TransformCtx<'a>) -> Self {
Self {
helper_loader: HelperLoader::new(ctx),
module_imports: ModuleImports::new(ctx),
var_declarations: VarDeclarations::new(ctx),
top_level_statements: TopLevelStatements::new(ctx),
helper_loader: HelperLoader::new(ctx),
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_transformer/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ pub struct TransformCtx<'a> {
pub source_text: &'a str,

// Helpers
/// Manage helper loading
pub helper_loader: HelperLoaderStore<'a>,
/// Manage import statement globally
pub module_imports: ModuleImportsStore<'a>,
/// Manage inserting `var` statements globally
pub var_declarations: VarDeclarationsStore<'a>,
/// Manage inserting statements at top of program globally
pub top_level_statements: TopLevelStatementsStore<'a>,
/// Manage helper loading
pub helper_loader: HelperLoaderStore<'a>,
}

impl<'a> TransformCtx<'a> {
Expand All @@ -55,10 +55,10 @@ impl<'a> TransformCtx<'a> {
source_path,
source_type: SourceType::default(),
source_text: "",
helper_loader: HelperLoaderStore::new(&options.helper_loader),
module_imports: ModuleImportsStore::new(),
var_declarations: VarDeclarationsStore::new(),
top_level_statements: TopLevelStatementsStore::new(),
helper_loader: HelperLoaderStore::new(&options.helper_loader),
}
}

Expand Down