Skip to content
Closed
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
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
* Compiler: simplify (a | 0) >>> 0 into (a >>> 0) (#1177)
* Compiler: improve static evaluation of cond (#1178)
* Compiler: be more consistent dealing with js vs ocaml strings (#984)
* Compiler: Compiler: add BigInt to provided symbols (fix #1168) (#1191)
* Compiler: add BigInt to provided symbols (fix #1168) (#1191)
* Compiler: use globalThis to find joo_global_object (fix #699) (#1195)
* Lib: add messageEvent to Dom_html (#1164)
* Lib: add PerformanceObserver API (#1164)
* Lib: add CSSStyleDeclaration.{setProperty, getPropertyValue, getPropertyPriority, removeProperty} (#1170)
Expand Down
15 changes: 1 addition & 14 deletions compiler/lib/driver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -363,20 +363,7 @@ let pack ~global { Linker.runtime_code = js; always_required_codes } =
| `Function -> f
| `Bind_to _ -> f
| `Custom name -> J.ECall (f, [ J.EVar (J.ident name), `Not_spread ], J.N)
| `Auto ->
let global =
J.ECall
( J.EFun
( None
, []
, [ ( J.Statement (J.Return_statement (Some (J.EVar (J.ident "this"))))
, J.N )
]
, J.N )
, []
, J.N )
in
J.ECall (f, [ global, `Not_spread ], J.N)
| `Auto -> J.ECall (f, [ J.EVar (J.ident "globalThis"), `Not_spread ], J.N)
in
match global with
| `Bind_to name ->
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests-compiler/empty_cma.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let%expect_test _ =
Sys.remove "empty.js";
[%expect
{|
(function(joo_global_object){"use strict";return}(function(){return this}()));
(function(joo_global_object){"use strict";return}(globalThis));

//# sourceMappingURL=empty.map
|}]
2 changes: 1 addition & 1 deletion compiler/tests-compiler/sourcemap.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ let%expect_test _ =
5: var Test=[0,id];
6: runtime.caml_register_global(0,Test,"Test");
7: return}
8: (function(){return this}()));
8: (globalThis));
9:
10: //# sourceMappingURL=test.map
null:-1:-1 -> 3:4
Expand Down