Skip to content

Commit 1663048

Browse files
committed
Revert
1 parent e1299bc commit 1663048

1 file changed

Lines changed: 17 additions & 30 deletions

File tree

  • crates/swc_ecma_transforms_module/src

crates/swc_ecma_transforms_module/src/util.rs

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,23 @@ impl Scope {
385385

386386
self.import_types.insert(import.src.value, true);
387387
} else {
388+
self.imports
389+
.entry(import.src.value.clone())
390+
.and_modify(|(span, opt)| {
391+
if opt.is_none() {
392+
*span = import.src.span;
393+
394+
let ident =
395+
private_ident!(import.src.span, local_name_for_src(&import.src.value));
396+
*opt = Some((ident.sym, ident.span));
397+
}
398+
})
399+
.or_insert_with(|| {
400+
let ident =
401+
private_ident!(import.src.span, local_name_for_src(&import.src.value));
402+
(import.src.span, Some((ident.sym, ident.span)))
403+
});
404+
388405
let mut has_non_default = false;
389406
for s in import.specifiers {
390407
match s {
@@ -411,19 +428,6 @@ impl Scope {
411428
self.import_types.insert(import.src.value.clone(), true);
412429
}
413430
ImportSpecifier::Default(i) => {
414-
let ident = i.local.clone();
415-
416-
self.imports
417-
.entry(import.src.value.clone())
418-
.and_modify(|(span, opt)| {
419-
if opt.is_none() {
420-
*span = import.src.span;
421-
422-
*opt = Some((ident.sym.clone(), ident.span));
423-
}
424-
})
425-
.or_insert_with(|| (import.src.span, Some((ident.sym, ident.span))));
426-
427431
if !import.src.value.starts_with("@swc/helpers") {
428432
self.idents.insert(
429433
i.local.to_id(),
@@ -464,23 +468,6 @@ impl Scope {
464468
}
465469
}
466470
}
467-
468-
self.imports
469-
.entry(import.src.value.clone())
470-
.and_modify(|(span, opt)| {
471-
if opt.is_none() {
472-
*span = import.src.span;
473-
474-
let ident =
475-
private_ident!(import.src.span, local_name_for_src(&import.src.value));
476-
*opt = Some((ident.sym, ident.span));
477-
}
478-
})
479-
.or_insert_with(|| {
480-
let ident =
481-
private_ident!(import.src.span, local_name_for_src(&import.src.value));
482-
(import.src.span, Some((ident.sym, ident.span)))
483-
});
484471
}
485472
}
486473

0 commit comments

Comments
 (0)