Skip to content

Commit d827908

Browse files
committed
annotations
1 parent 2b29707 commit d827908

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

jscomp/runtime/caml_option.ml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25-
let undefinedHeader = [| |]
25+
let%private undefinedHeader = [| |]
26+
type nest = (int array * int)
27+
2628

2729
let some ( x : Obj.t) : Obj.t =
2830
if Obj.magic x = None then
2931
(let block = Obj.repr (undefinedHeader, 0) in
3032
Obj.set_tag block 256;
3133
block)
3234
else
33-
if x != Obj.repr Js.null && match (Obj.magic x ) with (x,_) -> x == Obj.repr undefinedHeader then
35+
if x != Obj.repr Js.null && match (Obj.magic x :nest ) with (x,_) -> x == undefinedHeader then
3436
(
35-
let nid = match (Obj.magic x) with (_,x) -> x + 1 in
37+
let nid = match (Obj.magic x : nest) with (_,x) -> x + 1 in
3638
let block = Obj.repr (undefinedHeader, nid) in
3739
Obj.set_tag block 256;
3840
block
@@ -60,9 +62,9 @@ let null_to_opt (type t ) ( x : t Js.null) : t option =
6062
(** The input is already of [Some] form, [x] is not None,
6163
make sure [x[0]] will not throw *)
6264
let valFromOption (x : Obj.t) : Obj.t =
63-
if x != Obj.repr Js.null && match (Obj.magic x) with (x,_) -> x == Obj.repr undefinedHeader
65+
if x != Obj.repr Js.null && match (Obj.magic x : nest) with (x,_) -> x == undefinedHeader
6466
then
65-
(match (Obj.magic x) with (_, (depth : int)) ->
67+
(match (Obj.magic x : nest) with _, depth ->
6668
if depth = 0 then Obj.magic None
6769
else Obj.magic (undefinedHeader, depth - 1))
6870
else Obj.magic x

0 commit comments

Comments
 (0)