@@ -761,11 +761,11 @@ let rec iter_bound_idents
761761  : type  k  . _  -> k  general_pattern  -> _  
762762  =  fun  f  pat  -> 
763763  match  pat.pat_desc with  
764-   |  Tpat_var  (id ,s ) -> 
765-      f (id,s, pat.pat_type,pat.pat_mode ) 
766-   |  Tpat_alias (p , id , s ) -> 
764+   |  Tpat_var  (id ,  _ ) -> 
765+      f (id,  pat.pat_type) 
766+   |  Tpat_alias (p , id , _ ) -> 
767767      iter_bound_idents f p; 
768-       f (id,s, pat.pat_type,pat.pat_mode ) 
768+       f (id,  pat.pat_type) 
769769  |  Tpat_or (p1 , _ , _ ) -> 
770770      (*  Invariant : both arguments bind the same variables *)  
771771      iter_bound_idents f p1 
@@ -781,7 +781,7 @@ let rev_pat_bound_idents_full pat =
781781  ! idents_full 
782782
783783let  rev_only_idents  idents_full  = 
784-   List. rev_map (fun  (id ,_ , _ , _ ) -> id) idents_full 
784+   List. rev_map (fun  (id ,_ ) -> id) idents_full 
785785
786786let  pat_bound_idents_full  pat  = 
787787  List. rev (rev_pat_bound_idents_full pat) 
@@ -794,6 +794,23 @@ let rev_let_bound_idents_full bindings =
794794  List. iter (fun  vb  -> iter_bound_idents add vb.vb_pat) bindings; 
795795  ! idents_full 
796796
797+ let  let_bound_idents_with_modes  bindings  = 
798+   let  modes =  Ident.Tbl. create 3  in  
799+   let  rec  loop  : type k . k general_pattern -> _  =  
800+     fun  pat  -> 
801+       match  pat.pat_desc with  
802+       |  Tpat_var  (id , { loc } ) -> 
803+           Ident.Tbl. add modes id (loc, pat.pat_mode) 
804+       |  Tpat_alias (p , id , { loc } ) -> 
805+           loop p; 
806+           Ident.Tbl. add modes id (loc, pat.pat_mode) 
807+       |  d  -> shallow_iter_pattern_desc { f =  loop } d 
808+   in  
809+   List. iter (fun  vb  -> loop vb.vb_pat) bindings; 
810+   List. rev_map 
811+     (fun  (id , _ ) -> id, List. rev (Ident.Tbl. find_all modes id)) 
812+     (rev_let_bound_idents_full bindings) 
813+ 
797814let  let_bound_idents_full  bindings  = 
798815  List. rev (rev_let_bound_idents_full bindings) 
799816let  let_bound_idents  pat  = 
0 commit comments