Skip to content

WIP: Remove assert keyword #7098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
update output
  • Loading branch information
aspeddro committed Nov 17, 2024
commit 1862b7f8f0c68585b84629ab1ec21000522b9dd9
13 changes: 8 additions & 5 deletions compiler/core/lam_compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1564,17 +1564,20 @@ let compile output_prefix =
Immutable
in

let else_ = S.throw_stmt block_expr in
let else_ =
if !Clflags.no_assert_false then S.exp E.undefined
else S.throw_stmt block_expr
in

let result =
Js_output.make
[S.if_ v block ~else_:[else_]]
~value:E.undefined ~output_finished:False
in
let _a =
if !Clflags.no_assert_false then Js_output.make block else result
in
_a
(* let _a = *)
(* if !Clflags.no_assert_false then Js_output.make block else result *)
(* in *)
result
| {value = None} -> assert false)
| {primitive = Praise; args = [e]; _} -> (
match
Expand Down
5 changes: 4 additions & 1 deletion lib/es6/Belt_internalAVLset.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,14 @@ function checkInvariantInternal(_v) {
}
let l = v.l;
let r = v.r;
(
let diff = (
l !== undefined ? l.h : 0
) - (
r !== undefined ? r.h : 0
) | 0;
if (!(diff <= 2 && diff >= -2)) {

}
checkInvariantInternal(l);
_v = r;
continue;
Expand Down
5 changes: 4 additions & 1 deletion lib/es6/Belt_internalAVLtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,10 @@ function checkInvariantInternal(_v) {
}
let l = v.l;
let r = v.r;
treeHeight(l) - treeHeight(r) | 0;
let diff = treeHeight(l) - treeHeight(r) | 0;
if (!(diff <= 2 && diff >= -2)) {

}
checkInvariantInternal(l);
_v = r;
continue;
Expand Down
5 changes: 4 additions & 1 deletion lib/js/Belt_internalAVLset.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,14 @@ function checkInvariantInternal(_v) {
}
let l = v.l;
let r = v.r;
(
let diff = (
l !== undefined ? l.h : 0
) - (
r !== undefined ? r.h : 0
) | 0;
if (!(diff <= 2 && diff >= -2)) {

}
checkInvariantInternal(l);
_v = r;
continue;
Expand Down
5 changes: 4 additions & 1 deletion lib/js/Belt_internalAVLtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,10 @@ function checkInvariantInternal(_v) {
}
let l = v.l;
let r = v.r;
treeHeight(l) - treeHeight(r) | 0;
let diff = treeHeight(l) - treeHeight(r) | 0;
if (!(diff <= 2 && diff >= -2)) {

}
checkInvariantInternal(l);
_v = r;
continue;
Expand Down
Loading