Skip to content

Commit 1b6f09f

Browse files
committed
make more
1 parent bdd2cd4 commit 1b6f09f

File tree

44 files changed

+325
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+325
-4
lines changed

crates/jsdoc/src/ast.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ pub struct TagItem {
3030
}
3131

3232
#[ast_node]
33-
#[non_exhaustive]
3433
pub enum Tag {
3534
#[tag("Yield")]
3635
Yield(YieldTag),

crates/swc_bundler/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ version = "32.0.0"
1818
[lib]
1919
bench = false
2020

21+
[lints.rust]
22+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(swc_ast_unknown)'] }
23+
2124
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2225
[features]
2326
concurrent = ["swc_common/concurrent", "dashmap", "rayon", "indexmap/rayon"]

crates/swc_bundler/src/bundler/chunk/cjs.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ fn wrap_module(
140140
unreachable!("module item found but is_es6 is false: {:?}", i)
141141
}
142142
ModuleItem::Stmt(s) => s,
143+
#[cfg(swc_ast_unknown)]
144+
_ => panic!("unable to access unknown nodes"),
143145
})
144146
.collect(),
145147
..Default::default()
@@ -318,6 +320,8 @@ where
318320
.into();
319321
return;
320322
}
323+
#[cfg(swc_ast_unknown)]
324+
_ => panic!("unable to access unknown nodes"),
321325
}
322326
}
323327

crates/swc_bundler/src/bundler/chunk/computed_key.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ where
7373
ModuleExportName::Str(..) => {
7474
unimplemented!("module string names unimplemented")
7575
}
76+
#[cfg(swc_ast_unknown)]
77+
_ => panic!("unable to access unknown nodes"),
7678
};
7779
if ctx.transitive_remap.get(&exported.ctxt).is_some() {
7880
let specifier = ExportSpecifier::Named(ExportNamedSpecifier {
@@ -230,6 +232,8 @@ impl Fold for ExportToReturn {
230232
let decl = match item {
231233
ModuleItem::ModuleDecl(decl) => decl,
232234
ModuleItem::Stmt(_) => return item,
235+
#[cfg(swc_ast_unknown)]
236+
_ => panic!("unable to access unknown nodes"),
233237
};
234238

235239
let stmt = match decl {
@@ -287,6 +291,8 @@ impl Fold for ExportToReturn {
287291
)
288292
}
289293
DefaultDecl::TsInterfaceDecl(_) => None,
294+
#[cfg(swc_ast_unknown)]
295+
_ => panic!("unable to access unknown nodes"),
290296
},
291297
ModuleDecl::ExportDefaultExpr(_) => None,
292298
ModuleDecl::ExportAll(export) => return export.into(),
@@ -308,6 +314,8 @@ impl Fold for ExportToReturn {
308314
Some(ModuleExportName::Str(..)) => {
309315
unimplemented!("module string names unimplemented")
310316
}
317+
#[cfg(swc_ast_unknown)]
318+
Some(_) => panic!("unable to access unknown nodes"),
311319
None => {
312320
if let ModuleExportName::Ident(orig) = &named.orig {
313321
self.export_id(orig.clone());
@@ -316,6 +324,8 @@ impl Fold for ExportToReturn {
316324
}
317325
}
318326
},
327+
#[cfg(swc_ast_unknown)]
328+
_ => panic!("unable to access unknown nodes"),
319329
}
320330
}
321331

@@ -332,6 +342,8 @@ impl Fold for ExportToReturn {
332342
ModuleDecl::TsImportEquals(_) => None,
333343
ModuleDecl::TsExportAssignment(_) => None,
334344
ModuleDecl::TsNamespaceExport(_) => None,
345+
#[cfg(swc_ast_unknown)]
346+
_ => panic!("unable to access unknown nodes"),
335347
};
336348

337349
if let Some(stmt) = stmt {

crates/swc_bundler/src/bundler/chunk/merge.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ where
264264
ModuleExportName::Str(..) => {
265265
unimplemented!("module string names unimplemented")
266266
}
267+
#[cfg(swc_ast_unknown)]
268+
_ => panic!("unable to access unknown nodes"),
267269
};
268270

269271
let id: Id = exported.into();
@@ -286,9 +288,13 @@ where
286288
ModuleExportName::Str(..) => {
287289
unimplemented!("module string names unimplemented")
288290
}
291+
#[cfg(swc_ast_unknown)]
292+
_ => panic!("unable to access unknown nodes"),
289293
}
290294
}
291295
}
296+
#[cfg(swc_ast_unknown)]
297+
_ => panic!("unable to access unknown nodes"),
292298
}
293299
}
294300
}
@@ -380,11 +386,15 @@ where
380386
Expr::Call(CallExpr { callee, .. }) => match callee {
381387
Callee::Super(_) | Callee::Import(_) => continue,
382388
Callee::Expr(v) => v,
389+
#[cfg(swc_ast_unknown)]
390+
_ => panic!("unable to access unknown nodes"),
383391
},
384392
Expr::Await(AwaitExpr { arg, .. }) => match &mut **arg {
385393
Expr::Call(CallExpr { callee, .. }) => match callee {
386394
Callee::Super(_) | Callee::Import(_) => continue,
387395
Callee::Expr(v) => v,
396+
#[cfg(swc_ast_unknown)]
397+
_ => panic!("unable to access unknown nodes"),
388398
},
389399
_ => continue,
390400
},
@@ -518,6 +528,8 @@ where
518528
ModuleExportName::Str(..) => {
519529
unimplemented!("module string names unimplemented")
520530
}
531+
#[cfg(swc_ast_unknown)]
532+
_ => panic!("unable to access unknown nodes"),
521533
};
522534
// Default is not exported via `export *`
523535
if &*exported.sym == "default" {
@@ -613,6 +625,8 @@ where
613625
ModuleExportName::Str(..) => {
614626
unimplemented!("module string names unimplemented")
615627
}
628+
#[cfg(swc_ast_unknown)]
629+
_ => panic!("unable to access unknown nodes"),
616630
};
617631
new.push(
618632
imported
@@ -665,6 +679,8 @@ where
665679
);
666680
}
667681
}
682+
#[cfg(swc_ast_unknown)]
683+
_ => panic!("unable to access unknown nodes"),
668684
}
669685
}
670686

@@ -754,6 +770,8 @@ where
754770
}
755771
}
756772
DefaultDecl::TsInterfaceDecl(_) => continue,
773+
#[cfg(swc_ast_unknown)]
774+
_ => panic!("unable to access unknown nodes"),
757775
}
758776

759777
// Create `export { local_default as default }`
@@ -926,6 +944,8 @@ where
926944
| Decl::TsEnum(_)
927945
| Decl::TsModule(_)
928946
| Decl::Using(..) => continue,
947+
#[cfg(swc_ast_unknown)]
948+
_ => panic!("unable to access unknown nodes"),
929949
};
930950

931951
tracing::trace!(
@@ -1023,6 +1043,8 @@ where
10231043
"module string names unimplemented"
10241044
)
10251045
}
1046+
#[cfg(swc_ast_unknown)]
1047+
_ => panic!("unable to access unknown nodes"),
10261048
};
10271049
}
10281050
ExportSpecifier::Default(s) => {
@@ -1069,6 +1091,8 @@ where
10691091
definite: Default::default(),
10701092
});
10711093
}
1094+
#[cfg(swc_ast_unknown)]
1095+
_ => panic!("unable to access unknown nodes"),
10721096
}
10731097
}
10741098

@@ -1101,6 +1125,8 @@ where
11011125
ModuleExportName::Str(..) => {
11021126
unimplemented!("module string names unimplemented")
11031127
}
1128+
#[cfg(swc_ast_unknown)]
1129+
_ => panic!("unable to access unknown nodes"),
11041130
};
11051131
let orig_ident = match orig {
11061132
ModuleExportName::Ident(ident) => ident,
@@ -1202,6 +1228,8 @@ where
12021228
ModuleExportName::Str(..) => {
12031229
unimplemented!("module string names unimplemented")
12041230
}
1231+
#[cfg(swc_ast_unknown)]
1232+
_ => panic!("unable to access unknown nodes"),
12051233
}
12061234
}
12071235
}
@@ -1262,6 +1290,8 @@ where
12621290
ModuleExportName::Str(..) => {
12631291
unimplemented!("module string names unimplemented")
12641292
}
1293+
#[cfg(swc_ast_unknown)]
1294+
_ => panic!("unable to access unknown nodes"),
12651295
};
12661296
vars.push((
12671297
module_id,
@@ -1317,6 +1347,8 @@ where
13171347
continue;
13181348
}
13191349
}
1350+
#[cfg(swc_ast_unknown)]
1351+
_ => panic!("unable to access unknown nodes"),
13201352
}
13211353
}
13221354

crates/swc_bundler/src/bundler/export.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ where
229229
ModuleExportName::Str(..) => {
230230
unimplemented!("module string names unimplemented")
231231
}
232+
#[cfg(swc_ast_unknown)]
233+
_ => panic!("unable to access unknown nodes"),
232234
};
233235
}
234236
ExportSpecifier::Default(d) => {
@@ -243,6 +245,8 @@ where
243245
ModuleExportName::Str(..) => {
244246
unimplemented!("module string names unimplemented")
245247
}
248+
#[cfg(swc_ast_unknown)]
249+
_ => panic!("unable to access unknown nodes"),
246250
};
247251
if let Some((_, export_ctxt)) = ctxt {
248252
orig.ctxt = export_ctxt;
@@ -255,6 +259,8 @@ where
255259
Some(ModuleExportName::Str(..)) => {
256260
unimplemented!("module string names unimplemented")
257261
}
262+
#[cfg(swc_ast_unknown)]
263+
Some(_) => panic!("unable to access unknown nodes"),
258264
None => {
259265
let mut exported: Ident = orig.clone();
260266
exported.ctxt = self.export_ctxt;
@@ -280,6 +286,8 @@ where
280286
}
281287
}
282288
}
289+
#[cfg(swc_ast_unknown)]
290+
_ => panic!("unable to access unknown nodes"),
283291
}
284292
}
285293

crates/swc_bundler/src/bundler/finalize.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ where
164164
let decl = match item {
165165
ModuleItem::ModuleDecl(v) => v,
166166
ModuleItem::Stmt(stmt) => return Some(stmt),
167+
#[cfg(swc_ast_unknown)]
168+
_ => panic!("unable to access unknown nodes"),
167169
};
168170

169171
match decl {
@@ -224,6 +226,8 @@ where
224226
ModuleExportName::Str(..) => unimplemented!(
225227
"module string names unimplemented"
226228
),
229+
#[cfg(swc_ast_unknown)]
230+
_ => panic!("unable to access unknown nodes"),
227231
};
228232
props.push(PropOrSpread::Prop(Box::new(
229233
Prop::KeyValue(KeyValueProp {
@@ -235,18 +239,24 @@ where
235239
Some(ModuleExportName::Str(..)) => {
236240
unimplemented!("module string names unimplemented")
237241
}
242+
#[cfg(swc_ast_unknown)]
243+
Some(_) => panic!("unable to access unknown nodes"),
238244
None => {
239245
let orig = match s.orig {
240246
ModuleExportName::Ident(ident) => ident,
241247
ModuleExportName::Str(..) => unimplemented!(
242248
"module string names unimplemented"
243249
),
250+
#[cfg(swc_ast_unknown)]
251+
_ => panic!("unable to access unknown nodes"),
244252
};
245253
props.push(PropOrSpread::Prop(Box::new(
246254
Prop::Shorthand(orig),
247255
)));
248256
}
249257
},
258+
#[cfg(swc_ast_unknown)]
259+
_ => panic!("unable to access unknown nodes"),
250260
}
251261
}
252262

@@ -303,6 +313,8 @@ where
303313
)
304314
}
305315
DefaultDecl::TsInterfaceDecl(_) => None,
316+
#[cfg(swc_ast_unknown)]
317+
_ => panic!("unable to access unknown nodes"),
306318
},
307319
ModuleDecl::ExportDefaultExpr(export) => {
308320
let default_var = private_ident!("default");
@@ -328,6 +340,9 @@ where
328340
}
329341

330342
ModuleDecl::ExportAll(_) => None,
343+
344+
#[cfg(swc_ast_unknown)]
345+
_ => panic!("unable to access unknown nodes"),
331346
}
332347
})
333348
.collect(),

crates/swc_bundler/src/bundler/import/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ where
368368
let orig = match &s.orig {
369369
ModuleExportName::Ident(ident) => ident,
370370
ModuleExportName::Str(..) => unimplemented!("module string names unimplemented"),
371+
#[cfg(swc_ast_unknown)]
372+
_ => panic!("unable to access unknown nodes"),
371373
};
372374

373375
self.add_forced_ns_for(orig.to_id());
@@ -378,6 +380,8 @@ where
378380
exported.ctxt = self.module_ctxt;
379381
}
380382
Some(ModuleExportName::Str(..)) => unimplemented!("module string names unimplemented"),
383+
#[cfg(swc_ast_unknown)]
384+
Some(_) => panic!("unable to access unknown nodes"),
381385
None => {
382386
let exported = Ident::new(orig.sym.clone(), orig.span, self.module_ctxt);
383387
s.exported = Some(ModuleExportName::Ident(exported));
@@ -438,6 +442,8 @@ where
438442
Some(ModuleExportName::Str(..)) => {
439443
unimplemented!("module string names unimplemented")
440444
}
445+
#[cfg(swc_ast_unknown)]
446+
Some(_) => panic!("unable to access unknown nodes"),
441447
None => {
442448
let mut imported: Ident = n.local.clone();
443449
imported.ctxt = export_ctxt;
@@ -451,6 +457,8 @@ where
451457
ImportSpecifier::Namespace(n) => {
452458
self.imported_idents.insert(n.local.to_id(), export_ctxt);
453459
}
460+
#[cfg(swc_ast_unknown)]
461+
_ => panic!("unable to access unknown nodes"),
454462
}
455463
}
456464
}

crates/swc_bundler/src/bundler/keywords.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ impl VisitMut for KeywordRenamer {
6161
let orig = match &n.orig {
6262
ModuleExportName::Ident(ident) => ident,
6363
ModuleExportName::Str(..) => unimplemented!("module string names unimplemented"),
64+
#[cfg(swc_ast_unknown)]
65+
_ => panic!("unable to access unknown nodes"),
6466
};
6567
if let Some(renamed) = self.renamed(orig) {
6668
n.orig = ModuleExportName::Ident(renamed);

crates/swc_bundler/src/bundler/load.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ where
373373
all: forced_ns.contains(&src.src.value),
374374
});
375375
}
376+
#[cfg(swc_ast_unknown)]
377+
_ => panic!("unable to access unknown nodes"),
376378
}
377379
}
378380

@@ -438,6 +440,8 @@ impl Visit for Es6ModuleDetector {
438440
}
439441
}
440442
Callee::Super(_) | Callee::Import(_) => {}
443+
#[cfg(swc_ast_unknown)]
444+
_ => panic!("unable to access unknown nodes"),
441445
}
442446
}
443447

@@ -480,6 +484,8 @@ impl Visit for Es6ModuleDetector {
480484
ModuleDecl::TsImportEquals(_) => {}
481485
ModuleDecl::TsExportAssignment(_) => {}
482486
ModuleDecl::TsNamespaceExport(_) => {}
487+
#[cfg(swc_ast_unknown)]
488+
_ => panic!("unable to access unknown nodes"),
483489
}
484490
}
485491
}

0 commit comments

Comments
 (0)