Skip to content

Commit 58133f1

Browse files
committed
make ecma_transforms_base
1 parent 846054d commit 58133f1

File tree

13 files changed

+44
-0
lines changed

13 files changed

+44
-0
lines changed

crates/swc_ecma_compiler/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ name = "swc_ecma_compiler"
99
repository = { workspace = true }
1010
version = "4.0.0"
1111

12+
[features]
13+
unknown = ["swc_ecma_visit/unknown"]
14+
1215
[dependencies]
1316
bitflags = { workspace = true }
1417
rustc-hash = { workspace = true }

crates/swc_ecma_lexer/src/common/parser/typescript.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,8 @@ fn parse_ts_type_operator<'a, P: Parser<'a>>(
17671767
TsTypeOperatorOp::Unique => expect!(p, &P::Token::UNIQUE),
17681768
TsTypeOperatorOp::KeyOf => expect!(p, &P::Token::KEYOF),
17691769
TsTypeOperatorOp::ReadOnly => expect!(p, &P::Token::READONLY),
1770+
#[cfg(feature = "unknown")]
1771+
_ => unreachable!(),
17701772
}
17711773

17721774
let type_ann = parse_ts_type_operator_or_higher(p)?;

crates/swc_ecma_quote/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ version = "24.0.0"
1111
[lib]
1212
bench = false
1313

14+
[features]
15+
unknown = ["swc_ecma_ast/unknown"]
16+
1417
[dependencies]
1518
swc_common = { version = "14.0.4", path = "../swc_common" }
1619
swc_ecma_ast = { version = "15.0.0", path = "../swc_ecma_ast" }

crates/swc_ecma_transforms_base/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ concurrent = ["concurrent-renamer", "par-iter", "swc_ecma_utils/concurre
1717
concurrent-renamer = ["par-iter"]
1818
# Allow helpers to be inlined. If this feature is disabled, the helpers will always be imported.
1919
inline-helpers = []
20+
unknown = ["swc_ecma_utils/unknown", "swc_ecma_parser/unknown"]
2021

2122
[dependencies]
2223
better_scoped_tls = { version = "1.0.1", path = "../better_scoped_tls" }

crates/swc_ecma_transforms_base/src/ext.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,17 @@ impl AsOptExpr for Callee {
2727
match self {
2828
Callee::Super(_) | Callee::Import(_) => None,
2929
Callee::Expr(e) => Some(e),
30+
#[cfg(feature = "unknown")]
31+
_ => None
3032
}
3133
}
3234

3335
fn as_expr_mut(&mut self) -> Option<&mut Expr> {
3436
match self {
3537
Callee::Super(_) | Callee::Import(_) => None,
3638
Callee::Expr(e) => Some(e),
39+
#[cfg(feature = "unknown")]
40+
_ => None
3741
}
3842
}
3943
}

crates/swc_ecma_transforms_base/src/fixer.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ impl VisitMut for Fixer<'_> {
156156
let lhs_expr = match &mut expr.left {
157157
AssignTarget::Simple(e) => Some(e),
158158
AssignTarget::Pat(..) => None,
159+
#[cfg(feature = "unknown")]
160+
_ => None
159161
};
160162

161163
if let Some(e) = lhs_expr
@@ -203,6 +205,8 @@ impl VisitMut for Fixer<'_> {
203205
}));
204206
}
205207
}
208+
#[cfg(feature = "unknown")]
209+
_ => ()
206210
}
207211
}
208212

crates/swc_ecma_transforms_base/src/rename/analyer_and_collector.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ impl Visit for AnalyzerAndCollector {
100100
match node.body.as_ref() {
101101
BlockStmtOrExpr::BlockStmt(n) => n.visit_children_with(self),
102102
BlockStmtOrExpr::Expr(n) => n.visit_with(self),
103+
#[cfg(feature = "unknown")]
104+
_ => ()
103105
}
104106

105107
self.analyzer.is_pat_decl = old_analyzer_is_pat_decl;
@@ -229,6 +231,8 @@ impl Visit for AnalyzerAndCollector {
229231
f.visit_with(self);
230232
}
231233
DefaultDecl::TsInterfaceDecl(_) => {}
234+
#[cfg(feature = "unknown")]
235+
_ => {}
232236
}
233237
}
234238

crates/swc_ecma_transforms_base/src/rename/analyzer/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ impl Analyzer {
167167
self.add_usage(orig.to_id());
168168
}
169169
ModuleExportName::Str(..) => {}
170+
#[cfg(feature = "unknown")]
171+
_ => {}
170172
};
171173
}
172174

crates/swc_ecma_transforms_base/src/rename/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ where
364364
DefaultDecl::TsInterfaceDecl(n) => {
365365
n.visit_mut_children_with(self);
366366
}
367+
#[cfg(feature = "unknown")]
368+
_ => ()
367369
}
368370
}
369371

crates/swc_ecma_transforms_base/src/rename/ops.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ where
168168
}
169169
}
170170
ModuleExportName::Str(_) => {}
171+
#[cfg(feature = "unknown")]
172+
_ => {}
171173
}
172174

173175
s.exported = Some(exported);

0 commit comments

Comments
 (0)