Fixes wrong order for conversion
This commit is contained in:
@ -18,7 +18,15 @@ module Node = struct
|
||||
end
|
||||
;;
|
||||
|
||||
module NodeMap = Map.Make(Node)
|
||||
module NodeMap = struct
|
||||
include Map.Make(Node)
|
||||
|
||||
let add_to_list_last x data m =
|
||||
let add = function None -> Some [data]
|
||||
| Some l -> Some (l @ [data]) in
|
||||
update x add m
|
||||
end
|
||||
|
||||
module NodeSet = Set.Make(Node)
|
||||
|
||||
module type C = sig
|
||||
@ -141,7 +149,7 @@ module Make(M: PrintableType) = struct
|
||||
| false ->
|
||||
let prevcfgterminal = Option.get cfg.terminal in
|
||||
{ cfg with
|
||||
content = (NodeMap.add_to_list
|
||||
content = (NodeMap.add_to_list_last
|
||||
prevcfgterminal
|
||||
newcontent
|
||||
cfg.content) }
|
||||
@ -192,7 +200,7 @@ module Make(M: PrintableType) = struct
|
||||
|
||||
Printf.fprintf ppf "Code:\n";
|
||||
List.iter (fun ((n, stms) : Node.t * elt list) : unit ->
|
||||
Printf.fprintf ppf "\tid %d --> %a\n%!" n.id M.pplist (List.rev stms)
|
||||
Printf.fprintf ppf "\tid %d --> %a\n%!" n.id M.pplist stms
|
||||
) (NodeMap.to_list c.content);
|
||||
Printf.fprintf ppf "\n";
|
||||
end
|
||||
|
||||
@ -12,7 +12,12 @@ module Node : sig
|
||||
val create : unit -> t
|
||||
end
|
||||
|
||||
module NodeMap : Map.S with type key = Node.t
|
||||
module NodeMap : sig
|
||||
include Map.S with type key = Node.t
|
||||
|
||||
val add_to_list_last : key -> 'a -> 'a list t -> 'a list t
|
||||
end
|
||||
|
||||
module NodeSet : Set.S with type elt = Node.t
|
||||
|
||||
module type C = sig
|
||||
|
||||
Reference in New Issue
Block a user