Skip to content

Commit 10b58a3

Browse files
committed
fix #2642
1 parent d3b8ce6 commit 10b58a3

File tree

145 files changed

+392
-1743
lines changed

Some content is hidden

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

145 files changed

+392
-1743
lines changed

jscomp/core/js_dump.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,8 @@ and statement_desc top cxt f (s : J.statement_desc) : Ext_pp_scope.t =
13491349
P.space f ;
13501350
P.string f s;
13511351
semi f;
1352-
P.newline f;
1352+
(* P.newline f; *)
1353+
(* #2642 *)
13531354
cxt
13541355
| Debugger
13551356
->

jscomp/ext/ext_pp.ml

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
2-
*
2+
*
33
* This program is free software: you can redistribute it and/or modify
44
* it under the terms of the GNU Lesser General Public License as published by
55
* the Free Software Foundation, either version 3 of the License, or
@@ -17,7 +17,7 @@
1717
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1818
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1919
* GNU Lesser General Public License for more details.
20-
*
20+
*
2121
* You should have received a copy of the GNU Lesser General Public License
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. *)
@@ -29,24 +29,24 @@
2929

3030

3131

32-
module L = struct
32+
module L = struct
3333
let space = " "
3434
let indent_str = " "
3535
end
3636

37-
let indent_length = String.length L.indent_str
37+
let indent_length = String.length L.indent_str
3838

3939
type t = {
4040
output_string : string -> unit;
41-
output_char : char -> unit;
41+
output_char : char -> unit;
4242
flush : unit -> unit;
4343
mutable indent_level : int;
44-
mutable last_new_line : bool;
44+
mutable last_new_line : bool;
4545
(* only when we print newline, we print the indent *)
4646
}
4747

48-
let from_channel chan = {
49-
output_string = (fun s -> output_string chan s);
48+
let from_channel chan = {
49+
output_string = (fun s -> output_string chan s);
5050
output_char = (fun c -> output_char chan c);
5151
flush = (fun _ -> flush chan);
5252
indent_level = 0 ;
@@ -62,105 +62,105 @@ let from_buffer buf = {
6262
last_new_line = false;
6363
}
6464

65-
(* If we have [newline] in [s],
66-
all indentations will be broken
65+
(* If we have [newline] in [s],
66+
all indentations will be broken
6767
in the future, we can detect this in [s]
6868
*)
69-
let string t s =
69+
let string t s =
7070
t.output_string s ;
7171
t.last_new_line <- false
7272

73-
let newline t =
74-
if not t.last_new_line then
73+
let newline t =
74+
if not t.last_new_line then
7575
begin
7676
t.output_char '\n';
77-
for i = 0 to t.indent_level - 1 do
77+
for i = 0 to t.indent_level - 1 do
7878
t.output_string L.indent_str;
7979
done;
8080
t.last_new_line <- true
8181
end
8282

83-
let force_newline t =
83+
let force_newline t =
8484
t.output_char '\n';
85-
for i = 0 to t.indent_level - 1 do
85+
for i = 0 to t.indent_level - 1 do
8686
t.output_string L.indent_str;
8787
done
8888

89-
let space t =
89+
let space t =
9090
string t L.space
9191

92-
let nspace t n =
92+
let nspace t n =
9393
string t (String.make n ' ')
9494

95-
let group t i action =
95+
let group t i action =
9696
if i = 0 then action ()
97-
else
97+
else
9898
let old = t.indent_level in
9999
t.indent_level <- t.indent_level + i;
100-
Ext_pervasives.finally () (fun _ -> t.indent_level <- old) action
100+
Ext_pervasives.finally () (fun _ -> t.indent_level <- old) action
101101

102102
let vgroup = group
103103

104-
let paren t action =
104+
let paren t action =
105105
string t "(";
106106
let v = action () in
107107
string t ")";
108-
v
108+
v
109109

110-
let brace fmt u =
110+
let brace fmt u =
111111
string fmt "{";
112112
(* break1 fmt ; *)
113113
let v = u () in
114114
string fmt "}";
115-
v
115+
v
116116

117-
let bracket fmt u =
117+
let bracket fmt u =
118118
string fmt "[";
119119
let v = u () in
120120
string fmt "]";
121-
v
121+
v
122122

123-
let brace_vgroup st n action =
123+
let brace_vgroup st n action =
124124
string st "{";
125-
let v = vgroup st n (fun _ ->
126-
newline st;
125+
let v = vgroup st n (fun _ ->
126+
newline st;
127127
let v = action () in
128128
v
129129
) in
130130
force_newline st;
131131
string st "}";
132132
v
133133

134-
let bracket_vgroup st n action =
134+
let bracket_vgroup st n action =
135135
string st "[";
136-
let v = vgroup st n (fun _ ->
137-
newline st;
136+
let v = vgroup st n (fun _ ->
137+
newline st;
138138
let v = action () in
139139
v
140140
) in
141141
force_newline st;
142142
string st "]";
143143
v
144144

145-
let bracket_group st n action =
145+
let bracket_group st n action =
146146
group st n (fun _ -> bracket st action)
147147

148-
let paren_vgroup st n action =
148+
let paren_vgroup st n action =
149149
string st "(";
150-
let v = group st n (fun _ ->
151-
newline st;
150+
let v = group st n (fun _ ->
151+
newline st;
152152
let v = action () in
153153
v
154154
) in
155155
newline st;
156156
string st ")";
157-
v
157+
v
158158
let paren_group st n action = group st n (fun _ -> paren st action)
159159

160-
let brace_group st n action =
160+
let brace_group st n action =
161161
group st n (fun _ -> brace st action )
162162

163-
let indent t n =
164-
t.indent_level <- t.indent_level + n
163+
let indent t n =
164+
t.indent_level <- t.indent_level + n
165165

166166
let flush t () = t.flush ()

jscomp/test/a_scope_bug.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ function odd(_z) {
1010
console.log(String(a));
1111
_z = 32;
1212
continue ;
13-
1413
};
1514
}
1615

jscomp/test/and_or_tailcall_test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ function f(b, _, _n) {
1111
} else {
1212
_n = n + 1 | 0;
1313
continue ;
14-
1514
}
1615
};
1716
}
@@ -26,7 +25,6 @@ function or_f(b, _, _n) {
2625
} else {
2726
_n = n + 1 | 0;
2827
continue ;
29-
3028
}
3129
};
3230
}

jscomp/test/app_root_finder.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ function find_package_json(_dir) {
1818
} else {
1919
_dir = new_dir;
2020
continue ;
21-
2221
}
2322
}
2423
};

jscomp/test/arith_lexer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@ function __ocaml_lex_lexeme_rec(lexbuf, ___ocaml_lex_state) {
2828
Curry._1(lexbuf[/* refill_buff */0], lexbuf);
2929
___ocaml_lex_state = __ocaml_lex_state$1;
3030
continue ;
31-
3231
} else {
3332
switch (__ocaml_lex_state$1) {
3433
case 0 :
3534
___ocaml_lex_state = 0;
3635
continue ;
37-
case 1 :
36+
case 1 :
3837
return /* NUMERAL */Block.__(0, [Caml_format.caml_int_of_string(Lexing.lexeme(lexbuf))]);
3938
case 2 :
4039
return /* IDENT */Block.__(1, [Lexing.lexeme(lexbuf)]);

jscomp/test/array_test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ function is_sorted(x) {
1818
} else if (Caml_obj.caml_lessthan(Caml_array.caml_array_get(x, i), Caml_array.caml_array_get(x, i + 1 | 0))) {
1919
_i = i + 1 | 0;
2020
continue ;
21-
2221
} else {
2322
return /* false */0;
2423
}

jscomp/test/ast_js_mapper_test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ function searchForSureExists(xs, k) {
5151
} else {
5252
_i = i + 1 | 0;
5353
continue ;
54-
5554
}
5655
};
5756
}

jscomp/test/bal_set_mini.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ function min_elt(_def, _param) {
106106
_param = l;
107107
_def = param[1];
108108
continue ;
109-
110109
} else {
111110
return param[1];
112111
}
@@ -165,7 +164,6 @@ function mem(x, _param) {
165164
} else {
166165
_param = c < 0 ? param[0] : param[2];
167166
continue ;
168-
169167
}
170168
} else {
171169
return /* false */0;

jscomp/test/bdd.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ function $$eval(_bdd, vars) {
1616
} else if (Caml_array.caml_array_get(vars, bdd[1])) {
1717
_bdd = bdd[3];
1818
continue ;
19-
2019
} else {
2120
_bdd = bdd[0];
2221
continue ;
23-
2422
}
2523
};
2624
}
@@ -75,7 +73,6 @@ function resize(newSize) {
7573
]);
7674
_bucket = bucket[1];
7775
continue ;
78-
7976
}
8077
} else {
8178
return /* () */0;
@@ -143,7 +140,6 @@ function mkNode(low, v, high) {
143140
} else {
144141
_b = b[1];
145142
continue ;
146-
147143
}
148144
} else {
149145
var n_002 = (nodeC[0] = nodeC[0] + 1 | 0, nodeC[0]);

0 commit comments

Comments
 (0)