@@ -67,7 +67,7 @@ struct NamedImport<'a> {
6767 local : BoundIdentifier < ' a > ,
6868}
6969
70- enum ImportKind < ' a > {
70+ enum Import < ' a > {
7171 Named ( NamedImport < ' a > ) ,
7272 Default ( BoundIdentifier < ' a > ) ,
7373}
@@ -78,7 +78,7 @@ enum ImportKind<'a> {
7878/// to produce output that's the same as Babel's.
7979/// Substitute `FxHashMap` once we don't need to match Babel's output exactly.
8080pub struct ModuleImportsStore < ' a > {
81- imports : RefCell < IndexMap < Atom < ' a > , Vec < ImportKind < ' a > > > > ,
81+ imports : RefCell < IndexMap < Atom < ' a > , Vec < Import < ' a > > > > ,
8282}
8383
8484// Public methods
@@ -97,7 +97,7 @@ impl<'a> ModuleImportsStore<'a> {
9797 ///
9898 /// If `front` is `true`, `import`/`require` is added to front of the `import`s/`require`s.
9999 pub fn add_default_import ( & self , source : Atom < ' a > , local : BoundIdentifier < ' a > , front : bool ) {
100- self . add_import ( source, ImportKind :: Default ( local) , front) ;
100+ self . add_import ( source, Import :: Default ( local) , front) ;
101101 }
102102
103103 /// Add named `import` to top of program.
@@ -114,7 +114,7 @@ impl<'a> ModuleImportsStore<'a> {
114114 local : BoundIdentifier < ' a > ,
115115 front : bool ,
116116 ) {
117- self . add_import ( source, ImportKind :: Named ( NamedImport { imported, local } ) , front) ;
117+ self . add_import ( source, Import :: Named ( NamedImport { imported, local } ) , front) ;
118118 }
119119
120120 /// Returns `true` if no imports have been scheduled for insertion.
@@ -137,7 +137,7 @@ impl<'a> ModuleImportsStore<'a> {
137137 /// If `front` is `true`, `import`/`require` is added to front of the `import`s/`require`s.
138138 /// TODO(improve-on-babel): `front` option is only required to pass one of Babel's tests. Output
139139 /// without it is still valid. Remove this once our output doesn't need to match Babel exactly.
140- fn add_import ( & self , source : Atom < ' a > , import : ImportKind < ' a > , front : bool ) {
140+ fn add_import ( & self , source : Atom < ' a > , import : Import < ' a > , front : bool ) {
141141 match self . imports . borrow_mut ( ) . entry ( source) {
142142 IndexMapEntry :: Occupied ( mut entry) => {
143143 entry. get_mut ( ) . push ( import) ;
@@ -194,19 +194,19 @@ impl<'a> ModuleImportsStore<'a> {
194194
195195 fn get_import (
196196 source : Atom < ' a > ,
197- names : Vec < ImportKind < ' a > > ,
197+ names : Vec < Import < ' a > > ,
198198 ctx : & mut TraverseCtx < ' a > ,
199199 ) -> Statement < ' a > {
200200 let specifiers = ctx. ast . vec_from_iter ( names. into_iter ( ) . map ( |kind| match kind {
201- ImportKind :: Named ( named) => {
201+ Import :: Named ( named) => {
202202 ImportDeclarationSpecifier :: ImportSpecifier ( ctx. ast . alloc_import_specifier (
203203 SPAN ,
204204 ModuleExportName :: IdentifierName ( IdentifierName :: new ( SPAN , named. imported ) ) ,
205205 named. local . create_binding_identifier ( ) ,
206206 ImportOrExportKind :: Value ,
207207 ) )
208208 }
209- ImportKind :: Default ( local) => ImportDeclarationSpecifier :: ImportDefaultSpecifier (
209+ Import :: Default ( local) => ImportDeclarationSpecifier :: ImportDefaultSpecifier (
210210 ctx. ast . alloc_import_default_specifier ( SPAN , local. create_binding_identifier ( ) ) ,
211211 ) ,
212212 } ) ) ;
@@ -223,7 +223,7 @@ impl<'a> ModuleImportsStore<'a> {
223223
224224 fn get_require (
225225 source : Atom < ' a > ,
226- names : std:: vec:: Vec < ImportKind < ' a > > ,
226+ names : std:: vec:: Vec < Import < ' a > > ,
227227 require_symbol_id : Option < SymbolId > ,
228228 ctx : & mut TraverseCtx < ' a > ,
229229 ) -> Statement < ' a > {
@@ -240,7 +240,7 @@ impl<'a> ModuleImportsStore<'a> {
240240 let arg = Argument :: from ( ctx. ast . expression_string_literal ( SPAN , source) ) ;
241241 ctx. ast . vec1 ( arg)
242242 } ;
243- let Some ( ImportKind :: Default ( local) ) = names. into_iter ( ) . next ( ) else { unreachable ! ( ) } ;
243+ let Some ( Import :: Default ( local) ) = names. into_iter ( ) . next ( ) else { unreachable ! ( ) } ;
244244 let id = local. create_binding_pattern ( ctx) ;
245245 let decl = {
246246 let init = ctx. ast . expression_call ( SPAN , callee, NONE , args, false ) ;
0 commit comments