Skip to content

Commit 0e78d6d

Browse files
committed
Compiler: more sourcemap improvements
1 parent 08124c0 commit 0e78d6d

15 files changed

+683
-650
lines changed

compiler/driver.ml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ let gen_missing js missing =
221221
Expression_statement (
222222
ECall(EVar (S {name="caml_failwith";var=None}),
223223
[EBin(Plus,EStr(prim,`Utf8),
224-
EStr(" not implemented",`Utf8))], N),
225-
N))],N)
224+
EStr(" not implemented",`Utf8))], N))),
225+
N],N)
226226
),
227227
N
228228
)) :: acc
@@ -236,7 +236,7 @@ let gen_missing js missing =
236236
Format.eprintf "the commandline option '-disable genprim'@.";
237237
report_missing_primitives missing;
238238
end;
239-
Statement (Variable_statement miss) :: js
239+
(Statement (Variable_statement miss), N) :: js
240240

241241

242242
let link formatter ~standalone ?linkall js =
@@ -371,27 +371,29 @@ let pack ~standalone ?(toplevel=false)?(linkall=false) js =
371371
(* pack *)
372372
let use_strict js =
373373
if Option.Optim.strictmode ()
374-
then J.Statement (J.Expression_statement (J.EStr ("use strict", `Utf8), J.N)) :: js
374+
then (J.Statement (J.Expression_statement (J.EStr ("use strict", `Utf8))), J.N) :: js
375375
else js in
376376

377377
let global =
378378
J.ECall (
379379
J.EFun (None, [], [
380380
J.Statement (
381381
J.Return_statement(
382-
Some (J.EVar (J.S {J.name="this";var=None})),
383-
J.N))
382+
Some (J.EVar (J.S {J.name="this";var=None})))),
383+
J.N
384384
], J.N), [], J.N) in
385385

386-
let js = if standalone then
386+
let js =
387+
if standalone then
387388
let f =
388-
J.EFun (None, [J.S {J.name = global_object; var=None }], use_strict js,J.N) in
389+
J.EFun (None, [J.S {J.name = global_object; var=None }], use_strict js,
390+
J.U) in
389391
[J.Statement (
390392
J.Expression_statement
391-
((J.ECall (f, [global], J.N)), J.N))]
393+
((J.ECall (f, [global], J.N)))), J.N]
392394
else
393395
let f = J.EFun (None, [J.V (Code.Var.fresh ())], js, J.N) in
394-
[J.Statement (J.Expression_statement (f, J.N))] in
396+
[J.Statement (J.Expression_statement f), J.N] in
395397

396398
(* post pack optim *)
397399
let t3 = Util.Timer.make () in

0 commit comments

Comments
 (0)