Skip to content

Commit

Permalink
refactor(transformer): re-order fields of Common
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Oct 14, 2024
1 parent a9260cf commit 8b66746
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit 8b66746

Please sign in to comment.