@@ -688,57 +688,21 @@ and for_module ~env mod_desc module_name =
688688 scope lookups match precisely.
689689*)
690690and scan_let_modules ~env (e : Typedtree.expression ) =
691- match e.exp_desc with
692- | Texp_letmodule (id , name , mexpr , body ) ->
693- let stamp = Ident. binding_time id in
694- let item = for_module ~env mexpr.mod_desc name.txt in
695- let declared =
696- Process_attributes. new_declared ~item ~extent: name.loc ~name ~stamp
697- ~module_path: NotVisible false []
698- in
699- Stamps. add_module env.stamps stamp declared;
700- scan_let_modules ~env body
701- | Texp_let (_rf , bindings , body ) ->
702- List. iter
703- (fun {Typedtree. vb_expr} -> scan_let_modules ~env vb_expr)
704- bindings;
705- scan_let_modules ~env body
706- | Texp_apply {funct; args; _} ->
707- scan_let_modules ~env funct;
708- args
709- |> List. iter (function
710- | _ , Some e -> scan_let_modules ~env e
711- | _ , None -> () )
712- | Texp_tuple exprs -> List. iter (scan_let_modules ~env ) exprs
713- | Texp_sequence (e1 , e2 ) ->
714- scan_let_modules ~env e1;
715- scan_let_modules ~env e2
716- | Texp_match (e , cases , exn_cases , _ ) ->
717- scan_let_modules ~env e;
718- let scan_case {Typedtree. c_lhs = _ ; c_guard; c_rhs} =
719- (match c_guard with
720- | Some g -> scan_let_modules ~env g
721- | None -> () );
722- scan_let_modules ~env c_rhs
723- in
724- List. iter scan_case cases;
725- List. iter scan_case exn_cases
726- | Texp_function {body; _} -> scan_let_modules ~env body
727- | Texp_try (e , cases ) ->
728- scan_let_modules ~env e;
729- cases
730- |> List. iter (fun {Typedtree. c_lhs = _ ; c_guard; c_rhs} ->
731- (match c_guard with
732- | Some g -> scan_let_modules ~env g
733- | None -> () );
734- scan_let_modules ~env c_rhs)
735- | Texp_ifthenelse (e1 , e2 , e3_opt ) -> (
736- scan_let_modules ~env e1;
737- scan_let_modules ~env e2;
738- match e3_opt with
739- | Some e3 -> scan_let_modules ~env e3
740- | None -> () )
741- | _ -> ()
691+ let expr iterator (expression : Typedtree.expression ) =
692+ (match expression.exp_desc with
693+ | Texp_letmodule (id , name , mexpr , _body ) ->
694+ let stamp = Ident. binding_time id in
695+ let item = for_module ~env mexpr.mod_desc name.txt in
696+ let declared =
697+ Process_attributes. new_declared ~item ~extent: name.loc ~name ~stamp
698+ ~module_path: NotVisible false []
699+ in
700+ Stamps. add_module env.stamps stamp declared
701+ | _ -> () );
702+ Tast_iterator. default_iterator.expr iterator expression
703+ in
704+ let iterator = {Tast_iterator. default_iterator with expr} in
705+ iterator.expr iterator e
742706
743707and for_structure ~name ~env str_items =
744708 let exported = Exported. init () in
0 commit comments