Skip to content

Commit 7e4ac81

Browse files
author
Hongbo Zhang
committed
tweak output
1 parent 5539b92 commit 7e4ac81

File tree

211 files changed

+324
-216
lines changed

Some content is hidden

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

211 files changed

+324
-216
lines changed

jscomp/js_dump.ml

+13-6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ module L = struct
8585
let stringify = "stringify"
8686
let console = "console"
8787
let define = "define"
88+
let break = "break"
89+
let strict_directive = "'use strict';"
8890
end
8991
let return_indent = (String.length L.return / Ext_pp.indent_length)
9092

@@ -267,7 +269,10 @@ let rec pp_function
267269
(* pp_comment f (Some (Js_fun_env.to_string env))) ; *)
268270
let action return =
269271

270-
(if return then P.string f "return " else ());
272+
(if return then begin
273+
P.string f L.return ;
274+
P.space f
275+
end else ());
271276
P.string f L.function_;
272277
P.space f ;
273278
(match name with None -> () | Some x -> ignore (ident inner_cxt f x));
@@ -289,7 +294,9 @@ let rec pp_function
289294
P.string f L.return ;
290295
P.space f
291296
end else ());
292-
P.string f "(function(";
297+
P.string f "(";
298+
P.string f L.function_;
299+
P.string f "(";
293300
ignore @@ aux inner_cxt f lexical;
294301
P.string f ")";
295302
P.brace_vgroup f 0 (fun _ -> action true);
@@ -331,7 +338,7 @@ and output_one : 'a .
331338
(if break then
332339
begin
333340
P.newline f ;
334-
P.string f "break";
341+
P.string f L.break;
335342
semi f;
336343
end) ;
337344
cxt
@@ -355,7 +362,7 @@ and vident cxt f (v : J.vident) =
355362
ident cxt f v
356363
| Qualified (id,_, Some name) ->
357364
let cxt = ident cxt f id in
358-
P.string f ".";
365+
P.string f L.dot;
359366
P.string f (Ext_ident.convert name);
360367
cxt
361368
end
@@ -1366,7 +1373,7 @@ let amd_program f ({modules; block = b ; exports = exp ; side_effect } : J.prog
13661373
let cxt = aux cxt f modules in
13671374
P.string f ")";
13681375
P.brace_vgroup f 1 @@ (fun _ ->
1369-
let () = P.string f "'use strict';" in
1376+
let () = P.string f L.strict_directive in
13701377
let () = P.newline f in
13711378
let cxt = statement_list true cxt f b in
13721379
(* FIXME AMD : use {[ function xx ]} or {[ var x = function ..]} *)
@@ -1404,7 +1411,7 @@ let pp_program (program : J.program) (f : Ext_pp.t) =
14041411
begin
14051412
P.string f "// Generated CODE, PLEASE EDIT WITH CARE";
14061413
P.newline f;
1407-
P.string f "\"use strict\";"; (* TODO: use single quote in another commit*)
1414+
P.string f L.strict_directive;
14081415
P.newline f ;
14091416
(match Js_config.get_env () with
14101417
| Browser ->

jscomp/runtime/caml_array.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44

55
function caml_array_sub(x, offset, len) {

jscomp/runtime/caml_oo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_exceptions = require("./caml_exceptions");
55
var Caml_array = require("./caml_array");

jscomp/runtime/caml_string.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_exceptions = require("./caml_exceptions");
55

jscomp/runtime/curry.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_array = require("./caml_array");
55

jscomp/stdlib/arg.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_exceptions = require("../runtime/caml_exceptions");
55
var Pervasives = require("./pervasives");

jscomp/stdlib/array.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Pervasives = require("./pervasives");
55
var Caml_exceptions = require("../runtime/caml_exceptions");

jscomp/stdlib/arrayLabels.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var $$Array = require("./array");
55

jscomp/stdlib/buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Bytes = require("./bytes");
55
var Pervasives = require("./pervasives");

jscomp/stdlib/bytes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Pervasives = require("./pervasives");
55
var Caml_exceptions = require("../runtime/caml_exceptions");

jscomp/stdlib/bytesLabels.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Bytes = require("./bytes");
55

jscomp/stdlib/callback.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
55
var Obj = require("./obj");

jscomp/stdlib/camlinternalFormat.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Bytes = require("./bytes");
55
var Caml_float = require("../runtime/caml_float");

jscomp/stdlib/camlinternalFormatBasics.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44

55
function erase_rel(param) {

jscomp/stdlib/camlinternalLazy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
55
var Obj = require("./obj");

jscomp/stdlib/camlinternalMod.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
55
var Obj = require("./obj");

jscomp/stdlib/camlinternalOO.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
55
var Obj = require("./obj");

jscomp/stdlib/char.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Pervasives = require("./pervasives");
55
var Caml_string = require("../runtime/caml_string");

jscomp/stdlib/complex.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44

55
var one = /* float array */[

jscomp/stdlib/digest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Bytes = require("./bytes");
55
var Pervasives = require("./pervasives");

jscomp/stdlib/filename.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
55
var CamlinternalLazy = require("./camlinternalLazy");

jscomp/stdlib/format.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_exceptions = require("../runtime/caml_exceptions");
55
var Pervasives = require("./pervasives");

jscomp/stdlib/gc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Sys = require("./sys");
55
var Printf = require("./printf");

jscomp/stdlib/genlex.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Bytes = require("./bytes");
55
var Hashtbl = require("./hashtbl");

jscomp/stdlib/hashtbl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
55
var CamlinternalLazy = require("./camlinternalLazy");

jscomp/stdlib/int32.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_format = require("../runtime/caml_format");
55
var Caml_primitive = require("../runtime/caml_primitive");

jscomp/stdlib/int64.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_primitive = require("../runtime/caml_primitive");
55

jscomp/stdlib/lazy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
55
var Obj = require("./obj");

jscomp/stdlib/lexing.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Bytes = require("./bytes");
55
var Pervasives = require("./pervasives");

jscomp/stdlib/list.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Pervasives = require("./pervasives");
55
var Caml_exceptions = require("../runtime/caml_exceptions");

jscomp/stdlib/listLabels.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var List = require("./list");
55

jscomp/stdlib/map.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Pervasives = require("./pervasives");
55
var Caml_exceptions = require("../runtime/caml_exceptions");

jscomp/stdlib/marshal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Bytes = require("./bytes");
55
var Pervasives = require("./pervasives");

jscomp/stdlib/moreLabels.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var $$Map = require("./map");
55
var Hashtbl = require("./hashtbl");

jscomp/stdlib/nativeint.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_format = require("../runtime/caml_format");
55
var Sys = require("./sys");

jscomp/stdlib/obj.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
55
var Caml_exceptions = require("../runtime/caml_exceptions");

jscomp/stdlib/oo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var CamlinternalOO = require("./camlinternalOO");
55

jscomp/stdlib/parsing.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
55
var Caml_exceptions = require("../runtime/caml_exceptions");

jscomp/stdlib/pervasives.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_io = require("../runtime/caml_io");
55
var Caml_exceptions = require("../runtime/caml_exceptions");

jscomp/stdlib/printexc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
55
var Obj = require("./obj");

jscomp/stdlib/printf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Pervasives = require("./pervasives");
55
var Buffer = require("./buffer");

jscomp/stdlib/queue.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_exceptions = require("../runtime/caml_exceptions");
55
var Caml_primitive = require("../runtime/caml_primitive");

jscomp/stdlib/random.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_sys = require("../runtime/caml_sys");
55
var Pervasives = require("./pervasives");

jscomp/stdlib/scanf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_exceptions = require("../runtime/caml_exceptions");
55
var Pervasives = require("./pervasives");

jscomp/stdlib/set.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Pervasives = require("./pervasives");
55
var Caml_exceptions = require("../runtime/caml_exceptions");

jscomp/stdlib/sort.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_exceptions = require("../runtime/caml_exceptions");
55

jscomp/stdlib/stack.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44
var Caml_exceptions = require("../runtime/caml_exceptions");
55
var List = require("./list");

jscomp/stdlib/stdLabels.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
2-
"use strict";
2+
'use strict';
33

44

55
var $$Array = 0;

0 commit comments

Comments
 (0)