Skip to content

Commit 8ad0f96

Browse files
committed
clean up a little bit
1 parent 69a0a07 commit 8ad0f96

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

jscomp/runtime/caml_hash.ml

+7-7
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@ let is_empty_queue q = q . length = 0
6060

6161
(* pop from front *)
6262

63+
6364
let unsafe_pop (q : 'a t) =
6465
let cell = (Obj.magic (q . first) : 'a cell) in
65-
let content, next_cell = cell.content , cell.next in
66-
match next_cell with
67-
| None ->
66+
let next =cell.next in
67+
if next = None then (
6868
q . length <- 0 ;
6969
q . first <- None;
7070
q . last<- None;
71-
content
72-
| Some next ->
71+
) else (
7372
q . length <- q . length - 1;
74-
q . first <- next_cell ;
75-
content
73+
q . first <- next;
74+
);
75+
cell.content
7676

7777

7878

lib/js/caml_hash.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@ function push_back(q, v) {
2424

2525
function unsafe_pop(q) {
2626
var cell = q.first;
27-
var content = cell.content;
28-
var next_cell = cell.next;
29-
if (next_cell !== undefined) {
30-
q.length = q.length - 1 | 0;
31-
q.first = next_cell;
32-
return content;
33-
} else {
27+
var next = cell.next;
28+
if (next === undefined) {
3429
q.length = 0;
3530
q.first = undefined;
3631
q.last = undefined;
37-
return content;
32+
} else {
33+
q.length = q.length - 1 | 0;
34+
q.first = next;
3835
}
36+
return cell.content;
3937
}
4038

4139
function caml_hash(count, _limit, seed, obj) {

0 commit comments

Comments
 (0)