fn fold_module_item(&mut self, s: ModuleItem) -> ModuleItem {
        match s {
            ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e)) if !e.specifiers.is_empty() => {
                let e = e.fold_with(self);

                if e.specifiers.is_empty() {
                    return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }));
                }

                return ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e));
            }
            _ => {}
        };

        // Visit children to ensure that all references is added to the scope.
        let s = s.fold_children_with(self);

        if let ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(e)) = &s {
            match &e.decl {
                Decl::Fn(f) => {
                    // Drop getStaticProps.
                    if let Ok(is_data_identifier) = self.state.is_data_identifier(&f.ident) {
                        if is_data_identifier {
                            return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }));
                        }
                    } else {
                        return s;
                    }
                }

                Decl::Var(d) => {
                    if d.decls.is_empty() {
                        return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }));
                    }
                }
                _ => {}
            }
        }

        s
    }
/// Drops [ExportDecl] if all specifiers are removed.
Drops [ExportDecl] if all specifiers are removed.
Drops [ ExportDecl ] if all specifiers are removed .
fn fold_module_item(&mut self, s: ModuleItem) -> ModuleItem {
        match s {
            ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e)) if !e.specifiers.is_empty() => {
                let e = e.fold_with(self);
                if e.specifiers.is_empty() {
                    return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }));
                }
                return ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e));
            }
            _ => {}
        };
        // Visit children to ensure that all references is added to the scope.
        let s = s.fold_children_with(self);
        if let ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(e)) = &s {
            match &e.decl {
                Decl::Fn(f) => {
                    // Drop getStaticProps.
                    if let Ok(is_data_identifier) = self.state.is_data_identifier(&f.ident) {
                        if is_data_identifier {
                            return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }));
                        }
                    } else {
                        return s;
                    }
                }
                Decl::Var(d) => {
                    if d.decls.is_empty() {
                        return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }));
                    }
                }
                _ => {}
            }
        }
        s
    }
fn fold_module_item ( & mut self , s : ModuleItem ) -> ModuleItem { match s { ModuleItem :: ModuleDecl ( ModuleDecl :: ExportNamed ( e ) ) if ! e . specifiers . is_empty ( ) => { let e = e . fold_with ( self ) ; if e . specifiers . is_empty ( ) { return ModuleItem :: Stmt ( Stmt :: Empty ( EmptyStmt { span : DUMMY_SP } ) ) ; } return ModuleItem :: ModuleDecl ( ModuleDecl :: ExportNamed ( e ) ) ; } _ => { } } ; // Visit children to ensure that all references is added to the scope. let s = s . fold_children_with ( self ) ; if let ModuleItem :: ModuleDecl ( ModuleDecl :: ExportDecl ( e ) ) = & s { match & e . decl { Decl :: Fn ( f ) => { // Drop getStaticProps. if let Ok ( is_data_identifier ) = self . state . is_data_identifier ( & f . ident ) { if is_data_identifier { return ModuleItem :: Stmt ( Stmt :: Empty ( EmptyStmt { span : DUMMY_SP } ) ) ; } } else { return s ; } } Decl :: Var ( d ) => { if d . decls . is_empty ( ) { return ModuleItem :: Stmt ( Stmt :: Empty ( EmptyStmt { span : DUMMY_SP } ) ) ; } } _ => { } } } s }
Drops [ExportDecl] if all specifiers are removed.
Drops [ ExportDecl ] if all specifiers are removed .
&mut self
s
ModuleItem
&mut self
s
ModuleItem