@@ -3450,8 +3450,22 @@ impl Visit for GlobalCollector<'_> {
34503450 let mut all_module_items = Vec :: new ( ) ;
34513451
34523452 for item in & n. body {
3453- if let ModuleItem :: Stmt ( stmt) = item {
3454- all_module_items. push ( stmt. clone ( ) ) ;
3453+ match item {
3454+ // TODO handle all cases
3455+ ModuleItem :: Stmt ( stmt) => all_module_items. push ( stmt. clone ( ) ) ,
3456+ ModuleItem :: ModuleDecl ( mod_decl) => match mod_decl {
3457+ ModuleDecl :: ExportDecl ( export_decl) => {
3458+ all_module_items. push ( Stmt :: Decl ( export_decl. decl . clone ( ) ) )
3459+ }
3460+ ModuleDecl :: ExportAll ( _)
3461+ | ModuleDecl :: ExportDefaultDecl ( _)
3462+ | ModuleDecl :: ExportDefaultExpr ( _)
3463+ | ModuleDecl :: ExportNamed ( _)
3464+ | ModuleDecl :: TsExportAssignment ( _)
3465+ | ModuleDecl :: Import ( _)
3466+ | ModuleDecl :: TsImportEquals ( _)
3467+ | ModuleDecl :: TsNamespaceExport ( _) => { }
3468+ } ,
34553469 }
34563470 }
34573471 analyzer. lower_stmts ( all_module_items. as_slice ( ) ) ;
@@ -4251,3 +4265,37 @@ impl PartialEq<str> for ImportKind {
42514265 }
42524266 }
42534267}
4268+
4269+ impl PartialEq < str > for Value {
4270+ #[ inline]
4271+ fn eq ( & self , other : & str ) -> bool {
4272+ match self {
4273+ Self :: Const ( Const :: Literal ( s) ) => * * s == * other,
4274+ Self :: Phi ( v) if !v. is_empty ( ) => v. iter ( ) . all ( |x| * x == * other) ,
4275+ Self :: Uninit | Self :: Unknown | Self :: Object ( _) | Self :: Phi ( _) => false ,
4276+ }
4277+ }
4278+ }
4279+
4280+ impl PartialEq < Value > for str {
4281+ #[ inline]
4282+ fn eq ( & self , other : & Value ) -> bool {
4283+ * other == * self
4284+ }
4285+ }
4286+
4287+ impl PartialEq < str > for Const {
4288+ #[ inline]
4289+ fn eq ( & self , other : & str ) -> bool {
4290+ match self {
4291+ Self :: Literal ( s) => * * s == * other,
4292+ }
4293+ }
4294+ }
4295+
4296+ impl PartialEq < Const > for str {
4297+ #[ inline]
4298+ fn eq ( & self , other : & Const ) -> bool {
4299+ * other == * self
4300+ }
4301+ }
0 commit comments