Project

General

Profile

Revision 9603460e src/corelang.ml

View differences:

src/corelang.ml
663 663

  
664 664
let rename_const f_const c =
665 665
  { c with const_id = f_const c.const_id }
666
    
666

  
667
let rename_typedef f_var t =
668
  match t.tydef_desc with
669
  | Tydec_enum tags -> { t with tydef_desc = Tydec_enum (List.map f_var tags) }
670
  | _               -> t
671

  
667 672
let rename_prog f_node f_var f_const prog =
668 673
  List.rev (
669 674
    List.fold_left (fun accu top ->
670 675
      (match top.top_decl_desc with
671 676
      | Node nd -> 
672
	{ top with top_decl_desc = Node (rename_node f_node f_var f_const nd) }
677
	 { top with top_decl_desc = Node (rename_node f_node f_var f_const nd) }
673 678
      | Const c -> 
674
	{ top with top_decl_desc = Const (rename_const f_const c) }
679
	 { top with top_decl_desc = Const (rename_const f_const c) }
680
      | TypeDef tdef ->
681
	 { top with top_decl_desc = TypeDef (rename_typedef f_var tdef) }
675 682
      | ImportedNode _
676
      | Open _
677
      | TypeDef _ -> top)
683
      | Open _       -> top)
678 684
      ::accu
679 685
) [] prog
680
  )
686
		   )
681 687

  
682 688
(**********************************************************************)
683 689
(* Pretty printers *)

Also available in: Unified diff