Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 243f43d1d86a5f9c591257e7a055ca2c5b052f5d 1 parent 65dec96
@BourgerieQuentin BourgerieQuentin authored
View
9 compiler/libqmlcompil/qmlRenamingMap.ml
@@ -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 ->
View
11 compiler/libqmlcompil/qmlRenamingMap.mli
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.