Skip to content

tweak output using single quote for strict #71

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

Merged
merged 1 commit into from
Feb 4, 2016
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
19 changes: 13 additions & 6 deletions jscomp/js_dump.ml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ module L = struct
let stringify = "stringify"
let console = "console"
let define = "define"
let break = "break"
let strict_directive = "'use strict';"
end
let return_indent = (String.length L.return / Ext_pp.indent_length)

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

(if return then P.string f "return " else ());
(if return then begin
P.string f L.return ;
P.space f
end else ());
P.string f L.function_;
P.space f ;
(match name with None -> () | Some x -> ignore (ident inner_cxt f x));
Expand All @@ -289,7 +294,9 @@ let rec pp_function
P.string f L.return ;
P.space f
end else ());
P.string f "(function(";
P.string f "(";
P.string f L.function_;
P.string f "(";
ignore @@ aux inner_cxt f lexical;
P.string f ")";
P.brace_vgroup f 0 (fun _ -> action true);
Expand Down Expand Up @@ -331,7 +338,7 @@ and output_one : 'a .
(if break then
begin
P.newline f ;
P.string f "break";
P.string f L.break;
semi f;
end) ;
cxt
Expand All @@ -355,7 +362,7 @@ and vident cxt f (v : J.vident) =
ident cxt f v
| Qualified (id,_, Some name) ->
let cxt = ident cxt f id in
P.string f ".";
P.string f L.dot;
P.string f (Ext_ident.convert name);
cxt
end
Expand Down Expand Up @@ -1366,7 +1373,7 @@ let amd_program f ({modules; block = b ; exports = exp ; side_effect } : J.prog
let cxt = aux cxt f modules in
P.string f ")";
P.brace_vgroup f 1 @@ (fun _ ->
let () = P.string f "'use strict';" in
let () = P.string f L.strict_directive in
let () = P.newline f in
let cxt = statement_list true cxt f b in
(* FIXME AMD : use {[ function xx ]} or {[ var x = function ..]} *)
Expand Down Expand Up @@ -1404,7 +1411,7 @@ let pp_program (program : J.program) (f : Ext_pp.t) =
begin
P.string f "// Generated CODE, PLEASE EDIT WITH CARE";
P.newline f;
P.string f "\"use strict\";"; (* TODO: use single quote in another commit*)
P.string f L.strict_directive;
P.newline f ;
(match Js_config.get_env () with
| Browser ->
Expand Down
2 changes: 1 addition & 1 deletion jscomp/runtime/caml_array.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';


function caml_array_sub(x, offset, len) {
Expand Down
2 changes: 1 addition & 1 deletion jscomp/runtime/caml_oo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_exceptions = require("./caml_exceptions");
var Caml_array = require("./caml_array");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/runtime/caml_string.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

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

Expand Down
2 changes: 1 addition & 1 deletion jscomp/runtime/curry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

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

Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/arg.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_exceptions = require("../runtime/caml_exceptions");
var Pervasives = require("./pervasives");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/array.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Pervasives = require("./pervasives");
var Caml_exceptions = require("../runtime/caml_exceptions");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/arrayLabels.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

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

Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/buffer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Bytes = require("./bytes");
var Pervasives = require("./pervasives");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/bytes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Pervasives = require("./pervasives");
var Caml_exceptions = require("../runtime/caml_exceptions");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/bytesLabels.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

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

Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/callback.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
var Obj = require("./obj");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/camlinternalFormat.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Bytes = require("./bytes");
var Caml_float = require("../runtime/caml_float");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/camlinternalFormatBasics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';


function erase_rel(param) {
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/camlinternalLazy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
var Obj = require("./obj");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/camlinternalMod.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
var Obj = require("./obj");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/camlinternalOO.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
var Obj = require("./obj");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/char.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Pervasives = require("./pervasives");
var Caml_string = require("../runtime/caml_string");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/complex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';


var one = /* float array */[
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/digest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Bytes = require("./bytes");
var Pervasives = require("./pervasives");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/filename.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
var CamlinternalLazy = require("./camlinternalLazy");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/format.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_exceptions = require("../runtime/caml_exceptions");
var Pervasives = require("./pervasives");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/gc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Sys = require("./sys");
var Printf = require("./printf");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/genlex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Bytes = require("./bytes");
var Hashtbl = require("./hashtbl");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/hashtbl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
var CamlinternalLazy = require("./camlinternalLazy");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/int32.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_format = require("../runtime/caml_format");
var Caml_primitive = require("../runtime/caml_primitive");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/int64.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

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

Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/lazy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
var Obj = require("./obj");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/lexing.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Bytes = require("./bytes");
var Pervasives = require("./pervasives");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Pervasives = require("./pervasives");
var Caml_exceptions = require("../runtime/caml_exceptions");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/listLabels.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

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

Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/map.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Pervasives = require("./pervasives");
var Caml_exceptions = require("../runtime/caml_exceptions");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/marshal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Bytes = require("./bytes");
var Pervasives = require("./pervasives");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/moreLabels.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var $$Map = require("./map");
var Hashtbl = require("./hashtbl");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/nativeint.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_format = require("../runtime/caml_format");
var Sys = require("./sys");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/obj.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
var Caml_exceptions = require("../runtime/caml_exceptions");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/oo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

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

Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/parsing.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
var Caml_exceptions = require("../runtime/caml_exceptions");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/pervasives.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_io = require("../runtime/caml_io");
var Caml_exceptions = require("../runtime/caml_exceptions");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/printexc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_obj_runtime = require("../runtime/caml_obj_runtime");
var Obj = require("./obj");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/printf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Pervasives = require("./pervasives");
var Buffer = require("./buffer");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/queue.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_exceptions = require("../runtime/caml_exceptions");
var Caml_primitive = require("../runtime/caml_primitive");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/random.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_sys = require("../runtime/caml_sys");
var Pervasives = require("./pervasives");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/scanf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_exceptions = require("../runtime/caml_exceptions");
var Pervasives = require("./pervasives");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/set.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Pervasives = require("./pervasives");
var Caml_exceptions = require("../runtime/caml_exceptions");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/sort.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

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

Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/stack.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';

var Caml_exceptions = require("../runtime/caml_exceptions");
var List = require("./list");
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib/stdLabels.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated CODE, PLEASE EDIT WITH CARE
"use strict";
'use strict';


var $$Array = 0;
Expand Down
Loading