Skip to content

Commit 63172ef

Browse files
authored
fix(es/minifier): Disallow types (#10945)
**Related issue:** - #10944
1 parent a262eeb commit 63172ef

File tree

23 files changed

+34
-34
lines changed

23 files changed

+34
-34
lines changed

crates/swc_ecma_minifier/src/compress/hoist_decls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ impl Hoister<'_> {
277277
}
278278

279279
impl VisitMut for Hoister<'_> {
280-
noop_visit_mut_type!();
280+
noop_visit_mut_type!(fail);
281281

282282
fn visit_mut_module_items(&mut self, stmts: &mut Vec<ModuleItem>) {
283283
self.handle_stmt_likes(stmts);

crates/swc_ecma_minifier/src/compress/optimize/arguments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl ArgReplacer<'_> {
146146
}
147147

148148
impl VisitMut for ArgReplacer<'_> {
149-
noop_visit_mut_type!();
149+
noop_visit_mut_type!(fail);
150150

151151
/// Noop.
152152
fn visit_mut_arrow_expr(&mut self, _: &mut ArrowExpr) {}

crates/swc_ecma_minifier/src/compress/optimize/if_return.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ pub(super) struct ReturnFinder {
512512
}
513513

514514
impl Visit for ReturnFinder {
515-
noop_visit_type!();
515+
noop_visit_type!(fail);
516516

517517
fn visit_return_stmt(&mut self, n: &ReturnStmt) {
518518
n.visit_children_with(self);

crates/swc_ecma_minifier/src/compress/optimize/iife.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ pub struct ReturnVisitor {
13381338
}
13391339

13401340
impl Visit for ReturnVisitor {
1341-
noop_visit_type!();
1341+
noop_visit_type!(fail);
13421342

13431343
/// Don't recurse into constructor
13441344
fn visit_constructor(&mut self, _: &Constructor) {}
@@ -1381,7 +1381,7 @@ pub struct DeclVisitor {
13811381
}
13821382

13831383
impl Visit for DeclVisitor {
1384-
noop_visit_type!();
1384+
noop_visit_type!(fail);
13851385

13861386
/// Don't recurse into constructor
13871387
fn visit_constructor(&mut self, _: &Constructor) {}

crates/swc_ecma_minifier/src/compress/optimize/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ impl Optimizer<'_> {
14511451
}
14521452

14531453
impl VisitMut for Optimizer<'_> {
1454-
noop_visit_mut_type!();
1454+
noop_visit_mut_type!(fail);
14551455

14561456
#[cfg_attr(feature = "debug", tracing::instrument(level = "debug", skip_all))]
14571457
fn visit_mut_arrow_expr(&mut self, n: &mut ArrowExpr) {

crates/swc_ecma_minifier/src/compress/optimize/sequences.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2608,7 +2608,7 @@ struct UsageCounter<'a> {
26082608
}
26092609

26102610
impl Visit for UsageCounter<'_> {
2611-
noop_visit_type!();
2611+
noop_visit_type!(fail);
26122612

26132613
fn visit_ident(&mut self, i: &Ident) {
26142614
if self.target.sym == i.sym && self.target.ctxt == i.ctxt {

crates/swc_ecma_minifier/src/compress/optimize/unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ struct ThisPropertyVisitor {
10471047
}
10481048

10491049
impl Visit for ThisPropertyVisitor {
1050-
noop_visit_type!();
1050+
noop_visit_type!(fail);
10511051

10521052
fn visit_assign_expr(&mut self, e: &AssignExpr) {
10531053
if self.should_abort {

crates/swc_ecma_minifier/src/compress/optimize/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ enum FinalizerMode {
306306
}
307307

308308
impl VisitMut for Finalizer<'_> {
309-
noop_visit_mut_type!();
309+
noop_visit_mut_type!(fail);
310310

311311
fn visit_mut_bin_expr(&mut self, e: &mut BinExpr) {
312312
e.visit_mut_children_with(self);
@@ -503,7 +503,7 @@ impl<'a> NormalMultiReplacer<'a> {
503503
}
504504

505505
impl VisitMut for NormalMultiReplacer<'_> {
506-
noop_visit_mut_type!();
506+
noop_visit_mut_type!(fail);
507507

508508
fn visit_mut_expr(&mut self, e: &mut Expr) {
509509
if self.vars.is_empty() {
@@ -596,7 +596,7 @@ impl ExprReplacer {
596596
}
597597

598598
impl VisitMut for ExprReplacer {
599-
noop_visit_mut_type!();
599+
noop_visit_mut_type!(fail);
600600

601601
fn visit_mut_expr(&mut self, e: &mut Expr) {
602602
e.visit_mut_children_with(self);

crates/swc_ecma_minifier/src/compress/pure/dead_code.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ struct LabelFinder<'a> {
692692
found: bool,
693693
}
694694
impl Visit for LabelFinder<'_> {
695-
noop_visit_type!();
695+
noop_visit_type!(fail);
696696

697697
fn visit_break_stmt(&mut self, s: &BreakStmt) {
698698
if let Some(label) = &s.label {

crates/swc_ecma_minifier/src/compress/pure/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl Pure<'_> {
194194
}
195195

196196
impl VisitMut for Pure<'_> {
197-
noop_visit_mut_type!();
197+
noop_visit_mut_type!(fail);
198198

199199
fn visit_mut_assign_expr(&mut self, e: &mut AssignExpr) {
200200
{

0 commit comments

Comments
 (0)