Skip to content

Commit fa073e8

Browse files
authored
Js output: fix extra newline after if (#7920)
* Js output: fix extra newline after `if` * CHANGELOG
1 parent e0e2ce4 commit fa073e8

File tree

133 files changed

+2
-383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+2
-383
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- Keep track of compiler info during build. https://github.com/rescript-lang/rescript/pull/7889
3030
- Improve option optimization for constants. https://github.com/rescript-lang/rescript/pull/7913
3131
- Option optimization: do not create redundant local vars. https://github.com/rescript-lang/rescript/pull/7915
32+
- Js output: remove superfluous newline after every `if`. https://github.com/rescript-lang/rescript/pull/7920
3233

3334
#### :house: Internal
3435

compiler/core/js_dump.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,9 +1365,7 @@ and statement_desc top cxt f (s : J.statement_desc) : cxt =
13651365
P.space f;
13661366
let cxt = brace_block cxt f s1 in
13671367
match s2 with
1368-
| [] | [{statement_desc = Block [] | Exp {expression_desc = Var _}}] ->
1369-
P.newline f;
1370-
cxt
1368+
| [] | [{statement_desc = Block [] | Exp {expression_desc = Var _}}] -> cxt
13711369
| [({statement_desc = If _} as nest)]
13721370
| [{statement_desc = Block [({statement_desc = If _; _} as nest)]; _}] ->
13731371
P.space f;

packages/@rescript/runtime/lib/es6/Belt_Array.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ function get(arr, i) {
77
if (i >= 0 && i < arr.length) {
88
return Primitive_option.some(arr[i]);
99
}
10-
1110
}
1211

1312
function getOrThrow(arr, i) {
@@ -328,7 +327,6 @@ function keep(a, f) {
328327
r[j] = v;
329328
j = j + 1 | 0;
330329
}
331-
332330
}
333331
r.length = j;
334332
return r;
@@ -344,7 +342,6 @@ function keepWithIndex(a, f) {
344342
r[j] = v;
345343
j = j + 1 | 0;
346344
}
347-
348345
}
349346
r.length = j;
350347
return r;
@@ -361,7 +358,6 @@ function keepMap(a, f) {
361358
r[j] = Primitive_option.valFromOption(v$1);
362359
j = j + 1 | 0;
363360
}
364-
365361
}
366362
r.length = j;
367363
return r;

packages/@rescript/runtime/lib/es6/Belt_HashMap.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function set0(h, key, value, eq, hash) {
5757
};
5858
h.size = h.size + 1 | 0;
5959
}
60-
6160
} else {
6261
h_buckets[i] = {
6362
key: key,
@@ -84,11 +83,9 @@ function set0(h, key, value, eq, hash) {
8483
if (tail !== undefined) {
8584
tail.next = undefined;
8685
}
87-
8886
}
8987
return;
9088
}
91-
9289
}
9390

9491
function set(h, key, value) {
@@ -166,7 +163,6 @@ function get(h, key) {
166163
};
167164
}
168165
}
169-
170166
}
171167

172168
function has(h, key) {

packages/@rescript/runtime/lib/es6/Belt_HashMapInt.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ function set(h, key, value) {
5454
};
5555
h.size = h.size + 1 | 0;
5656
}
57-
5857
} else {
5958
h_buckets[i] = {
6059
key: key,
@@ -81,11 +80,9 @@ function set(h, key, value) {
8180
if (tail !== undefined) {
8281
tail.next = undefined;
8382
}
84-
8583
}
8684
return;
8785
}
88-
8986
}
9087

9188
function remove(h, key) {
@@ -118,7 +115,6 @@ function remove(h, key) {
118115
};
119116
}
120117
}
121-
122118
}
123119

124120
function get(h, key) {
@@ -157,7 +153,6 @@ function get(h, key) {
157153
};
158154
}
159155
}
160-
161156
}
162157

163158
function has(h, key) {

packages/@rescript/runtime/lib/es6/Belt_HashMapString.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ function set(h, key, value) {
5454
};
5555
h.size = h.size + 1 | 0;
5656
}
57-
5857
} else {
5958
h_buckets[i] = {
6059
key: key,
@@ -81,11 +80,9 @@ function set(h, key, value) {
8180
if (tail !== undefined) {
8281
tail.next = undefined;
8382
}
84-
8583
}
8684
return;
8785
}
88-
8986
}
9087

9188
function remove(h, key) {
@@ -118,7 +115,6 @@ function remove(h, key) {
118115
};
119116
}
120117
}
121-
122118
}
123119

124120
function get(h, key) {
@@ -157,7 +153,6 @@ function get(h, key) {
157153
};
158154
}
159155
}
160-
161156
}
162157

163158
function has(h, key) {

packages/@rescript/runtime/lib/es6/Belt_HashSet.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,9 @@ function add0(h, key, hash, eq) {
111111
if (tail !== undefined) {
112112
tail.next = undefined;
113113
}
114-
115114
}
116115
return;
117116
}
118-
119117
}
120118

121119
function add(h, key) {

packages/@rescript/runtime/lib/es6/Belt_HashSetInt.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,9 @@ function add(h, key) {
111111
if (tail !== undefined) {
112112
tail.next = undefined;
113113
}
114-
115114
}
116115
return;
117116
}
118-
119117
}
120118

121119
function has(h, key) {

packages/@rescript/runtime/lib/es6/Belt_HashSetString.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,9 @@ function add(h, key) {
111111
if (tail !== undefined) {
112112
tail.next = undefined;
113113
}
114-
115114
}
116115
return;
117116
}
118-
119117
}
120118

121119
function has(h, key) {

packages/@rescript/runtime/lib/es6/Belt_List.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ function head(x) {
88
if (x !== 0) {
99
return Primitive_option.some(x.hd);
1010
}
11-
1211
}
1312

1413
function headOrThrow(x) {
@@ -25,7 +24,6 @@ function tail(x) {
2524
if (x !== 0) {
2625
return x.tl;
2726
}
28-
2927
}
3028

3129
function tailOrThrow(x) {
@@ -445,7 +443,6 @@ function take(lst, n) {
445443
if (has) {
446444
return cell;
447445
}
448-
449446
}
450447

451448
function drop(lst, n) {
@@ -494,7 +491,6 @@ function splitAt(lst, n) {
494491
rest
495492
];
496493
}
497-
498494
}
499495

500496
function concat(xs, ys) {

0 commit comments

Comments
 (0)