Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions jscomp/others/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ bs_MapStringM.cmj : bs_internalMapString.cmj bs_internalAVLtree.cmj \
bs_Array.cmj bs_MapStringM.cmi
bs_MapIntM.cmj : bs_internalMapInt.cmj bs_internalAVLtree.cmj bs_Array.cmj \
bs_MapIntM.cmi
bs_Set.cmj : bs_SortedSetDict.cmj bs_Cmp.cmj bs_Array.cmj bs_Set.cmi
bs_Set.cmj : bs_SortedSetDict.cmj bs_SetString.cmj bs_SetInt.cmj bs_Cmp.cmj \
bs_Array.cmj bs_Set.cmi
bs_SetM.cmj : bs_internalAVLset.cmj bs_SortArray.cmj bs_SetStringM.cmj \
bs_SetIntM.cmj bs_Cmp.cmj bs_Array.cmj bs_SetM.cmi
bs_MapM.cmj : bs_internalAVLtree.cmj bs_MapStringM.cmj bs_MapIntM.cmj \
Expand Down Expand Up @@ -135,7 +136,7 @@ bs_MapString.cmi :
bs_MapInt.cmi :
bs_MapStringM.cmi :
bs_MapIntM.cmi :
bs_Set.cmi : bs_SortedSetDict.cmi bs_Cmp.cmi
bs_Set.cmi : bs_SortedSetDict.cmi bs_SetString.cmi bs_SetInt.cmi bs_Cmp.cmi
bs_SetM.cmi : bs_SetStringM.cmi bs_SetIntM.cmi bs_Cmp.cmi
bs_MapM.cmi : bs_MapStringM.cmi bs_MapIntM.cmi bs_Cmp.cmi
bs_SetInt.cmi :
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_Cmp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
type 'a compare = ('a -> 'a -> int [@bs])
type ('a,'id) cmp = 'a compare

external getCmpIntenral : ('a,'id) cmp -> 'a compare = "%identity"
external getCmpInternal : ('a,'id) cmp -> 'a compare = "%identity"

module type T = sig
type id
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_Cmp.mli
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type 'a compare = 'a -> 'a -> int [@bs]
type ('a, 'id) cmp

(** only used for data structures, not exported for client usage *)
external getCmpIntenral: ('a,'id) cmp -> 'a compare = "%identity"
external getCmpInternal: ('a,'id) cmp -> 'a compare = "%identity"

module type T = sig
type id
Expand Down
3 changes: 1 addition & 2 deletions jscomp/others/bs_Map.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ let remove m x =
let removeMany m x =
let cmp, odata = S.cmp m, S.data m in
let newData = N.removeMany odata x ~cmp in
if newData == odata then m
else S.t ~cmp ~data:newData
S.t ~cmp ~data:newData

let set m key d =
let cmp = S.cmp m in
Expand Down
8 changes: 4 additions & 4 deletions jscomp/others/bs_MapInt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,21 @@ let remove n x =
| None -> N.empty
| Some n -> removeAux n x

let rec removeArrayAux t xs i len =
let rec removeMany0 t xs i len =
if i < len then
let ele = A.getUnsafe xs i in
let u = removeAux t ele in
match N.toOpt u with
| None -> u
| Some t -> removeArrayAux t xs (i + 1) len
| Some t -> removeMany0 t xs (i + 1) len
else
N.return t

let removeArray t keys =
let removeMany t keys =
let len = A.length keys in
match N.toOpt t with
| None -> N.empty
| Some t -> removeArrayAux t keys 0 len
| Some t -> removeMany0 t keys 0 len

let mergeArray h arr =
let len = A.length arr in
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_MapInt.mli
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ val checkInvariantInternal: _ t -> bool
val remove: 'a t -> key -> 'a t
(** [remove m x] returns a map containing the same bindings as
[m], except for [x] which is unbound in the returned map. *)
val removeArray: 'a t -> key array -> 'a t
val removeMany: 'a t -> key array -> 'a t

val set: 'a t -> key -> 'a -> 'a t
(** [add m x y] returns a map containing the same bindings as
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_MapIntM.ml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ let rec updateDone t (x : key) f =
| None -> t)
| Some nt ->
let k = N.key nt in
(* let c = (Bs_Cmp.getCmpIntenral cmp) x k [@bs] in *)
(* let c = (Bs_Cmp.getCmpInternal cmp) x k [@bs] in *)
if k = x then begin
match f (Some (N.value nt)) [@bs] with
| None ->
Expand Down
4 changes: 2 additions & 2 deletions jscomp/others/bs_MapM.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type ('k, 'v, 'id) t = ('k, 'v, 'id) S.t

let rec removeMutateAux nt x ~cmp =
let k = N.key nt in
let c = (Bs_Cmp.getCmpIntenral cmp) x k [@bs] in
let c = (Bs_Cmp.getCmpInternal cmp) x k [@bs] in
if c = 0 then
let l,r = N.(left nt, right nt) in
match N.(toOpt l, toOpt r) with
Expand Down Expand Up @@ -106,7 +106,7 @@ let rec updateDone t x f ~cmp =
| None -> t)
| Some nt ->
let k = N.key nt in
let c = (Bs_Cmp.getCmpIntenral cmp) x k [@bs] in
let c = (Bs_Cmp.getCmpInternal cmp) x k [@bs] in
if c = 0 then begin
match f (Some (N.value nt)) [@bs] with
| None ->
Expand Down
8 changes: 4 additions & 4 deletions jscomp/others/bs_MapString.ml
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,21 @@ let remove n x =
| None -> N.empty
| Some n -> removeAux n x

let rec removeArrayAux t xs i len =
let rec removeMany0 t xs i len =
if i < len then
let ele = A.getUnsafe xs i in
let u = removeAux t ele in
match N.toOpt u with
| None -> u
| Some t -> removeArrayAux t xs (i + 1) len
| Some t -> removeMany0 t xs (i + 1) len
else
N.return t

let removeArray t keys =
let removeMany t keys =
let len = A.length keys in
match N.toOpt t with
| None -> N.empty
| Some t -> removeArrayAux t keys 0 len
| Some t -> removeMany0 t keys 0 len

let mergeArray h arr =
let len = A.length arr in
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_MapString.mli
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ val checkInvariantInternal: _ t -> bool
val remove: 'a t -> key -> 'a t
(** [remove m x] returns a map containing the same bindings as
[m], except for [x] which is unbound in the returned map. *)
val removeArray: 'a t -> key array -> 'a t
val removeMany: 'a t -> key array -> 'a t

val set: 'a t -> key -> 'a -> 'a t
(** [add m x y] returns a map containing the same bindings as
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_MapStringM.ml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ let rec updateDone t (x : key) f =
| None -> t)
| Some nt ->
let k = N.key nt in
(* let c = (Bs_Cmp.getCmpIntenral cmp) x k [@bs] in *)
(* let c = (Bs_Cmp.getCmpInternal cmp) x k [@bs] in *)
if k = x then begin
match f (Some (N.value nt)) [@bs] with
| None ->
Expand Down
3 changes: 2 additions & 1 deletion jscomp/others/bs_Set.ml
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,5 @@ let packDictData (type elt) (type id) ~(dict : (elt, id) dict) ~data =
let checkInvariantInternal d = N.checkInvariantInternal (S.data d)



module Int = Bs_SetInt
module String = Bs_SetString
2 changes: 2 additions & 0 deletions jscomp/others/bs_Set.mli
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,5 @@ val getData: ('k,'id) t -> ('k,'id) Bs_SortedSetDict.t
val getDict: ('k,'id) t -> ('k,'id) dict
val packDictData: dict:('k, 'id) dict -> data:('k, 'id) Bs_SortedSetDict.t -> ('k, 'id) t

module Int = Bs_SetInt
module String = Bs_SetString
Loading