@@ -895,40 +895,38 @@ impl<C: Comments> VisitMut for ServerActions<C> {
895895 }
896896
897897 if let Some ( cache_type_str) = cache_type {
898- if !( self . in_cache_file . is_some ( ) && self . in_export_decl ) {
899- // It's a cache function. If it doesn't have a name, give it one.
900- match f. ident . as_mut ( ) {
901- None => {
902- let action_name = gen_cache_ident ( & mut self . reference_index ) ;
903- let ident = Ident :: new ( action_name, DUMMY_SP , Default :: default ( ) ) ;
904- f. ident . insert ( ident)
905- }
906- Some ( i) => i,
907- } ;
898+ // It's a cache function. If it doesn't have a name, give it one.
899+ match f. ident . as_mut ( ) {
900+ None => {
901+ let action_name = gen_cache_ident ( & mut self . reference_index ) ;
902+ let ident = Ident :: new ( action_name, DUMMY_SP , Default :: default ( ) ) ;
903+ f. ident . insert ( ident)
904+ }
905+ Some ( i) => i,
906+ } ;
908907
909- // Collect all the identifiers defined inside the closure and used
910- // in the cache function. With deduplication.
911- retain_names_from_declared_idents (
912- & mut child_names,
913- & self . declared_idents [ ..declared_idents_until] ,
914- ) ;
908+ // Collect all the identifiers defined inside the closure and used
909+ // in the cache function. With deduplication.
910+ retain_names_from_declared_idents (
911+ & mut child_names,
912+ & self . declared_idents [ ..declared_idents_until] ,
913+ ) ;
915914
916- let new_expr = self . maybe_hoist_and_create_proxy_for_cache_function (
917- child_names. clone ( ) ,
918- f. ident . clone ( ) ,
919- cache_type_str. as_str ( ) ,
920- & mut f. function ,
921- ) ;
915+ let new_expr = self . maybe_hoist_and_create_proxy_for_cache_function (
916+ child_names. clone ( ) ,
917+ f. ident . clone ( ) ,
918+ cache_type_str. as_str ( ) ,
919+ & mut f. function ,
920+ ) ;
922921
923- if self . in_default_export_decl {
924- // This function expression is also the default export:
925- // `export default async function() {}`
926- // This specific case (default export) isn't handled by `visit_mut_expr`.
927- // Replace the original function expr with a action proxy expr.
928- self . rewrite_default_fn_expr_to_proxy_expr = Some ( new_expr) ;
929- } else {
930- self . rewrite_expr_to_proxy_expr = Some ( new_expr) ;
931- }
922+ if self . in_default_export_decl {
923+ // This function expression is also the default export:
924+ // `export default async function() {}`
925+ // This specific case (default export) isn't handled by `visit_mut_expr`.
926+ // Replace the original function expr with a action proxy expr.
927+ self . rewrite_default_fn_expr_to_proxy_expr = Some ( new_expr) ;
928+ } else {
929+ self . rewrite_expr_to_proxy_expr = Some ( new_expr) ;
932930 }
933931 }
934932
0 commit comments