Skip to content

Commit 828d612

Browse files
committed
refactor(minifier): add NodeUtil trait for accessing symbols on ast nodes
1 parent e0832f8 commit 828d612

File tree

11 files changed

+790
-707
lines changed

11 files changed

+790
-707
lines changed

crates/oxc_minifier/src/ast_passes/fold_constants.rs

Lines changed: 92 additions & 59 deletions
Large diffs are not rendered by default.

crates/oxc_minifier/src/ast_passes/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,21 @@ pub use remove_syntax::RemoveSyntax;
1111
pub use substitute_alternate_syntax::SubstituteAlternateSyntax;
1212

1313
use oxc_ast::ast::Program;
14+
use oxc_semantic::{ScopeTree, SymbolTable};
1415
use oxc_traverse::{walk_program, Traverse, TraverseCtx};
1516

17+
use crate::node_util::NodeUtil;
18+
19+
impl<'a> NodeUtil for TraverseCtx<'a> {
20+
fn symbols(&self) -> &SymbolTable {
21+
self.scoping.symbols()
22+
}
23+
24+
fn scopes(&self) -> &ScopeTree {
25+
self.scoping.scopes()
26+
}
27+
}
28+
1629
pub trait CompressorPass<'a> {
1730
fn build(&mut self, program: &mut Program<'a>, ctx: &mut TraverseCtx<'a>)
1831
where

0 commit comments

Comments
 (0)