Skip to content
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

Runtime: remove useless switch case #1689

Merged
merged 1 commit into from
Sep 26, 2024
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
1 change: 0 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"rules": {
"recommended": true,
"complexity": {
"noUselessSwitchCase": "off",
"noUselessTernary": "off",
"useArrowFunction": "off",
"useOptionalChain": "off"
Expand Down
3 changes: 1 addition & 2 deletions runtime/compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ function caml_compare_val(a, b, total) {
if (a > b) return 1;
}
break;
case 246: // Lazy_tag
default: // Block with other tag
default: // Lazy_tag or Block with other tag
if (caml_is_continuation_tag(tag_a)) {
caml_invalid_argument("compare: continuation value");
break;
Expand Down
22 changes: 8 additions & 14 deletions runtime/internalMod.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,10 @@ function caml_CamlinternalMod_init_mod(loc, shape) {
//Version: < 4.13
function caml_CamlinternalMod_update_mod(shape, real, x) {
if (typeof shape === "number")
switch (shape) {
case 0: //function
case 1: //lazy
case 2: //class
default:
caml_update_dummy(real, x);
}
//function
//lazy
//class
caml_update_dummy(real, x);
else
switch (shape[0]) {
case 0: //module
Expand Down Expand Up @@ -123,13 +120,10 @@ function caml_CamlinternalMod_init_mod(loc, shape, cont) {
function caml_CamlinternalMod_update_mod(shape, real, x, cont) {
function loop(shape, real, x) {
if (typeof shape === "number")
switch (shape) {
case 0: //function
case 1: //lazy
case 2: //class
default:
caml_update_dummy(real, x);
}
//function
//lazy
//class
caml_update_dummy(real, x);
else
switch (shape[0]) {
case 0: //module
Expand Down
6 changes: 5 additions & 1 deletion runtime/marshal.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,11 @@ function caml_marshal_data_size(s, ofs) {
);
}
break;
case 0x8495a6bf: /* Intext_magic_number_big */
case 0x8495a6bf /* Intext_magic_number_big */:
caml_failwith(
"Marshal.data_size: object too large to be read back on a 32-bit platform",
);
break;
default:
caml_failwith("Marshal.data_size: bad object");
break;
Expand Down
Loading