Permalink
Browse files

[enhance] compiler, utils: Added remove to the renaming maps

  • Loading branch information...
1 parent 65dec96 commit 243f43d1d86a5f9c591257e7a055ca2c5b052f5d @BourgerieQuentin BourgerieQuentin committed Jul 24, 2012
Showing with 17 additions and 3 deletions.
  1. +8 −1 compiler/libqmlcompil/qmlRenamingMap.ml
  2. +9 −2 compiler/libqmlcompil/qmlRenamingMap.mli
@@ -1,5 +1,5 @@
(*
- Copyright © 2011 MLstate
+ Copyright © 2011, 2012 MLstate
This file is part of Opa.
@@ -50,6 +50,13 @@ let new_from_original t original_id =
let new_from_original_opt t original_id =
IdentMap.find_opt original_id t.map
+let remove_from_original t original_id =
+ let old_id = new_from_original t original_id in
+ {
+ map = IdentMap.remove original_id t.map;
+ rev = IdentMap.remove old_id t.rev;
+ }
+
let filter t filter =
IdentMap.fold
(fun original_id new_id filtered ->
@@ -1,5 +1,5 @@
(*
- Copyright © 2011 MLstate
+ Copyright © 2011, 2012 MLstate
This file is part of Opa.
@@ -27,9 +27,16 @@ type t
val empty : t
(** [add t original_id new_id] Add a new binding. Consider
-[original_id] has renamed on [new_id]. *)
+ [original_id] has renamed on [new_id].
+
+ BEWARE : If a previous binding exists it doesn't erase, implies map is not
+ bijective.
+*)
val add : t -> QmlAst.ident -> QmlAst.ident -> t
+(** [remove t original_id] Remove a binding with the [original_id]. *)
+val remove_from_original : t -> QmlAst.ident -> t
+
(** the input map must be injective *)
val from_map : QmlAst.ident IdentMap.t -> t

0 comments on commit 243f43d

Please sign in to comment.